/* glockpeek — forensic observatory dashboard
   Dark instrument panel. Red = exposure/danger (mirrors the CLI), teal = safe,
   amber = signal accent. The vulnerability heatmap is the hero. */

:root {
  /* Ruled-notebook identity, shared with the landing page: warm paper, a single
     fountain-pen ink, and one red — the margin line and its corrections — as the
     only accent. Nothing glows; attention is drawn with red, not light. */
  --bg: #f1ebdd;        /* desk / frame behind the sheet */
  --bg-2: #f6f1e7;      /* wells (inputs, tracks) — a touch off the sheet */
  --panel: #fbfaf6;     /* the sheet: cards / panels */
  --panel-2: #fffef9;   /* raised surfaces within a panel */
  --line: #e4ddcc;      /* slip edges / hairlines */
  --line-2: #d6cdba;    /* stronger dividers */
  --ink: #22324e;       /* primary text — fountain-pen blue-black */
  --ink-dim: #556480;   /* secondary text */
  --ink-faint: #6e7c91; /* least important text — darker than before for paper contrast */

  --safe: #5f8169;     /* clean / quiet — sage, deepened for paper */
  --signal: #c0564a;   /* the one accent: the margin red (marks, active, focus) */
  --signal-strong: #a8463c; /* red at full, for hover/emphasis */
  --slate: #5b6a83;    /* secondary accent, emphasis borders */
  --danger: #c0564a;   /* violation — the same correction red */
  --danger-deep: #a8463c;
  --exposed: #a99c82;  /* unmanaged — warm taupe, a different vulnerability */
  --exposed-dim: #c3b9a1; /* downtime — same family, one step back */
  --on-accent: #fbfaf6; /* text/glyphs sitting on a filled accent */

  --mono: "Courier Prime", ui-monospace, monospace;
  --sans: "Inter", system-ui, sans-serif;      /* body / dense UI text — readable small */
  --display: "Crimson Pro", Georgia, serif;    /* headings keep the editorial serif */

  --r: 4px;
}

* { box-sizing: border-box; }

/* The hidden attribute must beat the display rules on .loading/.error/#dash
   (a bare class selector ties the UA [hidden] rule on specificity). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  background: var(--bg);
}

/* The scanline/grid texture belonged to the dark instrument look — paper has none. */
.grain { display: none; }

.app { position: relative; z-index: 1; display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: var(--panel); }

/* ── Sidebar / nav ────────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 16px;
  /* the notebook's red margin line, between the index rail and the page */
  border-right: 1px solid rgba(192, 86, 74, .42);
  background: var(--panel);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px; }
.brand-mark {
  width: 34px; height: 34px;
  flex: none;
  display: block;
  object-fit: contain;
}

.brand h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 25px;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1;
  text-transform: lowercase;
}
.brand h1 span { color: var(--signal); }
.tagline { display: none; }   /* no marketing tagline in the app chrome */

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.nav li { margin: 0; }
.nav button {
  width: 100%;
  text-align: left;
  font-family: var(--display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.nav button:hover { color: var(--ink); background: rgba(34, 50, 78, .05); }
.nav button.active {
  color: var(--ink);
  font-weight: 700;
  background: rgba(192, 86, 74, .07);
  box-shadow: inset 2px 0 0 var(--signal);
}

/* Admin nav item: set apart from the regular views (divider + accent). */
.nav li.nav-admin { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav li.nav-admin button { color: var(--signal); }
.nav li.nav-admin button:hover { color: var(--signal); background: rgba(192, 86, 74, .08); }
.nav li.nav-admin button.active { color: var(--ink); background: rgba(192, 86, 74, .07); box-shadow: inset 2px 0 0 var(--signal); }

.sidebar-foot { margin-top: auto; padding: 10px 8px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }

/* Refresh button: a conic-progress ring (time left to the next auto-refresh)
   around a ↻ glyph, plus the countdown. --rf (0..1) is set each tick in JS. */
#refresh-btn { display: inline-flex; align-items: center; gap: 8px; background: none; border: none; padding: 4px 2px; cursor: pointer; color: var(--ink-dim); }
#refresh-btn .rf-ring {
  position: relative; width: 22px; height: 22px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; color: var(--ink-dim);
}
#refresh-btn .rf-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--signal) calc(var(--rf, 1) * 360deg), var(--line-2) 0);
  -webkit-mask: radial-gradient(transparent 54%, #000 56%);
  mask: radial-gradient(transparent 54%, #000 56%);
}
#refresh-btn .rf-text { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
#refresh-btn .rf-cd { color: var(--ink-faint); margin-left: 2px; }
#refresh-btn:hover { color: var(--ink); }
#refresh-btn:hover .rf-ring { color: var(--ink); }
#refresh-btn.refreshing .rf-ring { animation: rf-spin 0.8s linear infinite; }
@keyframes rf-spin { to { transform: rotate(360deg); } }
.src { font-family: var(--mono); font-size: 10px; line-height: 1.6; color: var(--ink-faint); }
.src .ver { font-style: italic; opacity: 0.8; }
.range-buttons { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.range-buttons button {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.range-buttons button:hover { color: var(--ink); }
.range-buttons button.active { background: var(--danger); color: var(--on-accent); box-shadow: 0 0 14px rgba(192, 86, 74,0.4); }

/* window pager */
.range-nav { display: flex; align-items: center; gap: 8px; }
.range-nav[hidden] { display: none; }
.range-nav button {
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1;
  color: var(--ink-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.range-nav button:hover:not(:disabled) { color: var(--ink); border-color: var(--line-2); background: var(--panel-2); }
.range-nav button:disabled { opacity: 0.32; cursor: default; }
.range-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  min-width: 148px;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ── Content / views ──────────────────────────────────── */
.content { min-width: 0; display: flex; flex-direction: column; }
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 22px clamp(16px, 3vw, 40px) 18px;
  border-bottom: 1px solid var(--line);
}
.view-title {
  font-family: var(--display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.01em;
  margin: 0;
}

main { padding: 24px clamp(16px, 3vw, 40px) 64px; min-width: 0; }
.view { display: none; flex-direction: column; gap: 22px; }
.view.active { display: flex; }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { margin-right: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; width: 100%; }
  .nav button { width: auto; }
  .sidebar-foot { display: none; }
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
/* minmax(0, 1fr) forces true equal thirds — otherwise the heatmap's intrinsic
   min-width would push its track wider than the two chart tracks. */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; align-items: start; }
@media (max-width: 980px) { .grid-3 { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px 22px;
  box-shadow: 2px 3px 0 rgba(34, 50, 78, .05);   /* a sheet laid on the desk */
}
.panel-head { margin-bottom: 16px; }
.panel-head h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink);
}
.panel-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-dim); }
.hero { border-color: var(--line-2); }

/* ── Composite health score (leading metric) ──────────── */
.score-hero { border-color: var(--line-2); }

/* Streak hero: the standing current/best clean-day streak, given weight on the
   Overview (not a small readout tile). */
.streak-hero { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
.streak-hero .sh-best { padding-left: 44px; border-left: 1px solid var(--line); }
.streak-hero .sh-num { font-family: var(--display); font-weight: 700; line-height: 0.92; color: var(--ink); }
.streak-hero .sh-current .sh-num { font-size: 72px; color: var(--safe); }
.streak-hero .sh-current.alarm .sh-num { color: var(--danger); }
.streak-hero .sh-best .sh-num { font-size: 72px; }
.streak-hero .sh-num .u { font-family: var(--sans); font-weight: 600; font-size: 20px; color: var(--ink-dim); margin-left: 9px; }
.streak-hero .sh-cap { font-family: var(--mono); font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-faint); margin-top: 10px; }
@media (max-width: 560px) {
  .streak-hero { grid-template-columns: 1fr; gap: 22px; }
  .streak-hero .sh-best { padding-left: 0; border-left: 0; padding-top: 22px; border-top: 1px solid var(--line); }
  .streak-hero .sh-num, .streak-hero .sh-best .sh-num { font-size: 56px; }
}
.score-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 30px;
  align-items: start;
}
@media (max-width: 900px) { .score-split { grid-template-columns: 1fr; } }
.score-body {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 34px;
  align-items: center;
}
@media (max-width: 620px) { .score-body { grid-template-columns: 1fr; justify-items: center; } }

/* Deterministic "how it's calculated / how to improve" explainer. */
.score-explain { border-left: 1px solid var(--line); padding-left: 26px; }
@media (max-width: 900px) {
  .score-explain { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 18px; }
}
.score-explain h3 {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint); margin: 0 0 7px;
}
.score-explain h3:not(:first-child) { margin-top: 16px; }
.se-formula { font-size: 12.5px; color: var(--ink-dim); margin: 0; line-height: 1.5; }
.se-formula span { display: block; color: var(--ink-faint); font-size: 11.5px; margin-top: 3px; }
.se-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.se-list li { font-size: 12.5px; color: var(--ink-dim); line-height: 1.45; }
.se-list b { color: var(--ink); font-family: var(--mono); font-weight: 600; }
.se-gain { color: var(--safe); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }
.se-note { font-size: 11.5px; color: var(--ink-faint); margin: 14px 0 0; line-height: 1.45; }

.score-gauge { position: relative; width: 168px; height: 168px; }
.score-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-track { fill: none; stroke: var(--line-2); stroke-width: 9; }
.gauge-arc {
  fill: none;
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), stroke 0.4s;
  filter: drop-shadow(0 0 6px rgba(34, 50, 78, 0.12));
}
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-num { font-family: var(--display); font-weight: 900; font-size: 54px; line-height: 1; letter-spacing: -0.02em; }
.gauge-max { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

.score-detail { min-width: 0; }
.score-band {
  font-family: var(--display);
  font-weight: 800;
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}
.score-verdict { margin: 8px 0 18px; color: var(--ink-dim); font-size: 14px; }
.score-breakdown { display: flex; flex-direction: column; gap: 11px; max-width: 460px; }
.pen { display: grid; grid-template-columns: 120px 38px 1fr; gap: 12px; align-items: center; }
.pen .plabel { font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); }
.pen .pval { font-family: var(--mono); font-size: 12.5px; color: var(--ink); text-align: right; }
.pen .ptrack { height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; }
.pen .pfill { height: 100%; border-radius: 3px; transition: width 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }

/* ── Instrument readout strip ─────────────────────────── */
.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.stat {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 16px 18px;
}
.stat .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.stat .v {
  font-family: var(--display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1.15;
  margin-top: 6px;
  letter-spacing: -0.01em;
}
.stat .v small { font-size: 13px; font-weight: 600; color: var(--ink-dim); }
.stat .sub { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-top: 2px; }
.stat .desc { font-size: 11px; color: var(--ink-faint); line-height: 1.4; margin-top: 9px; }
.stat.alarm .v { color: var(--danger); }
.stat.peak .v { color: var(--signal); }
.stat.safe .v { color: var(--safe); }

/* ── Heatmap ──────────────────────────────────────────── */
/* Vulnerability map + Unblocks-by-hour side by side in one panel: the compact
   heatmap keeps its natural width on the left, the chart fills the rest. */
.vuln-row { display: flex; gap: 32px; align-items: flex-start; flex-wrap: wrap; }
.vuln-col-heat { flex: 0 0 auto; }
.vuln-col-unblock { flex: 1 1 340px; min-width: 0; }
.hour-chart { position: relative; height: 210px; }

.heatmap {
  display: grid;
  grid-template-columns: 24px repeat(24, minmax(0, 1fr));
  gap: 3px;
  font-family: var(--mono);
  min-width: 0;
  /* The vulnerability map is the centrepiece — give it room to read at a glance. */
  max-width: 680px;
}
.hm-corner { }
.hm-hour, .hm-day {
  font-size: 10px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}
.hm-hour { padding-bottom: 2px; }
.hm-day { justify-content: flex-end; padding-right: 6px; }
.hm-cell {
  aspect-ratio: 1 / 1;
  min-width: 0;
  border-radius: 2px;
  background: var(--line);          /* empty slot = a faint ruled square */
  border: 1px solid rgba(34, 50, 78, .04);
  position: relative;
  cursor: default;
  transition: transform 0.1s;
}
.hm-cell:hover { transform: scale(1.35); z-index: 5; border-color: rgba(34, 50, 78, .4); }
.hm-cell.peak {
  box-shadow: 0 0 0 1.5px var(--signal);
  z-index: 2;
}
.hm-cell.unmanaged {
  background-image: repeating-linear-gradient(45deg, rgba(169,156,130,0.7) 0 3px, transparent 3px 6px);
  background-color: rgba(169,156,130,0.14);
}
.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  flex-wrap: wrap;
}
.legend-scale { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend-scale i { width: 16px; height: 12px; border-radius: 2px; display: inline-block; }
.legend-scale .lvl { display: inline-flex; align-items: center; gap: 4px; }
.legend-key { display: flex; align-items: center; gap: 6px; }
.legend-key .swatch { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.legend-key .swatch.hatch { background-image: repeating-linear-gradient(45deg, rgba(169,156,130,0.8) 0 3px, transparent 3px 6px); background-color: rgba(169,156,130,0.18); }

/* ── Calendar (real month grids) ──────────────────────── */
.calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(216px, 1fr));
  gap: 20px;
}
.cal-month { min-width: 0; }
.cal-month h3 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cal-month h3 .mtotal { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); font-weight: 500; }
.cal-weekdays, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-weekdays { margin-bottom: 6px; }
.cal-wd {
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.cal-day {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border-radius: 5px;
  background: var(--bg-2);
  border: 1px solid rgba(34, 50, 78, 0.06);
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 4px 5px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  transition: transform 0.1s, box-shadow 0.1s;
}
.cal-day.blank { background: transparent; border-color: transparent; }
.cal-day.out { opacity: 0.32; }            /* day outside the selected window */
.cal-day.has { color: var(--on-accent); font-weight: 600; }
/* Entirely clean, glocker-managed day — a quiet dark green. */
.cal-day.clean { background: rgba(127,163,141,0.16); border-color: rgba(127,163,141,0.34); }
.clean-swatch { background: rgba(127,163,141,0.16); box-shadow: inset 0 0 0 1px rgba(127,163,141,0.5); }
.cal-day:not(.blank):hover { transform: scale(1.12); z-index: 2; border-color: rgba(34, 50, 78,0.4); }
.cal-daynum { position: relative; z-index: 1; }
/* Proportional unmanaged strip, filling from the bottom by day fraction. */
.cal-hatch {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 0;
  background-image: repeating-linear-gradient(45deg, rgba(214, 96, 165, 0.85) 0 3px, transparent 3px 6px);
  background-color: rgba(169, 156, 130, 0.22);
}
.cal-day.today { box-shadow: 0 0 0 1.5px var(--signal); }
.cal-legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim);
}

/* ── History layout (calendar/timeline + sticky inspector) ── */
.history {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
}
.history-main { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
/* Not sticky: the detail flows with the page so a long Hits list stays fully
   reachable (a sticky, taller-than-viewport panel would hide its bottom). */
.history-side { min-width: 0; }
.history-side .day-inspector { margin: 0; }
@media (max-width: 1024px) {
  .history { grid-template-columns: 1fr; }
  .history-side { position: static; }
}

/* ── Day inspector ────────────────────────────────────── */
/* Fixed height so swapping content never shifts surrounding layout. */
.day-inspector { display: flex; flex-direction: column; }
.day-detail { display: flex; flex-direction: column; }
/* Days/points are clicked (not hovered) to open the detail. */
.cal-day[data-ts] { cursor: pointer; }

/* ── Analytics: Range on top, with the window's headline numbers folded in ── */
.range-top { border-left: 3px solid var(--signal); background: var(--panel-2); }
.range-summary { display: flex; gap: 40px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.range-summary:empty { display: none; }
.range-summary .rs { display: flex; align-items: baseline; gap: 8px; }
.range-summary .rs .n { font-family: var(--mono); font-weight: 700; font-size: 24px; color: var(--ink); }
.range-summary .rs .n.bad, .range-summary .rs .n.cold { color: var(--danger); }
.range-summary .rs .n.good { color: var(--safe); }
.range-summary .rs .l { font-size: 14px; color: var(--ink-dim); }
.range-summary .rs .rs-sub { font-size: 12px; color: var(--ink-faint); }
.range-summary .rs .rs-sub::before { content: "· "; }  /* clear separator: "day streak · best 10 days" */

/* Unblocks: grouped by site, ranked by total time, each expandable to instances. */
.um-groups { display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto; }
.um-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 4px; }
.um-group > summary::-webkit-details-marker { display: none; }
.um-group > summary::before { content: "\25B8"; flex: none; color: var(--ink-faint); font-size: 11px; transition: transform .15s; }
.um-group[open] > summary::before { transform: rotate(90deg); }
.um-group > summary:hover { background: rgba(34, 50, 78, .04); }
.umg-name { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.umg-tag { margin-left: 8px; padding: 1px 6px; border-radius: 3px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; vertical-align: 1px; }
.umg-tag.extend { color: var(--ink-dim); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.umg-meta { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); white-space: nowrap; }
.umg-bar { flex: none; width: 90px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.umg-bar > span { display: block; height: 100%; background: var(--exposed); }
.um-insts { padding: 2px 0 8px 24px; display: flex; flex-direction: column; gap: 2px; }
.dd-unb { margin-top: 16px; }
.dd-unb h4 { margin: 0 0 8px; }
#chart-timeline { cursor: pointer; }
/* Timeline is a compact sparkline — the calendar carries the detailed per-day
   view, so the trend line just needs to show shape, not fill a tall panel. */
.spark-wrap { position: relative; height: 108px; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }
.tl-key { display: inline-flex; align-items: center; gap: 6px; }
.tl-sw { display: inline-block; flex: 0 0 auto; }
.tl-line { width: 16px; height: 2px; background: var(--danger); }
.tl-band { width: 14px; height: 11px; border-radius: 2px; background: rgba(169, 156, 130, 0.3); }
.tl-tick { width: 3px; height: 12px; border-radius: 1px; background: linear-gradient(var(--signal), var(--safe)); }
.tl-sel { width: 12px; height: 11px; border-radius: 2px; background: rgba(34, 50, 78, 0.14); }
.tl-line2 { width: 16px; height: 2px; background: #6b8cb0; }  /* unblocks: distinct blue, not sage (too close to red at a glance) */

/* Analytics sub-tabs (History / Usage) beneath the shared range strip. */
.subtabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 4px;
  /* Stay on top: pin the tab bar so it stays visible while scrolling and doesn't
     shift when the Range strip below it hides for Tags. */
  position: sticky; top: 0; z-index: 20;
  background: var(--panel);   /* blend with the sheet, not a tan desk band */
  padding: 14px 0 10px;
}
.subtabs button {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim);
  background: transparent; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 7px 16px; cursor: pointer; white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.subtabs button:hover { color: var(--ink); }
.subtabs button.active { color: var(--on-accent); background: var(--signal); border-color: var(--signal); }
/* Sidebar nav groups (Overview / Monitoring / Account / Admin). */
.nav-group { margin-top: 14px; }
/* Monitoring container: the device switcher heads a soft panel that holds the
   views it scopes (Analytics + Insights). */
.nav-monitoring {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px;
}
/* Device scope switcher — the container header. A tidy field with a leading
   laptop glyph so it reads as "which machine", not stray nav text. */
.sidebar-devices { margin: 0 0 8px; }
.device-filter {
  width: 100%; box-sizing: border-box;
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 26px 6px 30px; cursor: pointer;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  /* laptop glyph (left) + caret (right) */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2397a3b4' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='12' rx='1.5'/%3E%3Cpath d='M2 20h20'/%3E%3C/svg%3E") no-repeat left 9px center / 15px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2397a3b4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 12px,
    var(--panel);
}
.device-filter:hover { color: var(--ink); border-color: var(--line-2); }
/* Single device: same field, but a static label — no caret, not interactive. */
.device-filter--label {
  cursor: default; padding-right: 10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2397a3b4' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='12' rx='1.5'/%3E%3Cpath d='M2 20h20'/%3E%3C/svg%3E") no-repeat left 9px center / 15px,
    var(--panel);
}
.device-filter--label:hover { color: var(--ink-dim); border-color: var(--line); }
.subview { display: none; }
/* Mirror .view's column+gap so panels inside a sub-tab keep their spacing
   (a plain block collapsed the gaps — notably under the usage stat tiles). */
.subview.active { display: flex; flex-direction: column; gap: 22px; }

/* Range panel header: title/subtitle on the left, the selected-window readout on
   the right. */
.range-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
/* Selected-window readout — sits top-right of the Range panel, showing the picked
   from → to span. Shown only on Analytics. */
.range-readout {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px;
  font-family: var(--mono); font-size: 15px; color: var(--ink);
  white-space: nowrap; text-align: right;
}
.range-readout .rr-arrow { color: var(--ink-faint); }
.range-readout .rr-days { color: var(--signal); margin-left: 3px; font-weight: 600; }

/* Account menu — traditional top-right dropdown (Sign out, …). */
.account { position: relative; }
.account-btn {
  display: inline-flex; align-items: center; gap: 6px; max-width: 240px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  background: none; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 6px 12px; cursor: pointer;
}
.account-btn:hover { color: var(--ink); border-color: var(--line); }
.account-btn #account-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-caret { color: var(--ink-faint); font-size: 10px; }
.account-drop {
  position: absolute; top: calc(100% + 6px); right: 0; min-width: 168px; z-index: 50;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 6px; box-shadow: 0 10px 30px rgba(34, 50, 78, 0.16);
}
.account-item {
  display: block; width: 100%; text-align: left;
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  background: none; border: none; border-radius: 6px; padding: 8px 10px; cursor: pointer;
}
.account-item:hover { background: rgba(34, 50, 78, 0.06); }

/* Footer separator before the version tag. */
.foot-sep { width: 100%; border: none; border-top: 1px solid var(--line); margin: 2px 0; }

/* Selected day: a bright ring on the calendar cell, mirrored by the timeline's
   selected-day band, so clicking one shows the selection in the other. */
.cal-day.sel { box-shadow: 0 0 0 2px var(--signal); z-index: 1; }
.dd-empty {
  font-family: var(--mono); font-size: 13px; color: var(--ink-faint);
  display: flex; align-items: center; justify-content: center;
  min-height: 200px; text-align: center; line-height: 1.6;
}
.dd-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.dd-date { font-family: var(--display); font-weight: 800; font-size: 16px; letter-spacing: 0.02em; }
.dd-badges { display: flex; align-items: center; gap: 8px; }
.dd-count { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.badge {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 999px;
}
.badge.alarm { color: var(--danger); background: rgba(192, 86, 74, 0.13); }
.badge.exposed { color: var(--exposed); background: rgba(169, 156, 130, 0.15); }

.dd-grid { display: flex; flex-direction: column; gap: 16px; }
.dd-sum h4, .dd-hits h4 {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-faint); margin: 0 0 8px;
}
.dd-sum h4:not(:first-child) { margin-top: 14px; }
.dd-hits { display: flex; flex-direction: column; }

.mrank { display: grid; grid-template-columns: 1fr 64px auto; gap: 10px; align-items: center; margin-bottom: 6px; }
.mlabel { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mbar { height: 5px; background: var(--bg-2); border-radius: 3px; overflow: hidden; }
.mbar > span { display: block; height: 100%; border-radius: 3px; }
.mcount { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); text-align: right; }

.hit-list { display: flex; flex-direction: column; gap: 1px; padding-right: 4px; }
.hit {
  display: grid; grid-template-columns: 44px auto 1fr; gap: 2px 10px; align-items: baseline;
  font-family: var(--mono); font-size: 12.5px; padding: 6px 0;
  border-bottom: 1px solid rgba(34, 50, 78, 0.04);
}
.hit .ht { grid-column: 1; grid-row: 1; color: var(--ink-dim); }
.hit-x {
  grid-column: 3; grid-row: 1; justify-self: start; align-self: center; margin-left: 4px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink-dim); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 2px 7px; border-radius: 4px;
}
.hit-x:hover { color: var(--on-accent); background: var(--danger); border-color: var(--danger); }

/* Ignored (false-positive) violations list. */
.ign-list { display: flex; flex-direction: column; gap: 8px; }
.ign {
  display: grid; grid-template-columns: 120px 1fr auto auto; gap: 12px; align-items: baseline;
  font-family: var(--mono); font-size: 12.5px;
}
.ign-when { color: var(--ink-faint); }
.ign-kw { color: var(--danger); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ign-dom { color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ign-restore {
  background: transparent; border: 0; color: var(--ink-faint); cursor: pointer;
  font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: 4px;
}
.ign-restore:hover { color: var(--safe); background: var(--panel-2); }
.hit .hk { grid-column: 2; grid-row: 1; color: var(--danger); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hit .hd {
  grid-column: 2 / 4; grid-row: 2; color: var(--ink-dim); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hit .hd em { color: var(--ink-faint); font-style: normal; text-transform: uppercase; }

/* Coverage line: unmanaged vs managed split for the hovered day. */
.dd-cov {
  display: flex; flex-direction: column; gap: 3px;
  font-family: var(--mono); font-size: 12.5px;
  margin-bottom: 14px; padding: 10px 12px;
  border-left: 2px solid var(--exposed);
  background: rgba(169, 156, 130, 0.08);
  border-radius: 0 6px 6px 0;
}
.dd-cov .cov-unm { color: var(--exposed); }
.dd-cov .cov-unm b { color: #c9b6c6; font-weight: 600; }
.dd-cov .cov-man { color: var(--ink-dim); }
.dd-cov .cov-why { color: var(--ink-faint); }

/* 24-hour strip in the day inspector */
.dd-hours { margin-bottom: 14px; }
.dd-hours-row { display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px; }
.dd-hcell {
  height: 22px; border-radius: 2px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform 0.1s;
}
.dd-hcell:hover { transform: scaleY(1.25); }
.dd-hcell.guarded { background: rgba(95, 129, 105, 0.22); box-shadow: inset 0 0 0 1px rgba(95, 129, 105, 0.3); }
.dd-hcell.unmanaged { background-image: repeating-linear-gradient(45deg, rgba(169, 156, 130,0.55) 0 3px, transparent 3px 6px); }
.dd-hcell.future { opacity: 0.35; }
.dd-hours-axis {
  display: grid; grid-template-columns: repeat(24, 1fr); gap: 2px;
  margin-top: 5px;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim);
}
.dd-hours-axis span { text-align: left; white-space: nowrap; }
.dd-hours-legend { display: flex; gap: 16px; margin-top: 8px; font-family: var(--sans); font-size: 12px; color: var(--ink-dim); }
.dd-hours-legend .ddl { display: inline-flex; align-items: center; gap: 6px; }
.dd-hours-legend .ddl::before { content: ""; width: 12px; height: 12px; border-radius: 2px; flex: none; }
.dd-hours-legend .ddl.guarded::before { background: rgba(95, 129, 105, 0.22); box-shadow: inset 0 0 0 1px rgba(95, 129, 105, 0.4); }
.dd-hours-legend .ddl.unmanaged::before { background-image: repeating-linear-gradient(45deg, rgba(169, 156, 130, 0.7) 0 3px, var(--panel-2) 3px 6px); }
.dd-hours-legend .ddl.slip::before { background: var(--danger); }

.dd-note { font-family: var(--mono); font-size: 13.5px; padding: 18px 4px; line-height: 1.6; }
.dd-note .dim { color: var(--ink-faint); }
.clean-note { color: var(--safe); }
.exposed-note { color: var(--exposed); }

/* ── Rank lists (keywords / domains / reasons) ────────── */
.ranklist { display: flex; flex-direction: column; gap: 10px; }
.rank {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}
.rank .label {
  font-family: var(--mono);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank .count { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.rank .track {
  grid-column: 1 / -1;
  height: 5px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
}
.rank .fill { height: 100%; border-radius: 3px; }
.rank .meta { grid-column: 1 / -1; font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); }
.empty { color: var(--ink-faint); font-family: var(--mono); font-size: 13px; padding: 8px 0; }

/* ── Unmanaged list ───────────────────────────────────── */
.unmanaged-list { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; }
.um {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 10px;
  border-left: 2px solid var(--exposed);
  border-radius: 0 3px 3px 0;
}
.um:nth-child(even) { background: rgba(169, 156, 130, 0.06); }  /* zebra, not a box each */
.um .when { font-family: var(--mono); font-size: 12px; white-space: nowrap; color: var(--ink-dim); }
.um .dur { font-family: var(--mono); font-size: 12px; color: var(--exposed); font-weight: 600; white-space: nowrap; margin-left: auto; }
.um .why { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um.open .dur::after { content: " · ongoing"; color: var(--danger); }

/* charts */
canvas { max-height: 260px; }

/* ── States ───────────────────────────────────────────── */
.loading, .error {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--ink-dim);
  z-index: 20;
  background: var(--bg);
}
.error { color: var(--danger); flex-direction: column; gap: 10px; text-align: center; padding: 20px; }

/* ── Boot dial ────────────────────────────────────────────
   The first load decrypts every sealed field in the browser, so on a long
   history there is a genuine wait. Rather than an unmoving "decrypting data…",
   a hairline ring reports the real fraction: an unhurried sweep while the
   records are still in flight (.indeterminate, no total known yet), then a
   filling arc once app.js can count the work. Deliberately quiet — one hue,
   hairline strokes, no bounce. --p is the 0..1 fill, set from JS. */
.boot {
  --p: 0;
  --arc: 339.292; /* 2πr for r=54, in user units = px at this viewBox scale */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.boot-dial {
  position: relative;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
}
/* A slow breath of light behind the dial, so a long decrypt never looks frozen
   even while the arc sits between batches. */
.boot-dial::before {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(127,163,141, 0.16), transparent 68%);
  animation: boot-breathe 3.2s ease-in-out infinite;
}

.boot-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* start the arc at 12 o'clock */
  overflow: visible;
}
.boot-track, .boot-arc {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}
.boot-track { stroke: var(--line-2); }
.boot-arc {
  stroke: var(--safe);
  stroke-dasharray: var(--arc);
  stroke-dashoffset: calc(var(--arc) * (1 - var(--p)));
  filter: drop-shadow(0 0 5px rgba(127,163,141,0.5));
  /* Progress arrives in batches, not per field — glide between them so the arc
     reads as continuous motion instead of a series of jumps. */
  transition: stroke-dashoffset 0.28s linear;
}
/* No total yet: a short arc sweeping the ring, at a pace that suggests work
   rather than urgency. */
.boot.indeterminate .boot-arc {
  stroke-dasharray: 52 var(--arc);
  stroke-dashoffset: 0;
  transition: none;
  transform-origin: 50% 50%;
  animation: boot-sweep 1.6s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
}

.boot-pct {
  position: relative;
  font-family: var(--mono);
  font-size: 24px;
  font-variant-numeric: tabular-nums; /* the ring must not twitch as digits change */
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink);
}
.boot-pct::after { content: "%"; font-size: 13px; color: var(--ink-faint); margin-left: 2px; }
.boot.indeterminate .boot-pct::after { content: ""; } /* no "—%" */

.boot-phase {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.boot-count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  min-height: 1.2em; /* reserve the line so the dial doesn't shift when it fills */
}

@keyframes boot-sweep { to { transform: rotate(360deg); } }
@keyframes boot-fade { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes boot-breathe {
  0%, 100% { opacity: 0.45; transform: scale(0.96); }
  50%      { opacity: 1;    transform: scale(1.04); }
}

/* Reduced motion: keep the readout, drop the movement. The arc still fills, it
   just snaps to each batch instead of gliding, and the sweep becomes a pulse. */
@media (prefers-reduced-motion: reduce) {
  .boot-dial::before { animation: none; opacity: 0.6; }
  .boot-arc { transition: none; }
  .boot.indeterminate .boot-arc { animation: boot-fade 2s ease-in-out infinite; }
}

/* staggered reveal of the active view's panels (re-runs on each view switch) */
.view.active > * { animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.view.active > *:nth-child(1) { animation-delay: 0.02s; }
.view.active > *:nth-child(2) { animation-delay: 0.08s; }
.view.active > *:nth-child(3) { animation-delay: 0.14s; }
.view.active > *:nth-child(4) { animation-delay: 0.20s; }
/* Subviews toggle display:none↔flex on subtab switch, which restarts this
   animation and makes the content jump up a few px each time. The rise is meant
   for top-level view entry only, so exempt the subviews. */
.view.active > .subview { animation: none; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .view.active > * { animation: none !important; }
}

/* ── Usage tag pie ─────────────────────────────────────── */
.pie-wrap { position: relative; height: 260px; }
.pie-wrap canvas { max-height: 260px; }

/* Taller container for the stacked tag-by-hour chart (24 bars + legend). */
.tall-chart { position: relative; height: 320px; }
.tall-chart canvas { max-height: 320px; }

/* ── Untagged windows list ─────────────────────────────── */
/* Tag-contributor drill-down: tree on the left, per-app word pie on the right. */
.tagc-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
@media (max-width: 860px) { .tagc-split { grid-template-columns: 1fr; } }
.tagc-pie { min-width: 0; }
.tagc-pie-head { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tagc-pie-body { position: relative; height: 220px; }
#tagc-pie-body canvas { max-height: 220px; }

/* Tag-contributor tree: apps expand to their windows. */
.tagtree { display: flex; flex-direction: column; gap: 4px; }
.tt-group { display: flex; flex-direction: column; }
.tt-app {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  grid-template-areas: "caret info time" "bar bar bar";
  gap: 3px 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.tt-app:hover { background: var(--panel-2); }
.tt-app.selected { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--signal); }
.tt-caret { grid-area: caret; color: var(--ink-faint); font-size: 9px; transition: transform 0.12s; }
.tt-group.open .tt-caret { transform: rotate(90deg); }
.tt-info { grid-area: info; min-width: 0; display: flex; align-items: baseline; gap: 8px; }
.tt-app .tt-name { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.tt-app .tt-sub { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
.tt-app .tt-time { grid-area: time; font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.tt-bar { grid-area: bar; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.tt-bar > span { display: block; height: 100%; background: var(--ink-faint); border-radius: 3px; }
.tt-win {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 3px 8px 3px 32px;
}
.tt-wtitle { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-wtime { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); white-space: nowrap; }
/* A window row lit up by hovering its word in the pie. */
.tt-win.hl { background: rgba(192, 86, 74, 0.14); border-radius: 4px; }
.tt-win.hl .tt-wtitle { color: var(--ink); }

.untag-list { display: flex; flex-direction: column; gap: 10px; }
.untag {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  grid-template-areas: "info time btn hide" "bar bar bar bar";
  gap: 4px 12px;
  align-items: center;
}
.untag-info { grid-area: info; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.untag-prog { font-family: var(--mono); font-size: 12.5px; color: var(--ink); }
.untag-title {
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.untag-title em { font-style: normal; color: var(--ink-dim); opacity: 0.7; }
.untag-time { grid-area: time; font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.untag-tag {
  grid-area: btn;
  font-family: var(--mono); font-size: 11px; color: var(--signal);
  background: transparent; border: 1px solid var(--line-2); border-radius: 6px;
  padding: 4px 9px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.untag-tag:hover { color: var(--on-accent); background: var(--signal); border-color: var(--signal); }
.untag-hide {
  grid-area: hide;
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim);
  background: transparent; border: 1px solid var(--line-2); border-radius: 6px;
  padding: 4px 9px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.untag-hide:hover { color: var(--on-accent); background: var(--ink-dim); border-color: var(--ink-dim); }
.untag-bar { grid-area: bar; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.untag-bar > span { display: block; height: 100%; background: var(--ink-faint); border-radius: 3px; }

/* Untagged windows: collapsed by default; the summary carries the top-10 total. */
.untag-details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.untag-details > summary::-webkit-details-marker { display: none; }
.untag-details > summary::before {
  content: "\25B8"; color: var(--ink-faint); font-size: 12px;
  display: inline-block; transition: transform 0.15s;
}
.untag-details[open] > summary::before { transform: rotate(90deg); }
.untag-details > summary h2 { margin: 0; }
.untag-total { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.untag-details .panel-sub { margin-top: 8px; }
.untag-details .untag-list { margin-top: 12px; }

/* Generic collapsible panel: a <details class="collapse"> whose <summary> is the
   panel heading (the disclosure triangle rotates open). Body content follows the
   summary and hides when collapsed. */
.collapse > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.collapse > summary::-webkit-details-marker { display: none; }
.collapse > summary::before {
  content: "\25B8"; color: var(--ink-faint); font-size: 12px;
  display: inline-block; transition: transform 0.15s;
}
.collapse[open] > summary::before { transform: rotate(90deg); }
.collapse > summary h2 { margin: 0; }
.collapse-count { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-dim); }
.collapse > .panel-sub { margin-top: 8px; padding-left: 24px; }  /* align under the heading, past the disclosure triangle */

/* ── Per-tag colour pickers ────────────────────────────── */
.tag-colors { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px; }
.tagcolor-empty { color: var(--ink-faint); font-family: var(--mono); font-size: 12px; }
.tagcolor {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-dim);
  cursor: pointer;
}
.tagcolor input[type="color"] {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; padding: 0;
  background: transparent; border: 1px solid var(--line-2); border-radius: 5px;
  cursor: pointer;
}
.tagcolor input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.tagcolor input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }
.tagcolor input[type="color"]::-moz-color-swatch { border: none; border-radius: 3px; }

/* ── Usage rule editor ─────────────────────────────────── */
.rules-editor { display: flex; flex-direction: column; gap: 8px; }
.rules-head,
.rule-row {
  display: grid;
  grid-template-columns: 20px 1fr 1.4fr 1.5fr 26px;
  gap: 8px;
  align-items: center;
}
.rule-row.dragging { opacity: 0.5; }
.rule-row.drop-target { box-shadow: 0 -2px 0 0 var(--signal); }
.rule-drag {
  cursor: grab;
  color: var(--ink-faint);
  font-size: 13px;
  line-height: 1;
  letter-spacing: -2px;
  text-align: center;
  user-select: none;
}
.rule-drag:active { cursor: grabbing; }
.rule-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.rule-tags-empty { color: var(--ink-faint); font-family: var(--mono); font-size: 11px; }
.rule-slot { display: inline-flex; align-items: center; gap: 5px; }
.rule-slot-ns { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.rule-tag {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 7px;
  max-width: 100%;
}
.rule-tag:focus { outline: none; border-color: var(--line-2); box-shadow: 0 0 0 2px rgba(192, 86, 74,0.15); }
.rules-head {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 2px 2px;
}
.rule-row input {
  width: 100%;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rule-row input:focus {
  outline: none;
  border-color: var(--line-2);
  box-shadow: 0 0 0 2px rgba(192, 86, 74,0.15);
}
.rule-row input::placeholder { color: var(--ink-faint); opacity: 0.6; }
.rule-row.invalid input { border-color: var(--danger); }
.rule-del {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 15px; line-height: 1;
  color: var(--ink-faint);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.rule-del:hover { color: var(--danger); border-color: var(--danger); }
.rules-empty { color: var(--ink-faint); font-family: var(--mono); font-size: 12px; padding: 6px 2px; }

/* Hidden-windows section: a separate, visually distinct list below the rules. */
.hide-editor {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hide-title { font-size: 14px; margin: 0; }
.hide-head {
  display: grid;
  grid-template-columns: 1fr 1.4fr 26px;
  gap: 8px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-faint); padding: 0 2px 2px;
}
.hide-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 26px;
  gap: 8px;
  align-items: center;
}
.rules-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 8px;
}
.rules-status { flex: 1; font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.rules-status.ok { color: var(--safe); }
.rules-status.err { color: var(--danger); }

/* Namespace pills above the Usage tag charts (per-prefix breakdown). */
.ns-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.ns-pill {
  font-family: var(--mono); font-size: 12px;
  color: var(--ink-dim);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.ns-pill:hover { color: var(--ink); }
.ns-pill.active { color: var(--on-accent); background: var(--signal); border-color: var(--signal); }

/* Tag registry editor (Tags sub-tab). */
.tagreg-ns { margin-bottom: 22px; }
.tagreg-ns-head {
  font-size: 14px; margin: 0 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.tagreg-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-faint); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px;
}
.tagreg-list { display: flex; flex-direction: column; gap: 6px; }
.tagreg-row {
  display: grid;
  grid-template-columns: 34px 1fr auto 26px;
  gap: 12px;
  align-items: center;
  padding: 5px 2px;
}
.tagreg-color {
  width: 34px; height: 26px; padding: 0;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
}
.tagreg-color:disabled { cursor: default; opacity: 0.7; }
.tagreg-color::-webkit-color-swatch-wrapper { padding: 3px; }
.tagreg-color::-webkit-color-swatch { border: none; border-radius: 4px; }
.tagreg-color::-moz-color-swatch { border: none; border-radius: 4px; }
.tagreg-name { font-family: var(--mono); font-size: 13px; color: var(--ink); }
/* Pill toggle for the distraction flag (used in the tag registry). */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; flex: none;
  width: 34px; height: 18px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
  transition: background 0.15s, border-color 0.15s;
}
.switch-thumb {
  position: absolute; top: 1px; left: 1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--ink-faint);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .switch-track { background: var(--signal); border-color: var(--signal); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); background: var(--bg); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 2px rgba(192, 86, 74,0.3); }
.switch-text { color: var(--ink-dim); }
.tagreg-del {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 15px; line-height: 1;
  color: var(--ink-faint); background: transparent;
  border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tagreg-del:hover { color: var(--danger); border-color: var(--danger); }
.tagreg-add { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.tagreg-newname, #tags-new-ns {
  font-family: var(--mono); font-size: 12px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px;
}
.tagreg-newname:focus, #tags-new-ns:focus { outline: none; border-color: var(--line-2); box-shadow: 0 0 0 2px rgba(192, 86, 74,0.15); }
.tags-add-ns { display: flex; gap: 10px; align-items: center; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.tags-add-ns .rules-status { flex: 1; }
.btn-ghost, .btn-primary {
  font-family: var(--display); font-weight: 600; font-size: 12.5px;
  border-radius: 8px; padding: 8px 14px; cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn-ghost { color: var(--ink-dim); background: transparent; border: 1px solid var(--line); }

/* Plan/status pill in the Devices header. */
.plan-pill {
  display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--ink-dim); background: var(--bg-2); white-space: nowrap;
}
.plan-pill.ok { color: var(--safe); border-color: rgba(95, 129, 105, 0.4); background: rgba(95, 129, 105, 0.12); }
.plan-pill.warn { color: #9a6a24; border-color: rgba(201, 160, 78, 0.5); background: rgba(201, 160, 78, 0.14); }
.plan-pill.bad { color: var(--danger); border-color: rgba(192, 86, 74, 0.45); background: rgba(192, 86, 74, 0.12); }
[data-view="devices"] .panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
[data-view="devices"] .panel-head h2 { margin: 0; }
[data-view="devices"] .panel-head .btn-ghost:first-of-type { margin-left: auto; }
.btn-ghost:hover { color: var(--ink); border-color: var(--line-2); }
.btn-primary { color: var(--on-accent); background: var(--signal); border: 1px solid var(--signal); }
.btn-primary:hover { box-shadow: 0 0 0 2px rgba(192, 86, 74,0.25); }
.btn-primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }

/* ── Login screen ─────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  width: min(360px, 90vw);
  display: flex; flex-direction: column; gap: 16px;
  padding: 32px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--panel); box-shadow: 0 20px 60px rgba(34, 50, 78, 0.16);
}
.login-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--display); font-size: 12px; color: var(--ink-dim);
}
.login-card input {
  font-family: var(--mono); font-size: 14px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card input:focus { border-color: var(--signal); box-shadow: 0 0 0 2px rgba(192, 86, 74,0.2); }
.login-card .btn-primary { margin-top: 4px; padding: 10px 14px; }
.login-error {
  margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--danger, #ff4d4d);
  text-align: center;
}
.login-note {
  margin: 0; font-family: var(--mono); font-size: 12.5px; color: var(--signal);
  text-align: center; line-height: 1.5;
}
.login-alt {
  margin: 0; font-family: var(--display); font-size: 12px; color: var(--ink-dim);
  text-align: center;
}
.login-alt a { color: var(--signal); text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }

/* ── Devices (connect your agent) ─────────────────────── */
.device-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.device-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2);
}
.device-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.device-name-line { display: flex; align-items: center; gap: 8px; }
.device-name { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 14px; }
.device-sub { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }
.device-badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-dim); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px;
}
.device-row--revoked { opacity: 0.6; }
.device-actions { display: flex; gap: 8px; flex-shrink: 0; }
.device-row--editing { align-items: stretch; }
.device-rename { display: flex; gap: 8px; align-items: center; width: 100%; flex-wrap: wrap; }
.device-rename-input {
  flex: 1; min-width: 160px; font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 11px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.device-rename-input:focus { border-color: var(--signal); box-shadow: 0 0 0 2px rgba(192, 86, 74,0.2); }
.device-rename-err { font-family: var(--mono); font-size: 11.5px; color: var(--danger, #ff4d4d); }
.device-empty { font-family: var(--mono); font-size: 12.5px; color: var(--ink-dim); padding: 4px 0; }
.device-usage { font-family: var(--mono); color: var(--ink-dim); }
.device-add { display: flex; gap: 8px; align-items: center; }
.device-add input {
  flex: 1; font-family: var(--mono); font-size: 13px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.device-add input:focus { border-color: var(--signal); box-shadow: 0 0 0 2px rgba(192, 86, 74,0.2); }
.device-add input:disabled { opacity: 0.5; }
.device-upsell { margin: 12px 0 0; font-family: var(--display); font-size: 12.5px; color: var(--signal); }
.device-config {
  font-family: var(--mono); font-size: 12.5px; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; overflow-x: auto; white-space: pre; margin: 8px 0 12px;
}

/* Device-connected modal: the one-time token, shown so it can't be missed. */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(7, 9, 13, 0.72);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-card {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 24px; width: min(560px, 92vw); max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(34, 50, 78, 0.16);
}
.modal-card h2 { margin: 0 0 12px; font-family: var(--display); font-size: 1.15rem; color: var(--ink); }
.modal-warn {
  border: 1px solid var(--signal); background: rgba(192, 86, 74, 0.1);
  color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: 13px;
  line-height: 1.45; margin-bottom: 14px;
}
.modal-warn strong { color: var(--signal); }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.btn-danger {
  font-family: var(--display); font-weight: 600; font-size: 12px;
  border-radius: 8px; padding: 7px 12px; cursor: pointer;
  color: var(--danger, #ff4d4d); background: transparent; border: 1px solid var(--line);
  transition: border-color 0.15s;
}
.btn-danger:hover { border-color: var(--danger, #ff4d4d); }

/* ── Admin: accounts ──────────────────────────────────── */
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2);
}
.user-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.user-email { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.user-sub { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }
.user-actions { display: flex; align-items: center; gap: 8px; }
.user-actions input {
  width: 56px; font-family: var(--mono); font-size: 13px; color: var(--ink); text-align: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 6px; outline: none;
}
.user-actions input:focus { border-color: var(--signal); box-shadow: 0 0 0 2px rgba(192, 86, 74,0.2); }
.user-badge {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-2);
}
.user-badge.admin { color: var(--signal); border-color: var(--signal); }
.user-badge.unverified { color: var(--ink-dim); }
.user-badge.sub { color: var(--signal); border-color: var(--signal); }

/* Subscription access banner (trial countdown / lapsed read-only / start-trial). */
/* A discreet strip inset to the content, not a full-bleed glowing box. The colour
   cue is a single bright left bar; the surface stays a quiet hairline panel. */
.access-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 14px clamp(16px, 3vw, 40px) 2px; padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--display); font-size: 13px; color: var(--ink-dim);
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid var(--slate);
}
.access-banner--info { border-left-color: var(--signal); background: rgba(75, 189, 212, 0.07); }
.access-banner--warn { border-left-color: var(--danger); background: rgba(185, 107, 110, 0.09); color: var(--ink); }
.access-banner > .btn-primary, .access-banner > .btn-ghost, .access-banner > .banner-actions { margin-left: auto; }
.access-banner .banner-actions { display: flex; align-items: center; gap: 10px; }

/* Subscription page */
.sub-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sub-plan { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--ink); }
.sub-status { font-size: 14px; color: var(--ink-dim); margin: 12px 0 22px; max-width: 60ch; }
.sub-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ── Data-sync panel ──────────────────────────────────── */
.sync-status { display: flex; flex-direction: column; gap: 8px; }
.sync-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.sync-row:last-child { border-bottom: none; padding-bottom: 0; }
.sync-label {
  font-family: var(--display); font-size: 12px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.sync-val { font-family: var(--mono); font-size: 13.5px; color: var(--ink); text-align: right; }
.sync-val.sync-stale { color: var(--ink-faint); }

/* ── Config tab ─────────────────────────────────────────── */
.config-list { display: flex; flex-direction: column; gap: 16px; }
.config-empty { color: var(--ink-faint); font-size: 0.9rem; }

.config-card { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel-2); overflow: hidden; }
.cfg-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.cfg-name { font-family: var(--display); font-size: 1rem; color: var(--ink); }
.cfg-when { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.cfg-locked { padding: 14px; color: var(--ink-faint); font-size: 0.88rem; }

/* Two-column shell: a narrow status rail (services + guardrails) and a wide
   main column (the list-heavy sections). Collapses to one column when narrow. */
.cfg-body { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 20px 32px; padding: 18px 20px; }
.cfg-col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.cfg-col--side { border-right: 1px solid var(--line); padding-right: 26px; }
@media (max-width: 760px) {
  .cfg-body { grid-template-columns: 1fr; }
  .cfg-col--side { border-right: none; padding-right: 0; }
}

.cfg-section h4 {
  margin: 0 0 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--signal); font-weight: 600;
}

/* Services as a state checklist: green dot = on, muted = off. */
.svc-list { display: flex; flex-direction: column; gap: 7px; }
.svc-item { display: flex; align-items: center; gap: 9px; font-size: 0.86rem; color: var(--ink-dim); }
.svc-item.off { color: var(--ink-faint); }
.svc-dot { width: 14px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.svc-item .svc-dot::before { content: "\2013"; color: var(--ink-faint); font-size: 14px; }            /* off: en-dash */
.svc-item.on .svc-dot::before { content: "\2713"; color: var(--safe); font-weight: 700; font-size: 13px; }  /* on: check */
.svc-tag { color: var(--ink-faint); font-size: 0.72rem; }

/* label → value pairs in a two-track grid so every value aligns in one column
   (the label track sizes to the widest label in the section). */
.cfg-rows { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; row-gap: 9px; align-items: baseline; font-size: 0.86rem; line-height: 1.5; }
.cfg-k { color: var(--ink-faint); font-family: var(--mono); font-size: 0.76rem; white-space: nowrap; }
.cfg-v { color: var(--ink-dim); min-width: 0; word-break: break-word; font-variant-numeric: tabular-nums; }
.cfg-days { color: var(--ink-faint); }
.cfg-lock { font-size: 0.92em; }
.cfg-ext { cursor: help; }

/* Growing lists (programs, domains): each entry is a name over its detail. */
.cfg-summary { font-size: 0.8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.cfg-note { font-size: 0.84rem; color: var(--ink-dim); line-height: 1.55; }
.cfg-note-k { display: block; color: var(--ink-faint); font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px; }
.cfg-items { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.cfg-summary + .cfg-items, .cfg-note + .cfg-items { margin-top: 12px; }
.cfg-item { display: flex; flex-direction: column; gap: 2px; padding-left: 11px; border-left: 2px solid var(--line-2); }
.cfg-item-name { font-family: var(--mono); font-size: 0.82rem; color: var(--ink); }
.cfg-item-detail { font-size: 0.83rem; color: var(--ink-dim); line-height: 1.55; }

/* ── Insights ─────────────────────────────────────────── */
/* Work-hours dual-range slider. */
.insights-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-bottom: 16px; }
.ins-slider-group { display: flex; align-items: center; gap: 12px; }
.ins-ctl-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; }
.wh-readout { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-dim); white-space: nowrap; }
.wh-slider { position: relative; width: 220px; height: 22px; }
.wh-track { position: absolute; top: 50%; left: 0; right: 0; height: 4px; transform: translateY(-50%); background: var(--line-2); border-radius: 999px; }
.wh-fill { position: absolute; top: 0; bottom: 0; background: var(--signal); border-radius: 999px; }
.wh-slider input[type="range"] {
  position: absolute; top: 0; left: 0; width: 100%; height: 22px; margin: 0; background: none;
  -webkit-appearance: none; appearance: none; pointer-events: none;
}
.wh-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto; cursor: pointer;
  width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 2px solid var(--signal);
}
.wh-slider input[type="range"]::-moz-range-thumb {
  pointer-events: auto; cursor: pointer;
  width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 2px solid var(--signal);
}

/* Tabs — one per violation kind, with a count. */
.subtab-count { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); }
.subtabs button.active .subtab-count { color: inherit; }
.subtabs button:disabled { opacity: 0.4; cursor: default; }

/* Shown when no device config snapshot has synced — insights can't cross-check. */
.insight-noconfig {
  margin: 0 0 16px; padding: 10px 14px; font-size: 0.83rem; line-height: 1.5;
  color: var(--ink-dim); background: var(--panel-2);
  border: 1px solid var(--line); border-left: 3px solid var(--signal); border-radius: var(--r);
}

/* Master–detail: a sticky left column (controls + category rail) beside the
   selected category's cards. The frame stays put; only the detail scrolls. */
.insights-body { display: grid; grid-template-columns: 224px 1fr; gap: 26px; align-items: start; }
.insight-side { position: sticky; top: 14px; align-self: start; display: flex; flex-direction: column; gap: 18px; }
.insight-detail { min-width: 0; }

.insight-nav { display: flex; flex-direction: column; gap: 2px; }
.insight-navrow {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
  color: var(--ink-dim); font-family: var(--mono); font-size: 12.5px;
  transition: background 0.15s, color 0.15s;
}
.insight-navrow:hover:not(.clear) { background: var(--panel-2); color: var(--ink); }
.insight-navrow.active { background: var(--panel-2); color: var(--ink); box-shadow: inset 2px 0 0 var(--line-2); }
.insight-navlabel { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-navcount { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.insight-navrow.active .insight-navcount { color: inherit; }
/* One status dot, not a colour per category: filled = has suggestions,
   hollow = clear. */
.insight-navdot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-dim); flex: none; }
.insight-navrow.active .insight-navdot { background: var(--ink); }
.insight-navrow.clear { color: var(--ink-faint); cursor: default; }
.insight-navrow.clear .insight-navdot { background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }
.insight-navsep { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); margin: 12px 0 2px 10px; }

/* Sliders stack in the narrow side column: label / slider / readout. */
.insight-side .insights-controls { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 0; }
.insight-side .ins-slider-group { flex-direction: column; align-items: flex-start; gap: 6px; }
.insight-side .wh-slider { width: 100%; }

@media (max-width: 680px) {
  .insights-body { grid-template-columns: 1fr; gap: 16px; }
  .insight-side { position: static; }
  .insight-side .insights-controls { flex-direction: row; flex-wrap: wrap; }
  .insight-side .ins-slider-group { flex-direction: row; align-items: center; }
  .insight-nav { flex-direction: row; flex-wrap: wrap; }
  .insight-navrow { width: auto; }
}

.insight-blurb { margin: 4px 0 14px; font-size: 0.85rem; color: var(--ink-faint); }
.insight-cards { display: flex; flex-direction: column; gap: 10px; }

/* Card: problem headline → details → suggestion → the config to paste. The left
   rail is coloured by the active kind. */
.insight-card { border: 1px solid var(--line); border-left: 3px solid var(--line-2); border-radius: var(--r); background: var(--panel-2); padding: 14px 16px; }
.ic-problem { margin: 0 0 9px; font-family: var(--display); font-size: 0.98rem; font-weight: 600; color: var(--ink); }
.ic-line { display: flex; gap: 10px; margin-bottom: 7px; font-size: 0.85rem; line-height: 1.5; }
.ic-tag {
  flex: 0 0 auto; width: 74px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--ink-faint); padding-top: 2px;
}
.ic-tag--fix { color: var(--safe); }
.ic-text { flex: 1 1 auto; min-width: 0; color: var(--ink-dim); }
.insight-config { margin: 9px 0 0; padding: 11px 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 0.77rem; line-height: 1.55; color: var(--ink-dim); overflow-x: auto; white-space: pre; }
.insight-more { margin: 4px 0 0; font-size: 0.82rem; color: var(--ink-faint); }
