/* Vintry — vineyard management SPA
   Design tokens: chart chrome/ink per validated dataviz palette;
   brand accents: wine + leaf. Light/dark via prefers-color-scheme. */

:root {
  /* surfaces & ink (palette reference) */
  --page:           #f9f9f7;
  --surface:        #fcfcfb;
  --ink:            #0b0b0b;
  --ink-2:          #52514e;
  --muted:          #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);

  /* brand */
  --wine:           #6f2b3f;
  --wine-strong:    #5a2233;
  --on-wine:        #fff;
  --wine-wash:      rgba(111, 43, 63, 0.08);
  --leaf:           #3f7a34;
  --leaf-wash:      rgba(63, 122, 52, 0.10);

  /* categorical series (light) — fixed slot order, never cycled */
  --series-1:       #2a78d6;
  --series-2:       #1baf7a;
  --series-3:       #eda100;
  --series-4:       #008300;
  --series-5:       #4a3aa7;
  --series-6:       #e34948;
  --series-7:       #e87ba4;
  --series-8:       #eb6834;

  /* sequential blue (light picks) */
  --seq-250:        #86b6ef;
  --seq-450:        #2a78d6;
  --seq-600:        #184f95;

  /* status (fixed) */
  --status-good:    #0ca30c;
  --status-warn:    #fab219;
  --status-serious: #ec835a;
  --status-crit:    #d03b3b;

  --radius:         12px;
  --radius-sm:      8px;
  --shadow:         0 1px 2px rgba(11,11,11,0.04), 0 4px 16px rgba(11,11,11,0.05);
  --font:           system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --page:         #0d0d0d;
    --surface:      #1a1a19;
    --ink:          #ffffff;
    --ink-2:        #c3c2b7;
    --muted:        #898781;
    --grid:         #2c2c2a;
    --baseline:     #383835;
    --border:       rgba(255, 255, 255, 0.10);

    --wine:         #b06078;
    --wine-strong:  #c47c92;
    --on-wine:      #0d0d0d;
    --wine-wash:    rgba(176, 96, 120, 0.14);
    --leaf:         #6faf63;
    --leaf-wash:    rgba(111, 175, 99, 0.14);

    /* categorical series (dark steps) */
    --series-1:     #3987e5;
    --series-2:     #199e70;
    --series-3:     #c98500;
    --series-4:     #008300;
    --series-5:     #9085e9;
    --series-6:     #e66767;
    --series-7:     #d55181;
    --series-8:     #d95926;

    --seq-250:      #86b6ef;
    --seq-450:      #3987e5;
    --seq-600:      #184f95;

    --shadow:       0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.35);
  }
}
:root[data-theme="dark"] {
    --page:         #0d0d0d;
    --surface:      #1a1a19;
    --ink:          #ffffff;
    --ink-2:        #c3c2b7;
    --muted:        #898781;
    --grid:         #2c2c2a;
    --baseline:     #383835;
    --border:       rgba(255, 255, 255, 0.10);

    --wine:         #b06078;
    --wine-strong:  #c47c92;
    --on-wine:      #0d0d0d;
    --wine-wash:    rgba(176, 96, 120, 0.14);
    --leaf:         #6faf63;
    --leaf-wash:    rgba(111, 175, 99, 0.14);

    /* categorical series (dark steps) */
    --series-1:     #3987e5;
    --series-2:     #199e70;
    --series-3:     #c98500;
    --series-4:     #008300;
    --series-5:     #9085e9;
    --series-6:     #e66767;
    --series-7:     #d55181;
    --series-8:     #d95926;

    --seq-250:      #86b6ef;
    --seq-450:      #3987e5;
    --seq-600:      #184f95;

    --shadow:       0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }
/* hide scrollbars everywhere; scrolling (wheel/touch/drag) still works */
* { scrollbar-width: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- splash ---------- */
.splash {
  height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}
.splash-mark { font-size: 42px; }
.splash-text { font-size: 18px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.08em; }
/* hidden until the splash has lingered ~8s — a booted app replaces the
   whole splash long before this reveals */
.splash-reset {
  margin-top: 20px; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  font-size: 13px; color: var(--wine); background: transparent;
  border: 1px solid color-mix(in srgb, var(--wine) 35%, transparent);
  opacity: 0; pointer-events: none;
  animation: splash-reset-in 0.3s ease 8s forwards;
}
@keyframes splash-reset-in { to { opacity: 1; pointer-events: auto; } }
.boot-recovery { display: flex; flex-direction: column; align-items: center; gap: 14px;
                 text-align: center; max-width: 340px; padding: 0 20px; }
.boot-recovery p { color: var(--ink-2); font-size: 14px; line-height: 1.5; }

/* ---------- shell ---------- */
.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 16px; letter-spacing: 0.02em;
  color: var(--wine);
  /* it's a button now (→ landing) */
  appearance: none; background: none; border: none; cursor: pointer;
  font-family: inherit; padding: 0;
  white-space: nowrap;
}
.brand .grape { font-size: 20px; }

.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-item {
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500;
  color: var(--ink-2);
  padding: 6px 12px; border-radius: 999px;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background 0.15s, color 0.15s;
}
.nav-item .nav-icon { margin-right: 0; }
.drawer-item { line-height: 1; }
.nav-item:hover { background: var(--wine-wash); color: var(--ink); }
.nav-item.active { background: var(--wine); color: var(--on-wine); }

.locale-switch { display: flex; gap: 1px; border: 1px solid var(--border); border-radius: 999px; padding: 2px; }
.locale-switch button {
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 2px 8px; border-radius: 999px;
}
.locale-switch button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* full-width scroll container so the wheel works over the side gutters too;
   content is centred with responsive padding instead of max-width + margin */
.main { flex: 1; width: 100%; padding: 24px max(20px, calc((100% - 1040px) / 2)) 64px; overflow-y: auto; }
.main.full { padding: 0; margin: 0; position: relative; overflow: hidden; min-height: 0; }

/* ---------- typography ---------- */
h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
/* entity title: name + variety badge + edit/delete tools on one centred row */
h1.title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
h1.title-row > span { margin-right: 2px; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 24px; }
.section { margin-top: 32px; }

/* ---------- cards & tiles ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.tile-row {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 24px;
}
.tile { padding: 14px 16px; }
.tile-label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.tile-value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.tile-value small { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.tile-hint { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.tile-hint.good { color: var(--leaf); }
.tile-hint.warn { color: var(--status-serious); }

/* ---------- chart ---------- */
.chart-card { padding: 16px 18px 10px; }
.chart-title { font-size: 14px; font-weight: 650; margin-bottom: 2px; }
.chart-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font); }
.tick-label { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.bar-label { font-size: 11px; font-weight: 600; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.axis-line { stroke: var(--baseline); stroke-width: 1; }
.bar { fill: var(--seq-450); }
.bar.dim { opacity: 0.45; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--ink); color: var(--page);
  font-size: 12px; font-weight: 500;
  padding: 4px 8px; border-radius: 6px;
  transform: translate(-50%, -130%);
  white-space: nowrap;
}

/* ---------- fill meters ---------- */
.meter-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.meter-name { flex: 0 0 150px; font-size: 13.5px; font-weight: 500; }
.meter-track { flex: 1; height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; background: var(--seq-450); }
.meter-fill.low { background: var(--status-serious); }
.meter-val { flex: 0 0 88px; text-align: right; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11.5px; font-weight: 650;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); padding: 8px 10px;
  border-bottom: 1px solid var(--baseline);
}
td { padding: 8px 10px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--wine-wash); }

/* ---------- badges & tags ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
  background: var(--leaf-wash); color: var(--leaf);
}
.badge.wine { background: var(--wine-wash); color: var(--wine); }
.badge.muted { background: var(--grid); color: var(--ink-2); }
.badge.ok   { background: color-mix(in srgb, var(--leaf) 16%, transparent); color: var(--leaf); }
.badge.warn { background: color-mix(in srgb, var(--status-serious) 18%, transparent); color: var(--status-serious); }
.badge.crit { background: color-mix(in srgb, var(--status-crit) 16%, transparent); color: var(--status-crit); }
.swatch { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.tag-disease { background: rgba(208,59,59,0.12); color: var(--status-crit); }
.tag-weather { background: rgba(42,120,214,0.12); color: var(--series-1); }
.tag-observation { background: var(--leaf-wash); color: var(--leaf); }
.tag-idea { background: rgba(237,161,0,0.14); color: #a06d00; }
@media (prefers-color-scheme: dark) {
  .tag-idea { color: #eda100; }
}

/* ---------- notes ---------- */
.note-list { display: flex; flex-direction: column; gap: 10px; }
.note-card { display: flex; flex-direction: column; gap: 6px; }
.note-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.note-date { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.note-target { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
/* break unbroken strings (URLs, long tokens) so one word can't stretch the
   card — overflow-wrap: anywhere also lets the column shrink to fit */
.note-text { font-size: 14px; overflow-wrap: anywhere; }

/* ---------- forms ---------- */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 140px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
/* Every text-ish input, listed explicitly. NOT a bare `input` selector —
   that catches checkboxes and radios and wrecks them. This list was
   missing email/password/search/tel, which is why the beta request's email
   field and the AI settings' API-key field rendered as raw browser boxes
   next to properly styled neighbours. */
input[type="text"], input[type="number"], input[type="date"],
input[type="email"], input[type="password"], input[type="search"],
input[type="tel"], input[type="url"], select, textarea {
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--page);
  border: 1px solid var(--baseline);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  outline: none;
  box-sizing: border-box;
  height: 38px;
}
input:focus, select:focus, textarea:focus { border-color: var(--wine); }
textarea { resize: vertical; min-height: 60px; height: auto; padding: 8px 10px; }
.btn {
  appearance: none; cursor: pointer; font: inherit;
  font-size: 14px; font-weight: 600;
  border: none; border-radius: var(--radius-sm);
  padding: 9px 18px;
  background: var(--wine); color: var(--on-wine);
  transition: background 0.15s;
}
.btn:hover { background: var(--wine-strong); }
.btn.ghost { background: none; color: var(--wine); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--wine-wash); }
.btn.small { font-size: 12.5px; padding: 5px 12px; }

/* ---------- parcel detail: row strips ---------- */
.rows-viz { display: flex; flex-direction: column; gap: 5px; }
.row-strip { display: flex; align-items: center; gap: 8px; }
.row-n { flex: 0 0 28px; text-align: right; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-bays { display: flex; gap: 2px; height: 14px; }
.bay-seg { border-radius: 3px; background: var(--seq-450); min-width: 6px; }
.bay-seg.partial { background: var(--seq-250); }
.bay-seg.empty { background: var(--status-serious); }
.bay-seg.nonstandard { background: var(--muted); }
.bay-seg:hover { outline: 2px solid var(--wine); outline-offset: 1px; }
.rows-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.rows-legend span { display: inline-flex; align-items: center; gap: 6px; }

.backlink {
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; color: var(--wine);
  padding: 0; margin-bottom: 12px; display: inline-flex; align-items: center; gap: 4px;
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--ink-2); }
.kv .v { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- 3D map ---------- */
.map-page { position: absolute; inset: 0; }
.map-page:fullscreen { width: 100%; height: 100%; background: var(--page); }
.map-container { position: absolute; inset: 0; }
.map-container canvas { display: block; }

.map-hud {
  position: absolute; top: 14px; left: 14px; z-index: 5;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.map-hud .hud-group {
  display: flex; gap: 2px; padding: 3px;
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow);
}
.hud-btn {
  appearance: none; border: none; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  background: none; padding: 5px 10px; border-radius: 7px;
  white-space: nowrap;
}
.hud-btn:hover { background: var(--wine-wash); color: var(--ink); }
.hud-btn.active { background: var(--wine); color: var(--on-wine); }

/* legend dock: round toggle in the corner, panel pops above it */
.legend-dock {
  position: absolute; bottom: 14px; left: 14px; z-index: 5;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.legend-dock .map-legend { animation: legend-pop 0.16s ease-out both; }
@keyframes legend-pop {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
/* touch: no hover — give the tap-to-pin rows a real finger target */
@media (pointer: coarse) {
  .map-legend .item.hoverable { padding: 7px 8px; }
}

.map-legend {
  display: flex; flex-direction: column; gap: 4px;
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 12px; color: var(--ink-2);
  box-shadow: var(--shadow);
}
.map-legend .item { display: flex; align-items: center; gap: 7px; }

/* gap-mode pick popover: bottom-centre confirm for mark-gap / replant */
.map-pick {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  z-index: 7; min-width: min(360px, calc(100% - 28px));
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow);
}
.map-pick-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--wine);
}
.map-pick .form-row { align-items: center; }

.map-panel {
  position: absolute; top: 14px; right: 14px; bottom: auto; z-index: 6;
  /* wide enough for the composers' meta row (date field + submit) */
  width: min(380px, calc(100vw - 28px));
  max-height: calc(100% - 28px); overflow-y: auto;
  /* no backdrop-filter: blurring over a per-frame WebGL canvas makes the
     compositor flicker (esp. Linux/ANGLE) — near-opaque surface instead */
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.map-panel h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* header left group: the title text ellipsizes, the variety badge stays whole */
.map-panel-title { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.map-panel-title > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-panel-title .badge { flex: none; }
/* minimized: collapse to the title bar (peek the 3D map behind) */
.map-panel.sz-min { max-height: none; overflow: visible; }
.map-panel.sz-min > :not(h2) { display: none; }
/* maximized: FILL the column (explicit height, not just a cap — a short
   panel must still visibly grow) so all the details + forms have room */
.map-panel.sz-max {
  height: calc(100% - 28px); max-height: calc(100% - 28px);
  width: min(440px, calc(100vw - 28px));
}
/* panel composers: task and note share one silhouette — the field row
   (date / category+camera) first, the primary action full-width below */
.map-panel .add-meta { flex-wrap: wrap; }
.map-panel .add-meta .compact-field { flex: 1 1 auto; }
.map-panel .add-meta > .btn:not(.photo-btn) { flex: 1 1 100%; margin-left: 0; }
.panel-close {
  appearance: none; border: none; background: none; cursor: pointer;
  font-size: 16px; color: var(--muted); padding: 2px 6px; border-radius: 6px;
}
.panel-close:hover { background: var(--grid); color: var(--ink); }
.panel-close.danger { color: var(--status-crit); font-weight: 700; }
.panel-close.danger:hover { background: color-mix(in srgb, var(--status-crit) 12%, transparent); color: var(--status-crit); }
.panel-close .ico { width: 17px; height: 17px; display: block; }
.btn.has-ico, .hud-btn.has-ico { display: inline-flex; align-items: center; gap: 6px; }
.has-ico .ico { width: 15px; height: 15px; }

@media (max-width: 640px) {
  .map-panel {
    top: auto; right: 0; left: 0; bottom: 0;
    width: 100%; max-height: 60%;
    border-radius: 16px 16px 0 0;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  /* while a composer is open the sheet grows so the fields fit without
     hunting for them below the fold */
  .map-panel:has(.add-form) { max-height: 82%; }
  /* window states on the mobile bottom sheet */
  .map-panel.sz-min, .map-panel.sz-min:has(.add-form) { height: auto; max-height: none; }
  /* explicit height so a short panel still fills to 92% of the screen */
  .map-panel.sz-max, .map-panel.sz-max:has(.add-form) {
    height: 92dvh; max-height: 92dvh; width: 100%;
  }
  .meter-name { flex-basis: 100px; }
}

/* ---------- misc ---------- */
.placeholder { color: var(--muted); font-size: 13.5px; padding: 12px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
/* let columns shrink to fit — default min-width:auto lets content force width */
.grid-2 > * { min-width: 0; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.mt { margin-top: 16px; }

/* bay editor (tier-3 corrections) */
.bay-seg { cursor: pointer; }
.bay-seg.editing { outline: 2px solid var(--wine); outline-offset: 1px; }
.bay-editor {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: 8px; padding: 2px 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow);
}
.bay-count { font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* freshness (rules/field-actuality.md): calculated / confirmed / stale */
.bay-seg.calc { opacity: 0.5; }
.bay-seg.fresh { outline: 2px solid var(--leaf); outline-offset: -1px; }
.bay-seg.stale { opacity: 0.75; outline: 1px dashed var(--muted); outline-offset: -1px; }
.bay-seg.editing { outline: 2px solid var(--wine); outline-offset: 1px; }

/* map picker modal (two-click calibration) */
.picker-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11,11,11,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.picker-box {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px;
  width: min(860px, 100%); display: flex; flex-direction: column; gap: 10px;
  /* never taller than the visible viewport (dvh excludes mobile browser
     chrome); the map shrinks to keep head + controls on screen */
  max-height: calc(100dvh - 24px); overflow-y: auto; overflow-x: hidden; max-width: 100%;
}
.picker-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); }
.picker-map { height: min(58vh, 540px); border-radius: var(--radius-sm); overflow: hidden; flex: 0 0 auto; max-width: 100%; }

@media (max-width: 640px) {
  /* bottom sheet, matching the wizard card; leave room for controls */
  .picker-overlay { align-items: flex-end; padding: 0; }
  .picker-box {
    width: 100%; border-radius: 16px 16px 0 0;
    max-height: 96dvh; padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .picker-map { height: 46dvh; }
}

/* maximized: the popup fills the viewport and the map flex-grows to take
   all the room left after the head + control rows — a big canvas for
   precise row / handle work. */
.picker-overlay.maximized { padding: 0; align-items: stretch; justify-content: stretch; }
.picker-box.maximized {
  width: 100vw; height: 100dvh; max-width: none; max-height: 100dvh;
  border-radius: 0; overflow: hidden;
}
.picker-box.maximized .picker-map {
  flex: 1 1 auto; height: auto; min-height: 0; border-radius: 0;
}

/* toast + first-run guidance */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; background: var(--ink); color: var(--page);
  font-size: 13.5px; font-weight: 600; padding: 8px 18px; border-radius: 999px;
  box-shadow: var(--shadow); animation: toast-in 0.2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.demo-banner {
  background: var(--wine-wash); color: var(--wine);
  font-size: 13.5px; font-weight: 600;
  padding: 8px 20px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.guide-step {
  padding: 9px 4px; font-size: 14px; cursor: pointer;
  border-bottom: 1px solid var(--grid); border-radius: 6px;
}
.guide-step:last-child { border-bottom: none; }
.guide-step:hover { background: var(--wine-wash); }
.guide-step.done { color: var(--muted); text-decoration: line-through; }

/* per-vine slots */
.vine-slots { display: flex; flex-wrap: wrap; gap: 4px; }
.vine-chip {
  min-width: 28px; height: 28px; display: inline-flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 600; cursor: pointer;
  border-radius: 7px; background: var(--seq-250); color: #fff;
}
.vine-chip.gap { background: var(--status-serious); }
.vine-chip.custom { outline: 2px solid var(--leaf); outline-offset: -2px; }
.vine-chip.open { outline: 2px solid var(--wine); outline-offset: -2px; }

/* drill-down breadcrumbs */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13.5px; margin-bottom: 12px; }
.crumb { appearance: none; border: none; background: none; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--wine); padding: 0; }
.crumb:hover { text-decoration: underline; }
.crumb-cur { font-weight: 600; color: var(--ink-2); }
.crumb-sep { color: var(--muted); }
button.row-n { text-align: right; }

/* native form controls (date picker icon etc.) follow the ACTUAL theme.
   color-scheme drives the native calendar indicator's colour, so it must
   track data-theme — not just prefers-color-scheme — or a black icon
   stays invisible on an app-toggled dark input. */
:root { color-scheme: light; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) { color-scheme: dark; } }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
input[type="date"] { min-width: 130px; }

/* dd.mm.yyyy date field rendered as ONE input: the wrapper owns the
   border; text part + naked icon-only native picker inside */
.date-wrap {
  display: flex; align-items: center; width: 100%;
  background: var(--page);
  border: 1px solid var(--baseline);
  border-radius: var(--radius-sm);
  height: 38px; box-sizing: border-box;
}
.date-wrap:focus-within { border-color: var(--wine); }
.date-wrap input[type="text"] {
  border: none; background: transparent; flex: 1; width: auto; min-width: 0;
  height: 100%; padding: 0 4px 0 10px; outline: none;
}
.date-icon {
  border: none !important; background: transparent !important;
  width: 30px; min-width: 0 !important; flex: 0 0 30px;
  height: 100%; padding: 0 6px 0 0 !important;
  color: transparent; cursor: pointer;
}
.date-icon::-webkit-datetime-edit { display: none; }
.date-icon:focus { outline: none; }

/* tasks */
.task-card .note-text { font-size: 14.5px; }
/* block-tinted location chip (colour set inline per block) */
.loc-chip {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%;
  font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
}
.loc-chip .pin-ico svg { width: 13px; height: 13px; }
.loc-chip .task-loc-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* terminal outcome line: done (green check) / abandoned (red cross) */
.task-status {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 8px;
  font-size: 12px; font-weight: 600;
}
.task-status.done { color: var(--leaf); }
.task-status.abandoned { color: var(--status-crit); }
.task-status .pin-ico svg { width: 14px; height: 14px; }

/* confirm dialog */
.confirm-box { width: min(440px, 100%); }
.confirm-text { font-size: 15px; line-height: 1.5; }
.btn.danger { background: var(--status-crit); color: #fff; }
.btn.danger:hover { background: #a82f2f; }

/* undo snackbar with countdown */
.undo-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 190; display: flex; align-items: center; gap: 14px;
  background: var(--ink); color: var(--page);
  font-size: 13.5px; font-weight: 600;
  padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow);
  animation: toast-in 0.2s ease-out;
}
.undo-restore {
  position: relative; overflow: hidden; appearance: none; border: none;
  cursor: pointer; font: inherit; font-weight: 700;
  color: var(--ink); background: var(--page);
  padding: 7px 16px 9px; border-radius: 8px;
}
.undo-progress {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: var(--status-crit);
  animation: undo-shrink 20s linear forwards;
}
@keyframes undo-shrink { from { width: 100%; } to { width: 0; } }

/* system-message snack: bottom-right */
/* peer-activity: what teammates did on the last sync — a stack of icon
   pills, above the snack, bottom-right */
.peer-toasts {
  position: fixed; right: 20px; bottom: 68px; z-index: 185;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  pointer-events: none;
}
.peer-toast {
  /* every pill the same size, slightly rounded, slightly transparent (no
     backdrop blur — it flickers over the per-frame WebGL map on some GPUs) */
  width: 200px; box-sizing: border-box;
  display: flex; align-items: center; gap: 9px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--ink); border: 1px solid var(--border);
  padding: 6px 13px 6px 6px; box-shadow: var(--shadow);
  font-size: 13.5px; animation: peer-in 0.22s ease-out both;
}
/* round icon badge: soft accent circle, the glyph in full accent + a bolder
   stroke so it reads on both themes */
.peer-toast-ico {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--series-2) 85%, var(--surface));
  color: #fff;
}
.peer-toast.hot .peer-toast-ico {
  background: color-mix(in srgb, var(--status-crit) 85%, var(--surface));
}
.peer-toast-ico .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.peer-toast-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-toast-n { font-weight: 800; }
@keyframes peer-in { from { opacity: 0; transform: translateX(12px); } }

.snack {
  position: fixed; right: 20px; bottom: 20px; z-index: 180;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-left: 4px solid var(--series-1);
  font-size: 13.5px; padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow); animation: toast-in 0.2s ease-out;
}
/* in-place ghost card for a deleted block */
.ghost-card {
  display: flex; align-items: center; justify-content: space-between;
  border-style: dashed; opacity: 0.85; color: var(--ink-2);
}
.ghost-card .undo-restore {
  color: var(--page); background: var(--ink);
}
.note-card.ghost-card, .task-card.ghost-card {
  flex-direction: row; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600;
}

/* icon action row on own task / note cards: complete · edit · delete */
.card-actions { display: flex; gap: 2px; justify-content: flex-end; margin-top: 6px; }
.card-actions .panel-close .ico { width: 17px; height: 17px; }
.card-actions .act-done:hover { color: var(--leaf); background: var(--leaf-wash); }
.card-actions .act-del:hover { color: var(--status-crit); background: rgba(208,59,59,0.12); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* deletion skeleton: content dissolves into a shimmer */
.skeleton-line {
  height: 14px; border-radius: 7px; margin: 14px 0;
  background: linear-gradient(90deg, var(--grid) 25%, var(--baseline) 50%, var(--grid) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* consistent add-form action: primary button below fields, right-aligned */
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

/* inline edit composer (task / note): roomy text, compact meta, spaced actions */
.edit-text { width: 100%; min-height: 84px; }
.edit-bar {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 10px;
}
.edit-bar .compact-field { flex: 0 0 170px; min-width: 0; }
.edit-actions { display: flex; gap: 8px; align-items: flex-end; margin-left: auto; }

/* landing — big editorial style: hero, framed screenshots, alternating
   feature sections, values strip, wine CTA band */
.landing {
  min-height: 100vh; min-height: 100dvh; overflow-y: auto;
  padding: 20px max(24px, calc((100% - 1060px) / 2)) 40px;
  background:
    radial-gradient(1300px 560px at 50% -12%, var(--wine-wash), transparent),
    var(--page);
}
.landing-top { display: flex; justify-content: space-between; align-items: center; }
.landing-hero { text-align: center; padding: 88px 0 24px; }
.landing-title {
  font-size: clamp(38px, 6vw, 62px); line-height: 1.06; font-weight: 800;
  letter-spacing: -0.02em; margin: 0 0 18px; color: var(--ink);
}
.landing-sub {
  max-width: 640px; margin: 0 auto 30px; color: var(--ink-2);
  font-size: 18px; line-height: 1.6;
}
.landing-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.landing-open { font-size: 17px; padding: 14px 34px; border-radius: 12px; }
.landing-ghost { font-size: 17px; padding: 14px 26px; border-radius: 12px; }
.land-shot {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(60, 20, 40, 0.35);
  background: var(--surface); cursor: pointer;
}
.land-shot img { display: block; width: 100%; height: auto; }
.hero-shot { max-width: 980px; margin: 64px auto 0; }
.land-sec {
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 64px;
  align-items: center; padding: 104px 0;
}
.land-sec:first-of-type { padding-top: 128px; }
.land-sec.rev .land-copy { order: 2; }
.land-sec.rev .land-shot { order: 1; }
.land-copy h2 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.15; margin: 0 0 10px; }
.land-lead { font-size: 17px; color: var(--ink-2); margin: 0 0 18px; line-height: 1.55; }
.land-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.land-list li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; font-size: 15.5px; }
.land-check { color: var(--leaf); flex: 0 0 auto; display: inline-flex; margin-top: 2px; }
.land-check .ico { width: 17px; height: 17px; }
.land-values {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px; padding: 24px 0 96px;
}
.land-value {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.land-value h3 { margin: 0 0 6px; font-size: 16px; color: var(--wine); }
.land-value p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.land-band {
  background: var(--wine); color: var(--on-wine);
  border-radius: 18px; text-align: center; padding: 64px 28px;
}
.land-band h2 { margin: 0 0 8px; font-size: clamp(24px, 3vw, 32px); }
.land-band p { margin: 0 auto 22px; max-width: 520px; opacity: 0.85; line-height: 1.5; }
.land-band .on-wine { background: var(--on-wine); color: var(--wine); }
.land-wine { margin: 18px auto 0 !important; font-size: 13.5px; opacity: 0.75; }
/* roadmap: numbered vision cards */
.land-road { padding: 104px 0 96px; text-align: center; }
.land-road > h2 { font-size: clamp(26px, 3.4vw, 34px); margin: 0 0 8px; }
.land-road .land-lead { margin-bottom: 36px; }
.land-road-grid {
  display: grid; gap: 18px; text-align: left;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.land-road-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.land-road-n { font-size: 13px; font-weight: 700; color: var(--wine); opacity: 0.7; }
.land-road-card h3 { margin: 8px 0 8px; font-size: 16.5px; }
.land-road-card p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.55; }
.beta-pill {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--wine); background: var(--wine-wash);
  padding: 2px 8px; border-radius: 999px;
}
.landing-foot {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12.5px; margin-top: 64px;
}
.landing-foot .foot-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center; }
.foot-note { max-width: 560px; text-align: center; line-height: 1.5; opacity: 0.8; }
.landing-ver { font-variant-numeric: tabular-nums; }
.landing-fb {
  appearance: none; background: none; border: none; cursor: pointer;
  font: inherit; color: var(--leaf); font-weight: 600; padding: 0;
}
@media (max-width: 860px) {
  .land-sec { grid-template-columns: 1fr; gap: 22px; padding: 40px 0; }
  .land-sec.rev .land-copy { order: 0; }
  .land-sec.rev .land-shot { order: 1; }
  .landing-hero { padding-top: 36px; }
}

/* feedback: green tab on the right edge + report modal */
.fb-tab {
  position: fixed; right: 0; top: 55%; transform: translateY(-50%); z-index: 90;
  appearance: none; border: none; cursor: pointer; font: inherit;
  writing-mode: vertical-rl;
  background: var(--leaf); color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
  padding: 14px 6px; border-radius: 8px 0 0 8px;
  box-shadow: var(--shadow);
  display: inline-flex; align-items: center; gap: 7px;
}
.fb-tab:hover { filter: brightness(1.08); }
.fb-ico { display: inline-flex; writing-mode: horizontal-tb; }
.fb-ico .ico { width: 15px; height: 15px; }
@media (max-width: 720px) { .fb-tab { display: none; } } /* drawer item instead */
.fb-drawer { color: var(--leaf); }
.fb-status { font-size: 13px; font-weight: 600; align-self: center; margin-right: auto; }
.fb-status.done { color: var(--leaf); }
.fb-status.err { color: var(--status-crit); }

/* boot splash: grape with a progress ring while the event log replays */
.boot-splash {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--page);
}
.boot-wrap { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.boot-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--grid); border-top-color: var(--wine);
  animation: boot-spin 0.9s linear infinite;
}
.boot-grape { font-size: 40px; }
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* notes browse: search box + category filter chips on one row */
.browse-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-box {
  display: flex; align-items: center; gap: 8px; flex: 1 1 260px; max-width: 380px;
  background: var(--page); border: 1px solid var(--baseline);
  border-radius: var(--radius-sm); height: 38px; box-sizing: border-box;
  padding: 0 6px 0 12px; color: var(--muted);
}
.search-box:focus-within { border-color: var(--wine); }
.search-box input {
  border: none; background: transparent; outline: none; flex: 1; min-width: 0;
  height: 100%; padding: 0;
}
.search-ico { display: inline-flex; flex: 0 0 auto; }
.search-ico .ico { width: 16px; height: 16px; }
.tag-filter { display: flex; gap: 6px; flex-wrap: wrap; }
/* active-block switcher on scoped pages, tinted per block */
.block-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: -12px 0 20px; }
.block-chip {
  appearance: none; cursor: pointer; font: inherit;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  padding: 4px 12px; border-radius: 999px; background: var(--grid);
  border: 1px solid transparent; opacity: 0.6;
}
.block-chip:hover { opacity: 0.9; }
.block-chip.on { opacity: 1; border-color: currentColor; }
.filter-chip {
  appearance: none; cursor: pointer; font: inherit;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; opacity: 0.55;
}
.filter-chip:hover { opacity: 0.85; }
.filter-chip.on { opacity: 1; border-color: currentColor; }

/* symmetric add composer (task = note): growing text on top, meta row below */
.add-form { display: flex; flex-direction: column; gap: 10px; }
.add-form .grow-field { flex: none; min-width: 0; }
.add-meta { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.add-meta .compact-field { flex: 0 0 170px; min-width: 0; }
.add-meta .btn { margin-left: auto; }
.grow-text {
  min-height: 38px; max-height: 200px; resize: none; overflow-y: auto;
  line-height: 1.45; display: block;
}

/* ---------- burger + drawer ---------- */
.burger {
  appearance: none; border: none; background: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--ink); padding: 4px 8px;
  display: none;
}
.nav-icon, .drawer-icon { margin-right: 6px; }
.nav-item .nav-icon { margin-right: 4px; font-size: 13px; }

.drawer-scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(11,11,11,0.4); animation: fade-in 0.15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 91;
  width: min(280px, 82vw);
  background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  animation: slide-in 0.2s ease-out;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
@keyframes slide-in { from { transform: translateX(-100%); } }
.drawer-brand { padding: 18px 20px; font-size: 18px; border-bottom: 1px solid var(--border); }
.drawer-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.drawer-item {
  appearance: none; border: none; background: none; cursor: pointer;
  width: 100%; text-align: left; font: inherit; font-size: 15.5px;
  color: var(--ink); padding: 12px 20px; display: flex; align-items: center;
}
.drawer-item:hover { background: var(--wine-wash); }
.drawer-item.active { background: var(--wine-wash); color: var(--wine); font-weight: 650; }
.drawer-icon { width: 26px; display: inline-flex; justify-content: center; }
.drawer-footer { border-top: 1px solid var(--border); padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.drawer-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.drawer-ver { font-variant-numeric: tabular-nums; }

/* responsive: burger below the breakpoint, horizontal nav above */
@media (max-width: 720px) {
  .burger { display: inline-block; }
  .desktop-nav { display: none !important; }
  .topbar .brand { flex: 1; justify-content: center; }
}

.footer-row { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }

/* stroke line icons: inherit color from the item (theme + active adapt) */
.ico { width: 18px; height: 18px; display: block; }
.nav-icon, .drawer-icon { display: inline-flex; align-items: center; }
.nav-item .nav-icon { margin-right: 5px; opacity: 0.85; }
.nav-item.active .nav-icon { opacity: 1; }
.drawer-icon { width: 26px; justify-content: center; }
.drawer-icon .ico { width: 19px; height: 19px; }

/* hide secondary table columns on narrow screens */
@media (max-width: 640px) { .col-hide-sm { display: none; } }

/* dashboard task cards: whole card is a link */
.task-card.clickable { cursor: pointer; border: 1px solid var(--border); transition: background-color 0.12s ease; }
.task-card.clickable:hover { background: var(--wine-wash); }
.task-head { flex-wrap: wrap; margin-bottom: 8px; }
.task-head .note-date { flex: 0 0 auto; }
.task-head .badge, .task-head .tag { margin-left: auto; flex: 0 0 auto; }
.note-card.clickable { cursor: pointer; border: 1px solid var(--border); transition: background-color 0.12s ease; }
.note-card.clickable:hover { background: var(--wine-wash); }
.pin-ico { display: inline-flex; flex: 0 0 auto; }
.pin-ico svg { width: 14px; height: 14px; display: block; }
.badge .pin-ico svg { width: 12px; height: 12px; }
.land-road-more { margin: 28px 0 0; color: var(--muted); font-size: 13.5px; }
.land-now {
  text-align: center; font-size: clamp(26px, 3.4vw, 34px);
  margin: 96px 0 -40px; padding-top: 24px;
}
.land-road > h2 { margin-bottom: 28px; }
.land-sub-t {
  font-size: 13px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--wine); margin: 36px 0 10px;
}
.land-road-grid.duo { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); max-width: 760px; margin: 0 auto; }
.landing-controls { display: flex; gap: 10px; align-items: center; }

/* privacy manifesto band — big, green, before the roadmap */
.land-privacy {
  background: linear-gradient(140deg, #24471e, #3f7a34);
  color: #fff; border-radius: 22px;
  padding: 80px clamp(28px, 6vw, 72px);
  margin: 24px 0 0;
}
.land-privacy h2 {
  font-size: clamp(30px, 4.6vw, 48px); line-height: 1.08;
  letter-spacing: -0.02em; margin: 0 0 16px; max-width: 720px;
}
.land-priv-lead { font-size: 18px; line-height: 1.6; opacity: 0.88; max-width: 620px; margin: 0 0 44px; }
.land-priv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px 40px; }
.land-priv-item h3 { margin: 0 0 6px; font-size: 19px; }
.land-priv-item p { margin: 0; opacity: 0.82; font-size: 15px; line-height: 1.55; }

/* AI showcase: giant statement + live-demo bubbles */
.land-ai-hero {
  font-size: clamp(28px, 4.2vw, 44px); line-height: 1.1;
  letter-spacing: -0.02em; margin: 8px 0 10px; color: var(--ink);
}
.ai-bubbles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px; max-width: 920px; margin: 40px auto 56px; text-align: left;
}
.ai-bubble {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px 32px; box-shadow: var(--shadow);
}
.ai-cap {
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--wine);
}
.ai-q { font-size: clamp(18px, 2vw, 22px); font-weight: 700; line-height: 1.35; margin: 12px 0 16px; }
.ai-a {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  background: var(--leaf-wash); color: var(--leaf);
  font-size: 14.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px;
}
.ai-a .pin-ico svg { width: 15px; height: 15px; }
.land-ai-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 36px 48px; max-width: 920px; margin: 0 auto; text-align: left;
}
.land-ai-grid h3 { margin: 0 0 6px; font-size: 19px; }
.land-ai-grid p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.55; }

/* collaborative platform: the roadmap finale */
.land-collab { margin-top: 0; text-align: center; }
.land-collab-t {
  font-size: clamp(28px, 4.2vw, 44px); line-height: 1.1;
  letter-spacing: -0.02em; margin: 0 0 10px; color: var(--ink);
}
.land-collab-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px; max-width: 960px; margin: 40px auto 0; text-align: left;
}
.land-collab-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px 32px; box-shadow: var(--shadow);
}
.land-collab-col h4 {
  margin: 0 0 16px; font-size: 13px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--wine);
}
.land-collab-note { margin: 26px auto 0; max-width: 560px; color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* AI-powered Excel import: wide statement card */
.land-ai-import {
  max-width: 920px; margin: 36px auto 0; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 30px 32px; box-shadow: var(--shadow);
}
.land-ai-import h3 { margin: 0 0 8px; font-size: 21px; }
.land-ai-import p { margin: 0 0 16px; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }

.land-ai { padding: 112px 0 0; text-align: center; }
.soon-pill {
  vertical-align: middle; margin-left: 14px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--leaf); background: var(--leaf-wash);
  padding: 4px 12px; border-radius: 999px;
}
.band-ico { display: inline-flex; vertical-align: -3px; }
.band-ico .ico { width: 15px; height: 15px; }

.land-overline { display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 14px; }
.land-overline-t {
  font-size: 13px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--wine);
}

/* legend hover: spotlight a variety on the map */
.map-legend .item.hoverable { cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.map-legend .item.hoverable:hover, .map-legend .item.hoverable.on { background: var(--wine-wash); }
.map-legend .legend-count {
  margin-left: auto; padding-left: 10px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}

/* map selection precision chips (Участок / Ряд N / Пролёт M / Куст K) */
.lvl-chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* camera tools: bottom-right column of round buttons (top view, reset,
   compass — the compass needle is rotated by the render loop) */
.map-tools {
  position: absolute; right: 14px; bottom: 14px; z-index: 5;
  /* pin every control to the right edge so opening the layer switch (which
     widens the column) fans its options LEFT without shifting the others */
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.map-round {
  appearance: none; font: inherit; padding: 0;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  color: var(--ink-2); cursor: pointer;
}
.map-round svg { display: block; }
.map-round .ico { width: 19px; height: 19px; }
.map-round:hover { background: var(--wine-wash); color: var(--ink); }
.map-round.active { background: var(--wine); color: var(--on-wine); border-color: var(--wine); }

/* live weather card — opens from the weather button, sits left of the rail */
.wx-card {
  position: absolute; right: 64px; bottom: 14px; z-index: 6;
  width: 210px; max-width: calc(100vw - 84px);
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 13px 15px; color: var(--ink);
}
.wx-card-head { display: flex; align-items: center; justify-content: space-between; }
.wx-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.02em; }
.wx-close {
  appearance: none; border: none; background: none; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--ink-2); padding: 0 2px;
}
.wx-main { display: flex; align-items: center; gap: 12px; margin: 8px 0 10px; }
.wx-ico-lg .ico { width: 42px; height: 42px; color: var(--wine); }
.wx-temp { font-size: 30px; font-weight: 700; line-height: 1; }
.wx-cond { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.wx-rows { display: flex; flex-direction: column; gap: 5px;
  border-top: 1px solid var(--border); padding-top: 9px; font-size: 13px; }
.wx-row { display: flex; justify-content: space-between; }
.wx-row span:first-child { color: var(--ink-2); }
.wx-refresh {
  appearance: none; font: inherit; margin-top: 11px; width: 100%;
  border: 1px solid var(--border); background: transparent; color: var(--ink-2);
  border-radius: 9px; padding: 6px; cursor: pointer; font-size: 12.5px;
}
.wx-refresh:hover { background: var(--wine-wash); color: var(--ink); }
.wx-empty { color: var(--ink-2); font-size: 13px; padding: 10px 0 4px; }

/* settings toggle switch */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--border);
  border-radius: 14px; cursor: pointer; transition: background 0.2s;
}
.switch .track::before {
  content: ""; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  transition: transform 0.2s;
}
.switch input:checked + .track { background: var(--wine); }
.switch input:checked + .track::before { transform: translateX(19px); }
.wx-switch { margin-top: 11px; border-top: 1px solid var(--border); padding-top: 9px; }
.wx-sw-lbl { font-size: 11px; color: var(--ink-2); margin-bottom: 6px; }
.wx-sw-row { display: flex; flex-wrap: wrap; gap: 5px; }
.wx-sw {
  appearance: none; font: inherit; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--ink-2);
  border-radius: 8px; min-width: 30px; height: 30px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 600;
}
.wx-sw .ico { width: 17px; height: 17px; }
.wx-sw:hover { background: var(--wine-wash); color: var(--ink); border-color: var(--wine); }

/* layer picker: one round button, options fan out with a pop */
.layer-picker { display: flex; gap: 8px; align-items: center; }
.layer-opt { animation: layer-pop 0.18s cubic-bezier(0.34, 1.4, 0.64, 1) both; }
@keyframes layer-pop {
  from { opacity: 0; transform: translateX(-10px) scale(0.55); }
  to   { opacity: 1; transform: none; }
}

/* map-layer switch: top-right corner, options fan LEFT off the edge */
.map-layers { position: absolute; top: 14px; right: 14px; z-index: 5;
  display: flex; flex-direction: row-reverse; gap: 8px; align-items: flex-start; }
.map-layers .layer-picker,
/* in the right-hand tools column the layer switch fans its options left too */
.map-tools .layer-picker { flex-direction: row-reverse; justify-content: flex-start; }
.map-layers .layer-opt,
.map-tools .layer-opt {
  animation-name: layer-pop-r;
}
@keyframes layer-pop-r {
  from { opacity: 0; transform: translateX(10px) scale(0.55); }
  to   { opacity: 1; transform: none; }
}

/* phones: iOS Safari auto-zooms the page when a focused control has
   font-size < 16px — keep every form control at 16px there, and give
   the search clear button a real tap target */
@media (max-width: 720px) {
  input[type="text"], input[type="number"], input[type="date"],
  input[type="email"], input[type="password"], input[type="search"],
  input[type="tel"], input[type="url"], select, textarea,
  .search-box input { font-size: 16px; }
  .search-box { max-width: none; }
  .search-box .panel-close { padding: 8px 10px; }
}

/* pick popovers: close lives top-right, as windows taught everyone */
.map-pick .pick-close { margin-left: auto; }
.panel-tools { display: inline-flex; gap: 6px; align-items: center; }

/* popover header: the location never wraps, it ellipsizes */
.map-pick-label .pick-loc {
  min-width: 0; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- task priorities ---------- */
.prio-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 2px; flex: none; align-self: center;
}
.prio-pick { display: inline-flex; gap: 7px; align-items: center; height: 38px; }
.prio-btn {
  appearance: none; cursor: pointer; padding: 0;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid transparent; opacity: 0.45; transition: opacity .12s, transform .12s;
}
.prio-btn:hover { opacity: 0.8; }
.prio-btn.on { opacity: 1; transform: scale(1.25); border-color: var(--ink); }

/* ---------- settings sections ---------- */
.sec-sub { color: var(--muted); font-size: 13.5px; margin: -4px 0 12px; }
.danger-row { border-top: 1px solid var(--grid); padding-top: 12px; }
.danger-btn { color: var(--status-serious); border-color: color-mix(in srgb, var(--status-serious) 40%, transparent); }
.danger-btn:hover { background: color-mix(in srgb, var(--status-serious) 10%, transparent); }

/* whole-row bulk editor: label · field · year · button, aligned across
   both rows so the buttons line up */
.row-bulk {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 88px auto;
  gap: 10px 10px; align-items: center; margin-top: 12px;
}
.row-bulk-lbl { color: var(--muted); font-size: 13px; white-space: nowrap; }
.row-bulk > select, .row-bulk .wiz-year { width: 100%; }
/* variety-input renders a flex span — let it fill its grid cell */
.row-bulk > span:not(.row-bulk-lbl) { min-width: 0; }
@media (max-width: 560px) {
  .row-bulk { grid-template-columns: 1fr 88px auto; }
  .row-bulk-lbl { grid-column: 1 / -1; margin-bottom: -4px; }
}

.row-link { color: var(--wine); cursor: pointer; text-decoration: none; }
.row-link:hover { text-decoration: underline; }

/* ---------- farm roles ---------- */
.ro-pill {
  align-self: center; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--wine) 14%, transparent);
  color: var(--wine); border: 1px solid color-mix(in srgb, var(--wine) 35%, transparent);
}
.farm-devs { border-collapse: collapse; margin-top: 8px; min-width: min(520px, 100%); }
.farm-devs td { padding: 7px 16px 7px 0; font-size: 13.5px; vertical-align: middle;
                border-bottom: 1px solid var(--grid); }
.farm-devs tr:last-child td { border-bottom: none; }
.farm-devs .dev-name { font-weight: 600; }
.farm-devs .dev-joined { color: var(--muted); font-size: 12.5px; }
.farm-devs .dev-actions { white-space: nowrap; }
.dev-act {
  appearance: none; cursor: pointer; margin-right: 6px;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); font-size: 15px; line-height: 1;
}
.dev-act:hover { background: var(--grid); }
.dev-act.danger:hover { border-color: var(--status-serious); color: var(--status-serious); }
.dev-act:disabled { opacity: 0.5; cursor: default; }

/* recovery kit: 64 hex characters someone has to copy off a screen by
   hand, so they get room to breathe and a size that reads across a desk */
.kit-hex {
  margin-top: 10px; padding: 14px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--grid);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; line-height: 1.9; letter-spacing: 0.08em;
  word-spacing: 0.4em; word-break: break-word; user-select: all;
}
.kit-warn {
  margin-top: 10px; font-size: 13px; line-height: 1.5;
  color: var(--status-serious);
}

/* closed-beta door: both ways through plus the way past, all visible */
/* ---- the gate: a full-screen page, not a dialog --------------------------
   For somebody founding a vineyard this is not an interruption to the app,
   it IS the app — so it gets a page, with room to separate the three ways
   in instead of stacking them down a modal. */
.gate {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px 20px; background: var(--page);
}
.gate-panel { width: min(620px, 100%); }
.gate-icon { width: 46px; height: 46px; display: block; margin: 8px auto 14px; }
.gate h1 { font-size: 26px; margin: 0 0 8px; text-align: center; }
.gate-lead { color: var(--muted); font-size: 14.5px; line-height: 1.6;
  margin: 0 0 4px; text-align: center; }
.gate-lead.small { font-size: 13px; text-align: left; }
.gate-corner { position: fixed; top: 12px; right: 14px; display: flex; gap: 6px; z-index: 5; }
.gate-corner button { appearance: none; cursor: pointer; padding: 4px 9px;
  font: inherit; font-size: 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); }
.gate-corner button.on { background: var(--wine); color: var(--on-wine); border-color: var(--wine); }
.gate-footer { margin-top: 26px; display: flex; gap: 18px;
  font-size: 12px; color: var(--muted); }

/* the closed-beta half, separated from the doors by a rule and a heading
   so «I have a code» and «I need one» are visibly one topic, not two more
   buttons in a stack */
.gate-beta { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.gate-beta-t { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.gate-code { margin-top: 12px; padding: 14px; border-radius: 12px;
  background: var(--grid); border: 1px solid var(--border); }
.gate-code > label, .gate-form > label {
  display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 8px; }
.gate-code .form-row { gap: 8px; }
.gate-code input { flex: 1; min-width: 0; }
.gate-ask { margin-top: 12px; font-size: 13.5px; color: var(--muted); }
/* it has to LOOK clickable — muted text the same colour as its sentence is
   not an affordance, it is a sentence */
.gate-ask a, .gate-past a {
  cursor: pointer; color: var(--wine); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
}
.gate-ask a:hover, .gate-past a:hover { text-decoration-thickness: 2px; }
.gate-form { margin-top: 14px; padding: 14px; border-radius: 12px;
  background: var(--grid); border: 1px solid var(--border); }
.gate-form .form-row { gap: 8px; flex-wrap: wrap; }
.gate-form input { flex: 1; min-width: 170px; }
.gate-form textarea { width: 100%; margin-top: 8px; }
.gate-name { width: 100%; margin-top: 16px; font-size: 16px !important; }
.gate-actions { margin-top: 16px; }
.gate-past { margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--border); text-align: center; }
.gate-past a { font-size: 13.5px; }
.gate-past .placeholder { margin-top: 6px; }
.gate .kit-hex { margin: 16px 0; }

/* two doors, deliberately equal in weight — a grower starting out and a
   worker handed a phone arrive at the same screen */
.cgate-doors {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 6px;
}
@media (max-width: 560px) { .cgate-doors { grid-template-columns: 1fr; } }
.cgate-door {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--grid);
}
.cgate-door-t { font-weight: 600; font-size: 14.5px; }
.cgate-door p { margin: 0; flex: 1; font-size: 13px; line-height: 1.5; color: var(--muted); }
.cgate-door .btn { align-self: flex-start; }

/* ---- the creation wizard: a page, like the gate ---------------------------
   It was a .news-card, and .wiz-card/.wiz-help were never defined — so it
   inherited max-height:min(70vh,560px) with no scrolling child, and step 4
   (which lists every row in the block) overflowed onto the page background.
   Founding a vineyard is the task, not an interruption to it. */
.wiz {
  /* centred like the gate, but justify-content:center on a min-height:100vh
     column still lets a tall step (4 lists every row in the block) grow past
     the fold and scroll normally */
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 28px 20px 40px; background: var(--page);
}
.wiz-panel { width: min(680px, 100%); }
.wiz-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wiz-title { font: 600 20px/1.2 inherit; color: var(--ink); }
.wiz-step { margin-top: 4px; font-size: 13px; color: var(--muted); }

/* four steps as dots — progress you can see at a glance beats a sentence */
.wiz-dots { display: flex; gap: 6px; margin: 14px 0 10px; }
.wiz-dot {
  height: 4px; flex: 1; border-radius: 999px; background: var(--border);
}
.wiz-dot.done { background: var(--wine-wash, rgba(111,43,63,.35)); }
.wiz-dot.on { background: var(--wine); }

.wiz-help {
  margin: 0 0 18px; font-size: 14px; line-height: 1.6; color: var(--muted);
}
.wiz .form-actions { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
.wiz .field input { font-size: 16px; }
@media (max-width: 560px) { .wiz { padding: 18px 14px 32px; } }
