/* Ops Hub v3 — consumes shared-base.css tokens, adds the hub layer. */

:root {
  --hub-rail: 232px;
  --rail-bg: #2d3a2e;
  --rail-ink: rgba(250, 248, 244, 0.86);
  --rail-ink-2: rgba(250, 248, 244, 0.5);
  --rail-line: rgba(255, 255, 255, 0.08);
  --rail-active: rgba(228, 170, 79, 0.16);

  --surface: #ffffff;
  --surface-2: #f3efe7;
  --ink: #2d3a32;
  --ink-2: #5a6b5f;
  --ink-3: #6f7d74;
  --line: rgba(102, 137, 113, 0.14);
  --line-strong: rgba(102, 137, 113, 0.28);

  --chart-tops: #2f8556;
  --chart-smalls: #a3aca6;
  --chart-target: #b8862a;
  --chart-grid: rgba(45, 58, 50, 0.1);
  --chart-text: #6f7d74;
  --chart-hover: rgba(102, 137, 113, 0.1);

  --good: #3f7f57;
  --warn: #9a7a2e;
  --bad: #b5493a;
  --good-bg: rgba(63, 127, 87, 0.12);
  --warn-bg: rgba(228, 170, 79, 0.16);
  --bad-bg: rgba(181, 73, 58, 0.12);

  --topo-ink: %232d3a2e;
  --topo-alpha: 0.05;
}

:root[data-theme="dark"] {
  --rail-bg: #0f1210;
  --surface: #1a1f1c;
  --surface-2: #161b18;
  --ink: rgba(255, 255, 255, 0.9);
  --ink-2: rgba(255, 255, 255, 0.62);
  --ink-3: rgba(255, 255, 255, 0.44);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);

  --chart-tops: #4fa06b;
  --chart-smalls: #6f7a73;
  --chart-target: #e4aa4f;
  --chart-grid: rgba(255, 255, 255, 0.07);
  --chart-text: rgba(255, 255, 255, 0.5);
  --chart-hover: rgba(255, 255, 255, 0.05);

  --good: #7fbf95;
  --warn: #e4aa4f;
  --bad: #e07b6b;
  --good-bg: rgba(127, 191, 149, 0.14);
  --warn-bg: rgba(228, 170, 79, 0.16);
  --bad-bg: rgba(224, 123, 107, 0.14);

  --topo-ink: %23ffffff;
  --topo-alpha: 0.035;
}

/* ---------- base ---------- */
html { scroll-behavior: smooth; }
body {
  display: grid;
  grid-template-columns: var(--hub-rail) minmax(0, 1fr);
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--topo-alpha);
  background-size: 600px 600px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600' viewBox='0 0 600 600'%3E%3Cg fill='none' stroke='%23668971' stroke-width='1'%3E%3Cellipse cx='300' cy='300' rx='60' ry='40' transform='rotate(-15 300 300)'/%3E%3Cellipse cx='300' cy='300' rx='110' ry='75' transform='rotate(-12 300 300)'/%3E%3Cellipse cx='300' cy='300' rx='165' ry='115' transform='rotate(-8 300 300)'/%3E%3Cellipse cx='300' cy='300' rx='225' ry='160' transform='rotate(-4 300 300)'/%3E%3Cellipse cx='300' cy='300' rx='290' ry='210'/%3E%3Cellipse cx='140' cy='160' rx='45' ry='30' transform='rotate(20 140 160)'/%3E%3Cellipse cx='140' cy='160' rx='90' ry='60' transform='rotate(18 140 160)'/%3E%3Cellipse cx='140' cy='160' rx='140' ry='95' transform='rotate(14 140 160)'/%3E%3Cellipse cx='480' cy='420' rx='55' ry='35' transform='rotate(-25 480 420)'/%3E%3Cellipse cx='480' cy='420' rx='100' ry='65' transform='rotate(-22 480 420)'/%3E%3Cellipse cx='480' cy='420' rx='150' ry='100' transform='rotate(-18 480 420)'/%3E%3Cpath d='M0 200 Q150 180 300 220 Q450 260 600 230'/%3E%3Cpath d='M0 350 Q100 320 250 360 Q400 400 600 370'/%3E%3Cpath d='M0 500 Q200 470 350 510 Q500 550 600 520'/%3E%3C/g%3E%3C/svg%3E");
}
:root[data-theme="dark"] body::after { opacity: 0.08; }

a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.mono { font-family: var(--font-mono); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.muted { color: var(--ink-3); }
.hidden { display: none !important; }

/* ---------- rail ---------- */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--rail-bg);
  color: var(--rail-ink);
  border-right: 1px solid var(--rail-line);
  z-index: 40;
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--rail-line);
}
.rail-brand img { width: 36px; height: 36px; border-radius: 50%; }
.rail-brand strong { display: block; font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.rail-brand span { display: block; font-size: 11px; color: var(--rail-ink-2); font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.rail-group { padding: 14px 12px 4px; }
.rail-group + .rail-group { border-top: 1px solid var(--rail-line); }
.rail-group .eyebrow { padding: 0 8px 8px; color: var(--rail-ink-2); }
.rail a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--rail-ink-2);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease;
}
.rail a:hover { color: var(--rail-ink); background: rgba(255, 255, 255, 0.05); }
.rail a[aria-current="page"] { color: var(--ro-gold); background: var(--rail-active); }
.rail a svg { width: 16px; height: 16px; flex: none; }
.rail-foot {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid var(--rail-line);
  font-size: 12px;
  color: var(--rail-ink-2);
}
.rail-foot .pulse { display: inline-flex; align-items: center; gap: 8px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 var(--good); }
.pulse-dot.live { animation: pulse 2.4s ease-out infinite; }
.pulse-dot.off { background: var(--bad); }
.pulse-dot.idle { background: var(--ink-3); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(127, 191, 149, 0.5); } 70% { box-shadow: 0 0 0 8px rgba(127, 191, 149, 0); } 100% { box-shadow: 0 0 0 0 rgba(127, 191, 149, 0); } }

/* ---------- main + topbar ---------- */
.main { min-width: 0; padding: 0 32px 72px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 -32px 8px;
  padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; width: 40px; height: 40px; border-radius: 8px; align-items: center; justify-content: center; }
.menu-btn:hover { background: var(--surface-2); }
.chips { display: flex; gap: 4px; padding: 3px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.chip {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease;
}
.chip:hover { color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.custom-range { display: none; align-items: center; gap: 6px; }
.custom-range.open { display: flex; }
.custom-range input {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}
.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.tb-btn:hover { color: var(--ink); }
.tb-btn:active { transform: scale(0.98); }
.tb-btn svg { width: 14px; height: 14px; }
.tb-btn.primary { background: var(--ro-green); border-color: var(--ro-green); color: #fff; }
.tb-btn.primary:hover { color: #fff; filter: brightness(1.06); }
.tb-spacer { flex: 1; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.clock { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- greeting ---------- */
.greeting { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 22px 0 6px; flex-wrap: wrap; }
.greeting h1 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 34px; line-height: 1.1; letter-spacing: -0.01em; }
.greeting .eyebrow { font-size: 12px; }

/* ---------- sections ---------- */
.sec { margin-top: 28px; }
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-strong);
}
.sec-head h2 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 24px; line-height: 1; letter-spacing: -0.005em; }
.sec-head .sec-meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.sec-head .sec-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--ink-3); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 14px; height: 14px; }
.sec.collapsed .sec-body { display: none; }
.sec.collapsed .icon-btn.collapse svg { transform: rotate(-90deg); }
.sec-body { transition: opacity 0.2s ease; }
body[data-loading="1"] .sec-body.stale { opacity: 0.55; }

/* ---------- cards & tiles ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-title h3 { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.card-title a { font-size: 12px; color: var(--ink-3); text-decoration: none; }
.card-title a:hover { color: var(--ink); text-decoration: underline; }
.tile { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tile .label { font-size: 12px; color: var(--ink-3); }
.tile .value { font-family: var(--font-mono); font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; white-space: nowrap; }
.tile .value small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.tile .sub { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--ink-3); background: var(--surface-2); }
.delta.up.is-bad { color: var(--bad); background: var(--bad-bg); }
.delta.down.is-good { color: var(--good); background: var(--good-bg); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.good { color: var(--good); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--bad); }
.status.none { color: var(--ink-3); }
.meter { position: relative; height: 6px; border-radius: 3px; background: var(--green-dim); overflow: hidden; }
.meter > span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--ro-green); transition: width 0.6s var(--ease-out-expo, ease); }
.meter.warn { background: var(--gold-dim); }
.meter.warn > span { background: var(--ro-gold); }
.meter.bad { background: var(--danger-dim); }
.meter.bad > span { background: var(--danger); }
.card-link { display: block; text-decoration: none; color: inherit; border-radius: 10px; transition: transform 0.15s ease; }
.card-link:hover { transform: translateY(-2px); }
.card-link:hover .card { border-color: var(--line-strong); }
.card-link .card { height: 100%; }
#chatLock[data-state="open"] { color: var(--good); }
#chatLock[data-state="open"] .shackle { transform: translateX(3px) rotate(-20deg); transform-origin: 16px 11px; }
.empty { font-size: 13px; color: var(--ink-3); padding: 10px 0; }
.empty a { color: var(--ink-2); }
.err { font-size: 12px; color: var(--bad); }

/* ---------- Right now ---------- */
.now-grid { display: grid; grid-template-columns: minmax(300px, 1.5fr) repeat(4, minmax(150px, 1fr)); gap: 14px; }
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 0%, var(--green-dim), transparent 60%);
  pointer-events: none;
}
.hero .strain { font-family: var(--font-display); font-style: italic; font-size: 17px; color: var(--ink-2); }
.hero .big { display: flex; align-items: baseline; gap: 10px; }
.hero .big .n { font-family: var(--font-mono); font-size: 68px; font-weight: 600; line-height: 1; letter-spacing: -0.03em; }
.hero .big .u { font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.hero .sub { font-size: 13px; color: var(--ink-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero .meter { height: 8px; margin-top: 4px; }
.hero .pace { font-size: 13px; color: var(--ink-2); }
.hero .pace strong { color: var(--ink); font-weight: 600; }
.now-grid .card.tile { justify-content: space-between; }

/* ---------- ledger ---------- */
.ledger-frame { position: relative; }
.ledger-wrap { overflow-x: auto; padding-bottom: 4px; }
.ledger { display: block; min-width: 640px; font-family: var(--font-mono); }
.ledger text { fill: var(--ink-2); font-size: 11px; }
.ledger .row-label { fill: var(--ink-3); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.ledger .col-label { fill: var(--ink); font-size: 12px; font-weight: 600; }
.ledger .col-sub { fill: var(--ink-3); font-size: 10px; }
.ledger .v-tops { fill: var(--ink); font-weight: 600; }
.ledger .v-dim { fill: var(--ink-3); }
.ledger .grid { stroke: var(--chart-grid); stroke-width: 1; }
.ledger .base { stroke: var(--line-strong); stroke-width: 1; }
.ledger .bar-tops { fill: var(--chart-tops); }
.ledger .bar-smalls { fill: var(--chart-smalls); }
.ledger .tgt { stroke: var(--chart-target); stroke-width: 1.5; }
.ledger .dot { stroke: var(--surface); stroke-width: 2; }
.ledger .dot.good { fill: var(--chart-tops); }
.ledger .dot.warn { fill: var(--chart-target); }
.ledger .dot.plain { fill: var(--chart-tops); }
.ledger .rate-link { stroke: var(--chart-tops); stroke-width: 1.5; fill: none; opacity: 0.6; }
.ledger .flag { fill: var(--chart-target); }
.ledger .col-hit { fill: transparent; }
.ledger .col-bg { fill: transparent; }
.ledger .col-bg.current { fill: var(--green-dim); }
.ledger .col-bg.hover { fill: var(--chart-hover); }
.ledger-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.ledger-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ledger-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.ledger-legend i.tops { background: var(--chart-tops); }
.ledger-legend i.smalls { background: var(--chart-smalls); }
.ledger-legend i.tgt { height: 2px; width: 14px; background: var(--chart-target); border-radius: 1px; }
.ledger-legend i.flag { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--chart-target); background: none; border-radius: 0; }
.notes { margin-top: 14px; display: grid; gap: 6px; }
.note { display: grid; grid-template-columns: 64px 1fr; gap: 12px; font-size: 13px; color: var(--ink-2); }
.note .when { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); padding-top: 2px; }
.note .body { white-space: pre-line; }

/* ---------- charts ---------- */
.chart-host { position: relative; width: 100%; }
.chart-host svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-host text { fill: var(--chart-text); font-family: var(--font-mono); font-size: 11px; }
.chart-host .grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-host .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-host .bar-tops { fill: var(--chart-tops); }
.chart-host .bar-smalls { fill: var(--chart-smalls); }
.chart-host .tgt { stroke: var(--chart-target); stroke-width: 1.5; }
.chart-host .line { stroke: var(--chart-tops); stroke-width: 2; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart-host .line.ma { stroke: var(--chart-smalls); }
.chart-host .area { fill: var(--chart-tops); opacity: 0.1; }
.chart-host .dot { fill: var(--chart-tops); stroke: var(--surface); stroke-width: 2; }
.chart-host .hover-bg { fill: var(--chart-hover); }
.chart-host .hit { fill: transparent; }
.chart-host .end-label { fill: var(--ink); font-weight: 600; }
.tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  min-width: 140px;
  /* A mixed day can name four cultivars in the title; without a ceiling the
     whole box stretches to fit one line. */
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-md);
  font-size: 12px;
  color: var(--ink-2);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.tip.on { opacity: 1; transform: translateY(0); }
.tip .t { font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 12px; }
.tip .r b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.tip .r i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.tip .r i.tops { background: var(--chart-tops); }
.tip .r i.smalls { background: var(--chart-smalls); }
.tip .r i.tgt { background: var(--chart-target); }
.tip .n { margin-top: 6px; font-size: 11px; color: var(--ink-3); white-space: pre-line; max-width: 260px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend i.tops { background: var(--chart-tops); }
.legend i.smalls { background: var(--chart-smalls); }
.legend i.ma { background: var(--chart-smalls); height: 2px; width: 14px; }
.legend i.tgt { background: var(--chart-target); height: 2px; width: 14px; }

/* ---------- pipe / watch ---------- */
.pipe-grid { display: grid; grid-template-columns: 1.1fr 1.4fr 0.7fr; gap: 14px; }
.pipe-grid td:first-child { white-space: nowrap; }
.watch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.queue { display: grid; gap: 12px; }
.q-row { display: grid; gap: 6px; }
.q-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.q-head b { font-weight: 600; }
.q-head .ref { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); margin-left: 6px; }
.q-head .fin { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.q-nums { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.q-nums b { font-family: var(--font-mono); color: var(--ink); font-weight: 500; }
.q-passes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.q-pass { font-family: var(--font-mono); font-size: 10.5px; padding: 2px 7px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.q-pass.done { color: var(--good); border-color: transparent; background: var(--good-bg); }
.q-pass.active { color: var(--ink); border-color: var(--line-strong); }
table.grid-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.grid-table th { text-align: left; font-family: var(--font-mono); font-weight: 500; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 6px 8px 8px 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.grid-table td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid-table tr:last-child td { border-bottom: 0; }
table.grid-table td.n, table.grid-table th.n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
table.grid-table td.n { color: var(--ink); }
table.grid-table td.dim { color: var(--ink-3); }
table.grid-table tr.short td:first-child { color: var(--bad); font-weight: 600; }
.table-scroll { overflow-x: auto; }
.list { display: grid; gap: 6px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.list li { list-style: none; display: flex; justify-content: space-between; gap: 8px; }
.list li span:last-child { font-family: var(--font-mono); color: var(--ink-3); font-size: 11px; white-space: nowrap; }

/* ---------- trend / cost / daily ---------- */
.trend-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
.lower-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 14px; }
.cost-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.cost-grid .tile .value { font-size: 22px; }
.daily-actions { display: flex; gap: 8px; align-items: center; }
.cultivar-name { font-weight: 500; }
.cultivar-name small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.bar-inline { display: inline-block; height: 6px; border-radius: 3px; background: var(--chart-tops); vertical-align: middle; margin-right: 6px; }

/* ---------- chat drawer ---------- */
.chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ro-green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: transform 0.15s ease;
}
.chat-fab:hover { transform: translateY(-2px); }
.chat-fab svg { width: 22px; height: 22px; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  transition: transform 0.25s var(--ease-out-expo, ease);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 20px; }
.drawer-head .eyebrow { display: block; }
.drawer-head .grow { flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--ro-green); color: #fff; border-bottom-right-radius: 3px; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.msg.err { align-self: stretch; background: var(--bad-bg); color: var(--bad); font-size: 12.5px; }
.msg.typing span { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 10px; }
.quick button { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); }
.quick button:hover { color: var(--ink); background: var(--surface-2); }
.drawer-foot { display: flex; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.drawer-foot input { flex: 1; font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); }
.drawer-foot button { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.drawer-foot button:hover { color: var(--ink); background: var(--surface-2); }
.drawer-foot button.send { background: var(--ro-green); border-color: var(--ro-green); color: #fff; }
.drawer-foot button[aria-pressed="true"] { color: var(--ro-gold); border-color: var(--ro-gold); }
.drawer-foot button svg { width: 16px; height: 16px; }
.drawer-foot button.listening { color: var(--bad); border-color: var(--bad); }
.scrim { position: fixed; inset: 0; z-index: 65; background: rgba(0, 0, 0, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.scrim.on { opacity: 1; pointer-events: auto; }

/* ---------- unlock dialog ---------- */
dialog.unlock { border: 1px solid var(--line-strong); border-radius: 12px; padding: 0; background: var(--surface); color: var(--ink); width: min(380px, 92vw); box-shadow: var(--shadow-lg); }
dialog.unlock::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog.unlock form { padding: 22px; display: grid; gap: 12px; }
dialog.unlock h3 { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 22px; }
dialog.unlock p { font-size: 13px; color: var(--ink-2); }
dialog.unlock input { font: inherit; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink); }
dialog.unlock .row { display: flex; gap: 8px; justify-content: flex-end; }
dialog.unlock .err { min-height: 16px; }

/* ---------- skeleton ---------- */
.skel { display: inline-block; height: 1em; width: 60%; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .now-grid { grid-template-columns: 1fr 1fr 1fr; }
  .now-grid .hero { grid-column: 1 / -1; }
  .pipe-grid { grid-template-columns: 1fr 1fr; }
  .pipe-grid > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 1024px) {
  .trend-grid, .lower-grid { grid-template-columns: 1fr; }
  .watch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .rail { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform 0.25s var(--ease-out-expo, ease); }
  body.nav-open .rail { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .main { padding: 0 16px 72px; }
  .topbar { margin: 0 -16px 8px; padding: 10px 16px; }
  .clock { display: none; }
  .greeting h1 { font-size: 28px; }
  .hero .big .n { font-size: 52px; }
  .now-grid { grid-template-columns: 1fr 1fr; }
  .pipe-grid { grid-template-columns: 1fr; }
  .pipe-grid > :last-child { grid-column: auto; }
  .cost-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .now-grid, .watch-grid { grid-template-columns: 1fr; }
  .chips { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .rail, .topbar, .chat-fab, .drawer, .scrim { display: none !important; }
  body { grid-template-columns: 1fr; }
  .card { box-shadow: none; }
}
