/* Hathras Potato Logistics — site stylesheet.
   Tokens first; light is default, dark is a selected set of steps applied for the
   OS preference (unless the viewer chose light) and for an explicit dark choice. */

:root {
  color-scheme: light;
  --page: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --ink: #0f1419;
  --ink-2: #4a5160;
  --ink-muted: #6b7280;
  --line: #e3e6eb;
  --axis: #c3c8d0;
  --ring: rgba(15, 20, 25, 0.06);
  --shadow: 0 1px 2px rgba(15, 20, 25, 0.04), 0 4px 16px rgba(15, 20, 25, 0.05);

  --brand: #2a78d6;
  --brand-ink: #1c5cab;
  --brand-soft: #e8f1fc;
  --on-brand: #ffffff;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --band-1: rgba(42, 120, 214, 0.14);

  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --delta-up: #006300;
  --delta-down: #b42323;

  --radius: 12px;
  --radius-sm: 8px;
  --max: 1200px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0f12;
    --surface: #16191e;
    --surface-2: #1d2127;
    --ink: #eef0f3;
    --ink-2: #c0c5cd;
    --ink-muted: #9097a1;
    --line: #2a2f37;
    --axis: #3a404a;
    --ring: rgba(255, 255, 255, 0.06);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --brand: #3987e5;
    --brand-ink: #86b6ef;
    --brand-soft: #172536;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --band-1: rgba(57, 135, 229, 0.22);
    --delta-up: #2fbf2f;
    --delta-down: #f07070;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0f12;
  --surface: #16191e;
  --surface-2: #1d2127;
  --ink: #eef0f3;
  --ink-2: #c0c5cd;
  --ink-muted: #9097a1;
  --line: #2a2f37;
  --axis: #3a404a;
  --ring: rgba(255, 255, 255, 0.06);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --brand: #3987e5;
  --brand-ink: #86b6ef;
  --brand-soft: #172536;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --band-1: rgba(57, 135, 229, 0.22);
  --delta-up: #2fbf2f;
  --delta-down: #f07070;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); letter-spacing: -0.025em; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
code { font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.small { font-size: 0.82rem; }
.xs { font-size: 0.74rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 1000;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--brand); color: var(--on-brand); font-size: 0.8rem; letter-spacing: 0.02em;
}
.brand-text small { display: block; font-weight: 500; font-size: 0.72rem; color: var(--ink-muted); }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; list-style: none; padding: 0; margin-top: 0; margin-bottom: 0; }
.nav-links > li { position: relative; }
.nav-links a, .nav-links button.linkish {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: 0.92rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav-links a:hover, .nav-links button.linkish:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--brand); }
.dropdown {
  position: absolute; top: calc(100% + 6px); left: -8px; width: 320px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: none;
}
.has-dropdown:hover .dropdown, .has-dropdown:focus-within .dropdown, .has-dropdown.open .dropdown { display: block; }
.dropdown a { display: block; padding: 10px 12px; }
.dropdown a strong { display: block; color: var(--ink); font-size: 0.92rem; }
.dropdown a span { display: block; color: var(--ink-muted); font-size: 0.8rem; font-weight: 400; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.menu-btn { display: none; }

@media (max-width: 900px) {
  .menu-btn { display: inline-grid; }
  .nav-links {
    display: none; position: absolute; left: 0; right: 0; top: 64px; flex-direction: column; align-items: stretch;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; margin: 0;
  }
  .nav.open .nav-links { display: flex; }
  .nav-links a, .nav-links button.linkish { width: 100%; padding: 12px; }
  .dropdown { position: static; width: auto; display: block; border: 0; box-shadow: none; padding: 0 0 0 12px; }
  .dropdown a span { display: none; }
  .nav-cta { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; font-weight: 600; font-size: 0.93rem; font-family: inherit;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-ink); }
:root[data-theme="dark"] .btn-primary:hover { background: #2a78d6; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; border-radius: 8px; }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-tight { padding: 40px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 680px; margin-bottom: 32px; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.eyebrow {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 10px;
}
.lead { font-size: 1.12rem; color: var(--ink-2); }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 64px; background:
  radial-gradient(1200px 400px at 85% -10%, var(--brand-soft), transparent 70%), var(--page); }
.hero-grid { display: grid; gap: 40px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 980px) { .hero-grid { grid-template-columns: 1.05fr 1fr; } }
.hero h1 span { color: var(--brand); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 20px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; margin: 0; list-style: none; color: var(--ink-2); font-size: 0.88rem; }
.hero-points li::before { content: "✓"; color: var(--status-good); font-weight: 700; margin-right: 6px; }
.preview { padding: 18px; }
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }

/* ---------- Grid & cards ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: 1fr; }
.split > * { min-width: 0; }   /* let wide tables scroll inside their column instead of squeezing the other */
@media (min-width: 980px) {
  .split-3-2 { grid-template-columns: 3fr 2fr; }
  .split-1-2 { grid-template-columns: 340px 1fr; }
  .split-3-2-map { grid-template-columns: 3fr 2fr; }
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 0;
}
.card-body { padding: 20px; }
.card-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-head p { margin: 2px 0 0; font-size: 0.82rem; color: var(--ink-2); }
.feature { padding: 22px; }
.feature .icon {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand); font-size: 1.1rem; margin-bottom: 14px;
}
.feature p { color: var(--ink-2); font-size: 0.92rem; margin: 0; }
a.card-link { display: block; color: inherit; transition: border-color 0.15s, transform 0.15s; }
a.card-link:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); }
.card-link .go { color: var(--brand); font-weight: 600; font-size: 0.88rem; margin-top: 14px; display: inline-block; }

/* ---------- KPI ---------- */
.kpi { padding: 18px 20px; }
.kpi .label { font-size: 0.8rem; color: var(--ink-2); font-weight: 500; }
.kpi .value { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.kpi .value small { font-size: 0.85rem; color: var(--ink-2); font-weight: 600; margin-left: 4px; }
.kpi .delta { font-size: 0.8rem; font-weight: 600; margin-top: 4px; }
.kpi .foot { font-size: 0.78rem; color: var(--ink-muted); margin-top: 2px; }
.up { color: var(--delta-up); }
.down { color: var(--delta-down); }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0; }
.stat-strip > div { padding: 22px 20px; border-right: 1px solid var(--line); }
.stat-strip > div:last-child { border-right: 0; }
.stat-strip .value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-strip .label { font-size: 0.82rem; color: var(--ink-2); }
@media (max-width: 700px) { .stat-strip > div { border-right: 0; border-bottom: 1px solid var(--line); } }

/* ---------- Badges / tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; color: var(--ink); border: 1px solid var(--line); white-space: nowrap;
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.badge i { font-style: normal; color: var(--c); font-size: 0.62rem; }
.lvl-good { --c: var(--status-good); }
.lvl-warning { --c: var(--status-warning); }
.lvl-serious { --c: var(--status-serious); }
.lvl-critical { --c: var(--status-critical); }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 6px; border: 1px dashed var(--axis);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted);
}
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-size: 0.76rem; font-weight: 600; }
:root[data-theme="dark"] .pill { color: #b7d3f6; }

/* ---------- Recorded vs estimated seasons ----------
   One visual language everywhere: verified actuals are solid; modelled values for
   seasons already harvested are hatched with a dashed edge and carry a text tag, so
   the state never depends on colour alone. Hatch is ink at low alpha (works in dark). */
:root { --hatch: color-mix(in srgb, var(--ink) 14%, transparent); --hatch-strong: color-mix(in srgb, var(--ink) 42%, transparent); }
.hatch { background-image: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 7px); }
.hatch-strong { background-image: repeating-linear-gradient(135deg, var(--hatch-strong) 0 2px, transparent 2px 6px); }
.est-tag, .rec-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 700; line-height: 1.5; white-space: nowrap; color: var(--ink); vertical-align: middle;
}
.est-tag { border: 1px dashed var(--ink-2); letter-spacing: 0.03em;
  background-image: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 6px); }
.rec-tag { border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; color: var(--ink-2); }
.rec-tag::before { content: ""; width: 8px; height: 8px; border-radius: 1px; background: var(--ink); }
.est-tag::before { content: ""; width: 8px; height: 8px; border-radius: 1px; border: 1px dashed var(--ink); }
.is-estimate { border-style: dashed !important; border-color: var(--ink-muted) !important; }
.table .est-tag { white-space: normal; max-width: 11rem; }

/* Season cards on the forecast page: one card per season, recorded first. */
.season-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.season-card { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); padding: 14px 16px; display: grid; gap: 8px; }
.season-card.is-estimate { background-image: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 9px); }
.season-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.season-card h3 { margin: 0; font-size: 1rem; font-variant-numeric: tabular-nums; }
.season-card dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.season-card dt { font-size: 0.74rem; color: var(--ink-2); }
.season-card dd { margin: 0; font-weight: 700; font-size: 1.35rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.season-card dd small { font-size: 0.78rem; font-weight: 600; color: var(--ink-2); margin-left: 3px; }
.season-card .range { font-size: 0.76rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* Denser numeric tables (forecast, backtest). */
table.table.dense th { padding: 7px 10px; }
table.table.dense td { padding: 7px 10px; }
table.table.dense th.group { text-align: center; border-bottom: 1px solid var(--line); color: var(--ink-2); }
table.table tr.is-estimate-row td { background-image: repeating-linear-gradient(135deg, var(--hatch) 0 1px, transparent 1px 9px); }
.legend .sw.hatch-sw { width: 16px; height: 10px; border: 1px dashed var(--ink-2); border-radius: 2px;
  background-image: repeating-linear-gradient(135deg, var(--hatch-strong) 0 2px, transparent 2px 5px); }

/* ---------- Alert ---------- */
.alert {
  display: flex; gap: 10px; padding: 14px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 9%, transparent);
}
.alert i { font-style: normal; color: var(--c); font-size: 0.8rem; margin-top: 3px; }
.alert strong { display: block; font-size: 0.95rem; }
.alert p { margin: 2px 0 0; font-size: 0.86rem; color: var(--ink-2); }

/* ---------- Controls ---------- */
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); flex-wrap: wrap; }
.seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: 7px; cursor: pointer;
  font: 600 0.8rem var(--font); color: var(--ink-2);
}
.seg button:hover { color: var(--ink); background: var(--surface-2); }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--surface); }
.field { margin-bottom: 18px; }
.field-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field label { font-size: 0.84rem; font-weight: 600; color: var(--ink-2); }
.field output { font-weight: 700; font-variant-numeric: tabular-nums; }
.field input[type="range"] { width: 100%; margin-top: 8px; accent-color: var(--brand); }
.field .hint { font-size: 0.74rem; color: var(--ink-muted); margin-top: 4px; }
select.input {
  width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 0.9rem;
}

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box.tall { height: 340px; }
.chart-box.short { height: 200px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 0 0 10px; list-style: none; font-size: 0.8rem; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--c); }
.legend .sw.dash { border-top-style: dashed; }
.legend .sw.box { height: 10px; border: 0; background: var(--c); border-radius: 2px; width: 10px; }
.legend .sw.band { height: 10px; border: 0; background: var(--c); border-radius: 2px; }
.chart-note { font-size: 0.76rem; color: var(--ink-muted); margin: 8px 0 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 600; color: var(--ink-muted); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table tbody tr:hover { background: var(--surface-2); }

/* ---------- Tool layout ---------- */
.page-head { padding: 36px 0 20px; }
.page-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.crumbs { font-size: 0.82rem; color: var(--ink-muted); margin-bottom: 8px; }
.crumbs a { color: var(--ink-muted); }
.tool-tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tool-tabs a {
  padding: 10px 14px; color: var(--ink-2); font-weight: 600; font-size: 0.88rem; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tool-tabs a:hover { color: var(--ink); text-decoration: none; }
.tool-tabs a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }
.stack > * + * { margin-top: 16px; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mini-stats > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; }
.mini-stats dt { font-size: 0.74rem; color: var(--ink-muted); }
.mini-stats dd { margin: 2px 0 0; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.mini-stats dd + dd { font-weight: 400; font-size: 0.76rem; color: var(--ink-2); }

/* ---------- Map ---------- */
.map { height: 440px; border-radius: var(--radius-sm); border: 1px solid var(--line); overflow: hidden; }
.leaflet-container { background: var(--surface-2); font-family: var(--font); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-tooltip { background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none; padding: 1px 7px; font-weight: 600; }
.leaflet-tooltip-top::before { border-top-color: var(--line); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.4); }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgba(22, 25, 30, 0.85) !important; color: var(--ink-2); }
.map-legend { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 0.74rem; color: var(--ink-2); line-height: 1.6; }
.map-legend b { color: var(--ink); }

/* ---------- Prose / timeline / CTA ---------- */
.prose { max-width: 760px; }
.prose p, .prose li { color: var(--ink-2); }
.prose h2 { margin-top: 1.6em; }
.steps { counter-reset: step; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps .card { padding: 22px; position: relative; }
.steps .card::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: var(--surface); font-weight: 700; font-size: 0.85rem; margin-bottom: 14px;
}
.steps p { color: var(--ink-2); font-size: 0.92rem; margin: 0; }
.cta {
  border-radius: 18px; padding: 40px 28px; text-align: center;
  background: linear-gradient(135deg, #1c5cab, #2a78d6 60%, #3987e5); color: #fff;
}
.cta h2 { color: #fff; }
.cta p { color: rgba(255, 255, 255, 0.85); max-width: 560px; margin: 0 auto 22px; }
.cta .btn-primary { background: #fff; color: #1c5cab; }
.cta .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.check-list { list-style: none; padding: 0; margin: 12px 0 0; }
.check-list li { padding-left: 22px; position: relative; margin-bottom: 6px; color: var(--ink-2); font-size: 0.92rem; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--status-good); font-weight: 700; }
.notice { border-left: 3px solid var(--status-warning); background: var(--surface); padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-2); font-size: 0.88rem; }

/* ---------- Footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); padding: 48px 0 28px; margin-top: 64px; font-size: 0.88rem; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.footer h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 8px; }
.footer a { color: var(--ink-2); }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 20px; color: var(--ink-muted); font-size: 0.78rem; }

/* =====================================================================
   ColdFlow additions: brand, account menu, flashes, landing, forms,
   own-data planner, dashboard.
   ===================================================================== */
.skip { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

.brand img { display: block; border-radius: 9px; }
.wordmark { font-weight: 800; font-size: 1.18rem; letter-spacing: -0.03em; color: var(--ink); }
.wordmark span, .splash-word span {
  background: linear-gradient(100deg, #2a78d6 10%, #1baf9f 90%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-login { color: var(--ink-2); font-weight: 600; font-size: 0.9rem; padding: 8px 10px; border-radius: 8px; }
.nav-login:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-mobile-only { display: none; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #2a78d6, #1baf9f); color: #fff; font: 700 0.95rem var(--font);
}
.account-menu { position: relative; }
.dropdown-right { left: auto; right: 0; width: 240px; }
.dropdown-who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dropdown-who strong { display: block; font-size: 0.92rem; }
.dropdown-who span { display: block; font-size: 0.78rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; }
.dropdown-btn {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; cursor: pointer;
  font: 600 0.92rem var(--font); color: var(--status-critical); border-radius: 8px;
}
.dropdown-btn:hover { background: var(--surface-2); }
@media (max-width: 900px) {
  .nav-mobile-only { display: block; }
  .nav-login { display: none; }
  .account-menu .dropdown { position: absolute; width: 240px; display: none; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px; }
  .account-menu.open .dropdown { display: block; }
  .account-menu .dropdown a span { display: block; }
}

.flashes { margin-top: 16px; display: grid; gap: 8px; }
.flash {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 0.9rem;
  border-left: 4px solid var(--brand);
}
.flash-success { border-left-color: var(--status-good); }
.flash-warning { border-left-color: var(--status-warning); }
.flash-error { border-left-color: var(--status-critical); }
.flash-x { border: 0; background: none; font-size: 1.2rem; line-height: 1; color: var(--ink-muted); cursor: pointer; }

/* ---------- Forms & auth ---------- */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; grid-template-columns: 1fr; }
@media (min-width: 980px) { .auth-wrap { grid-template-columns: 1fr 1fr; } }
.auth-side {
  display: none; position: relative; overflow: hidden; padding: 56px; color: #fff;
  background: linear-gradient(150deg, #123e74, #1c5cab 45%, #1baf9f);
}
@media (min-width: 980px) { .auth-side { display: flex; flex-direction: column; justify-content: space-between; } }
.auth-side h2 { color: #fff; font-size: 2rem; max-width: 420px; }
.auth-side p, .auth-side li { color: rgba(255, 255, 255, 0.85); }
.auth-side .check-list li { color: rgba(255, 255, 255, 0.9); }
.auth-side .check-list li::before { color: #9ff0d6; }
.auth-main { display: grid; place-items: center; padding: 48px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.8rem; margin-bottom: 6px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 0.86rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.form-field .opt { font-weight: 400; color: var(--ink-muted); }
.input-text {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; font-size: 0.95rem;
}
.input-text:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-color: var(--brand); }
.input-text[aria-invalid="true"] { border-color: var(--status-critical); }
.field-error { color: var(--delta-down); font-size: 0.8rem; margin-top: 5px; }
.form-error { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--status-critical) 10%, transparent); border: 1px solid var(--status-critical); font-size: 0.88rem; margin-bottom: 16px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; font-size: 0.86rem; color: var(--ink-2); }
.check-row input { margin-top: 3px; accent-color: var(--brand); }
.btn-block { width: 100%; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--ink-muted); font: 600 0.78rem var(--font); cursor: pointer; padding: 6px; }
.btn-danger { background: var(--status-critical); color: #fff; }
.btn-danger:hover { background: #b42323; }

/* ---------- Own-data planner ---------- */
.plan-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.data-table input {
  width: 100%; min-width: 92px; padding: 7px 8px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 0.86rem; font-variant-numeric: tabular-nums; text-align: right;
}
.data-table input[name="season"] { text-align: left; min-width: 84px; }
.data-table input[aria-invalid="true"] { border-color: var(--status-critical); }
.data-table td { padding: 6px 8px; }
.row-x { border: 0; background: none; color: var(--ink-muted); cursor: pointer; font-size: 1.1rem; padding: 4px 6px; border-radius: 6px; }
.row-x:hover { color: var(--status-critical); background: var(--surface-2); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.cal-grid label { display: block; font-size: 0.72rem; color: var(--ink-muted); font-weight: 600; margin-bottom: 3px; }
.cal-grid input { width: 100%; padding: 6px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 0.84rem; text-align: right; }
.cal-sum { font-size: 0.8rem; color: var(--ink-muted); margin-top: 6px; }
details.panel { border-top: 1px solid var(--line); }
details.panel > summary { cursor: pointer; padding: 14px 20px; font-weight: 600; font-size: 0.92rem; list-style: none; display: flex; justify-content: space-between; }
details.panel > summary::after { content: "▾"; color: var(--ink-muted); }
details.panel[open] > summary::after { content: "▴"; }
details.panel > div { padding: 0 20px 18px; }
.num-input { width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.warn-list { margin: 6px 0 0; padding-left: 18px; font-size: 0.86rem; color: var(--ink-2); }
.based-on { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; font-weight: 600; color: var(--ink-2); padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--axis); }
.save-status { font-size: 0.8rem; color: var(--ink-muted); }

/* ---------- Dashboard ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.plan-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.plan-row:last-child { border-bottom: 0; }
.plan-row strong a { color: var(--ink); }
.plan-actions { display: flex; gap: 8px; align-items: center; }
.plan-actions form { margin: 0; }

@media (min-width: 980px) { .split-plan { grid-template-columns: minmax(420px, 470px) 1fr; } }

/* =====================================================================
   Home launcher, assistant, command palette, transitions, print
   ===================================================================== */

/* ---------- Home launcher (single screen) ---------- */
body.home { overflow-x: hidden; }
.launch {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: calc(100vh - 65px); min-height: calc(100svh - 65px);
  display: grid; grid-template-rows: 1fr auto auto; gap: 22px; padding: 36px 0 18px;
}
.launch-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 80% 70% at 60% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 60% 40%, #000 30%, transparent 75%);
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; }
.orb-a { width: 520px; height: 520px; right: -120px; top: -160px; background: radial-gradient(circle, rgba(42,120,214,.45), transparent 65%); animation: orb 16s ease-in-out infinite alternate; }
.orb-b { width: 420px; height: 420px; left: 30%; bottom: -220px; background: radial-gradient(circle, rgba(27,175,159,.35), transparent 65%); animation: orb 20s ease-in-out infinite alternate-reverse; }
@keyframes orb { to { transform: translate(-40px, 30px) scale(1.08); } }
.launch-grid { display: grid; gap: 28px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .launch-grid { grid-template-columns: 1.05fr 0.95fr; gap: 56px; } }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font-size: 0.8rem; font-weight: 600; color: var(--ink-2);
}
.live-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--status-good); box-shadow: 0 0 0 0 rgba(12,163,12,.5); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 8px rgba(12,163,12,0); } 100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); } }
.launch-title { font-size: clamp(2.5rem, 5.6vw, 4.6rem); font-weight: 800; letter-spacing: -0.045em; line-height: 1.02; margin: 18px 0 16px; }
.launch-title span { background: linear-gradient(100deg, #2a78d6 10%, #1baf9f 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.launch-lead { font-size: 1.1rem; color: var(--ink-2); max-width: 540px; margin-bottom: 24px; }
.ask-bar {
  display: flex; align-items: center; gap: 10px; max-width: 580px; padding: 7px 7px 7px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(28, 92, 171, 0.10), var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.ask-bar:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow); }
.ask-bar input { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 1rem; outline: none; padding: 8px 0; }
.ask-spark { color: var(--brand); font-size: 1.1rem; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ask-chips button, .assistant-suggest button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 6px 12px; font: 500 0.82rem var(--font); cursor: pointer; transition: border-color .15s, color .15s;
}
.ask-chips button:hover, .assistant-suggest button:hover { border-color: var(--brand); color: var(--ink); }

.monitor { padding: 20px; box-shadow: 0 24px 60px rgba(28, 92, 171, 0.14), var(--shadow); }
.monitor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.monitor-kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); }
.monitor-body { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; margin: 16px 0; }
.gauge { position: relative; width: 150px; height: 150px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 11; }
.gauge-track { stroke: var(--surface-2); }
.gauge-cap { stroke: var(--axis); stroke-width: 11; stroke-dasharray: 2 312.2; stroke-dashoffset: calc(-314.16 * var(--cap)); }
.gauge-fill {
  stroke: var(--c); stroke-linecap: round; stroke-dasharray: 314.16; stroke-dashoffset: 314.16;
  animation: gauge 1.2s cubic-bezier(.2,.8,.2,1) .15s forwards;
}
@keyframes gauge { to { stroke-dashoffset: calc(314.16 * (1 - var(--p))); } }
.gauge-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.gauge-label strong { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.gauge-label span { font-size: 0.74rem; color: var(--ink-muted); margin-top: 4px; }
.monitor-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; }
.monitor-stats dt { font-size: 0.72rem; color: var(--ink-muted); }
.monitor-stats dd { margin: 1px 0 0; font-size: 1.12rem; font-weight: 700; }
.month-strip { position: relative; display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; height: 92px; align-items: end; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.mcol { position: relative; height: 100%; }
.mcol.peak::before { content: ""; position: absolute; inset: -4px -3px 0; background: var(--surface-2); border-radius: 6px; z-index: -1; }
.mcol i { position: absolute; bottom: -16px; left: 0; right: 0; text-align: center; font-style: normal; font-size: 0.66rem; color: var(--ink-muted); }
.bar { position: absolute; left: 0; right: 0; bottom: 0; height: 0; border-radius: 4px 4px 0 0; background: var(--series-1);
  animation: grow .7s cubic-bezier(.2,.8,.2,1) var(--d) forwards; }
.bar.over { bottom: var(--b); background: var(--status-critical); }
@keyframes grow { to { height: var(--h); } }
.cap-line { position: absolute; left: 0; right: 0; bottom: calc(16px + (100% - 16px) * var(--cap)); border-top: 1.5px dashed var(--ink-2); z-index: 2; }
.cap-line em { position: absolute; right: 0; top: -16px; font-style: normal; font-size: 0.66rem; color: var(--ink-muted); background: var(--surface); padding: 0 4px; }
.monitor-note { margin: 10px 0 0; font-size: 0.78rem; color: var(--ink-muted); }

.launch-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.tile {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; color: var(--ink);
  font: inherit; cursor: pointer; transition: transform .18s, border-color .18s, box-shadow .18s;
}
.tile:hover { text-decoration: none; transform: translateY(-3px); border-color: var(--brand); box-shadow: 0 14px 30px rgba(28, 92, 171, 0.12); }
.tile-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); font-size: 1.15rem; font-weight: 700; }
.tile-ico.ai { background: linear-gradient(135deg, #2a78d6, #1baf9f); color: #fff; }
.tile-txt { flex: 1; min-width: 0; }
.tile-txt strong { display: block; font-size: 0.98rem; }
.tile-txt span { display: block; font-size: 0.8rem; color: var(--ink-muted); }
.tile-go { color: var(--ink-muted); transition: transform .18s, color .18s; }
.tile:hover .tile-go { color: var(--brand); transform: translateX(3px); }
.launch-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.78rem; color: var(--ink-muted); }
.launch-foot a { color: var(--ink-muted); }
.launch-kbd { margin-left: auto; }
kbd { display: inline-block; min-width: 18px; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); font: 600 0.7rem var(--font); color: var(--ink-2); text-align: center; }
@media (max-width: 640px) {
  .launch { padding-top: 22px; }
  .monitor-body { grid-template-columns: 1fr; justify-items: center; }
  .monitor-stats { width: 100%; }
  .launch-kbd { display: none; }
}

/* ---------- Search button ---------- */
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); font: 500 0.86rem var(--font); cursor: pointer;
}
.search-btn:hover { color: var(--ink); background: var(--surface-2); }
@media (max-width: 1100px) { .search-btn .search-txt, .search-btn kbd { display: none; } .search-btn { padding: 0 11px; } }

/* ---------- Assistant ---------- */
.ask-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 1200; display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border: 0; border-radius: 999px; cursor: pointer; color: #fff; font: 700 0.92rem var(--font);
  background: linear-gradient(135deg, #2a78d6, #1baf9f); box-shadow: 0 12px 30px rgba(28, 92, 171, 0.35);
  transition: transform .18s, opacity .18s;
}
.ask-fab:hover { transform: translateY(-2px); }
body.home .ask-fab { display: none; }
body.assistant-open .ask-fab { opacity: 0; pointer-events: none; transform: scale(.9); }
@media (max-width: 640px) { .ask-fab { padding: 13px; } .ask-fab-txt { display: none; } }
.assistant {
  position: fixed; z-index: 1300; right: 16px; bottom: 16px; top: 80px; width: min(420px, calc(100vw - 32px));
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(15, 20, 25, 0.25); opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .2s, transform .2s; overflow: hidden;
}
.assistant.open { opacity: 1; transform: none; }
@media (max-width: 640px) { .assistant { right: 0; left: 0; bottom: 0; top: 56px; width: auto; border-radius: 18px 18px 0 0; } }
.assistant-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.assistant-id { display: flex; gap: 10px; align-items: center; }
.assistant-id strong { display: block; font-size: 0.95rem; }
.assistant-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #2a78d6, #1baf9f); }
.assistant-mode { display: block; font-size: 0.74rem; color: var(--ink-muted); }
.assistant-mode[data-state="ai"]::before { content: "● "; color: var(--status-good); }
.assistant-mode[data-state="offline"]::before { content: "● "; color: var(--status-warning); }
.assistant-actions { display: flex; gap: 6px; }
.icon-btn.sm { width: 32px; height: 32px; font-size: 0.9rem; }
.assistant-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 10px 13px; border-radius: 14px; font-size: 0.9rem; line-height: 1.5; overflow-wrap: anywhere; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin: 0; }
.msg ul { margin: 4px 0 6px; padding-left: 18px; }
.msg.bot { align-self: flex-start; background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.error { border: 1px solid var(--status-critical); }
.msg a { font-weight: 600; }
.msg.typing { display: inline-flex; gap: 4px; padding: 14px; }
.msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-muted); animation: blink 1.2s infinite; }
.msg.typing span:nth-child(2) { animation-delay: .15s; } .msg.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.assistant-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.assistant-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); }
.assistant-form textarea {
  flex: 1; resize: none; max-height: 140px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--page); color: var(--ink); font: inherit; font-size: 0.92rem; line-height: 1.4;
}
.assistant-form textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); border-color: var(--brand); }
.assistant-form .btn { width: 40px; height: 40px; padding: 0; font-size: 1.1rem; border-radius: 12px; }
.assistant-foot { margin: 0; padding: 0 14px 10px; font-size: 0.7rem; color: var(--ink-muted); text-align: center; }

/* ---------- Command palette ---------- */
.palette { position: fixed; inset: 0; z-index: 1500; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 20, 0.45); backdrop-filter: blur(3px); opacity: 0; transition: opacity .15s; }
.palette-box { position: relative; width: min(620px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); overflow: hidden; opacity: 0; transform: translateY(-8px) scale(.98); transition: opacity .15s, transform .15s; }
.palette.open .palette-backdrop, .palette.open .palette-box { opacity: 1; transform: none; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink-muted); }
.palette-input input { flex: 1; border: 0; outline: none; background: none; color: var(--ink); font: inherit; font-size: 1.02rem; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-list [role="option"] { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.palette-list [role="option"] small { color: var(--ink-muted); }
.palette-list [aria-selected="true"] { background: var(--brand-soft); }
.palette-list [aria-selected="true"] span { color: var(--brand-ink); font-weight: 600; }
:root[data-theme="dark"] .palette-list [aria-selected="true"] span { color: #b7d3f6; }
.palette-group { padding: 10px 12px 4px; font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.palette-empty { padding: 18px; text-align: center; color: var(--ink-muted); }
.palette-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 0.74rem; color: var(--ink-muted); }

/* ---------- Page transitions ---------- */
@view-transition { navigation: auto; }
.nav { view-transition-name: cf-nav; }
.page-head { view-transition-name: cf-hero; }
.ask-fab { view-transition-name: cf-fab; }
::view-transition-old(root) { animation: cf-out .22s ease both; }
::view-transition-new(root) { animation: cf-in .38s cubic-bezier(.2,.8,.2,1) both; }
::view-transition-group(cf-hero) { animation-duration: .42s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
@keyframes cf-out { to { opacity: 0; transform: translateY(-10px) scale(.985); } }
@keyframes cf-in { from { opacity: 0; transform: translateY(14px); } }
html.no-vt main { animation: cf-in .38s cubic-bezier(.2,.8,.2,1) both; }
body.is-leaving main { transition: opacity .2s, transform .2s; opacity: 0; transform: translateY(-10px) scale(.985); }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  html.no-vt main, .gauge-fill, .bar, .orb, .live-pill i { animation-duration: 0.01ms !important; animation-delay: 0s !important; }
}

/* ---------- Capacity-needed callout ---------- */
.need { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; padding: 12px 14px; border-radius: 10px; border: 1px dashed var(--axis); font-size: 0.88rem; color: var(--ink-2); }
.need strong { color: var(--ink); font-size: 1.05rem; }

/* ---------- Print / PDF report ---------- */
.print-only { display: none; }
@media print {
  @page { margin: 14mm; }
  :root { color-scheme: light; }
  body { background: #fff !important; color: #000; font-size: 11pt; }
  .nav, .footer, .flashes, .no-print, .ask-fab, .assistant, .palette, .tool-tabs, .toolbar, .seg,
  #planner-form, details.panel, .plan-actions, .btn { display: none !important; }
  .print-only { display: block; }
  .card { box-shadow: none !important; break-inside: avoid; }
  .split, .split-plan, .split-1-2 { display: block !important; }
  .stack > * + * { margin-top: 10px; }
  .page-head { padding: 0 0 8px; }
  a { color: #000; text-decoration: none; }
  .chart-box { height: 240px !important; }
}

/* Mobile fixes: keep grid tracks shrinkable and the nav compact. */
.launch, .launch-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .launch-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); } }
.launch-copy, .monitor { min-width: 0; }
@media (max-width: 900px) { .nav-actions .nav-cta { display: none; } }
@media (max-width: 640px) {
  .nav-actions .search-btn { display: none; }
  .nav-inner { gap: 12px; }
  .ask-bar input::placeholder { font-size: 0.9rem; }
}
.launch > * { min-width: 0; }
@media (max-width: 640px) {
  .launch-tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .tile-txt span, .tile-go { display: none; }
  .tile-txt strong { font-size: 0.9rem; }
}

/* What-if block */
.whatif { margin-top: 6px; padding-top: 14px; border-top: 1px dashed var(--line); }
.whatif-title { margin: 0 0 10px; font-size: 0.9rem; }

/* Block map */
.heat-bar { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: flex-end; justify-content: space-between; }
.heat-legend { display: grid; grid-template-columns: auto 180px auto; gap: 4px 8px; align-items: center; }
.heat-scale { height: 10px; border-radius: 5px; background: linear-gradient(90deg, #1c5cab, #6da7ec 35%, #c3c2b7 50%, #ec835a 70%, #b42323); }
.heat-ticks { grid-column: 2; display: flex; justify-content: space-between; }
.bd-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 70px; }
.bd-months span { position: relative; display: block; border-radius: 3px 3px 0 0; background: var(--c); min-height: 2px; }
.bd-months i { display: block; font-style: normal; font-size: 0.62rem; color: var(--ink-muted); text-align: center; margin-top: 2px; }
.bd-months .col { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bd-near { list-style: none; padding: 0; margin: 0; font-size: 0.86rem; }
.bd-near li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.bd-near li:last-child { border-bottom: 0; }
#block-rows tr { cursor: pointer; }
#block-rows tr.sel { background: var(--brand-soft); }

/* Offline indicator */
html.is-offline .nav::after {
  content: "Offline · showing saved figures"; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  background: var(--status-warning); color: #1a1300; font: 700 0.74rem var(--font); padding: 3px 12px; border-radius: 0 0 8px 8px;
}

/* Tailwind home: the footer sits directly under the dark page. */
body.home-tw .footer { margin-top: 0; }
/* Dark nav on the dark home page (light and dark theme alike). */
body.home-tw .nav {
  --surface: #0f172a; --surface-2: #1e293b; --ink: #f1f5f9; --ink-2: #cbd5e1; --ink-muted: #94a3b8; --line: #1e293b;
  background: rgba(2, 6, 23, 0.92); border-bottom-color: #1e293b; color-scheme: dark;
}
body.home-tw .nav .wordmark { color: #f1f5f9; }

/* ---------- Field view: farmers, FPOs and store owners ----------
   Plain-language tiles first; dense data sits behind "Advanced Data & Methodology".
   Traffic lights always pair colour with a shape and words. Touch targets >= 48px. */
.fv-actions { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.fv-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.fv-tile h2, .fv-act h2 { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: 1.02rem; line-height: 1.3; }
.fv-tile h2 > span, .fv-act h2 { display: flex; flex-direction: column; }
.fv-icon { flex: none; color: var(--ink-2); margin-top: 1px; }
.fv-label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.fv-select, .fv-btn { min-height: 48px; font-size: 1rem; }
.fv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; text-align: center; }
.fv-big { margin: 0; font-size: 1.6rem; font-weight: 750; letter-spacing: -0.01em; line-height: 1.2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.fv-line { margin: 0; color: var(--ink-2); line-height: 1.5; }
.fv-note { margin: 0; font-size: 0.8rem; color: var(--ink-muted); }
.fv-basis { margin: 10px 0 0; font-size: 0.85rem; color: var(--ink-2); }
.fv-h { font-size: 1.15rem; margin: 22px 0 12px; display: flex; flex-direction: column; }
.fv-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 10px 20px; }
.fv-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 22px 0 12px; }

/* Status: colour + shape + label. Text stays in ink for contrast. */
.fv-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 1rem; color: var(--ink); flex-wrap: wrap; }
.fv-status i { font-style: normal; font-size: 0.8rem; }
.fv-green { --fv: var(--status-good); }
.fv-yellow { --fv: var(--status-warning); }
.fv-red { --fv: var(--status-critical); }
.fv-status i { color: var(--fv); }

.fv-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fv-card { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--fv); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 6px; }
.fv-card h3 { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 1.05rem; }
.fv-card p { margin: 0; }
.fv-num { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.fv-sub { font-size: 0.85rem; font-weight: 400; color: var(--ink-2); }
.fv-card.is-mine { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Month strip: bar height = how full district storage is; peak and book-before marked. */
.fv-months { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; align-items: end; height: 84px; }
.fv-m { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 3px; }
.fv-bar { width: 100%; height: var(--h); min-height: 2px; background: var(--c); border-radius: 3px 3px 0 0; opacity: 0.85; }
.fv-m.lvl-good .fv-bar { background: var(--axis); }
.fv-mn { font-size: 0.72rem; color: var(--ink-muted); }
.fv-m.is-peak .fv-mn { color: var(--ink); font-weight: 800; }
.fv-m.is-peak .fv-bar { outline: 2px solid var(--ink); outline-offset: 1px; opacity: 1; }
.fv-m.is-book .fv-mn { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; color: var(--ink); font-weight: 700; }
.fv-key { margin: 0; font-size: 0.78rem; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fv-key-peak, .fv-key-book { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-left: 6px; }
.fv-key-peak { outline: 2px solid var(--ink); background: var(--status-critical); }
.fv-key-book { border-bottom: 2px solid var(--ink); }

/* Owner action cards: one number each, high contrast. */
.fv-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.fv-act { background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--fv, var(--ink)); border-radius: var(--radius-sm); padding: 16px; display: grid; gap: 6px; }
.fv-act .fv-big { font-size: 1.9rem; }
.fv-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fv-alerts li { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--status-critical); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 1.02rem; min-height: 48px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }

/* Progressive disclosure */
details.advanced { margin-top: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.advanced > summary { cursor: pointer; min-height: 48px; padding: 12px 18px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::after { content: "Show"; font-weight: 600; font-size: 0.85rem; color: var(--brand-ink); }
details.advanced[open] > summary::after { content: "Hide"; }
.advanced-body { padding: 0 18px 18px; }
.kpi-est-wrap { position: relative; display: grid; }
.kpi-est-wrap > .est-tag { position: absolute; top: 10px; right: 10px; }
.kpi-est-wrap > .card { border-style: dashed; }

/* Language: every translated label renders both strings; the chosen one shows.
   The <head> script sets data-lang before paint, so nothing flashes or shifts on load. */
.t-hi { display: none; }
:root[data-lang="hi"] .t-en { display: none; }
:root[data-lang="hi"] .t-hi { display: inline; }
:root[data-lang="hi"] body { line-height: 1.6; }   /* Devanagari needs a little more leading */

.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 2px; }
.lang-switch button {
  min-height: 48px; min-width: 48px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--ink-2); font: 600 0.86rem var(--font); cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.lang-switch button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

/* Field use on phones: comfortable touch targets for every button and dropdown. */
@media (pointer: coarse) {
  .btn, .btn-sm, select.input, .seg button, details.panel > summary, .tool-tabs a, .assistant-suggest button { min-height: 48px; }
  .btn, .btn-sm, .tool-tabs a { display: inline-flex; align-items: center; justify-content: center; }
}

/* ---------- Voice controls: read aloud and speak a block name ----------
   48px targets for field use; state shown by icon, label and outline, not colour alone. */
.fv-say-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.say-btn, .mic-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; min-width: 48px;
  padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: 600 0.86rem var(--font); cursor: pointer; flex: none;
}
.say-btn:hover, .mic-btn:hover { color: var(--ink); background: var(--surface-2); }
.say-btn:focus-visible, .mic-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.say-btn.is-speaking, .mic-btn.is-listening { color: var(--ink); border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }
.mic-btn { padding: 0; width: 48px; }
.mic-btn.is-listening svg { animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .mic-btn.is-listening svg { animation: none; } }
.voice-field { display: flex; gap: 8px; align-items: stretch; }
.voice-field > select, .voice-field > input { flex: 1; min-width: 0; min-height: 48px; font-size: 1rem; }
.voice-status { margin: 4px 0 0; font-size: 0.88rem; color: var(--ink); }
.voice-toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); max-width: min(92vw, 520px); margin: 0;
  padding: 10px 14px; border-radius: 10px; background: var(--ink); color: var(--surface); font-size: 0.9rem; z-index: 60; }
.block-filter { border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
