/* ============================================================================
   dashboard.css — desktop-only overrides for the standalone master dashboard.
   Loaded AFTER css/styles.css, so it only widens/relayouts for big screens; all
   component styling (cards, kpi tiles, chat, modal, dash-*) is inherited.
   This surface runs on a laptop, NOT the 7" car head unit, so we let the page
   scroll, use a wider centered column, and bump base sizes up.
   ========================================================================== */

/* The car app locks the body to 100vh and hides overflow. On desktop we want a
   normal scrolling document and larger, comfortable type. */
html, body.dashboard { height: 100%; overflow: auto; font-size: 14px; }

body.dashboard #app { height: 100vh; height: 100dvh; }

/* Full-bleed scrollport; center the tab column (override styles.css #content max-width). */
body.dashboard #content {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 22px clamp(16px, 4vw, 56px) 48px;
  box-sizing: border-box;
}
body.dashboard #content > div {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Roomier top bar + tab strip for a pointer-driven desktop UI. */
body.dashboard #topbar { padding: 13px 24px; }
body.dashboard #topbar .title { font-size: 11px; letter-spacing: .24em; }

/* Sync progress banner — visible during folder sync, import, and other waits. */
body.dashboard .sync-banner {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  border-bottom: 1px solid transparent;
  background: rgba(8, 12, 24, .92);
  transition: max-height .35s ease, opacity .28s ease, border-color .28s;
  pointer-events: none;
}
body.dashboard .sync-banner.active {
  max-height: 76px;
  opacity: 1;
  border-bottom-color: rgba(34, 211, 238, .22);
  pointer-events: auto;
}
body.dashboard .sync-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px clamp(16px, 4vw, 56px);
}
body.dashboard .sync-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(34, 211, 238, .18);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: sync-spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes sync-spin { to { transform: rotate(360deg); } }
body.dashboard .sync-banner-text { flex: 1; min-width: 0; }
body.dashboard .sync-banner-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cyan);
}
body.dashboard .sync-banner-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.dashboard .sync-progress-track {
  height: 4px;
  margin-top: 8px;
  background: rgba(148, 163, 184, .14);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
body.dashboard .sync-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(34, 211, 238, .85), rgba(52, 211, 153, .9));
  transition: width .22s ease;
}
body.dashboard .sync-progress-bar.indeterminate {
  width: 38%;
  position: absolute;
  left: 0;
  top: 0;
  transition: none;
  animation: sync-indeterminate 1.35s ease-in-out infinite;
}
@keyframes sync-indeterminate {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(320%); }
}
body.dashboard .sync-banner-count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  flex-shrink: 0;
  min-width: 4.5em;
  text-align: right;
}
body.dashboard #btn-sync-top.syncing .sync-btn-ic {
  display: inline-block;
  animation: sync-spin .7s linear infinite;
}
body.dashboard #btn-sync-top.syncing { opacity: .85; pointer-events: none; }
body.dashboard #tabs { padding: 10px clamp(12px, 3vw, 40px); gap: 6px; }
body.dashboard .tab-btn { font-size: 11px; padding: 9px 18px; }

/* Bigger KPI tiles + multi-column dash grids now that we have horizontal room. */
body.dashboard .dash-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
body.dashboard .kpi-val { font-size: 30px; }
body.dashboard .kpi-spark { height: 44px; }

/* Two-up card rows for the desktop overview/battery layouts. */
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.dash-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) {
  .dash-cols, .dash-cols-3 { grid-template-columns: 1fr; }
}

/* Taller charts read better on a laptop. */
body.dashboard .chart-wrap { min-height: 220px; }

/* Sessions table for the dashboard's session browser. */
.sess-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sess-table th, .sess-table td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sess-table th { color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600;
  position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sess-table th.sortable { cursor: pointer; user-select: none; color: var(--text); }
.sess-table th.sortable:hover { color: var(--cyan); background: rgba(34, 211, 238, .06); }
.sess-table th.sortable.sorted { color: var(--cyan); }
.sess-table th .th-lbl { margin-right: 6px; }
.sess-table th .sort-ic { font-size: 11px; opacity: .45; display: inline-block; min-width: 1em; }
.sess-table th.sorted .sort-ic { opacity: 1; color: var(--cyan); }
.sess-table td:first-child, .sess-table th:first-child { text-align: left; }
.sess-table th.sortable:nth-child(3), .sess-table td.sess-name { text-align: left; }
.sess-table tbody tr { cursor: pointer; transition: background .15s; }
.sess-table tbody tr:hover { background: rgba(34, 211, 238, .06); }
.sess-table tbody tr.active { background: rgba(34, 211, 238, .12); }
.sess-table .num { font-variant-numeric: tabular-nums; }
.sess-table .sess-name { font-size: 13px; }
.sess-wrap { overflow: auto; }

/* Sessions tab — stretch the table to fill the viewport below the toolbar. */
body.dashboard #content.content--fill {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 16px;
}
body.dashboard #content.content--fill > #tab-sessions {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}
body.dashboard #content.content--fill .sess-toolbar { flex-shrink: 0; }
body.dashboard #content.content--fill .sess-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
}
body.dashboard #content.content--fill .sess-drop-hint { flex-shrink: 0; }
body.dashboard #content.content--fill .sess-panel .ct { flex-shrink: 0; }
body.dashboard #content.content--fill .sess-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
}

/* Health verdict pills reused for the per-sensor grading grid. */
.health-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.health-cell { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.health-cell .hname { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-cell .hval { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--text); flex-shrink: 0; }
.health-cell.ok { border-color: rgba(34, 197, 94, .3); }
.health-cell.warn { border-color: rgba(234, 179, 8, .35); }
.health-cell.crit { border-color: rgba(220, 38, 38, .4); }
.health-cell.miss { opacity: .5; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--dim); }
.health-cell.ok .health-dot { background: var(--sev-ok); }
.health-cell.warn .health-dot { background: var(--sev-warn); }
.health-cell.crit .health-dot { background: var(--sev-crit); box-shadow: 0 0 8px var(--sev-crit); }

/* Big empty/connect state for first run (no folder linked yet). */
.connect-hero { text-align: center; padding: 56px 24px; }
.connect-hero h2 { font-size: 18px; color: var(--text); margin-bottom: 10px; font-family: var(--sans); }
.connect-hero p { color: var(--muted); font-size: 12px; line-height: 1.7; max-width: 520px; margin: 0 auto 18px; }

/* Export menu (future save-back hooks live here). */
.export-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Sessions manager — drag handle, include toggle, row actions */
.sess-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.sess-table .drag-col { width: 28px; text-align: center; color: var(--dim); cursor: grab; user-select: none; }
.sess-table tr.dragging { opacity: .45; }
.sess-table tr.hidden-row { opacity: .45; }
.sess-table tr.hidden-row .sess-name { text-decoration: line-through; color: var(--dim); }
.sess-table .act-col { width: 72px; text-align: right; white-space: nowrap; }
.sess-table .act-col button { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.sess-table .act-col button:hover { color: var(--text); background: rgba(148,163,184,.12); }
.sess-table .act-col button.del:hover { color: var(--red); }
.sess-table .inc-col { width: 36px; text-align: center; }
.sess-table .inc-col input { cursor: pointer; width: 16px; height: 16px; accent-color: var(--cyan); }
.sess-drop-hint { font-size: 11px; color: var(--dim); margin-bottom: 8px; }

/* Fleet context banner — explains what data the viewer is showing. */
.fleet-ctx { border-color: rgba(34, 211, 238, .2); }
.fleet-ctx .ctx-sep { color: var(--dim); margin: 0 4px; }
.fleet-ctx .period-sel { max-width: 280px; margin-top: 4px; }

/* Inline control row — selector left, subtle toggle right (Trends + scatter). */
.dash-ctrl-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.dash-ctrl-main { flex: 0 1 auto; min-width: 0; }
.dash-ctrl-main .fld { width: 100%; }
.dash-ctrl-opt {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  margin-left: auto;
  padding-bottom: 6px;
}
.dash-ctrl-opt-lbl {
  font-size: 9px;
  color: var(--dim);
  letter-spacing: .03em;
  white-space: nowrap;
}
body.dashboard .switch.switch--subtle {
  width: 30px;
  height: 17px;
}
body.dashboard .switch.switch--subtle .track {
  border-radius: 9px;
  background: rgba(51, 65, 85, .55);
}
body.dashboard .switch.switch--subtle .track::before {
  width: 11px;
  height: 11px;
  top: 3px;
  left: 3px;
  background: rgba(148, 163, 184, .85);
}
body.dashboard .switch.switch--subtle input:checked + .track {
  background: rgba(52, 211, 153, .22);
}
body.dashboard .switch.switch--subtle input:checked + .track::before {
  transform: translateX(13px);
  background: rgba(52, 211, 153, .75);
}
@media (max-width: 520px) {
  .dash-ctrl-opt { width: 100%; justify-content: flex-end; padding-bottom: 0; }
}

/* Trends tab — responsive grid of KPI charts (not stacked). */
.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
  align-items: start;
}
@media (max-width: 760px) {
  .trend-grid { grid-template-columns: 1fr; }
}
.trend-card .trend-sub {
  font-size: 10px;
  color: var(--dim);
  line-height: 1.55;
  margin: 2px 0 10px;
}
.trend-card .chart-wrap { min-height: 200px; }
@media (min-width: 900px) {
  .trend-card--wide { grid-column: span 2; }
}

.trends-verdict { border-color: rgba(34, 211, 238, .22); }
.trends-verdict--ok { border-color: rgba(34, 197, 94, .35); }
.trends-verdict--warn { border-color: rgba(251, 191, 36, .4); }
.trends-verdict--crit { border-color: rgba(248, 113, 113, .45); }
.trends-verdict--dim { border-color: var(--border); }
.trends-verdict-headline {
  font-size: 15px; font-weight: 650; margin: 4px 0 6px; color: var(--text);
  letter-spacing: -.01em;
}
.trends-verdict-keys {
  display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px;
  font-size: 10px; color: var(--dim);
}
.scatter-section { margin-top: 8px; }
.scatter-hdr { margin-bottom: 12px; }
.scatter-hdr .note { margin-top: 4px; }
.scatter-howto { margin-bottom: 8px; max-width: 72ch; }
.scatter-ctrl-row { margin: 8px 0 4px; }
.scatter-ctrl-row .scatter-center-sel { max-width: 280px; }
.scatter-more-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border);
}
.scatter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
  align-items: start;
}
@media (max-width: 760px) {
  .scatter-grid { grid-template-columns: 1fr; }
}
.scatter-card .chart-wrap { min-height: 260px; }
.scatter-stats { font-size: 10px; color: var(--dim); margin: 4px 0 4px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.scatter-guide { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.scatter-pill { font-size: 10px; line-height: 1.45; padding: 6px 10px; border-radius: var(--r-sm); flex: 1 1 160px; min-width: 0; }
.scatter-pill-lbl { font-size: 8px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 3px; }
.scatter-pill--good { background: rgba(34, 197, 94, .1); border: 1px solid rgba(34, 197, 94, .32); color: #bbf7d0; }
.scatter-pill--good .scatter-pill-lbl { color: var(--green); }
.scatter-pill--watch { background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .32); color: #fde68a; }
.scatter-pill--watch .scatter-pill-lbl { color: var(--yellow); }
.scatter-pill--neutral { background: rgba(148, 163, 184, .08); border: 1px solid var(--border); color: var(--muted); flex: 1 1 100%; }
.scatter-hue-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.scatter-hue-lbl { font-size: 9px; color: var(--dim); flex-shrink: 0; }
.scatter-hue-bar { flex: 1; height: 8px; border-radius: 4px; border: 1px solid var(--border); }

/* HV Battery tab — verdict, metrics, module map */
.bat-verdict { padding-bottom: 14px; }
.bat-verdict-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.bat-summary { font-size: 12px; color: var(--muted); line-height: 1.55; margin: 8px 0 0; max-width: 52em; }
.bat-score { text-align: right; flex-shrink: 0; line-height: 1; }
.bat-score-n { font-size: 42px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.bat-score-u { font-size: 14px; color: var(--dim); margin-left: 2px; }
.bat-metric-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.bat-metric { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: rgba(15, 23, 42, .35); }
.bat-metric-lbl { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.bat-metric-val { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bat-metric-u { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 3px; }
.bat-metric-hint { font-size: 9px; color: var(--dim); margin-top: 4px; line-height: 1.4; }
.bat-metric--ok { border-color: rgba(34, 197, 94, .25); }
.bat-metric--warn { border-color: rgba(234, 179, 8, .35); }
.bat-metric--crit { border-color: rgba(220, 38, 38, .4); }
.bat-chip { font-size: 9px; padding: 2px 8px; border-radius: 999px; background: rgba(148, 163, 184, .12); color: var(--dim); }
.bat-chip--ok { background: rgba(34, 197, 94, .12); color: var(--green); }
.bat-chip--warn { background: rgba(251, 191, 36, .14); color: var(--yellow); }
.bat-action-list { margin: 8px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); line-height: 1.65; }
.bat-action-list li { margin-bottom: 6px; }
.bat-mod-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
@media (max-width: 760px) { .bat-mod-grid { grid-template-columns: repeat(4, 1fr); } }
.bat-mod { padding: 8px 6px; text-align: center; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.bat-mod-id { font-size: 9px; color: var(--dim); letter-spacing: .04em; }
.bat-mod-ir { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.bat-mod-dev { font-size: 8px; color: var(--dim); margin-top: 2px; }
.bat-mod--ok { border-color: rgba(34, 197, 94, .2); }
.bat-mod--warn { border-color: rgba(234, 179, 8, .35); }
.bat-mod--crit { border-color: rgba(220, 38, 38, .4); }
.bat-mod--weak { box-shadow: 0 0 0 1px rgba(251, 191, 36, .45); }

/* HV current — mirrored discharge / regen panels sharing one x-axis concept. */
.dual-chart { display: flex; flex-direction: column; gap: 0; }
.dual-chart__panel .chart-wrap { min-height: 88px; }
.dual-lbl { font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.dual-chart__zero {
  text-align: center; font-size: 9px; color: var(--dim); padding: 3px 0;
  border-top: 1px dashed rgba(148,163,184,.25); border-bottom: 1px dashed rgba(148,163,184,.25);
}

/* Sensors tab — full-bleed table + chips.
   Seven sibling cells (not nested mm-cols): name grows; Unit/Min/Avg/Max pin
   to the right edge with equal card padding L/R. */
body.dashboard .sensor-group.card {
  padding: 18px 24px;
  width: 100%;
  box-sizing: border-box;
}
body.dashboard .sensor-table {
  width: 100%;
  display: flex;
  flex-direction: column;
}
body.dashboard .sensor-row {
  display: grid;
  grid-template-columns:
    12px
    18px
    minmax(0, 1fr)
    4.75rem
    5.5rem
    5.5rem
    5.5rem;
  align-items: center;
  column-gap: 12px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 9px 0;
  margin: 0;
}
body.dashboard .sensor-row--hdr { padding-bottom: 6px; border: none; }
body.dashboard .sensor-row--hdr .sensor-name,
body.dashboard .sensor-row--hdr .sensor-unit,
body.dashboard .sensor-row--hdr .sensor-num {
  color: var(--dim); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
body.dashboard .sensor-name {
  flex: unset;
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.dashboard .sensor-unit,
body.dashboard .sensor-num {
  flex: unset;
  width: auto;
  text-align: right;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--dim);
}
body.dashboard .sensor-num--avg { font-weight: 600; color: var(--text); }
body.dashboard .sensor-crit {
  width: 18px; justify-self: center; text-align: center;
}
body.dashboard .key-sensor { color: #a78bfa; font-size: 12px; text-shadow: 0 0 6px rgba(167,139,250,.7); }

/* Chip *group* centered in the card; each chip is content-sized with left-
   aligned copy (do NOT stretch 1fr columns — that looked like per-cell centering). */
body.dashboard .group-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 14px 36px;
  width: 100%;
  margin: 4px 0 14px;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: rgba(15, 23, 42, .45);
  border: 1px solid var(--border);
  box-sizing: border-box;
}
body.dashboard .group-chip {
  flex: 0 1 auto;
  min-width: 5.5rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}
body.dashboard .group-chip--ok .calc-val { color: #86efac; }
body.dashboard .group-chip--watch .calc-val { color: #fde68a; }
body.dashboard .group-chip--concern .calc-val { color: #fca5a5; }
body.dashboard .calc-lbl {
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--dim); font-weight: 600; text-align: left;
}
body.dashboard .calc-val {
  font-size: 20px; font-variant-numeric: tabular-nums; margin-top: 4px;
  color: var(--text); line-height: 1.2; text-align: left;
}
body.dashboard .calc-hint {
  font-size: 11px; color: var(--dim); margin-top: 3px; text-align: left;
}

/* Sensors status strip — exactly 4 tiles, full width (no auto-fit empty slots). */
body.dashboard .dash-grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 720px) {
  body.dashboard .dash-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Maintenance tab — summary only; full hub is maintenance-dashboard.html */
body.dashboard .maint-hero {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px;
}
body.dashboard .maint-lead { font-size: 14px; color: #c8d0dc; line-height: 1.65; margin-top: 8px; max-width: 52em; }
body.dashboard .maint-hero-cta { display: flex; flex-direction: column; gap: 10px; min-width: 220px; }
body.dashboard .maint-cta { text-align: center; text-decoration: none; padding: 12px 18px; font-size: 14px; }
body.dashboard .maint-nct-btn {
  background: rgba(251, 191, 36, .12); border: 1px solid rgba(251, 191, 36, .4); color: var(--yellow);
  padding: 10px 16px; font-size: 13px;
}
body.dashboard .maint-garage-preview { list-style: none; margin: 10px 0 0; padding: 0; font-size: 14px; line-height: 1.65; }
body.dashboard .maint-garage-preview li { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.04); color: #d4dae4; }
body.dashboard .maint-garage-preview li.maint-more { color: var(--dim); font-size: 13px; }
body.dashboard .maint-alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 14px; line-height: 1.6; }
body.dashboard .maint-alert:last-child { margin-bottom: 0; }
body.dashboard .maint-alert b { display: block; margin-bottom: 4px; font-size: 14px; }
body.dashboard .maint-alert p { color: #c8d0dc; margin: 0; }
body.dashboard .maint-alert-crit { background: rgba(251,113,133,.1); border: 1px solid rgba(251,113,133,.35); }
body.dashboard .maint-alert-crit b { color: var(--red); }
body.dashboard .maint-alert-warn { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.3); }
body.dashboard .maint-alert-warn b { color: var(--yellow); }

/* NCT lightbox on master dashboard */
body.dashboard .maint-lightbox {
  display: none; position: fixed; inset: 0; z-index: 200; align-items: center; justify-content: center; padding: 20px;
}
body.dashboard .maint-lightbox.open { display: flex; }
body.dashboard .maint-lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.78); backdrop-filter: blur(4px); }
body.dashboard .maint-lightbox-panel {
  position: relative; background: var(--surface2); border: 1px solid var(--border2); border-radius: 14px;
  width: min(720px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
body.dashboard .maint-lightbox-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px 10px; border-bottom: 1px solid var(--border);
}
body.dashboard .maint-lightbox-head h2 { font-size: 16px; font-weight: 700; color: var(--text); }
body.dashboard .maint-lightbox-sub { font-size: 13px; color: var(--dim); margin-top: 4px; }
body.dashboard .maint-lightbox-body { flex: 1; overflow-y: auto; padding: 14px 20px; font-size: 14px; color: var(--text); }
body.dashboard .maint-lightbox-foot {
  display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--border);
}
body.dashboard .maint-nct-bar {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 0 20px 8px;
}
body.dashboard .maint-nct-fill {
  height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green));
  border-radius: 4px; transition: width .3s;
}
body.dashboard .nct-cat { margin-bottom: 16px; }
body.dashboard .nct-cat-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--cyan); margin-bottom: 6px; font-weight: 600; }
body.dashboard .nct-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04); cursor: pointer; }
body.dashboard .nct-row.done { opacity: .7; }
body.dashboard .nct-row.done .nct-lbl { text-decoration: line-through; color: var(--dim); }
body.dashboard .nct-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--cyan); flex-shrink: 0; }
body.dashboard .nct-lbl { font-weight: 600; font-size: 14px; }
body.dashboard .nct-detail { font-size: 13px; color: var(--dim); margin-top: 3px; line-height: 1.5; }

/* Modal readability on desktop dashboard — stay inside the viewport */
body.dashboard #modal {
  width: min(94vw, 520px);
  max-height: min(86vh, 780px);
  padding: 20px 22px 18px;
  font-size: 14px;
  background: var(--surface2);
  border-color: var(--border2);
}
body.dashboard #modal.modal--wide { width: min(96vw, 820px); }
body.dashboard #modal h3,
body.dashboard #modal #modal-title { font-size: 15px; color: var(--text); font-weight: 700; }
body.dashboard #modal .modal-x { width: 40px; height: 40px; font-size: 18px; color: #c5ccd8; }
body.dashboard #modal-body,
body.dashboard #modal p {
  color: #d4dae4;
  font-size: 13px;
  line-height: 1.55;
  font-family: ui-monospace, 'IBM Plex Mono', Menlo, monospace;
}
body.dashboard #modal-actions .btn { min-height: 44px; font-size: 14px; padding: 10px 18px; }
body.dashboard #modal-actions .btn.primary { background: var(--cyan); color: #041018; font-weight: 600; }
