/* ICO Coffee Intelligence Atlas — component styles (built on tokens.css) */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  overflow-x: hidden;
}
body.detail-open { overflow: hidden; }

::selection { background: var(--cream-200); color: var(--coffee-900); }

/* ---------- Layout shell ---------- */
.wrap { max-width: var(--container-wide); margin: 0 auto; padding: 0 var(--space-12); }
@media (max-width: 900px) { .wrap { padding: 0 var(--space-6); } }

/* ---------- Top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 60;
  height: var(--topnav-h, 72px); background: rgba(250, 243, 225, 0.88);
  backdrop-filter: saturate(1.1);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.topnav .wrap { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.brand { display: flex; align-items: center; gap: var(--space-4); }
.brand img { height: 60px; width: auto; display: block; }
.brand .divider { width: 1px; height: 26px; background: var(--border-strong); }
.brand .platform { display: flex; flex-direction: column; line-height: 1.15; }
.brand .platform .name { font-weight: var(--fw-bold); font-size: var(--fs-14); color: var(--coffee-900); letter-spacing: var(--tracking-snug); }
.brand .platform .sub { font-size: 11px; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-subtle); }
.topnav .nav-meta { display: flex; align-items: center; gap: var(--space-6); }
.nav-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.nav-stat .lbl { font-size: 10px; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-subtle); }
.nav-stat .val { font-family: var(--font-mono); font-size: var(--fs-14); font-weight: var(--fw-semibold); color: var(--coffee-700); }
.nav-stat .val .pos { color: var(--leaf-600); } .nav-stat .val .neg { color: var(--cherry-500); }
@media (max-width: 720px) { .nav-meta .nav-stat:not(:first-child) { display: none; } .brand .platform .sub { display:none; } }

/* platform launch button */
.platform-btn { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-sans); font-size: var(--fs-12); font-weight: var(--fw-semibold); color: var(--cream-50); background: var(--coffee-700); border: none; border-radius: var(--radius-sm); padding: 9px 14px; cursor: pointer; transition: background var(--dur-fast) var(--ease-out); white-space: nowrap; }
.platform-btn:hover { background: var(--coffee-800); }
.platform-btn:active { background: var(--coffee-900); }
.platform-btn svg { width: 14px; height: 14px; stroke: currentColor; }

/* LIVE badge on cards */
.card .c-live { display: inline-flex; align-items: center; gap: 4px; font-size: 9px; font-weight: var(--fw-bold); letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--leaf-600); }
.card .c-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--leaf-600); box-shadow: 0 0 0 2px rgba(103,142,62,.2); }

/* live module action in detail bar */
.live-action { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-sans); font-size: var(--fs-14); font-weight: var(--fw-semibold); color: var(--cream-50); background: var(--coffee-700); border: none; border-radius: var(--radius-sm); padding: 8px 16px; cursor: pointer; transition: background var(--dur-fast) var(--ease-out); }
.live-action:hover { background: var(--coffee-800); }
.live-action svg { width: 15px; height: 15px; stroke: currentColor; }

/* live overlay */
.live-layer { position: fixed; inset: 0; z-index: 95; background: var(--coffee-900); display: flex; flex-direction: column; opacity: 0; visibility: hidden; transition: opacity var(--dur-med) var(--ease-out), visibility var(--dur-med); }
.live-layer.open { opacity: 1; visibility: visible; }
.live-bar { flex: 0 0 56px; display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-6); background: var(--cream-50); border-bottom: 1px solid var(--border); }
.live-bar .crumb { font-size: var(--fs-12); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.live-bar .crumb b { color: var(--coffee-900); font-weight: var(--fw-semibold); }
.live-bar .bar-spacer { flex: 1; }
.live-note { font-size: 11px; color: var(--fg-subtle); font-family: var(--font-mono); }
.live-newtab { font-size: var(--fs-12); font-weight: var(--fw-semibold); color: var(--coffee-700); text-decoration: none; white-space: nowrap; }
.live-newtab:hover { color: var(--coffee-900); }
.live-frame-wrap { flex: 1; position: relative; background: var(--coffee-900); }
.live-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; background: #1a1210; }
.live-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: var(--space-3); color: var(--cream-200); font-size: var(--fs-14); font-family: var(--font-mono); z-index: 1; }
.live-loading.hide { display: none; }
.live-loading .spin { width: 18px; height: 18px; border: 2px solid rgba(237,214,164,.25); border-top-color: var(--cream-200); border-radius: 50%; animation: ico-spin .8s linear infinite; }
@keyframes ico-spin { to { transform: rotate(360deg); } }
@media (max-width: 720px) { .live-note { display: none; } }

/* ---------- Hero ---------- */
.hero { padding: var(--space-16) 0 var(--space-10); border-bottom: 1px solid var(--border); position: relative; }
.hero .eyebrow { margin-bottom: var(--space-4); }
.hero h1 { font-size: clamp(2.2rem, 5vw, var(--fs-56)); max-width: 16ch; }
.hero .lead { max-width: 64ch; margin-top: var(--space-4); }
.hero-kpis {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0; margin-top: var(--space-10);
  border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden;
  background: var(--paper);
}
.kpi { padding: var(--space-6); border-right: 1px solid var(--border); position: relative; }
.kpi:last-child { border-right: 0; }
.kpi .k-label { font-size: 11px; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-subtle); margin-bottom: var(--space-3); }
.kpi .k-value { font-family: var(--font-display); font-size: var(--fs-32); line-height: 1; color: var(--coffee-900); letter-spacing: var(--tracking-tight); }
.kpi .k-unit { font-family: var(--font-sans); font-size: var(--fs-12); color: var(--fg-subtle); margin-top: var(--space-2); display: flex; align-items: baseline; gap: 6px; }
.kpi .k-delta { font-weight: var(--fw-bold); font-family: var(--font-mono); }
.kpi .k-delta.pos { color: var(--leaf-600); } .kpi .k-delta.neg { color: var(--cherry-500); }
.kpi .k-spark { position: absolute; right: var(--space-4); top: var(--space-5); width: 72px; height: 28px; opacity: .85; pointer-events: none; }
.kpi .k-spark canvas { width: 72px !important; height: 28px !important; }
@media (max-width: 1000px) { .hero-kpis { grid-template-columns: repeat(2, 1fr); } .kpi:nth-child(2n){border-right:0;} .kpi { border-bottom: 1px solid var(--border);} }
@media (max-width: 520px) { .hero-kpis { grid-template-columns: 1fr; } .kpi { border-right: 0; } }

/* ---------- Controls (sticky) ---------- */
.controls {
  position: sticky; top: 72px; z-index: 50;
  background: rgba(250, 243, 225, 0.94); backdrop-filter: blur(2px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) 0;
}
.controls .wrap { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.search { position: relative; flex: 0 0 320px; max-width: 100%; }
.search input {
  width: 100%; font-family: var(--font-sans); font-size: var(--fs-14);
  padding: 10px 14px 10px 38px; background: var(--paper);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--fg);
  transition: border-color var(--dur-fast) var(--ease-out);
}
.search input:focus { outline: none; border-color: var(--coffee-700); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--fg-subtle); }
.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; flex: 1; }
.chip {
  font-family: var(--font-sans); font-size: var(--fs-12); font-weight: var(--fw-medium);
  padding: 7px 14px; border-radius: var(--radius-pill); cursor: pointer;
  border: 1px solid var(--border-strong); background: transparent; color: var(--fg-muted);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.chip:hover { border-color: var(--coffee-700); color: var(--coffee-900); }
.chip.active { background: var(--coffee-700); border-color: var(--coffee-700); color: var(--cream-50); }
.chip .ct { opacity: .6; font-variant-numeric: tabular-nums; margin-left: 4px; }
.result-count { font-size: var(--fs-12); color: var(--fg-subtle); letter-spacing: var(--tracking-wide); text-transform: uppercase; margin-left: auto; }

/* ---------- Sections ---------- */
.section { padding: var(--space-12) 0 0; }
.section:last-of-type { padding-bottom: var(--space-16); }
.section.hidden { display: none; }
.section-head { display: flex; align-items: baseline; gap: var(--space-4); margin-bottom: var(--space-6); padding-bottom: var(--space-4); border-bottom: 1px solid var(--divider); }
.section-head .eyebrow { color: var(--coffee-700); }
.section-head h2 { font-size: var(--fs-24); font-weight: var(--fw-bold); letter-spacing: var(--tracking-snug); }
.section-head .sec-count { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--fg-subtle); margin-left: auto; }

/* ---------- Card grid ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-5); }

.card {
  position: relative; background: var(--paper); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--space-5); cursor: pointer;
  display: flex; flex-direction: column; min-height: 220px;
  transition: border-color var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
  overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--coffee-700)); opacity: 0; transition: opacity var(--dur-med) var(--ease-out); }
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.card:hover::before { opacity: 1; }
.card:focus-visible { outline: 2px solid var(--coffee-700); outline-offset: 2px; }

.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.card .c-eyebrow { font-size: 10px; letter-spacing: var(--tracking-wide); text-transform: uppercase; font-weight: var(--fw-bold); color: var(--accent, var(--coffee-700)); }
.card .c-tag { font-size: 10px; font-family: var(--font-mono); color: var(--fg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px 6px; white-space: nowrap; }
.card h3 { font-size: var(--fs-18); font-weight: var(--fw-bold); line-height: var(--lh-snug); letter-spacing: var(--tracking-snug); color: var(--coffee-900); margin-bottom: var(--space-2); }
.card .c-desc { font-size: var(--fs-12); line-height: var(--lh-normal); color: var(--fg-muted); margin-bottom: var(--space-4); }
.card .c-mini { height: 56px; margin: auto 0 var(--space-4); position: relative; }
.card .c-mini canvas { width: 100% !important; height: 56px !important; }
.card .c-mini .mini-placeholder { width:100%; height:56px; display:flex; align-items:center; gap:3px; }
.card-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); margin-top: auto; padding-top: var(--space-3); border-top: 1px solid var(--divider); }
.card-foot > div { min-width: 0; }
.card-foot > div:last-child { text-align: right; flex: 0 0 auto; }
.card-foot .m-label { font-size: 10px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.card-foot .m-value { font-family: var(--font-mono); font-size: var(--fs-18); font-weight: var(--fw-semibold); color: var(--coffee-900); }
.card-foot .m-delta { font-family: var(--font-mono); font-size: var(--fs-12); font-weight: var(--fw-bold); }
.card-foot .m-delta.pos { color: var(--leaf-600); } .card-foot .m-delta.neg { color: var(--cherry-500); } .card-foot .m-delta.flat { color: var(--fg-subtle); }
.card .c-open { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: var(--fw-semibold); color: var(--coffee-700); }
.card .c-open svg { width: 14px; height: 14px; stroke: currentColor; transition: transform var(--dur-fast) var(--ease-out); }
.card:hover .c-open svg { transform: translateX(3px); }

/* mini bar placeholder (for non-charted cards) */
.mini-bar { flex: 1; background: var(--accent, var(--coffee-700)); opacity: .26; border-radius: 1px; align-self: flex-end; }
.mini-dotgrid { display:grid; grid-template-columns: repeat(12,1fr); gap:3px; width:100%; height:56px; }
.mini-dotgrid span { background: var(--accent, var(--coffee-700)); border-radius: 1px; opacity: var(--o, .3); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out); }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1 !important; transform: none !important; } }

/* ---------- Detail view ---------- */
.detail-layer {
  position: fixed; inset: 0; z-index: 80; background: var(--bg);
  overflow-y: auto; opacity: 0; visibility: hidden;
  transition: opacity var(--dur-med) var(--ease-out), visibility var(--dur-med);
}
.detail-layer.open { opacity: 1; visibility: visible; }
.detail-inner { transform: translateY(16px); transition: transform var(--dur-slow) var(--ease-out); }
.detail-layer.open .detail-inner { transform: none; }

.detail-bar {
  position: sticky; top: 0; z-index: 5; height: 64px; background: rgba(250,243,225,0.94);
  backdrop-filter: blur(3px); border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.detail-bar .wrap { display: flex; align-items: center; gap: var(--space-4); width: 100%; }
.back-btn {
  display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-sans);
  font-size: var(--fs-14); font-weight: var(--fw-semibold); color: var(--coffee-700);
  background: transparent; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 14px; cursor: pointer; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast);
}
.back-btn:hover { background: var(--cream-200); color: var(--coffee-900); }
.back-btn svg { width: 16px; height: 16px; stroke: currentColor; }
.detail-bar .crumb { font-size: var(--fs-12); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-subtle); }
.detail-bar .crumb b { color: var(--coffee-900); font-weight: var(--fw-semibold); }
.detail-bar .bar-spacer { flex: 1; }
.detail-bar .bar-status { font-size: 11px; font-family: var(--font-mono); color: var(--fg-subtle); display:flex; align-items:center; gap:6px; }
.detail-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--leaf-600); box-shadow: 0 0 0 3px rgba(103,142,62,.18); }

.detail-head { padding: var(--space-12) 0 var(--space-8); }
.detail-head .eyebrow { margin-bottom: var(--space-3); }
.detail-head h1 { font-size: clamp(2rem, 4vw, var(--fs-40)); max-width: 20ch; }
.detail-head .lead { max-width: 70ch; margin-top: var(--space-3); }
.detail-tags { display: flex; gap: var(--space-2); margin-top: var(--space-5); flex-wrap: wrap; }
.tag-pill { font-size: 11px; font-family: var(--font-mono); color: var(--fg-muted); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px 11px; }

.detail-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-bottom: var(--space-8); }
.detail-kpis .dk { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-5); }
.detail-kpis .dk .dk-label { font-size: 10px; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-subtle); margin-bottom: var(--space-2); }
.detail-kpis .dk .dk-value { font-family: var(--font-display); font-size: var(--fs-32); color: var(--coffee-900); line-height: 1; letter-spacing: var(--tracking-tight); }
.detail-kpis .dk .dk-sub { font-size: var(--fs-12); color: var(--fg-muted); margin-top: var(--space-2); }
.detail-kpis .dk .dk-sub .pos { color: var(--leaf-600); font-weight: var(--fw-bold); } .detail-kpis .dk .dk-sub .neg { color: var(--cherry-500); font-weight: var(--fw-bold); }
@media (max-width: 900px){ .detail-kpis { grid-template-columns: repeat(2,1fr);} }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); margin-bottom: var(--space-8); }
.detail-grid.cols-1 { grid-template-columns: 1fr; }
@media (max-width: 900px){ .detail-grid { grid-template-columns: 1fr; } }
.panel { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-6); }
.panel.span-2 { grid-column: 1 / -1; }
.panel h4 { font-size: var(--fs-14); font-weight: var(--fw-bold); color: var(--coffee-900); margin-bottom: var(--space-1); display:flex; align-items:center; justify-content:space-between; }
.panel .p-sub { font-size: var(--fs-12); color: var(--fg-subtle); margin-bottom: var(--space-5); }
.panel .chart-holder { position: relative; height: 300px; }
.panel .chart-holder.tall { height: 360px; }
.legend { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-4); }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--fg-muted); }
.legend i { width: 12px; height: 3px; border-radius: 2px; display:inline-block; }

/* data table */
table.dtable { width: 100%; border-collapse: collapse; font-size: var(--fs-12); font-family: var(--font-sans); }
table.dtable th { text-align: right; font-size: 10px; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-subtle); font-weight: var(--fw-bold); padding: 10px 12px; border-bottom: 2px solid var(--border-strong); }
table.dtable th:first-child { text-align: left; }
table.dtable td { text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--divider); color: var(--fg); font-family: var(--font-mono); }
table.dtable td:first-child { text-align: left; font-family: var(--font-sans); font-weight: var(--fw-medium); color: var(--coffee-900); }
table.dtable tr:hover td { background: var(--cream-100); }
table.dtable td .pos { color: var(--leaf-600); } table.dtable td .neg { color: var(--cherry-500); }

.methodology { background: var(--bg-accent); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-6); margin-bottom: var(--space-8); }
.methodology .eyebrow { margin-bottom: var(--space-3); }
.methodology p { font-size: var(--fs-14); color: var(--coffee-800); margin-bottom: var(--space-2); max-width: 80ch; }
.methodology .src { font-size: var(--fs-12); color: var(--fg-subtle); font-family: var(--font-mono); margin-top: var(--space-3); }

.feature-list { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
@media (max-width:700px){ .feature-list { grid-template-columns: 1fr; } }
.feature-list li { display: flex; gap: var(--space-3); font-size: var(--fs-14); color: var(--coffee-800); align-items: flex-start; }
.feature-list li svg { width: 16px; height: 16px; stroke: var(--leaf-600); flex: 0 0 16px; margin-top: 2px; }

.detail-nav { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-8) 0 var(--space-16); border-top: 1px solid var(--border); margin-top: var(--space-8); }
.detail-nav button { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); cursor: pointer; text-align: left; flex: 0 0 auto; max-width: 340px; transition: border-color var(--dur-fast) var(--ease-out); font-family: var(--font-sans); }
.detail-nav button:hover { border-color: var(--coffee-700); }
.detail-nav button.next { text-align: right; margin-left: auto; }
.detail-nav button .dn-label { font-size: 10px; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--fg-subtle); }
.detail-nav button .dn-title { font-size: var(--fs-14); font-weight: var(--fw-bold); color: var(--coffee-900); }

/* 3D viz pseudo-visual */
.viz-stage { height: 300px; border-radius: var(--radius-md); position: relative; overflow: hidden; background: var(--coffee-900); border: 1px solid var(--coffee-800); }
.viz-stage canvas { display:block; }
.viz-stage.embedded { height: 520px; padding: 0; }
.viz-stage.embedded iframe.viz-iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--coffee-900); color-scheme: dark; }

/* ===========================================================
   UNIFIED DASHBOARD — flowing single-page layout
   =========================================================== */
.dash-sticky-nav {
  /* Pin directly BELOW the global top nav (not at top:0, where the higher
     z-index .topnav would cover it) so sections 01–06 stay visible on scroll. */
  position: sticky; top: var(--topnav-h, 72px); z-index: 50;
  background: rgba(250,243,225,0.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.dash-sticky-nav .wrap { display: flex; gap: var(--space-2); align-items: center; padding: var(--space-3) 0; overflow-x: auto; }
.dash-sticky-nav a {
  font-size: var(--fs-12); letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--coffee-600); text-decoration: none; padding: 8px 14px; border-radius: var(--radius-md);
  white-space: nowrap; font-weight: 600; border: 1px solid transparent;
}
.dash-sticky-nav a:hover { background: rgba(81,42,36,0.06); color: var(--coffee-900); }
.dash-sticky-nav a.active { background: var(--coffee-900); color: var(--cream-50); border-color: var(--coffee-900); }

.dash-section {
  padding: var(--space-16) 0 var(--space-12);
  border-top: 1px solid var(--divider);
}
.dash-section:first-of-type { border-top: 0; }
.dash-section .sec-head { display: grid; grid-template-columns: 1fr; gap: var(--space-2); margin-bottom: var(--space-8); max-width: 78ch; }
.dash-section .sec-head .num {
  font-family: var(--font-mono); font-size: var(--fs-12); color: var(--coffee-600);
  letter-spacing: var(--tracking-wider); text-transform: uppercase; font-weight: 600;
}
.dash-section .sec-head h2 { font-size: var(--fs-40); line-height: 1.05; letter-spacing: -0.02em; margin: 0; }
.dash-section .sec-head p.lead { color: var(--coffee-600); margin-top: var(--space-2); }

.dash-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-3); margin-bottom: var(--space-6);
}
.dash-kpi {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5); box-shadow: var(--shadow-xs);
  border-left: 3px solid var(--coffee-700);
}
.dash-kpi .lbl { font-size: 11px; letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--grey-500); font-weight: 700; }
.dash-kpi .val { font-family: var(--font-display); font-size: var(--fs-32); line-height: 1; color: var(--coffee-900); margin: var(--space-2) 0 4px; }
.dash-kpi .sub { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--coffee-600); }
.dash-kpi.cherry { border-left-color: var(--cherry-500); }
.dash-kpi.leaf { border-left-color: var(--leaf-600); }
.dash-kpi.coffee { border-left-color: var(--coffee-700); }
.dash-kpi .pos { color: var(--leaf-600); }
.dash-kpi .neg { color: var(--cherry-700); }

.dash-grid { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
.dash-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.dash-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.dash-grid.cols-2-1 { grid-template-columns: 2fr 1fr; }
/* A chart beside a table that must not scroll: the table column is exactly as
   wide as the table, and the chart takes what is left (never under 300px). */
.dash-grid.cols-chart-table { grid-template-columns: minmax(300px, 1fr) auto; }
@media (max-width: 920px) {
  .dash-grid.cols-2, .dash-grid.cols-3, .dash-grid.cols-2-1, .dash-grid.cols-chart-table { grid-template-columns: 1fr; }
}
/* Grid items default to min-width:auto, i.e. "never narrower than my content".
   A .dash-table's nowrap cells (or a chart canvas mid-resize) therefore burst
   the track and push the PAGE into horizontal scroll, which reads as graphs
   cut off on the right. Let the tracks shrink instead — the wide table keeps
   its own .dash-table-wrap scroller, so nothing becomes unreachable. */
.dash-grid > *, .dash-kpis > * { min-width: 0; }

.dash-panel {
  background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6); box-shadow: var(--shadow-xs);
}
.dash-panel h3 { font-size: var(--fs-18); margin: 0 0 4px; font-weight: 700; color: var(--coffee-900); }
.dash-panel .p-sub { font-size: var(--fs-12); color: var(--coffee-600); margin-bottom: var(--space-4); text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.dash-panel .chart-holder { height: 320px; position: relative; }
.dash-panel .chart-holder.tall { height: 420px; }
.dash-panel .chart-holder.short { height: 240px; }
.dash-panel .legend { display: flex; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-3); font-size: var(--fs-12); color: var(--coffee-600); }
.dash-panel .legend span { display: inline-flex; align-items: center; gap: 6px; }
.dash-panel .legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.dash-table-wrap { overflow-x: auto; margin-top: var(--space-4); }
.dash-table, .dtable { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: var(--fs-12); }
.dtable th { text-align: right; padding: 8px 12px; background: var(--cream-100); color: var(--coffee-700); border-bottom: 1px solid var(--border-strong); font-family: var(--font-sans); text-transform: uppercase; letter-spacing: var(--tracking-wide); font-weight: 700; font-size: 11px; }
.dtable th:first-child, .dtable td:first-child { text-align: left; }
.dtable td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--coffee-900); }
.dtable tr:hover td { background: rgba(245,234,208,0.45); }
.dtable td.pos { color: var(--leaf-600); }
.dtable td.neg { color: var(--cherry-700); }
/* nowrap: on narrow viewports the year columns must overflow into the
   scrollable .dash-table-wrap, not wrap digits mid-number (ICO review). */
.dash-table th, .dash-table td { white-space: nowrap; }
.dash-table th { text-align: right; padding: 8px 12px; background: var(--cream-100); color: var(--coffee-700); border-bottom: 1px solid var(--border-strong); font-family: var(--font-sans); text-transform: uppercase; letter-spacing: var(--tracking-wide); font-weight: 700; font-size: 11px; }
.dash-table th:first-child, .dash-table td:first-child { text-align: left; }
.dash-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--coffee-900); }
.dash-table tr:hover td { background: rgba(245,234,208,0.45); }
.dash-table td.pos { color: var(--leaf-600); }
/* Vivid cherry (not the deep maroon) + bold so negatives read at a glance —
   ICO review feedback asked for a more intense red on negative deltas. */
.dash-table td.neg { color: var(--cherry-500); font-weight: 700; }

.dash-viz {
  background: var(--coffee-900); border-radius: var(--radius-md); position: relative;
  overflow: hidden; min-height: 520px;
}
.dash-viz canvas { display: block; width: 100%; height: 100%; }
.dash-viz .viz-overlay {
  position: absolute; top: var(--space-4); left: var(--space-4); right: var(--space-4);
  display: flex; justify-content: space-between; pointer-events: none;
  font-family: var(--font-mono); color: var(--cream-50); font-size: var(--fs-12);
}
.dash-viz .viz-overlay .meta { background: rgba(42,22,18,0.7); border: 1px solid rgba(245,234,208,0.2); padding: 8px 12px; border-radius: var(--radius-sm); pointer-events: auto; }
.dash-viz .viz-overlay .meta b { color: var(--cherry-400); font-weight: 700; }

.dash-callout {
  background: var(--bg-accent); border-left: 4px solid var(--coffee-700);
  padding: var(--space-4) var(--space-5); border-radius: var(--radius-sm);
  margin-top: var(--space-4); font-size: var(--fs-14); color: var(--coffee-900);
}
.dash-callout .meta { display: block; font-size: 11px; letter-spacing: var(--tracking-wider); text-transform: uppercase; color: var(--coffee-700); font-weight: 700; margin-bottom: 4px; }

.dash-jump { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-6); }
.dash-jump .chip { background: var(--paper); border: 1px solid var(--border-strong); color: var(--coffee-700); padding: 8px 14px; border-radius: var(--radius-pill); font-size: var(--fs-14); font-weight: 600; text-decoration: none; }
.dash-jump .chip:hover { background: var(--coffee-700); color: var(--cream-50); border-color: var(--coffee-700); }
.dash-jump .chip.solid { background: var(--coffee-700); color: var(--cream-50); border-color: var(--coffee-700); }
.dash-jump .chip.solid:hover { background: var(--coffee-800); }

/* ---------- Footer ---------- */
.footer { background: var(--bg-inverse); color: var(--fg-inverse); padding: var(--space-16) 0 var(--space-10); margin-top: var(--space-16); }
.footer .wrap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--space-10); }
.footer img { height: 30px; margin-bottom: var(--space-5); }
.footer p { font-size: var(--fs-14); color: rgba(245,234,208,.7); max-width: 42ch; }
.footer h5 { font-size: 11px; letter-spacing: var(--tracking-wide); text-transform: uppercase; color: rgba(245,234,208,.5); margin-bottom: var(--space-4); }
.footer ul { list-style: none; } .footer li { margin-bottom: var(--space-2); }
.footer li a { color: var(--cream-100); font-size: var(--fs-14); text-decoration: none; }
.footer li a:hover { color: #fff; }
.footer .colophon { grid-column: 1 / -1; border-top: 1px solid rgba(245,234,208,.18); margin-top: var(--space-8); padding-top: var(--space-6); display: flex; justify-content: space-between; font-size: var(--fs-12); color: rgba(245,234,208,.5); }
@media (max-width: 800px){ .footer .wrap { grid-template-columns: 1fr; gap: var(--space-8);} .footer .colophon{flex-direction:column;gap:var(--space-3);} }

/* empty state */
.empty { text-align:center; padding: var(--space-20) 0; color: var(--fg-subtle); display:none; }
.empty.show { display:block; }
.empty h3 { color: var(--coffee-700); margin-bottom: var(--space-2); }

/* ── Info affordance: a small ⓘ revealing a definition popover on hover/focus.
      Used to explain technical terms (e.g. YTD) inline. Theme-aware via tokens. */
.info-i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; margin-left: 5px; border-radius: 50%;
  border: 1px solid var(--border-strong, rgba(81,42,36,0.32)); color: var(--fg-subtle, #7a6456);
  font: 700 9px/1 var(--font-mono, ui-monospace, monospace); font-style: normal;
  cursor: help; position: relative; vertical-align: middle; flex: 0 0 auto;
  user-select: none; text-transform: none; letter-spacing: 0;
}
.info-i:hover, .info-i:focus { color: var(--coffee-700, #512a24); border-color: var(--coffee-700, #512a24); outline: none; }
.info-i::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 7px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content; max-width: 240px; z-index: 60;
  background: var(--bg-elevated, #fff); color: var(--fg, #2a1612);
  border: 1px solid var(--border-strong, rgba(81,42,36,0.32)); border-radius: var(--radius-md, 4px);
  padding: 8px 10px; font: 400 11px/1.45 var(--font-sans, 'Archivo', system-ui, sans-serif);
  text-transform: none; letter-spacing: 0; text-align: left; white-space: normal;
  box-shadow: 0 10px 26px rgba(42,22,18,0.20);
  opacity: 0; pointer-events: none; transition: opacity 140ms ease, transform 140ms ease;
}
.info-i:hover::after, .info-i:focus::after { opacity: 1; transform: translateX(-50%) translateY(0); }
