/* Soil to Signal deck — tokens and layout from the Claude Design mockup.
   Landscape, always-on, read from a metre away. Dark is the default. */

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

:root, #deck[data-theme="dark"] {
  --bg: oklch(0.185 0.028 142); --panel: oklch(0.235 0.03 143); --panel2: oklch(0.278 0.032 143);
  --border: oklch(0.34 0.03 141);
  --ink: oklch(0.95 0.016 85); --dim: oklch(0.775 0.022 80); --faint: oklch(0.615 0.022 80);
  --sage: #7A9E4E; --olive: #6B8C42; --terracotta: #C07848; --gold: #D4A828;
  --red: oklch(0.62 0.21 27.325); --frost: #8FB0C6; --wet: #5E9488; --grid: oklch(0.27 0.026 142);
}
#deck[data-theme="dark"] img.brandmark { filter: brightness(1.75) saturate(0.95); }
#deck[data-theme="light"] {
  --bg: oklch(0.965 0.022 85); --panel: oklch(0.985 0.008 85); --panel2: oklch(0.945 0.018 80);
  --border: oklch(0.875 0.022 80);
  --ink: oklch(0.145 0 0); --dim: oklch(0.50 0.035 60); --faint: oklch(0.62 0.03 60);
  --sage: #6B8C42; --olive: #4A6530; --terracotta: #C07848; --gold: #A8821C;
  --red: #B24230; --frost: #4E7C8C; --wet: #3F6E63; --grid: oklch(0.905 0.02 80);
}

html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Work Sans", system-ui, sans-serif; font-size: 14px; }
#deck { height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); }
h1, h2, h3 { font-family: "Cormorant Garamond", Georgia, serif; font-weight: 500; margin: 0; }
h2 { font-size: 26px; }
h3 { font-size: 30px; }
h4, .label { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; }
.label.gold, .gold { color: var(--gold); }
p { margin: 0 0 8px; line-height: 1.45; }
.muted { color: var(--dim); }
.small { font-size: 12px; }
.faint { color: var(--faint); }
.spacer { flex: 1 1 auto; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
kbd { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--faint); font-weight: 400; }

/* header */
.top { height: 58px; flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 0 14px; border-bottom: 1px solid var(--border); background: var(--panel); }
.brandmark { height: 44px; width: auto; display: block; }
.brandmark.pq { height: 40px; }
#nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
#nav button, .btn { display: inline-flex; align-items: center; gap: 7px; height: 48px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--dim); font: 500 14px "Work Sans", sans-serif; cursor: pointer; white-space: nowrap; }
#nav button.on { border-color: var(--olive); background: var(--panel2); color: var(--ink); }
.btn.gold { color: var(--gold); border-color: var(--gold); }
.btn.primary { background: var(--olive); border-color: var(--olive); color: #fff; }
.btn.primary kbd { color: rgba(255,255,255,0.7); }
.btn:disabled { opacity: 0.45; cursor: default; }
.clock { font-family: ui-monospace, Menlo, monospace; font-size: 22px; font-weight: 500; letter-spacing: 0.02em; }

/* alerts */
.alerts { display: flex; gap: 10px; padding: 10px 14px 0; align-items: stretch; }
.alert { flex: 1; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--terracotta); }
.alert.silent { border-left-color: var(--red); }
.alert .label { margin: 0; white-space: nowrap; }
.alert.silent .label { color: var(--red); }
.alert.stuck .label { color: var(--terracotta); }
.alert.dry { border-left-color: var(--gold); }
.alert.dry .label { color: var(--gold); }
.alerts .btn { height: auto; flex: 0 0 auto; }

/* main */
#main { flex: 1 1 auto; min-height: 0; padding: 10px 14px; display: flex; overflow: hidden; }
.view { flex: 1; display: flex; gap: 10px; min-height: 0; }
.view[hidden] { display: none; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel.grow { flex: 1; }
.panel-foot { margin-top: auto; font-family: ui-monospace, Menlo, monospace; font-size: 10px; letter-spacing: 0.12em; color: var(--faint); }
.big-dash { font-family: "Cormorant Garamond", serif; font-size: 28px; color: var(--faint); margin-bottom: 6px; }

/* home */
.beds { flex: 3; display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: auto; }
.bed-card { flex: 1 1 0; max-height: 260px; min-height: 96px; display: grid; grid-template-columns: 1.1fr 1fr 1.4fr 1.1fr; gap: 12px; align-items: center; padding: 14px 18px; }
.bed-card.silent { opacity: 0.55; }
.bed-card h2 { font-size: 30px; line-height: 1; margin-bottom: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-family: ui-monospace, Menlo, monospace; font-size: 11px; padding: 3px 8px; border-radius: 10px; background: var(--panel2); color: var(--dim); }
.chip.warn { color: var(--terracotta); }
.chip.bad { color: var(--red); }
.chip.ok { color: var(--sage); }
.ok { color: var(--sage); }
.warn { color: var(--terracotta); }
.bignum { font-family: "Cormorant Garamond", serif; font-size: 64px; line-height: 1; color: var(--gold); white-space: nowrap; }
.bignum.pct { color: var(--sage); }
.bignum.pct.dry { color: var(--terracotta); }
.bignum.pct.wet { color: var(--wet); }
.bignum.stale, .bignum.stuck, .bignum.none { color: var(--dim); }
.bignum .unit { font-size: 0.55em; margin-left: 4px; }
.bed-status .label { margin-bottom: 4px; }
.bed-status .label.stale { color: var(--dim); }
.bed-status .label.stuck { color: var(--terracotta); }
.bed-status .label.pct { color: var(--sage); }
.bed-status .label.none { color: var(--faint); }
.bed-status p { font-size: 12px; color: var(--dim); margin: 0; }
.bad { color: var(--red); }
/* change over the last 24 h under the number: minus is drying */
.delta-line { margin-top: 6px; font-size: 13px; white-space: nowrap; }
.delta { font-weight: 500; }
.delta.drying { color: var(--terracotta); }
.delta.wetting { color: var(--wet); }
/* moisture bar with the dry line as a tick: the % needs a reference to mean anything */
.bar { position: relative; height: 10px; border-radius: 5px; background: var(--panel2); overflow: visible; margin: 2px 0 4px; }
.bar i { display: block; height: 100%; border-radius: 5px; background: var(--sage); }
.bar.dry i { background: var(--terracotta); }
.bar.wet i { background: var(--wet); }
.bar b { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); opacity: 0.7; }
.bar-label { display: flex; justify-content: space-between; white-space: nowrap; gap: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
/* one line in plain words; the largest text in the status column */
.verdict { font-family: "Cormorant Garamond", serif; font-size: 24px; line-height: 1.1; margin-bottom: 4px; color: var(--sage); }
.verdict.warn { color: var(--terracotta); }
.verdict.bad { color: var(--red); }
.verdict.none { color: var(--faint); font-size: 18px; }
.spark { display: flex; flex-direction: column; gap: 4px; }
.spark svg { width: 100%; height: 46px; display: block; }
.spark .label { display: flex; justify-content: space-between; margin: 0; color: var(--faint); }

/* pots */
.pots-panel { flex: 3; }
.cal-panel { flex: 2; max-width: 400px; }
.cal-panel .bench-head { margin-bottom: 0; }
.cal-note { margin: 10px 0 0; }
/* the read-only mirror (public_port) has no calibration and no event log */
.readonly #cal-btn, .readonly #feed-btn, .readonly #water-btn { display: none; }
#cal-btn.on { border-color: var(--olive); background: var(--panel2); color: var(--ink); }
.bed-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bed-head h2 { font-size: 28px; white-space: nowrap; }
#pots-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.seg { display: flex; gap: 4px; }
.seg[hidden] { display: none; }
.seg button { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--dim); font: 500 13px "Work Sans", sans-serif; cursor: pointer; }
.seg button.on { border-color: var(--olive); background: var(--panel2); color: var(--ink); }
.chart-head { display: flex; justify-content: space-between; }
.chart { flex: 1; min-height: 0; }
.chart svg { width: 100%; height: 100%; display: block; }
.probe-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 10px; }
.probe-card { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.probe-card .label { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 2px; white-space: nowrap; }
.probe-card .val { font-family: "Cormorant Garamond", serif; font-size: 26px; color: var(--gold); line-height: 1.1; }
.probe-card .val.pct { color: var(--sage); }
.probe-card .val.stuck { color: var(--terracotta); }
.probe-card .val.none { color: var(--faint); }
.probe-card p { font-size: 11px; color: var(--dim); margin: 2px 0 0; }
.probe-card.stuck { border-color: var(--terracotta); }
.probe-card { cursor: pointer; border-left: 3px solid var(--pot, var(--border)); }
.probe-card.on { background: var(--panel); border-color: var(--pot, var(--olive)); box-shadow: 0 0 0 1px var(--pot, var(--olive)); }
.probe-card .val.none, .probe-card .val.stale { color: var(--faint); }
.probe-card .val.pct.dry { color: var(--terracotta); }
.probe-card .val.pct.wet { color: var(--wet); }
.probe-card .val .unit { font-size: 0.6em; }
.bed-foot { margin-top: 8px; font-size: 12px; }

/* tables / calibration */
.bench-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-family: ui-monospace, Menlo, monospace; font-size: 10px; letter-spacing: 0.12em; color: var(--dim); font-weight: 400; padding: 6px 8px; border-bottom: 1px solid var(--border); }
td { padding: 10px 8px; border-bottom: 1px solid var(--grid); font-family: ui-monospace, Menlo, monospace; font-size: 15px; vertical-align: middle; }
td.dim { color: var(--dim); }
td.flag { font-size: 12px; color: var(--gold); }
td.flag.stuck { color: var(--terracotta); }
td.flag.ok { color: var(--sage); }
td svg { width: 150px; height: 18px; display: block; }
tr.on td { background: var(--panel2); }
tr.pick { cursor: pointer; }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0 14px; }
.stepper div { font-size: 11px; color: var(--faint); border-top: 2px solid var(--border); padding-top: 6px; }
.stepper div span { display: block; font-family: ui-monospace, Menlo, monospace; font-size: 10px; margin-bottom: 2px; }
.stepper div.on { color: var(--ink); border-top-color: var(--sage); }
.stepper div.done { border-top-color: var(--olive); }
.cal-body { background: var(--panel2); border-radius: 8px; padding: 14px 16px; font-size: 15px; line-height: 1.45; }
.cal-body .bignum { font-size: 40px; margin: 8px 0 2px; }
.cal-body .bignum .sub { font-family: "Work Sans", sans-serif; font-size: 12px; color: var(--dim); margin-left: 10px; }
.cal-body pre { font-family: ui-monospace, Menlo, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; background: var(--panel); padding: 8px 10px; border-radius: 6px; margin: 6px 0; user-select: all; }
.cal-body .warn { color: var(--terracotta); }
.cal-body .err { color: var(--red); }
.cal-actions { display: flex; gap: 10px; }
.cal-actions .btn.primary { flex: 1; justify-content: center; }
.samples { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.samples span { font-family: ui-monospace, Menlo, monospace; font-size: 12px; padding: 2px 6px; background: var(--panel); border-radius: 4px; }

/* footer */
/* Touch screen: no key hints anywhere. The shortcuts still work with a keyboard. */
kbd { display: none; }
.foot { height: 26px; flex: 0 0 auto; display: flex; justify-content: flex-end; align-items: center; padding: 0 14px; border-top: 1px solid var(--border); font-size: 11px; color: var(--terracotta); }
.foot[hidden] { display: none; }
.btn.small { height: 34px; padding: 0 10px; font-size: 12px; }
.bed-foot { display: flex; align-items: center; gap: 10px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-box { width: 460px; gap: 10px; }
.modal-box input { height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--ink); font: 15px "Work Sans", sans-serif; }

@media (max-width: 1000px) {
  .bed-card { grid-template-columns: 1fr 1fr; max-height: none; }
}
