/* Dar Global — sales lead dashboard.
   Warm beige/cream design system. Every categorical and ordinal set below was
   run through the palette validator against THESE surfaces (light #fffdf9,
   dark #1a1714) — contrast and colorblind separation only mean something
   measured against the surface the chart actually sits on. */

:root {
  color-scheme: light;

  /* Page beige is sampled from the logo artwork's own ground so the mark sits
     on the header without a visible rectangle behind it. */
  --page:            #f2ede7;   /* beige plane — matches the logo artwork */
  --page-2:          #eae3da;   /* deeper beige, for banded areas */
  --surface-1:       #fffdf9;   /* warm white card — the validated chart surface */
  --surface-2:       #f8f3ec;   /* inset / hover */

  --text-primary:    #1c1813;
  --text-secondary:  #5c5348;
  --text-muted:      #8c8175;

  --gridline:        #ece3d3;
  --baseline:        #d6cab4;
  --border:          rgba(28, 24, 19, 0.11);
  --border-strong:   rgba(28, 24, 19, 0.18);

  /* Khaki drawn from the logo mark, darkened to clear 4.5:1 on the page beige —
     the logo's own tone is too light to carry small uppercase text. */
  --accent:          #786945;   /* 4.62:1 on the page beige */
  --accent-soft:     #eee7db;

  --series-1: #0f6ea3;
  --series-2: #c25a34;
  --series-3: #2f8f6f;
  --series-4: #b3811a;
  --series-5: #ab4f79;

  --ordinal-1: #d2a86c;
  --ordinal-2: #b8843f;
  --ordinal-3: #8f5c23;
  --ordinal-4: #5e3a14;

  --good:     #0ca30c;
  --warning:  #b8843f;
  --critical: #c0392b;
  --good-text: #0b6b0b;

  --shadow-sm: 0 1px 2px rgba(60, 45, 25, .05), 0 2px 8px rgba(60, 45, 25, .04);
  --shadow-md: 0 2px 4px rgba(60, 45, 25, .06), 0 10px 28px rgba(60, 45, 25, .07);

  --radius: 14px;
  --radius-sm: 9px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --page:            #12100e;
  --page-2:          #17140f;
  --surface-1:       #1a1714;
  --surface-2:       #221d18;

  --text-primary:    #f7f2e9;
  --text-secondary:  #c4b8a6;
  --text-muted:      #948977;

  --gridline:        #2a251f;
  --baseline:        #3a332b;
  --border:          rgba(247, 242, 233, 0.11);
  --border-strong:   rgba(247, 242, 233, 0.20);

  --accent:          #d2a86c;
  --accent-soft:     #2a2118;

  --series-1: #3f97cc;
  --series-2: #d16b41;
  --series-3: #35a07c;
  --series-4: #b58421;
  --series-5: #c46590;

  --ordinal-1: #f0dcbe;
  --ordinal-2: #d2a86c;
  --ordinal-3: #b8843f;
  --ordinal-4: #8a5a22;

  --good-text: #4cc44c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .34), 0 12px 32px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: 1260px; margin: 0 auto; padding: 0 28px 88px; }

/* ---------- top bar ---------- */

/* Solid, not translucent: the logo artwork carries its own opaque beige ground,
   and a blurred/see-through bar composites to a slightly different tone, which
   makes that ground show up as a visible rectangle behind the mark. */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--page);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1260px; margin: 0 auto; padding: 16px 28px;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 16px; margin-right: auto; }

/* Source artwork is only 336x176, so it goes soft above roughly this size.
   Replacing static/logo.png with an SVG (or a 2-3x export) is what makes a
   larger mark sharp — no CSS can add detail that isn't in the file. */
.brand .logo {
  height: 70px; width: auto; flex: none; display: block;
}
.brand .logo.missing { display: none; }
.brand .logo.missing + .wordmark { display: inline; }

.brand .wordmark {
  display: none; flex: none;
  font-size: 17px; font-weight: 600; letter-spacing: 0.16em;
  color: var(--accent);
}

:root[data-theme="dark"] .brand .logo {
  filter: brightness(0.95);
}

.brand .brand-text { padding-left: 16px; border-left: 1px solid var(--border); }
.brand h1 {
  margin: 0; font-size: 16.5px; font-weight: 620; letter-spacing: -0.012em;
}
.brand .sub {
  margin: 1px 0 0; font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; gap: 7px;
}

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); flex: none; }
.dot.bad { background: var(--critical); }

.controls { display: flex; align-items: center; gap: 8px; }

.seg {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 9px; padding: 2px;
}
.seg button {
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary); background: none; border: 0;
  padding: 5px 12px; border-radius: 7px; cursor: pointer;
}
.seg button[aria-pressed="true"] {
  background: var(--surface-1); color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

button.icon {
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 9px; padding: 6px 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
button.icon:hover { color: var(--text-primary); border-color: var(--border-strong); }
button.icon:active { transform: translateY(1px); }

/* ---------- tabs ---------- */

.tabs {
  /* Wrap rather than scroll: the labels are full report names now, and a tab
     hidden behind a horizontal scrollbar is a tab nobody finds. */
  display: flex; flex-wrap: wrap; gap: 0 4px;
  border-bottom: 1px solid var(--border);
  margin: 0 0 30px; padding-top: 22px;
}
.tabs button {
  font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--text-muted); background: none; border: 0;
  padding: 10px 3px; margin-right: 22px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: var(--text-secondary); }
.tabs button[aria-selected="true"] {
  color: var(--text-primary); border-bottom-color: var(--accent);
}
.tabs .count {
  font-size: 11.5px; color: var(--text-muted); margin-left: 7px;
  font-variant-numeric: tabular-nums;
}

/* ---------- headings ---------- */

.kicker {
  font-size: 11px; font-weight: 650; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 7px;
}
.lede {
  margin: 0; font-size: 23px; font-weight: 600; letter-spacing: -0.019em;
  line-height: 1.25;
}
.dek {
  margin: 8px 0 0; font-size: 13.5px; color: var(--text-secondary);
  max-width: 76ch; line-height: 1.62;
}
.section-head { margin-bottom: 22px; }

/* ---------- cards ---------- */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.card-head h3 {
  margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em;
  color: var(--text-primary);
}
.card-head .hint { font-size: 12px; color: var(--text-muted); }

.grid { display: grid; gap: 16px; }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(208px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
@media (max-width: 900px) { .grid.two { grid-template-columns: 1fr; } }

/* ---------- stat tiles ---------- */

.tile {
  position: relative; overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 19px 15px;
  box-shadow: var(--shadow-sm);
}
.tile::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--tile-accent, transparent);
}
.tile .label {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 9px;
  min-height: 18px;
}
.tile .label .name { flex: 1; min-width: 0; line-height: 1.35; }
.tile .swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; margin-top: 4px; }
.tile .value {
  font-size: 33px; font-weight: 620; letter-spacing: -0.028em; line-height: 1.05;
}
.tile .meta { margin-top: 7px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.tile .meta strong { color: var(--text-secondary); font-weight: 600; }
.tile .spark { margin-top: 12px; height: 30px; }

.delta {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  font-size: 11.5px; font-weight: 600; border-radius: 6px;
  padding: 2px 7px; background: var(--surface-2); color: var(--text-secondary);
  white-space: nowrap; cursor: help;
}
.delta.up { color: var(--good-text); }
.delta.down { color: var(--critical); }
.delta .arr { font-size: 10px; line-height: 1; }

/* ---------- overview cards ---------- */

.report-card {
  display: flex; flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer; text-align: left; font: inherit; color: inherit;
  transition: box-shadow .16s, transform .16s, border-color .16s;
}
.report-card:hover {
  box-shadow: var(--shadow-md); transform: translateY(-2px);
  border-color: var(--border-strong);
}
.report-card .rc-kicker {
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 9px;
}
.report-card h3 { margin: 0 0 3px; font-size: 15.5px; font-weight: 600; }
.report-card .rc-scope { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }
.report-card .rc-value {
  font-size: 38px; font-weight: 620; letter-spacing: -0.03em; line-height: 1;
}
.report-card .rc-unit { font-size: 12.5px; color: var(--text-secondary); margin-top: 5px; }
.report-card .rc-spark { margin-top: 14px; height: 38px; }
.report-card .rc-foot {
  margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--gridline);
  display: flex; gap: 18px; flex-wrap: wrap;
}
.report-card .rc-stat { font-size: 12px; color: var(--text-muted); }
.report-card .rc-stat b {
  display: block; font-size: 15px; color: var(--text-primary);
  font-weight: 600; letter-spacing: -0.01em;
}

/* ---------- charts ---------- */

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: inherit; fill: var(--text-muted); font-size: 11.5px; }
.chart .val { fill: var(--text-secondary); font-size: 11.5px; font-weight: 600; }
.chart .cat { fill: var(--text-secondary); font-size: 12.5px; }
.chart .cat-strong { fill: var(--text-primary); font-size: 12.5px; font-weight: 550; }
.chart .grid-line { stroke: var(--gridline); stroke-width: 1; }
.chart .axis-line { stroke: var(--baseline); stroke-width: 1; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .track { fill: var(--surface-2); }

.legend {
  display: flex; flex-wrap: wrap; gap: 9px 20px;
  margin: 0 0 16px; padding: 0; list-style: none;
}
.legend li {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-secondary);
}
.legend .swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px;
  box-shadow: var(--shadow-md);
  opacity: 0; transition: opacity .12s; max-width: 320px;
}
.tooltip.on { opacity: 1; }
.tooltip .t-title {
  font-weight: 600; margin-bottom: 7px; color: var(--text-primary);
  font-size: 12.5px;
}
.tooltip .t-row {
  display: flex; align-items: center; gap: 8px; color: var(--text-secondary);
  line-height: 1.75;
}
.tooltip .t-row .swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tooltip .t-row b {
  margin-left: auto; padding-left: 20px; color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 11px 14px; white-space: nowrap; }
th {
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--baseline);
  position: sticky; top: 0; background: var(--surface-1);
}
td { border-bottom: 1px solid var(--gridline); color: var(--text-secondary); }
td.name {
  color: var(--text-primary); font-weight: 550; white-space: normal;
  min-width: 200px;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover td { background: var(--surface-2); }
tfoot td {
  border-top: 1.5px solid var(--baseline); border-bottom: none;
  font-weight: 650; color: var(--text-primary); background: var(--surface-1);
}

/* Inline magnitude cue in a numeric cell.
   The number stays in normal right-aligned flow — the rule sits underneath it,
   so figures line up with plain numeric columns and with the footer total. An
   earlier version put a fixed-width bar beside the number, which pushed every
   body figure left of the total and broke the column. */
.cellbar { display: inline-block; min-width: 96px; }
.cellbar .n { display: block; }
.cellbar .rule {
  display: block; height: 3px; border-radius: 2px;
  margin: 5px 0 0 auto; opacity: .9; min-width: 3px;
  background: var(--series-1);
}

/* ---------- ask panel ---------- */

.ask {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 26px;
}
.ask h3 {
  margin: 0 0 4px; font-size: 15.5px; font-weight: 600;
}
.ask .ask-sub {
  margin: 0 0 16px; font-size: 13px; color: var(--text-secondary);
}
.ask-row { display: flex; gap: 10px; align-items: stretch; }
.ask-row input {
  flex: 1; min-width: 0; font: inherit; font-size: 14px;
  color: var(--text-primary); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 15px;
}
.ask-row input::placeholder { color: var(--text-muted); }
.ask-row input:focus {
  outline: none; border-color: var(--accent);
  background: var(--surface-1);
}
.ask-row button {
  font: inherit; font-size: 13.5px; font-weight: 550;
  color: #fff; background: var(--accent);
  border: 0; border-radius: 10px; padding: 11px 20px; cursor: pointer;
  white-space: nowrap;
}
:root[data-theme="dark"] .ask-row button { color: #1a1714; }
.ask-row button:disabled { opacity: .55; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.chips button {
  font: inherit; font-size: 12.5px; color: var(--text-secondary);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 13px; cursor: pointer;
}
.chips button:hover { color: var(--text-primary); border-color: var(--baseline); }

.ask-result { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--gridline); }
.ask-result .ask-title {
  font-size: 16px; font-weight: 600; margin: 0 0 5px;
}
.ask-result .ask-notes {
  font-size: 13px; color: var(--text-secondary); margin: 0 0 18px;
  line-height: 1.6; max-width: 78ch;
}
.ask-result .hero {
  font-size: 46px; font-weight: 620; letter-spacing: -0.03em; line-height: 1.05;
  margin: 4px 0 6px;
}
.ask-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }

.thinking {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13px; color: var(--text-secondary);
}
.thinking::before {
  content: ''; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pinned-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin: 30px 0 14px;
}
.pinned-head h3 {
  margin: 0; font-size: 12px; font-weight: 650; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-muted);
}
.pin-card { position: relative; }
.pin-card .unpin {
  position: absolute; top: 12px; right: 12px;
  font: inherit; font-size: 15px; line-height: 1; color: var(--text-muted);
  background: none; border: 0; cursor: pointer; padding: 3px 6px; border-radius: 6px;
}
.pin-card .unpin:hover { color: var(--critical); background: var(--surface-2); }

/* ---------- drill-down modal ---------- */

.ovl {
  position: fixed; inset: 0; z-index: 70;
  background: color-mix(in srgb, var(--text-primary) 45%, transparent);
  display: none; align-items: flex-start; justify-content: center;
  padding: 48px 20px; overflow: auto;
}
.ovl.on { display: flex; }
.modal {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: var(--radius); max-width: 1100px; width: 100%;
  box-shadow: 0 24px 70px rgba(40, 30, 15, .28);
}
/* Lead tables carry six columns; let them scroll inside the modal rather than
   forcing the dialog wider than the viewport. */
.modal-body .table-wrap { overflow-x: auto; max-width: 100%; }
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 22px 26px 16px; border-bottom: 1px solid var(--gridline);
  position: sticky; top: 0; background: var(--surface-1);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-head h4 { margin: 0 0 4px; font-size: 18px; font-weight: 600; letter-spacing: -0.012em; }
.modal-head p { margin: 0; font-size: 13px; color: var(--text-secondary); }
.modal .x {
  flex: none; width: 32px; height: 32px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 18px; line-height: 1; cursor: pointer;
}
.modal .x:hover { color: var(--text-primary); border-color: var(--baseline); }
.modal-body { padding: 8px 26px 26px; }
.modal-body h5 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); margin: 22px 0 8px; font-weight: 650;
}

.pill {
  display: inline-block; font-size: 11px; padding: 2px 9px;
  border-radius: 20px; font-weight: 600; white-space: nowrap;
}
.pill.no { background: color-mix(in srgb, var(--critical) 14%, transparent); color: var(--critical); }
.pill.yes { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }

/* clickable figures */
a.lnk {
  color: inherit; cursor: pointer; text-decoration: none;
  border-bottom: 1px dotted var(--baseline); font-weight: inherit;
}
a.lnk:hover { border-bottom-style: solid; color: var(--accent); }
.tile.clk { cursor: pointer; transition: box-shadow .16s, transform .16s, border-color .16s; }
.tile.clk:hover {
  box-shadow: var(--shadow-md); transform: translateY(-2px);
  border-color: var(--border-strong);
}
.tile .cue { font-size: 10.5px; color: var(--text-muted); letter-spacing: .06em;
             text-transform: uppercase; margin-top: 9px; }

td.flag { color: var(--critical); font-weight: 650; }
ul.names { margin: 0; padding-left: 17px; }
ul.names li { margin-bottom: 3px; }
ul.names li.none { list-style: none; margin-left: -17px; color: var(--good-text); }
.role { color: var(--text-muted); font-size: 12px; }

/* display:block on the track matters — it is a <span>, and an inline element
   ignores height, so the bar renders as nothing without it. */
.meter { min-width: 150px; display: block; }
.meter .track {
  display: block; height: 5px; border-radius: 3px;
  background: var(--surface-2); overflow: hidden; margin-top: 6px;
}
.meter .track span { display: block; height: 100%; border-radius: 3px; }

/* ---------- notices ---------- */

.notice {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  padding: 14px 16px; margin-bottom: 14px;
  font-size: 13px; color: var(--text-secondary); line-height: 1.6;
  box-shadow: var(--shadow-sm);
}
.notice.error { border-left-color: var(--critical); }
.notice .ico {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--warning); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 18px; text-align: center;
  margin-top: 1px;
}
.notice.error .ico { background: var(--critical); }
.notice strong { color: var(--text-primary); font-weight: 600; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--text-primary);
  padding: 1.5px 6px; border-radius: 5px;
}

details.disclose {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-1); padding: 12px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
details.disclose summary {
  cursor: pointer; font-size: 13px; font-weight: 550;
  color: var(--text-secondary); list-style: none;
  display: flex; align-items: center; gap: 9px;
}
details.disclose summary::-webkit-details-marker { display: none; }
details.disclose summary::before {
  content: '▸'; color: var(--text-muted); font-size: 11px;
  transition: transform .15s;
}
details.disclose[open] summary::before { transform: rotate(90deg); }
details.disclose .body { margin-top: 13px; font-size: 13px; line-height: 1.65; }

.hidden { display: none !important; }
.stale { opacity: .5; transition: opacity .15s; }

.foot {
  margin-top: 52px; padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); line-height: 1.7;
}
.foot pre {
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 13px; border-radius: var(--radius-sm);
  font-size: 11.5px; color: var(--text-secondary); margin: 9px 0 16px;
}
.foot strong { color: var(--text-secondary); }

/* ---------- skeleton ---------- */

.skeleton {
  border-radius: var(--radius); background: var(--surface-2);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .55 } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- export controls ---------- */

.section-actions { display: flex; gap: 9px; margin: 16px 0 4px; flex-wrap: wrap; }
.section-actions button {
  font: inherit; font-size: 12.5px; font-weight: 550;
  color: var(--text-secondary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 14px; cursor: pointer; display: inline-flex;
  align-items: center; gap: 7px; transition: all .13s;
}
.section-actions button:hover:not(:disabled) {
  color: var(--accent); border-color: var(--accent-soft); background: var(--surface-2);
}
.section-actions button:disabled { opacity: .55; cursor: default; }
.section-actions button svg { width: 14px; height: 14px; flex: none; }

/* Summary sheets — the printable crosstab shown in the overlay and exported to
   PDF. Ruled like the sample sheets: every cell bounded, so a row of six
   numbers can be read across without losing the line. */
.summary-table { margin: 0 0 30px; }
.summary-table:last-of-type { margin-bottom: 8px; }
.summary-table figcaption { margin-bottom: 12px; }
.summary-table figcaption h3 {
  margin: 0; font-size: 14.5px; font-weight: 620; letter-spacing: -0.01em;
  color: var(--text-primary);
}
.summary-table figcaption p { margin: 3px 0 0; font-size: 12px; color: var(--text-muted); }
.summary-table .tablewrap { overflow-x: auto; }
.summary-table table {
  width: 100%; border-collapse: collapse; font-size: 12.5px;
  border: 1px solid var(--border-strong, #cfc6b6);
}
/* The dashboard's tables set their headers in small caps and stick them to the
   top of a scrolling card. A summary sheet is neither: it reads as a document,
   in normal case, and sticky headers print as a smear. */
.summary-table th, .summary-table td {
  border: 1px solid var(--border-strong, #cfc6b6);
  padding: 7px 10px; vertical-align: middle;
  text-transform: none; letter-spacing: normal; white-space: normal;
  position: static;
}
.summary-table thead th {
  background: var(--surface-2); font-weight: 600; font-size: 11.5px;
  color: var(--text-secondary); text-align: center; line-height: 1.35;
}
.summary-table th.name { text-align: left; font-weight: 500; color: var(--text-primary); }
.summary-table td.num { text-align: center; font-variant-numeric: tabular-nums; }
.summary-table tbody tr:nth-child(even) td,
.summary-table tbody tr:nth-child(even) th { background: var(--surface-2); }
.summary-table tr.grand th, .summary-table tr.grand td {
  font-weight: 650; background: var(--surface-2) !important;
  border-top: 2px solid var(--text-secondary);
}

.summary-note {
  margin-top: 12px; font-size: 11.5px; color: var(--text-muted); line-height: 1.6;
}

/* Hidden on screen; both are print-only furniture. */
.print-head, .print-area { display: none; }

/* ---------- print / PDF export ---------- */

@media print {
  @page { size: A4 portrait; margin: 13mm 11mm 15mm; }

  /* Print the ink, not the interface. Anything that only exists to be clicked
     is meaningless on paper. */
  .topbar, .tabs, .section-actions, .ovl, .tooltip, .ask, #pinned,
  .foot, .seg, button, .cue { display: none !important; }

  html, body { background: #fff !important; }
  body { font-size: 11px; }
  .wrap { max-width: none; padding: 0; margin: 0; }

  .print-head {
    display: flex !important; align-items: center; gap: 16px;
    padding-bottom: 12px; margin-bottom: 20px;
    border-bottom: 2px solid var(--accent);
  }
  .print-head img { height: 40px; width: auto; }
  .print-head h1 { margin: 0; font-size: 16px; font-weight: 620; letter-spacing: -0.01em; }
  .print-head p { margin: 3px 0 0; font-size: 10.5px; color: var(--text-secondary); }

  /* Only the requested section reaches the page. Without this the tab machinery
     would print whichever section happened to be on screen. */
  body.printing #content > section:not(.print-target) { display: none !important; }
  body.printing #content > section.print-target { display: block !important; }
  /* Whole-dashboard export: every section, each starting a fresh page. */
  body.printing-all #content > section { display: block !important; }
  body.printing-all #content > section + section { break-before: page; }

  /* A one-off document (the executive summary) replaces the dashboard entirely. */
  body.printing-doc .wrap { display: none !important; }
  body.printing-doc .print-area { display: block !important; }
  /* Each summary sheet starts its own page, the way the samples are laid out.
     Long crosstabs still flow on, with the header repeated. */
  .print-area .summary-table { break-before: page; margin-bottom: 0; }
  .print-area .summary-table:first-of-type { break-before: auto; }
  .print-area .summary-table table { font-size: 9.5px; }
  .print-area .summary-table th, .print-area .summary-table td { padding: 4px 7px; }
  .print-area .summary-table { break-inside: auto; }   /* may span pages */

  /* Keep a card, a chart or a table row from being split across two pages —
     half a funnel on one page and half on the next is unreadable. */
  .card, .tile, figure, .chart, table { break-inside: avoid; }
  thead { display: table-header-group; }   /* repeat headers on every page */
  tr { break-inside: avoid; }
  .section-head { break-after: avoid; }

  /* A dotted underline invites a click nobody can make on paper. */
  .drill, a, .num-link { text-decoration: none !important; border-bottom: 0 !important; }

  /* Screen shadows and hovers become grey mush in print. */
  .card, .tile { box-shadow: none !important; border: 1px solid #d9d2c6 !important; }

  /* Charts are SVG and print cleanly, but browsers strip background fills by
     default; this keeps the series colours that carry the meaning. */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* Drill numbers inside a dense crosstab. The default .drill affordance is a
   bordered pill, which is right on a tile but turns a 6-column grid into a
   field of boxes. Here the number itself is the target — underlined on hover
   so it still reads as clickable. */
.summary-table td .drill,
.summary-table th .drill {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--text-primary); cursor: pointer;
  font-variant-numeric: tabular-nums; border-radius: 3px;
}
.summary-table td .drill:hover { color: var(--accent); text-decoration: underline; }
.summary-table td .drill:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.summary-table tr.grand td .drill { font-weight: 650; }

/* ---------- two-month comparison in a tile ---------- */

/* Replaces the sparkline when the window is exactly two months. A line between
   two points has no shape to read; two bars can be compared at a glance. */
.twomonth { margin-top: 14px; display: grid; gap: 6px; }
.tm-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px; }
.tm-mon {
  font-size: 11px; color: var(--text-muted); font-weight: 550;
  letter-spacing: .02em;
}
.tm-track {
  display: block; height: 7px; border-radius: 4px;
  background: var(--surface-2); overflow: hidden;
}
.tm-fill { display: block; height: 100%; border-radius: 4px; }
.tm-val {
  font-size: 12px; color: var(--text-secondary);
  font-variant-numeric: tabular-nums; min-width: 34px; text-align: right;
}

/* A lone tile should keep a card's proportions rather than stretching the full
   width of the page — auto-fit gives a single item the whole row. */
.grid.tiles:has(> .tile:only-child) {
  grid-template-columns: repeat(auto-fit, minmax(208px, 340px));
  justify-content: start;
}

/* ---------- month filter ---------- */

.monthfilter {
  display: inline-flex; align-items: center; gap: 8px;
  margin-right: 4px;
}
.monthfilter > span {
  font-size: 12px; font-weight: 550; color: var(--text-muted);
}
select.monthpick {
  font: inherit; font-size: 12.5px; font-weight: 550;
  color: var(--text-secondary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 7px 10px; cursor: pointer;
}
select.monthpick:hover { color: var(--text-primary); border-color: var(--border-strong); }
select.monthpick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A filter is a control, not content — it has no place on the printed page. */
@media print { .monthfilter { display: none !important; } }

/* ---------- tiles: fit a full row ---------- */

/* Report 3 carries six tiles. At the old 208px minimum the sixth wrapped onto
   a line of its own, which reads as a separate group rather than the last step
   of the same set. Tightened so six fit across the standard 1260px page, and
   the type scaled to match — a narrower tile still has to hold "17,544". */
.grid.tiles {
  grid-template-columns: repeat(auto-fit, minmax(174px, 1fr));
  gap: 13px;
}
.grid.tiles .tile { padding: 15px 16px 13px; }
.grid.tiles .tile .value { font-size: 28px; letter-spacing: -0.024em; }
.grid.tiles .tile .label { font-size: 11.5px; margin-bottom: 7px; }
.grid.tiles .tile .meta { font-size: 11.5px; margin-top: 6px; }
.grid.tiles .tile .cue { font-size: 10px; }

/* Below the full width there is no room for six across; let them wrap rather
   than shrink the numbers to nothing. */
@media (max-width: 1180px) {
  .grid.tiles { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}

/* ---------- report 5: assignment & recycling ---------- */

/* Sub-tabs inside a report. Deliberately lighter than the main tab bar — a
   second row of equal-weight tabs would compete with it for "where am I". */
.subtabs {
  display: flex; gap: 6px; margin: 18px 0 18px;
  border-bottom: 1px solid var(--border);
}
.subtabs button {
  font: inherit; font-size: 12.5px; font-weight: 550;
  color: var(--text-muted); background: none; border: 0;
  padding: 8px 13px; cursor: pointer; border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtabs button:hover { color: var(--text-secondary); background: var(--surface-2); }
.subtabs button[aria-selected="true"] {
  color: var(--text-primary); border-bottom-color: var(--accent);
  background: var(--surface-1);
}
.subtabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* The triage sequence. Numbered because it genuinely is a sequence — the first
   rule that matches wins, so the order carries meaning. */
/* Five steps on one line. minmax(0, 1fr) rather than 1fr: a bare 1fr floors at
   the widest word in the tile, and one long project or status name would push
   the fifth column off the row. */
.triage { display: grid; gap: 8px; }
@media (min-width: 900px) {
  .triage { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.tq {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 12px;
}
.tq-n {
  font-size: 10px; font-weight: 650; color: var(--accent);
  letter-spacing: .1em; margin-bottom: 5px;
}
.tq-q { font-size: 12.5px; font-weight: 620; margin-bottom: 3px; line-height: 1.35; }
.tq-d { font-size: 11px; color: var(--text-secondary); line-height: 1.45; }
.tq-r {
  margin-top: 8px; font-size: 11px; font-weight: 650;
  letter-spacing: .02em;
}

/* The coverage strip: three facts about how the two tables below relate to the
   headline, side by side so they read as one statement rather than three. */
.covgrid { display: grid; gap: 10px; }
@media (min-width: 760px) { .covgrid { grid-template-columns: repeat(3, 1fr); } }
.covgrid > div {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
}
.covgrid b {
  display: block; font-size: 22px; font-weight: 640; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.covgrid span {
  display: block; font-size: 12px; margin-top: 4px; color: var(--text-secondary);
}
.covgrid em {
  display: block; font-size: 11px; margin-top: 6px; color: var(--text-muted);
  font-style: normal;
}

/* One block per action, keyed by its colour down the left edge. */
.actionblock {
  background: var(--surface-1); border: 1px solid var(--border);
  border-top: 3px solid var(--action, var(--accent));
  border-radius: 12px; margin-top: 14px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.ab-head {
  display: grid; grid-template-columns: 190px minmax(0, 1fr) 200px;
  gap: 20px; padding: 18px 20px; align-items: start;
}
@media (max-width: 900px) { .ab-head { grid-template-columns: 1fr; } }
.ab-name {
  font-size: 13px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; margin-bottom: 5px;
}
.ab-num {
  font-size: 30px; font-weight: 640; letter-spacing: -.026em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ab-pc {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin-top: 5px;
}
.ab-body p { margin: 0 0 9px; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
code.rule {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border);
  padding: 4px 9px; border-radius: 6px; color: var(--text-primary);
  display: inline-block;
}
.ab-meta {
  border-left: 1px solid var(--border); padding-left: 18px;
  font-size: 11px; color: var(--text-muted);
}
.ab-meta .k { display: block; margin-top: 8px; }
.ab-meta .k:first-child { margin-top: 0; }
.ab-meta b {
  display: block; color: var(--text-primary); font-size: 12.5px;
  font-weight: 600; margin-bottom: 2px;
}

/* The three kinds of reassignment, inside the reassign block. */
.ab-types { border-top: 1px solid var(--border); background: var(--surface-2); }
.ab-type {
  display: grid; grid-template-columns: 160px 70px minmax(0, 1fr) 190px;
  gap: 16px; padding: 12px 20px; align-items: center;
  border-bottom: 1px solid var(--gridline);
}
.ab-type:last-child { border-bottom: 0; }
@media (max-width: 900px) { .ab-type { grid-template-columns: 1fr; gap: 4px; } }
.ab-type .tname {
  font-size: 12.5px; font-weight: 620; display: flex; align-items: center; gap: 8px;
}
.ab-type .tname i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.ab-type .tcount {
  font-size: 15px; font-weight: 640; text-align: right;
  font-variant-numeric: tabular-nums;
}
.ab-type .tdesc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.ab-type .twhen { font-size: 11px; color: var(--text-muted); text-align: right; }
.ab-type .twhen b { display: block; color: var(--text-primary); font-weight: 600; }

/* The numbered rule steps. */
ol.steps { margin: 4px 0 0; padding-left: 20px; }
ol.steps li { margin-bottom: 8px; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
ol.steps li::marker { color: var(--accent); font-weight: 650; }

.card .ct {
  font-size: 10.5px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--accent); font-weight: 650; margin-bottom: 9px;
}

/* Printing: sub-tabs are navigation, and every section has to reach the page. */
@media print {
  .subtabs { display: none !important; }
  [data-sub] { display: block !important; }
  .actionblock, .tq, .ab-type { break-inside: avoid; }
}

/* Six reports, so the tab bar has to work harder. Tighter spacing and a hair
   less type keeps the full report names on one line — the names match the
   report headings, so shortening them would break that pairing. */
.tabs { gap: 0; }
.tabs button {
  font-size: 13px; margin-right: 18px; padding: 10px 2px;
}
.tabs button:last-child { margin-right: 0; }
