/* ==========================================================================
   CaneHarvest portal — site.css (v2)
   Light/dark, dense, trustworthy data terminal. See docs/DESIGN_SYSTEM.md for
   the full contract. Sections below follow that document's numbering.
   ========================================================================== */

@import url("chrome.css");


/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}
img, svg, canvas { max-width: 100%; display: block; }
button { font: inherit; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
* { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   3. Type scale
   -------------------------------------------------------------------------- */
h1 { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .35rem; }
h2 { font-size: 15px; line-height: 1.3; font-weight: 600; margin: 0 0 .6rem; }
h3 { font-size: 14px; line-height: 1.3; font-weight: 600; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
.eyebrow {
  display: block; font-size: 11px; line-height: 1.2; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3);
}
.muted { color: var(--ink-3); }
.note { color: var(--ink-2); font-size: 12px; margin: 0 0 1rem; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 20px; overflow-x: hidden; }
@media (max-width: 640px) { .wrap { padding: 12px; } }


/* Account pages (Billing, Security, API docs) use the legal reading
   measure. Desk pages stay on the 1280px wrap for charts. */
.account { max-width: 46rem; }

/* Key/value rows for account pages */
.kv { display: grid; gap: .55rem; margin: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 1rem; font-size: 13px; }
.kv dt { color: var(--ink-3); margin: 0; }
.kv dd { margin: 0; font-weight: 500; color: var(--ink); }
.billing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.notice.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--line); }
.locked-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .5rem; }

/* Page head */
.page-head { margin-bottom: 1rem; }
.page-head h1 { margin-bottom: .3rem; }
.lede { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin: 0 0 8px; max-width: none; }
.meta-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .6rem .75rem;
  margin: 0 0 1rem;
}

/* Vertical rhythm: sections sit 16px apart */
.page-head, .kpis, .toolbar, .card, .chart-box, .charts, .grid-2, .grid-3 {
  margin-bottom: 16px;
}
.charts > .card:last-child,
.grid-2 > .card:last-child,
.grid-3 > .card:last-child { margin-bottom: 0; }

/* Grids */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.charts { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 960px) { .charts { grid-template-columns: 1fr 1fr; } }
.charts .card, .charts .chart-box { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }

/* --------------------------------------------------------------------------
   5. Components
   -------------------------------------------------------------------------- */

/* Pills — rectangular, 4px radius */
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 12px; font-weight: 500;
  padding: .25rem .6rem; border-radius: var(--radius);
}
.pill.live { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand-soft); }
.pill.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand);
}

/* KPI */
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  box-shadow: var(--shadow-1);
}
.kpi .lbl { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.kpi .val {
  font-size: 26px; line-height: 1.15; font-weight: 600;
  letter-spacing: -0.01em; margin-top: .2rem;
}
.kpi .val .unit { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: .25rem; }
.kpi .sub { font-size: 12px; color: var(--ink-3); margin-top: .2rem; }
.kpi.dim { opacity: .55; }
.kpi .delta {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: 12px; font-weight: 600; padding: .05rem .4rem; border-radius: var(--radius);
  margin-top: .25rem;
}
.kpi .delta.good, .kpi .delta.up { color: var(--pos); background: var(--pos-soft); }
.kpi .delta.bad, .kpi .delta.down { color: var(--neg); background: var(--neg-soft); }
.kpi .delta.neutral { color: var(--ink-2); background: var(--surface-2); }
.kpi .delta.flat { color: var(--ink-3); background: var(--surface-2); }

.kpi .cmp {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3); margin-top: .3rem;
}
.kpi .cmp .delta { margin-top: 0; }

/* Card */
.card, .chart-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem .75rem; margin-bottom: .6rem;
}
.card-head h2 { margin: 0; }
.card-head .pill { margin: 0; }
.card-title { min-width: 0; }
.card-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.card-actions { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }
.card-foot { font-size: 12px; color: var(--ink-3); margin-top: .75rem; }

/* Charts (ECharts renders into a plain div, not a canvas) */
.chart-h { position: relative; height: 280px; }
.chart-h > div { width: 100%; height: 100%; }
.chart-h-sm { position: relative; height: 88px; }
@media (max-width: 640px) { .chart-h { height: 240px; } }

.chart-tip { font-size: 12px; color: var(--ink-3); margin-top: 8px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.4; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th {
  color: var(--ink-3); font-weight: 500; font-size: 12px;
  text-transform: none; letter-spacing: normal;
}
td.num, th.num { text-align: right; white-space: nowrap; }
td:first-child, th:first-child { white-space: nowrap; }
td.dim { color: var(--ink-3); }
tbody tr:hover { background: var(--surface-2); }

.table-scroll {
  overflow: auto;
  max-height: 28rem;
  border-radius: var(--radius-md);
  /* bottom-only fade so the sticky header is never faded */
  mask-image: linear-gradient(to bottom, black 0, black calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0, black calc(100% - 12px), transparent 100%);
}
.table-scroll thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--line);
}

/* Sortable table headers (desk.js wraps th text in a button) */
.sort-btn {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: .25rem;
  text-align: inherit;
}
.sort-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}
.sort-ind::before { content: "↕"; opacity: 0; font-size: 11px; }
th:hover .sort-ind::before, th:focus-within .sort-ind::before { opacity: .5; }
th[aria-sort="ascending"] .sort-ind::before { content: "↑"; opacity: 1; }
th[aria-sort="descending"] .sort-ind::before { content: "↓"; opacity: 1; }
th[aria-sort]:not([aria-sort="none"]) { color: var(--ink); }
th.num .sort-btn { width: 100%; justify-content: flex-end; }

/* Inline progress bar (share of total). Set width via --w (0-100). */
.bar-cell { position: relative; }
.bar-cell::before {
  content: "";
  position: absolute; left: 0; top: 4px; bottom: 4px;
  width: calc(var(--w, 0) * 1%);
  max-width: 100%;
  background: var(--brand-soft);
  border-radius: var(--radius);
  z-index: 0;
}
.bar-cell > * { position: relative; z-index: 1; }

/* Desk toggle chips — rectangular, 4px radius.
   Chip markup ("<label><input data-series="X"> Name</label>") lives in desk
   pages we do not edit, so the coloured swatch dot is painted purely in CSS
   via a ::before pseudo-element, keyed off :has(input[data-series="..."]).
   A reusable .swatch class (with .total/.c/.n/.w/.initial/.final modifiers)
   is also provided for any markup that wants an explicit dot. */
.desk-toggles { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.desk-toggles label {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: .3rem .7rem .3rem .6rem;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.desk-toggles label::before {
  content: "";
  width: 8px; height: 8px; border-radius: 2px;
  background: var(--ink-3);
  flex: 0 0 auto;
}
.desk-toggles label:has(input[data-series="Total"])::before,
.desk-toggles label:has(input[data-series="National"])::before { background: var(--s-total); }
.desk-toggles label:has(input[data-series="C"])::before { background: var(--s-c); }
.desk-toggles label:has(input[data-series="N"])::before { background: var(--s-n); }
.desk-toggles label:has(input[data-series="W"])::before { background: var(--s-w); }
.desk-toggles label:has(input[data-series="Initial"])::before { background: var(--s-initial); }
.desk-toggles label:has(input[data-series="Final"])::before { background: var(--s-final); }
.desk-toggles label:has(input:checked) {
  border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft);
}
.desk-toggles input {
  position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none;
}

.swatch {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px;
  background: var(--ink-3); flex: 0 0 auto;
}
.swatch.total, .swatch.national { background: var(--s-total); }
.swatch.c { background: var(--s-c); }
.swatch.n { background: var(--s-n); }
.swatch.w { background: var(--s-w); }
.swatch.initial { background: var(--s-initial); }
.swatch.final { background: var(--s-final); }

/* Amplitude-style desk controls: granularity segmented control + range button */
.desk-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; position: relative; }

.seg {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); overflow: hidden;
}
.seg-item {
  border: 0; border-right: 1px solid var(--line);
  background: transparent; color: var(--ink-2);
  height: 28px; padding: 0 11px;
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
}
.seg-item:last-child { border-right: 0; }
.seg-item:hover { background: var(--surface-2); color: var(--ink); }
.seg-item[aria-pressed="true"] {
  background: var(--brand-soft); color: var(--brand-ink);
}
.seg-item[aria-pressed="true"]:hover { background: var(--brand-soft); }
/* Compact variant for in-card controls such as the Line / Bar toggle */
.seg.seg-sm .seg-item { height: 24px; padding: 0 9px; font-size: 12px; }

.range-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px 0 8px;
  border: 1px solid var(--line-2); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.range-btn:hover { background: var(--surface-2); }
.range-btn svg { width: 14px; height: 14px; flex: 0 0 auto; color: var(--ink-3); }
.range-btn .chev { width: 10px; height: 10px; margin-left: 1px; }

.zoom-reset[hidden] { display: none !important; }

.popover {
  position: absolute;
  display: flex; gap: 12px;
  min-width: 320px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 12px;
  z-index: 30;
}
.popover.stack { flex-direction: column; min-width: 0; width: min(92vw, 360px); }
.popover.stack .popover-presets {
  border-right: 0; border-bottom: 1px solid var(--line);
  padding-right: 0; padding-bottom: 8px; min-width: 0;
}
:root[data-theme="dark"] .popover { border-color: var(--line-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .popover { border-color: var(--line-2); }
}
/* Dark theme: inputs and popovers sit on --surface-2, one step off the page. */
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .popover { background: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) input,
  :root:not([data-theme="light"]) select,
  :root:not([data-theme="light"]) .popover { background: var(--surface-2); }
}
.popover-presets {
  display: flex; flex-direction: column; gap: 1px;
  padding-right: 12px; border-right: 1px solid var(--line);
  min-width: 140px;
}
.popover-presets button {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink-2);
  font-size: 12.5px; padding: 7px 8px; border-radius: var(--radius);
  cursor: pointer;
}
.popover-presets button:hover { background: var(--surface-2); color: var(--ink); }
.popover-presets button[aria-current="true"] {
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 600;
}
.popover-custom { display: flex; flex-direction: column; gap: 8px; min-width: 190px; }
.popover-custom .field-row { display: flex; gap: 8px; }
.popover-custom label { font-size: 11px; gap: .2rem; }
.popover-custom input[type="date"] { height: 32px; font-size: 12.5px; padding: 0 .5rem; }
.popover-custom .btn.tiny { align-self: flex-end; }

/* Notices (flash / err restyled as notices) */
.notice, .flash, .err {
  display: flex; align-items: flex-start; gap: .5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: .7rem .9rem;
  font-size: 13px;
  margin-bottom: 1rem;
}
.notice.info, .flash { color: var(--ink); background: var(--info-soft); border-color: var(--line); }
.notice.success { color: var(--brand-ink); background: var(--pos-soft); border-color: var(--line); }
.notice.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--line); }
.notice.error, .err { color: var(--neg); background: var(--neg-soft); border-color: var(--line); }

/* Empty state */
.empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--ink-2);
}
.empty-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: .3rem; }
.empty-body { font-size: 13px; color: var(--ink-2); max-width: 42ch; margin: 0 auto; }

/* Tags / badges — rectangular, 4px radius */
.tag, .badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: var(--radius);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
}
.tag.ok, .badge.ok { color: var(--brand-ink); background: var(--pos-soft); border-color: var(--line); }
.tag.warn, .badge.warn { color: var(--warn); background: var(--warn-soft); border-color: var(--line); }
.tag.off, .badge.off { color: var(--neg); background: var(--neg-soft); border-color: var(--line); }
.tag.wait, .badge.wait { color: var(--warn); background: var(--warn-soft); border-color: var(--line); }
.tag.neutral, .badge.neutral { color: var(--ink-2); background: var(--surface-2); border-color: var(--line); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  background: var(--brand); color: #fff; border: 1px solid var(--brand);
  padding: .55rem 1rem; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600; line-height: 1.2;
  cursor: pointer;
}
.btn:hover { background: var(--brand-ink); border-color: var(--brand-ink); text-decoration: none; }
.btn.secondary {
  background: var(--surface); color: var(--ink); border-color: var(--line-2);
}
.btn.secondary:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn.ghost {
  background: transparent; color: var(--ink-2); border-color: transparent;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--neg); color: #fff; border-color: var(--neg); }
.btn.danger:hover { background: #8f1c13; border-color: #8f1c13; }
.btn.tiny { padding: .25rem .6rem; font-size: 12px; margin-left: .35rem; border-radius: var(--radius); }
.btn[disabled] {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}

.login-shell { position: relative; }
.login-shell .theme-toggle { position: absolute; top: 1.25rem; right: 1.25rem; }

/* Feed list (compact rows — whole row is a link) */
.feed-list { display: flex; flex-direction: column; }
.feed-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 6px; margin: 0 -6px;
  border-bottom: 1px solid var(--line);
  color: inherit;
  border-radius: var(--radius-md);
}
.feed-row:last-child { border-bottom: 0; }
.feed-row:hover { background: var(--surface-2); text-decoration: none; }
.feed-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.feed-main { flex: 1 1 auto; min-width: 0; }
.feed-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.feed-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.feed-meta { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.feed-row .badge { flex: 0 0 auto; }
.feed-chev { width: 14px; height: 14px; color: var(--ink-3); flex: 0 0 auto; }

/* Forms */
.form { display: grid; gap: .8rem; max-width: 28rem; }
.form.wide { max-width: 100%; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
label { display: grid; gap: .3rem; font-size: 12px; font-weight: 500; color: var(--ink-3); }
input, select {
  height: 36px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 0 .65rem;
  font: inherit; font-size: 13px;
}
input::placeholder { color: var(--ink-3); }
input:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.filters { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: end; margin: 0 0 1rem; }
.filters .btn, .filters select, .filters input { height: 36px; }

/* Login / legal shells */
.login-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: var(--bg);
}
.login-card {
  width: min(26rem, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: 2rem 1.75rem;
}
.login-card .brand.lg { margin-bottom: 1.25rem; }
.login-card h1 { font-size: 20px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: .2rem; }
.login-links { font-size: 12px; margin-top: 1rem; text-align: center; }

.legal-shell { min-height: 100vh; padding: 2.5rem 1.5rem; background: var(--bg); display: flex; justify-content: center; }
.legal-card {
  width: 100%; max-width: 46rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 2.25rem 2.5rem;
}
.legal-card h1 { margin-bottom: .5rem; }
.legal-card h2 { margin-top: 1.5rem; font-size: 14px; }
.legal-card p { color: var(--ink-2); }

/* Misc utility components carried over */
.key-once {
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  padding: 1rem; border-radius: var(--radius-md);
  font-family: var(--mono); font-size: 12.5px;
  word-break: break-all;
}
.key-cell { max-width: 22rem; word-break: break-all; }

/* Jump chips: small outlined chip links */
.jump { display: flex; flex-wrap: wrap; gap: .5rem; }
.jump a {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .3rem .75rem;
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 500;
  background: var(--surface);
}
.jump a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* Footer */
.foot {
  color: var(--ink-3); font-size: 12px;
  padding: 2rem 0 2.5rem;
  text-align: center;
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}
.foot a { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute; left: 8px; top: -48px;
  background: var(--brand); color: #fff;
  padding: .6rem 1rem; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  z-index: 100;
  transition: top .12s ease;
}
.skip-link:focus { top: 8px; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}
a.btn:focus-visible, button:focus-visible { outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Page: Snapshot
   -------------------------------------------------------------------------- */
/* Space between the "Your desks" eyebrow and the feed-list/desk-card grid. */
.eyebrow + .grid-3, .eyebrow + .feed-list { margin-top: .6rem; }

/* Locked feed state (page not on subscription) */
.locked-head h2 { margin: .5rem 0 .25rem; }
.locked-head p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; max-width: 70ch; }
.locked-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .75rem; }

/* Demo (sample data) overlay on a locked feed's chart */
.demo .chart-h::after {
  content: "Sample data";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 700; letter-spacing: .02em;
  color: var(--ink); opacity: .06; transform: rotate(-12deg);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Print — always renders in the light palette
   -------------------------------------------------------------------------- */
@media print {
  :root {
    --bg: #ffffff; --surface: #ffffff; --surface-2: #f1f4f2;
    --line: #e3e8e5; --line-2: #cfd8d3;
    --ink: #10201a; --ink-2: #45554d; --ink-3: #5f6f67;
    --brand: #146c43; --brand-ink: #0c4a2e; --brand-soft: #e6f3ec;
    --pos: #15703f; --neg: #b42318; --warn: #b54708;
    --pos-soft: #e3f5ea; --neg-soft: #fbeae7; --warn-soft: #fdf1e5; --info-soft: #eaf1fb;
    --s-total: #10201a; --s-c: #d97706; --s-n: #2563eb; --s-w: #0e9f6e;
    --s-initial: #6b7280; --s-final: #146c43;
    --shadow-1: none; --shadow-2: none;
  }
  .top, .toolbar, .foot, .skip-link, .desk-toggles, .jump, .theme-toggle, .zoom-reset, .popover,
  .sort-ind, .feed-chev { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card, .chart-box, .kpi {
    box-shadow: none; border: 1px solid #ccc; break-inside: avoid;
  }
  body { background: #fff; }
  a { color: var(--ink); text-decoration: none; }
  .table-scroll { max-height: none; overflow: visible; mask-image: none; -webkit-mask-image: none; }
}

/* --------------------------------------------------------------------------
   Page: Plots / Finance
   -------------------------------------------------------------------------- */
/* Generic muted/dim inline span, for values rendered outside a td/kpi
   (e.g. the Finance Thb() helper's null case). .kpis already carries the
   16px bottom margin that spaces the three KPI groups on Finance. */
.dim { color: var(--ink-3); }
section > .eyebrow { margin-bottom: .5rem; }

/* --------------------------------------------------------------------------
   Page: CCS / History / Plots
   -------------------------------------------------------------------------- */
/* Extra series colours read by page scripts through `colorVar`:
   q1..q3 = fibre / brix / pol on the quality axis (non-purple, distinct from
   the region palette); r1..r5 = the five-season overlay ramp, oldest lightest,
   latest in ink. */
:root {
  --s-q1: #a16207; --s-q2: #0f766e; --s-q3: #be123c;
  --s-r1: #b7d3c2; --s-r2: #8fbfa3; --s-r3: #5fa080; --s-r4: #2f8a5c; --s-r5: #10201a;
}
:root[data-theme="dark"] {
  --s-q1: #e0a63a; --s-q2: #2fbfa8; --s-q3: #f27d92;
  --s-r1: #3f6f55; --s-r2: #52906e; --s-r3: #6fb58c; --s-r4: #a3d8b8; --s-r5: #e6ebe7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s-q1: #e0a63a; --s-q2: #2fbfa8; --s-q3: #f27d92;
    --s-r1: #3f6f55; --s-r2: #52906e; --s-r3: #6fb58c; --s-r4: #a3d8b8; --s-r5: #e6ebe7;
  }
}
