/* ============================================================================
   warm.css — the WARM-X concept design system.
   Same "Hearth" dashboard layout as warm.css (topbar+nav, grid/panels, stat
   cards, hand-rolled charts) re-themed with the REPORT palette: cool paper,
   committed teal accent, editorial categorical set. Serif display + humanist
   sans, soft rounded surfaces, gentle low shadows. Product register: the
   tool disappears into the task, color carried by accent + type, not decoration.
   Palette ported from dashboard-report/assets/report.css — every text token
   below is contrast-checked (≥4.5:1 body, ≥3:1 large) against --bg/--surface.
   ============================================================================ */

/* ---- Palette (cool paper, teal accent, editorial categorical) ------------- */
:root {
  /* grounds & surfaces */
  --bg:          #f7f8f8;   /* cool off-white paper (page) — from report --bg */
  --surface:     #ffffff;   /* raised cards / top bar — from report --surface */
  --surface-2:   #f3f5f5;   /* insets: filter bars, table header, chips — report --surface-2 */
  --surface-warm:#eaf6f4;   /* faint teal wash for the feature card */

  /* ink ramp (cool near-black -> cool slate) */
  --ink:      #1e2328;      /* body / figures — report --ink, 15.6:1 on paper */
  --ink-soft: #3a434b;      /* sub-headings — 10.1:1 on paper */
  --muted:    #566068;      /* secondary text — 6.0:1 on paper */
  --faint:    #64717a;      /* tertiary / captions — 4.7:1 on paper */

  /* lines */
  --border:  #dfe3e6;       /* hairline border — solid version of report's border rgba */
  --border-2:#eceeef;       /* softer inner divider — report --grid */
  --grid:    #eceeef;       /* chart grid-line — report --grid */
  --axis:    #ccd1d5;       /* chart axis-line — report --axis */

  /* accent — committed teal */
  --accent:      #0f766e;   /* teal (fills, primary btn) — report --accent */
  --accent-deep: #0c5952;   /* accent as text/links — 8.6:1 on paper */
  --accent-warm: #14b8a6;   /* brighter teal (hero highlights) */
  --accent-wash: #e3f2ef;   /* selected/hover tint — report --accent-weak */

  /* categorical (editorial, anchored on teal) — direct from report --s1..--s6 */
  --s1: #0f766e;  /* teal */
  --s2: #b45309;  /* amber */
  --s3: #6d28d9;  /* violet */
  --s4: #2563eb;  /* blue */
  --s5: #be123c;  /* rose */
  --s6: #475569;  /* slate */

  /* sequential teal ramp (light -> deep) — direct from report --seq1..--seq7 */
  --seq1: #ccfbf1;
  --seq2: #99f6e4;
  --seq3: #5eead4;
  --seq4: #2dd4bf;
  --seq5: #14b8a6;
  --seq6: #0f766e;
  --seq7: #0c5952;
  --clay: #2dd4bf;   /* mid teal — ink-legible funnel fill */

  /* semantic */
  --good:       #15803d;   /* text-safe green — report --good-ink */
  --good-fill:  #16a34a;   /* report --good */
  --warning:    #92400e;   /* text-safe amber — report --warning-ink */
  --warning-fill:#b45309;  /* report --warning */
  --critical:   #be123c;   /* text-safe rose — report --critical, 6.3:1 on paper */
  --critical-fill:#d33a5c;
  --neutral-fill:#9aa4ac;

  /* type */
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, Cambria, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* radii & shadow (soft, low) */
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 20px;
  --shadow-1: 0 1px 2px rgba(30,35,40,.06), 0 1px 3px rgba(30,35,40,.05);
  --shadow-2: 0 2px 6px rgba(30,35,40,.07), 0 8px 22px rgba(30,35,40,.06);

  /* z-scale (semantic) */
  --z-topbar: 100;
  --z-tooltip: 600;

  --maxw: 1160px;
}

/* ---- Reset-ish -------------------------------------------------------------*/
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
button { font-family: inherit; }
::selection { background: var(--accent-wash); }

/* ---- Top bar / chrome ------------------------------------------------------*/
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: var(--maxw); margin: 0 auto; padding: 0 26px;
  height: 62px; display: flex; align-items: center; gap: 22px;
}
.brand { display: inline-flex; align-items: baseline; gap: 9px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand .ember {
  width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent-warm), var(--accent) 70%);
  box-shadow: 0 0 0 3px var(--accent-wash);
  align-self: center;
}
.brand .name { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.015em; }
.brand .sub { font-size: 12.5px; color: var(--faint); font-family: var(--sans); }

.nav { display: flex; gap: 3px; margin-left: 6px; }
.nav a {
  font-size: 14px; color: var(--muted); text-decoration: none;
  padding: 7px 12px; border-radius: 9px; line-height: 1;
  transition: color .16s ease, background .16s ease;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--accent-deep); background: var(--accent-wash); font-weight: 500; }

.spacer { flex: 1; }
.rolewrap { display: flex; align-items: center; gap: 9px; }
.rolewrap .who {
  font-size: 12px; color: var(--muted); white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.rolewrap .who .badge {
  font-size: 11px; font-weight: 600; color: var(--accent-deep);
  background: var(--accent-wash); padding: 2px 8px; border-radius: 20px;
}
.rsel {
  font-family: var(--sans); font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 30px 7px 11px; cursor: pointer; line-height: 1;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2.5 4.3L6 7.8l3.5-3.5' fill='none' stroke='%23566068' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.rsel:hover { border-color: #c7ccd1; }
.rsel:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }

/* ---- Page shell ------------------------------------------------------------*/
.page { max-width: var(--maxw); margin: 0 auto; padding: 40px 26px 96px; }

/* Hero */
.hero { margin-bottom: 34px; }
.hero .eyebrow {
  font-size: 13px; color: var(--accent-deep); font-weight: 500;
  margin-bottom: 12px; display: inline-flex; align-items: center; gap: 8px;
}
.hero .eyebrow::before {
  content: ""; width: 18px; height: 1.5px; background: var(--accent); border-radius: 2px;
}
.hero h1 {
  font-size: clamp(2rem, 1.45rem + 1.9vw, 2.85rem);
  line-height: 1.08; margin-bottom: 14px; max-width: 18ch;
}
.hero .lede {
  font-size: clamp(1rem, .96rem + .25vw, 1.15rem);
  color: var(--ink-soft); max-width: 60ch; line-height: 1.6; text-wrap: pretty;
}
.hero .lede b { color: var(--ink); font-weight: 600; }
.hero .byline { margin-top: 14px; font-size: 13px; color: var(--faint); }

/* ---- Grid & panels ---------------------------------------------------------*/
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 20px; }
.grid + .grid { margin-top: 20px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; }
.c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; }
.c12 { grid-column: span 12; }

/* A column cell that nests a second grid (e.g. two stacked stat cards beside a
   taller panel in the same row) needs that inner grid to fill the stretched
   cell height, or the stacked cards float top-aligned with dead space below
   them while the row-mate panel runs the full row height. */
.c3 > .grid, .c4 > .grid, .c5 > .grid, .c6 > .grid, .c7 > .grid, .c8 > .grid { height: 100%; }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 22px 22px 20px; box-shadow: var(--shadow-1);
}
.panel.pad-lg { padding: 26px 26px 24px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.panel h2 { font-size: 1.22rem; line-height: 1.25; }
.panel h3 { font-size: 1.02rem; font-weight: 600; }
.panel .sub { font-size: 13.5px; color: var(--muted); margin-top: 5px; margin-bottom: 16px; max-width: 62ch; line-height: 1.5; text-wrap: pretty; }
.panel .sub b { color: var(--ink-soft); font-weight: 600; }
.tag { font-size: 11.5px; color: var(--faint); font-weight: 500; white-space: nowrap; }

/* Stat cards */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 4px; min-height: 118px;
}
.stat .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .value { font-family: var(--serif); font-size: 2.05rem; line-height: 1.05; font-weight: 600; color: var(--ink); letter-spacing: -.02em; margin-top: 2px; }
.stat .foot { font-size: 12.5px; color: var(--faint); margin-top: auto; }

/* one feature stat per page — larger, warm wash, no repetition */
.stat.feature {
  background:
    radial-gradient(120% 140% at 100% 0%, var(--surface-warm), transparent 55%),
    var(--surface);
  border-color: #cfe9e4;
  min-height: 100%;
}
.stat.feature .value { font-size: 3.2rem; color: var(--accent-deep); }
.stat.feature .label { color: var(--accent-deep); }

/* delta chip */
.delta { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.delta.up { color: var(--good); }
.delta.down { color: var(--critical); }
.delta .arw { font-size: 10px; }
.delta .ctx { color: var(--faint); font-weight: 400; }

/* ---- Charts ----------------------------------------------------------------*/
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-family: var(--sans); font-size: 11px; font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend .item { display: inline-flex; align-items: center; gap: 7px; }
.legend .key { width: 11px; height: 11px; border-radius: 4px; display: inline-block; }
.cap { font-size: 12.5px; color: var(--faint); margin-top: 12px; line-height: 1.5; text-wrap: pretty; }
.cap b { color: var(--muted); font-weight: 600; }

/* horizontal bars (leaderboard) */
.ch-hb { display: flex; flex-direction: column; gap: 12px; }
.ch-hb-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 14px; }
.ch-hb-label { font-size: 13.5px; color: var(--ink-soft); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-hb-track { height: 12px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.ch-hb-fill { height: 100%; border-radius: 8px; }
.ch-hb-val { font-size: 13.5px; color: var(--ink); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ch-hb-note { color: var(--faint); font-weight: 400; font-size: 12px; }

/* funnel */
.ch-funnel { display: flex; flex-direction: column; gap: 11px; }
.ch-fn-row { display: grid; grid-template-columns: 118px 1fr 132px; align-items: center; gap: 14px; }
.ch-fn-name { font-size: 13.5px; color: var(--ink-soft); font-weight: 500; }
.ch-fn-track { position: relative; height: 34px; background: var(--surface-2); border-radius: 9px; overflow: hidden; display: flex; align-items: center; }
.ch-fn-fill { height: 100%; border-radius: 9px; display: flex; align-items: center; padding-left: 12px; color: var(--ink); font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 0; }
.ch-fn-out { position: absolute; left: 10px; font-size: 12.5px; font-weight: 700; color: var(--ink); background: var(--surface); box-shadow: 0 0 0 1px var(--border-2); padding: 2px 8px; border-radius: 7px; font-variant-numeric: tabular-nums; }
.ch-fn-meta { font-size: 12.5px; color: var(--muted); text-align: right; white-space: nowrap; }
.ch-fn-meta b { color: var(--ink); font-weight: 700; }

/* ---- Tables ----------------------------------------------------------------*/
.tbl { width: 100%; overflow-x: auto; }
.wt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.wt th, .wt td { padding: 11px 14px; text-align: right; white-space: nowrap; }
.wt th {
  font-weight: 600; font-size: 11.5px; color: var(--muted);
  text-transform: none; letter-spacing: .01em;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.wt th:first-child, .wt td.l { text-align: left; }
.wt th:first-child { border-top-left-radius: var(--r-sm); }
.wt th:last-child { border-top-right-radius: var(--r-sm); }
.wt tbody td { border-bottom: 1px solid var(--border-2); color: var(--ink); font-variant-numeric: tabular-nums; }
.wt tbody tr:hover td { background: var(--surface-warm); }
.wt td.nm { font-weight: 600; color: var(--ink); }
.wt td.muted, .wt .muted { color: var(--muted); }
.wt tfoot td { padding: 12px 14px; font-weight: 700; color: var(--ink); border-top: 2px solid var(--border); background: var(--surface-2); font-variant-numeric: tabular-nums; }
.wt tfoot td.l { color: var(--ink-soft); }
.pos { color: var(--good); font-weight: 600; }
.dash { color: var(--faint); }

/* ---- Filter bar / pills ----------------------------------------------------*/
.filterbar {
  display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-end;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 20px; margin-bottom: 22px;
}
.fgroup { display: flex; flex-direction: column; gap: 8px; }
.fgroup .flabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 6px 13px; cursor: pointer; line-height: 1; display: inline-flex; align-items: center; gap: 7px;
  transition: all .15s ease;
}
.pill:hover { color: var(--ink); border-color: #c7ccd1; }
.pill.on { color: #fff; background: var(--accent-deep); border-color: var(--accent-deep); font-weight: 500; }
.pill .sw { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.pill.on .sw { box-shadow: 0 0 0 2px rgba(255,255,255,.5); }

/* ---- Admins-only notice ----------------------------------------------------*/
.notice {
  max-width: 560px; margin: 40px auto; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 46px 40px; box-shadow: var(--shadow-1);
}
.notice .lock {
  width: 52px; height: 52px; margin: 0 auto 20px; border-radius: 50%;
  background: var(--accent-wash); display: flex; align-items: center; justify-content: center;
  color: var(--accent-deep);
}
.notice h2 { font-size: 1.5rem; margin-bottom: 10px; }
.notice p { color: var(--muted); font-size: 15px; margin: 0 auto 22px; max-width: 42ch; line-height: 1.6; }
.notice a.btn {
  display: inline-block; background: var(--accent-deep); color: #fff; font-size: 14px; font-weight: 500;
  padding: 10px 20px; border-radius: 11px; text-decoration: none; transition: background .16s ease;
}
.notice a.btn:hover { background: #0a4a44; text-decoration: none; }

/* ---- Small utilities -------------------------------------------------------*/
.mini-stats { display: flex; flex-wrap: wrap; gap: 22px 30px; }
.mini { display: flex; flex-direction: column; gap: 3px; }
.mini .n { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; color: var(--ink); line-height: 1; letter-spacing: -.01em; }
.mini .l { font-size: 12.5px; color: var(--muted); }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-2); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.foot-note { margin-top: 40px; font-size: 13px; color: var(--faint); line-height: 1.6; max-width: 74ch; }

/* ---- Tooltip ---------------------------------------------------------------*/
#tt {
  position: fixed; z-index: var(--z-tooltip); pointer-events: none;
  transform: translate(-50%, -100%);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-2); padding: 10px 12px; min-width: 128px;
  font-size: 12.5px; opacity: 0; transition: opacity .12s ease;
}
#tt .tt-t { font-family: var(--serif); font-weight: 600; font-size: 13.5px; color: var(--ink); margin-bottom: 6px; }
#tt .tt-r { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 2px 0; }
#tt .tt-r .k { color: var(--muted); }
#tt .tt-r .v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Motion ----------------------------------------------------------------*/
@keyframes warm-rise { from { opacity: 0; transform: translateY(11px); } to { opacity: 1; transform: none; } }
@keyframes ch-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.rise { opacity: 0; animation: warm-rise .5s cubic-bezier(.22,1,.36,1) both; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; }
  .rise { opacity: 1; transform: none; }
}

/* ---- Responsive ------------------------------------------------------------*/
@media (max-width: 900px) {
  .c3,.c4,.c5,.c6,.c7,.c8 { grid-column: span 12; }
  .grid { gap: 16px; }
  .topbar-in { gap: 14px; }
  .brand .sub { display: none; }
}
@media (max-width: 760px) {
  .nav {
    max-width: 46vw; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; }
  .page { padding: 28px 18px 72px; }
  .rolewrap .who { display: none; }
}
@media (max-width: 560px) {
  .filterbar { gap: 16px; padding: 14px; }
  .ch-hb-row { grid-template-columns: 80px 1fr auto; }
  .ch-fn-row { grid-template-columns: 90px 1fr; }
  .ch-fn-meta { grid-column: 2; text-align: left; padding-left: 0; }
}
