/* dashboard page (redesign). Loaded after styles.css; owned by views for this page.
   Classes use the dsh- prefix; the older dash-* rules in styles.css still style
   the Network version pie (dash-versions, dash-pie, dash-legend). */

.dsh { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dsh .page-bar { margin-bottom: 0; }
.dsh-muted { color: var(--text-muted); }
.dsh-warn { color: var(--warning-dark); font-weight: 600; }
.dsh-bad { color: var(--danger); }
.dsh-ok { color: var(--success); }

/* Header */
.dsh-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dsh-live.is-stale { color: var(--warning-dark); }
.dsh-client { min-width: 180px; max-width: 280px; font-size: 13px; padding: 5px 8px; }

/* KPI tiles */
.dsh-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.dsh-kpi {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 10px 14px; text-align: left; font: inherit; color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-lg);
  cursor: pointer;
}
.dsh-kpi:hover { border-color: var(--primary); }
.dsh-kpi:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.dsh-kpi.is-loading { cursor: default; }
.dsh-kpi.is-loading:hover { border-color: var(--border); }
.dsh-kpi-l { font-size: 12px; color: var(--text-muted); }
.dsh-kpi-v { font-size: 22px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.dsh-kpi-of { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.dsh-kpi-s { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) { .dsh-kpi { transition: border-color .12s; } }

/* Two columns from 1200px: queue 2/3, side panels 1/3 */
.dsh-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1200px) { .dsh-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
.dsh-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; outline: none; scroll-margin-top: 16px; }
.dsh-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* Work-queue groups */
.dsh-grp { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--card-bg); }
.dsh-gh {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--bg-alt); border-bottom: 1px solid var(--border); cursor: pointer;
}
.dsh-grp.is-collapsed .dsh-gh { border-bottom: 0; }
.dsh-gh-t {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  border: 0; background: none; padding: 2px 0; font: inherit; font-size: 13.5px; color: var(--text);
  text-align: left; cursor: pointer;
}
.dsh-gh-t.is-static { cursor: default; }
.dsh-gh-t b { font-weight: 600; min-width: 0; }
.dsh-gh-t:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.dsh-caret { color: var(--text-muted); width: 12px; text-align: center; flex: none; }
.dsh-grp.is-collapsed .dsh-rows { display: none; }

.dsh-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
}
.dsh-rows > .dsh-row:last-child { border-bottom: 0; }
.dsh-row-main { min-width: 0; }
.dsh-ttl { font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; }
.dsh-where { font-weight: 400; color: var(--text-muted); }
.dsh-sub {
  font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dsh-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dsh-quiet { background: transparent; border: 1px solid transparent; color: var(--text-muted); }
.dsh-quiet:hover:not(:disabled) { background: var(--hover-strong); color: var(--text); }
.dsh-more {
  display: block; width: 100%; padding: 8px 14px; border: 0; border-top: 1px solid var(--border);
  background: none; font: inherit; font-size: 12.5px; color: var(--link); text-align: left; cursor: pointer;
}
.dsh-more:hover { background: var(--hover-bg); }

/* Pills */
.dsh-pill {
  display: inline-flex; align-items: center; flex: none; font-size: 12px; font-weight: 600;
  padding: 0 8px; line-height: 20px; border-radius: 999px; white-space: nowrap;
}
.dsh-pill-red   { background: var(--danger-bg);  color: var(--danger-dark); }
.dsh-pill-amber { background: var(--warning-bg); color: var(--warning-dark); }
.dsh-pill-gray  { background: var(--bg-muted);   color: var(--text-btn); }
.dsh-pill-blue  { background: var(--primary-light); color: var(--primary-text); }

/* Calm state, notes, snoozed */
.dsh-calm {
  display: flex; align-items: flex-start; gap: 10px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card-bg); font-size: 13.5px;
}
.dsh-calm .sdot { margin-top: 6px; }
.dsh-qnote { font-size: 12.5px; color: var(--warning-dark); }
.dsh-qfoot { display: flex; }
.dsh-link { border: 0; background: none; padding: 2px 0; font: inherit; font-size: 12.5px; color: var(--link); cursor: pointer; }
.dsh-link:hover { color: var(--link-hover); text-decoration: underline; }
.dsh-grp-snoozed .dsh-gh { cursor: default; }

/* Side panels */
.dsh-panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--card-bg); overflow: hidden; min-width: 0; }
.dsh-panel-h {
  margin: 0; padding: 9px 14px; font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--bg-alt); border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.dsh-panel-note { font-size: 11.5px; font-weight: 400; color: var(--text-muted); }
.dsh-panel-b { display: flex; flex-direction: column; padding: 4px 0; max-height: 420px; overflow: auto; }
.dsh-empty { padding: 10px 14px; font-size: 12.5px; color: var(--text-muted); }

.dsh-li {
  display: flex; align-items: flex-start; gap: 8px; width: 100%;
  padding: 7px 14px; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.dsh-li:hover { background: var(--hover-bg); }
.dsh-li.is-static { cursor: default; }
.dsh-li.is-static:hover { background: none; }
.dsh-li .sdot { margin-top: 6px; }
.dsh-li-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dsh-li-t { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.dsh-li-s { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.dsh-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.dsh-badges .dsh-pill { font-size: 11px; font-weight: 500; line-height: 18px; white-space: normal; }

.dsh-toner-h { display: flex; align-items: baseline; gap: 8px; }
.dsh-toner-h .dsh-li-t { flex: 1; min-width: 0; }
.dsh-toner-pct { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dsh-toner-pct.dsh-warn { color: var(--warning-dark); }
.dsh-toner-pct.dsh-ok { color: var(--text-muted); font-weight: 500; }
.dsh-bar { display: block; height: 4px; border-radius: 2px; background: var(--bg-muted); overflow: hidden; margin-top: 3px; }
.dsh-bar-fill { display: block; height: 100%; border-radius: 2px; }
.dsh-fill-warn { background: var(--warning); }
.dsh-fill-ok { background: var(--text-faint); }

.dsh-ev {
  display: grid; grid-template-columns: 56px 8px minmax(0, 1fr); gap: 8px; align-items: center;
  width: 100%; padding: 6px 14px; border: 0; background: none; font: inherit; font-size: 12.5px;
  color: var(--text); text-align: left; cursor: pointer;
}
.dsh-ev:hover { background: var(--hover-bg); }
.dsh-ev-time { color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dsh-ev-text { overflow-wrap: anywhere; }

.dsh-network > summary { cursor: pointer; list-style: none; border-bottom: 0; }
.dsh-network > summary::-webkit-details-marker { display: none; }
.dsh-network > summary::before { content: '▸'; color: var(--text-muted); width: 10px; }
.dsh-network[open] > summary { border-bottom: 1px solid var(--border); }
.dsh-network[open] > summary::before { content: '▾'; }
.dsh-network .dsh-panel-b { padding: 10px 14px; max-height: none; }
.dsh-net-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.dsh-network .dash-versions { grid-template-columns: 120px minmax(0, 1fr); }

.dsh-copy { width: 100%; font-family: var(--font-mono); font-size: 12.5px; resize: vertical; }

/* Narrow screens */
@media (max-width: 900px) {
  .dsh-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .dsh-client { max-width: none; flex: 1 1 100%; }
  .dsh-kpi { padding: 8px 12px; }
  .dsh-kpi-v { font-size: 19px; }
  .dsh-gh { flex-wrap: wrap; padding: 8px 12px; }
  .dsh-gh-t { flex: 1 1 calc(100% - 30px); }
  .dsh-gh-t b { font-size: 13px; }
  .dsh-caret { order: 1; }
  .dsh-gh > .btn { order: 2; }
  .dsh-row { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 9px 12px; }
  .dsh-acts { justify-content: flex-start; }
  .dsh-network .dash-versions { grid-template-columns: 1fr; justify-items: center; }
}
