/* TaskTak Agro office web app */
:root {
  /* Brand greens */
  --deep: #317A07; --primary: #317A07; --forest: #2A6A06;
  --lgreen: #E4F0DC; --lgreen-2: #EFF6EA;
  --mint: #97CF77; --soft-mint: #E3F1DA; --pale-mint: #D3E8C6; --online: #8EE06A; --goat: #719F56;
  /* Neutrals */
  --ground: #F3F0E7; --surface: #FBFAF6; --chip: #E9E5D8; --border: #DAD5C7; --skeleton: #E3DFD2;
  --handle: #C9C4B4; --input-b: #7A766A; --muted: #55615A; --body: #33413A; --ink: #1A2420;
  --ph: #6B6A60; /* brand green #317A07 */ --scrim: rgba(38, 49, 44, .55);
  /* Stop and caution */
  --red: #B3261E; --red-tint: #F6DEDA; --red-text: #7F1710;
  --amber: #E2A42B; --amber-tint: #F9DFA3; --amber-text: #4D3100; --amber-strong: #8A5B00; --amber-border: #E2A42B;
  /* Map */
  --land: #DDE6D3; --water: #B9D3E3; --here: #1A73E8;

  --f-head: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --f-text: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-chip: 999px; --r-btn: 14px; --r-input: 12px; --r-card: 16px; --r-big: 20px;
  --side-w: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 15px/1.45 var(--f-text); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 2.5px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--f-mono); font-weight: 500; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex: none; }

/* ───────────── Shell ───────────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100%; }
.side {
  background: var(--deep); color: #fff; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 14px 12px 24px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin;
  scrollbar-color: var(--forest) transparent;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: var(--mint); color: var(--deep); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 24px; height: 24px; }
.brand b { font: 700 18px/1.05 var(--f-head); display: block; }
.brand small { color: var(--soft-mint); font-size: 12px; }
.station {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  background: var(--forest); border: 1px solid rgba(151, 207, 119, .22); border-radius: 14px; padding: 10px 12px; color: #fff; margin-bottom: 10px;
}
.station b { display: block; font-size: 13.5px; font-weight: 700; }
.station span { color: var(--soft-mint); font: 500 11.5px var(--f-mono); }
.nav-group { color: var(--soft-mint); font: 700 11px/1 var(--f-text); letter-spacing: .08em; text-transform: uppercase; padding: 16px 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; color: #EAF2EC;
  text-decoration: none; font-size: 14px; font-weight: 500; border: 0; background: none; width: 100%; cursor: pointer;
}
.nav-item svg { color: var(--pale-mint); }
.nav-item:hover { background: var(--forest); }
.nav-item.on { background: var(--lgreen); color: var(--deep); font-weight: 700; }
.nav-item.on svg { color: var(--deep); }
.nav-item .count { margin-left: auto; min-width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; font-size: 12px; font-weight: 700; padding: 0 6px; }
.count.amber { background: var(--amber-tint); color: var(--amber-text); }
.count.red { background: var(--red); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(243, 240, 231, .94); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 12px 32px;
}
.icon-btn.menu-btn { display: none; }
.search { flex: 1; min-width: 0; max-width: 520px; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-input); padding: 0 12px; height: 42px; }
.search svg { color: var(--muted); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; font-size: 14px; }
.search input::placeholder { color: var(--ph); }
.search kbd { font: 500 11px var(--f-mono); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }
.top-spacer { flex: 1; }
.synced { display: inline-flex; align-items: center; gap: 8px; background: var(--lgreen); color: var(--deep); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
.dot.online { background: #3F9A0C; box-shadow: 0 0 0 3px rgba(142, 224, 106, .45); }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--deep); flex: none; }
.icon-btn .pip { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); border: 2px solid var(--surface); }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--deep); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.me b { display: block; font-size: 14px; line-height: 1.15; }
.me small { color: var(--muted); font-size: 12px; }

.content { padding: 28px 32px 56px; display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* ───────────── Type ───────────── */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .grow > *:first-child { margin-top: 0; }
.title { font: 700 34px/1.04 var(--f-head); color: var(--deep); margin: 0; text-wrap: balance; letter-spacing: -.005em; }
.sub { color: var(--body); margin: 6px 0 0; font-size: 15px; }
.eyebrow { font: 700 11px/1 var(--f-text); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sec { font: 700 19px/1.1 var(--f-head); color: var(--deep); margin: 0; }
.big { font: 700 42px/1 var(--f-head); color: var(--deep); font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ───────────── Buttons ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: var(--r-btn); border: 1.5px solid transparent; font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--forest); }
.btn-outline { background: var(--surface); color: var(--deep); border-color: var(--deep); }
.btn-outline:hover { background: var(--lgreen-2); }
.btn-soft { background: var(--lgreen); color: var(--deep); }
.btn-soft:hover { background: var(--pale-mint); }
.btn-danger { background: var(--red); color: #fff; }
.btn-white { background: #fff; color: var(--deep); }
.btn-ghost { background: none; color: var(--deep); padding: 0 10px; }
.btn-ghost:hover { background: var(--chip); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 11px; }
.btn-block { width: 100%; }
.link { color: var(--deep); font-weight: 700; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; cursor: pointer; padding: 0; }

/* ───────────── Surfaces ───────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head .meta { color: var(--muted); font-size: 12.5px; }
.card-head > :last-child:not(:first-child) { margin-left: auto; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }


/* two-pane layouts; --pane = fixed side */
.panes { display: grid; gap: 18px; grid-template-columns: minmax(0, var(--pane, 340px)) minmax(0, 1fr); align-items: start; }
.panes.rev { grid-template-columns: minmax(0, 1fr) minmax(0, var(--pane, 340px)); }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); padding: 16px 18px; min-width: 0; }
.stat .n { font: 700 30px/1 var(--f-head); color: var(--deep); font-variant-numeric: tabular-nums; }
.stat .n small { font: 600 15px var(--f-text); margin-left: 3px; }
.stat .l { color: var(--body); font-size: 14px; margin-top: 6px; }
.stat .h { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stat.red { background: var(--red-tint); border-color: #EBC0BA; }
.stat.red .n, .stat.red .l { color: var(--red-text); }
.stat.amber { background: var(--amber-tint); border: 1.5px solid var(--amber-border); }
.stat.amber .n, .stat.amber .l, .stat.amber .h { color: var(--amber-text); }
.stat.green { background: var(--lgreen); border-color: var(--pale-mint); }
.stat.dark { background: var(--deep); border-color: var(--deep); }
.stat.dark .n { color: #fff; } .stat.dark .l { color: var(--soft-mint); } .stat.dark .h { color: var(--soft-mint); }

/* Hero (dark) */
.hero { background: var(--deep); color: #fff; border-radius: var(--r-big); padding: 22px 24px; display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.hero .eyebrow { color: var(--soft-mint); }
.hero h2 { font: 700 30px/1.1 var(--f-head); margin: 8px 0 14px; }
.hero-nums { display: flex; gap: 28px; }
.hero-nums b { font: 700 32px/1 var(--f-head); display: block; }
.hero-nums span { color: var(--soft-mint); font-size: 12.5px; }
.quick { display: grid; grid-template-columns: repeat(4, 84px); gap: 10px; margin-left: auto; }
.quick button { height: 76px; border-radius: 14px; border: 0; background: var(--surface); color: var(--deep); font-weight: 700; font-size: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
.quick button:hover { background: var(--lgreen); }
.speciesbar { display: flex; height: 6px; border-radius: 6px; overflow: hidden; gap: 3px; margin-top: 14px; max-width: 360px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* Attention tiles */
.att { border-radius: var(--r-card); padding: 16px; border: 1px solid var(--border); background: var(--surface); position: relative; cursor: pointer; text-align: left; min-width: 0; }
.att .n { font: 700 28px/1 var(--f-head); color: var(--deep); }
.att b { display: block; font-size: 14px; margin-top: 8px; }
.att small { color: var(--muted); font-size: 12.5px; display: block; margin-top: 2px; }
.att > svg { position: absolute; top: 16px; right: 16px; color: var(--muted); }
.att.red { background: var(--red-tint); border-color: #EBC0BA; } .att.red .n, .att.red b, .att.red > svg { color: var(--red-text); }
.att.amber { background: var(--amber-tint); border: 1.5px solid var(--amber-border); } .att.amber .n, .att.amber b, .att.amber small { color: var(--amber-text); } .att.amber > svg { color: var(--amber-strong); }

/* Icon squares & list rows */
.isq { width: 38px; height: 38px; border-radius: 11px; background: var(--lgreen); color: var(--deep); display: grid; place-items: center; flex: none; }
.isq.red { background: var(--red-tint); color: var(--red); }
.isq.amber { background: var(--amber); color: var(--amber-text); }
.isq.grey { background: var(--chip); color: var(--body); }
.isq.dark { background: var(--deep); color: #fff; }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); min-width: 0; }
.li:first-child { border-top: 0; }
.li .t { font-weight: 600; font-size: 15px; }
.li .m { color: var(--muted); font-size: 13px; }
.li .r { margin-left: auto; text-align: right; flex: none; }

/* Chips, badges, tabs */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--chip); color: var(--body); }
.badge svg { width: 13px; height: 13px; }
.b-green { background: var(--lgreen); color: var(--forest); }
.b-solid { background: var(--primary); color: #fff; }
.b-red { background: var(--red-tint); color: var(--red-text); }
.b-redsolid { background: var(--red); color: #fff; }
.b-amber { background: var(--amber-tint); color: var(--amber-text); box-shadow: inset 0 0 0 1px var(--amber-border); }
.b-mint { background: var(--pale-mint); color: var(--deep); }
.b-outline { background: none; border: 1px solid var(--input-b); color: var(--body); }
.seg { align-self: flex-start; display: inline-flex; background: var(--chip); border-radius: 14px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; height: 38px; padding: 0 16px; border-radius: 11px; font-weight: 600; font-size: 14px; color: var(--body); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--deep); color: #fff; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { height: 36px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--input-b); background: var(--surface); font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--deep); border-color: var(--deep); color: #fff; }
.chip.sm { height: 30px; padding: 0 12px; font-size: 13px; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.toolbar .search { height: 38px; max-width: 280px; }
.sel { height: 38px; border-radius: 11px; border: 1.5px solid var(--input-b); background: var(--surface); padding: 0 10px; font-size: 14px; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

/* Tables */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font: 700 11px/1.3 var(--f-text); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 14px 12px; border-bottom: 1px solid var(--border); background: var(--surface); vertical-align: bottom; }
.tbl td { padding: 12px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: normal; overflow-wrap: anywhere; }
.tbl th:first-child, .tbl td:first-child { padding-left: 18px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 18px; }
.tbl td.r, .tbl .tag, .tbl .badge, .tbl .btn, .tbl .link { white-space: nowrap; overflow-wrap: normal; }
.tbl td:first-child { min-width: 96px; }
.tbl .mono { overflow-wrap: anywhere; }
.tbl-wrap { container: tbl / inline-size; }
.tbl tbody tr:hover td { background: var(--lgreen-2); }
.tbl tr.picked td { background: var(--lgreen); }
.tbl tr.click { cursor: pointer; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .wrap { white-space: normal; min-width: 140px; }
.split .tbl th, .split .tbl td, .panes .tbl th, .panes .tbl td { padding-left: 10px; padding-right: 10px; }
.split .tbl th:first-child, .split .tbl td:first-child { padding-left: 16px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tag { font: 500 14.5px var(--f-mono); color: var(--deep); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; background: none; border: 0; padding: 0; cursor: pointer; }
.tag.plain { text-decoration: none; cursor: default; }
.foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13.5px; flex-wrap: wrap; }
.pager { margin-left: auto; display: flex; gap: 6px; }
.pager button { height: 36px; min-width: 36px; padding: 0 12px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); font-weight: 700; font-size: 13.5px; cursor: pointer; }
.pager button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.note { color: var(--muted); font-size: 13px; padding: 12px 18px; border-top: 1px solid var(--border); }

/* Banners */
.stop { background: var(--red); color: #fff; border-radius: var(--r-card); padding: 16px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.stop .grow { min-width: min(100%, 260px); }
.stop .eyebrow { color: #FBD9D4; }
.stop h3 { font: 700 21px/1.15 var(--f-head); margin: 5px 0 2px; }
.stop p { margin: 0; font-size: 13.5px; color: #FDEBE8; }
.stop > svg { width: 28px; height: 28px; }
.callout { display: flex; gap: 12px; align-items: flex-start; border-radius: 14px; padding: 14px 16px; font-size: 14px; background: var(--lgreen-2); color: var(--forest); border: 1px solid var(--pale-mint); }
.callout b { display: block; }
.callout.amber { background: var(--amber-tint); color: var(--amber-text); border: 1.5px solid var(--amber-border); }
.callout.amber > svg { color: var(--amber-strong); }
.callout.amber .muted, .callout.amber small, .stat.amber .muted, .att.amber .muted { color: var(--amber-text); }
.callout.red { background: var(--red-tint); color: var(--red-text); border-color: #EBC0BA; }
.callout.grey { background: var(--chip); color: var(--body); border-color: var(--border); }
.sample-banner { margin-bottom: 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.drop { display: block; border-style: dashed; border-width: 2px; text-align: center; padding: 36px; cursor: pointer; }
.drop-t { font-weight: 700; margin-top: 10px; }
.drop-n { font-size: 13px; }
.kcard[draggable] { cursor: grab; }
.kcard.dragging { opacity: .45; }
.board .col.drop-over { outline: 2px dashed var(--primary); outline-offset: -4px; background: var(--lgreen-2); }
.cvi-paper { padding: 22px; border-width: 1.5px; border-color: var(--input-b); border-radius: 6px; }
.cvi-sign { margin-top: 14px; border: 1px dashed var(--input-b); border-radius: 6px; padding: 12px 14px; }
/* Print or save PDF: only the marked document */
@media print {
  body.printing * { visibility: hidden; }
  body.printing .print-doc, body.printing .print-doc * { visibility: visible; }
  body.printing .print-doc { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; }
  body.printing .print-doc .btn { display: none; }
}
.sheet-body > .callout { margin-bottom: 16px; }

/* Progress / meters */
.bar { height: 6px; background: var(--chip); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.bar.amber i { background: var(--amber); } .bar.red i { background: var(--red); }

/* Key-value grid */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; background: var(--lgreen-2); border-radius: 14px; padding: 14px 16px; }
.kv .eyebrow { font-size: 10.5px; }
.kv div > div:last-child { font-size: 14.5px; margin-top: 4px; }

.brand-row { gap: 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 14px; }
.brand-chip { width: 52px; height: 44px; border-radius: 10px; background: var(--chip); color: var(--forest); display: grid; place-items: center; flex: none; }
.brand-plate { width: 104px; height: 84px; border-radius: 14px; background: var(--chip); color: var(--forest); display: grid; place-items: center; flex: none; }

/* Empty */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .isq { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 12px; }
.empty b { display: block; color: var(--deep); font: 700 19px var(--f-head); margin-bottom: 4px; }

/* Kanban */
.board { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)); gap: 16px; overflow-x: auto; }
.col { background: var(--chip); border-radius: var(--r-card); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 240px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 6px; font-weight: 700; }
.col-head .badge { margin-left: auto; background: var(--surface); }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }

/* ───────────── Forms & sheet ───────────── */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { font-weight: 600; font-size: 14px; color: var(--ink); }
.field .help { color: var(--muted); font-size: 13px; }
.inp { height: 48px; border-radius: var(--r-input); border: 1.5px solid var(--input-b); background: var(--surface); padding: 0 14px; font-size: 15px; width: 100%; min-width: 0; }
textarea.inp { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
.inp::placeholder { color: var(--ph); }
.inp:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(49, 122, 7, .18); }
.unit { position: relative; }
.unit .inp { padding-right: 52px; }
.unit span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; }
.opt { display: flex; flex-wrap: wrap; gap: 8px; }
.opt label { cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 99px; border: 1.5px solid var(--input-b); font-weight: 600; font-size: 14px; background: var(--surface); }
.opt input:checked + span { background: var(--deep); border-color: var(--deep); color: #fff; }
.opt input:focus-visible + span { outline: 2.5px solid var(--primary); outline-offset: 2px; }
.divider { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 2px; }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: flex; justify-content: flex-end; animation: fade .18s ease-out; }
.sheet { width: min(560px, 100%); height: 100%; background: var(--ground); display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(30, 69, 8, .18); animation: slide .22s cubic-bezier(.2, .8, .2, 1); }
.sheet-head { padding: 22px 24px 16px; display: flex; gap: 12px; align-items: flex-start; border-bottom: 1px solid var(--border); background: var(--surface); }
.sheet-head h2 { font: 700 24px/1.1 var(--f-head); color: var(--deep); margin: 4px 0 0; }
.sheet-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.sheet-foot { padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.sheet-foot .btn { flex: 1; height: 52px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--deep); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; display: flex; gap: 10px; align-items: center; z-index: 80; box-shadow: 0 10px 30px rgba(30, 69, 8, .3); animation: fade .2s; max-width: calc(100% - 32px); }
.toast svg { color: var(--online); }
.toast.error { background: var(--red); }
.toast.error svg { color: #fff; }

/* Charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 500 11px var(--f-text); fill: var(--muted); }



/* medium tables: tighter cells */
@container tbl (max-width: 920px) {
  .tbl { font-size: 13.5px; }
  .tbl th, .tbl td { padding-left: 8px; padding-right: 8px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 14px; }
  .tbl th:last-child, .tbl td:last-child { padding-right: 14px; }
  .tbl th { letter-spacing: .04em; }
  .tbl .btn-sm { padding: 0 10px; }
}

/* narrow tables become stacked cards */
@container tbl (max-width: 760px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 14px; white-space: normal; text-align: right; min-height: 28px; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font: 600 12.5px/1.3 var(--f-text); text-align: left; flex: none; max-width: 46%; }
  .tbl td:first-child { justify-content: flex-start; text-align: left; font-size: 15.5px; padding-bottom: 6px; }
  .tbl td:first-child::before, .tbl td[data-label=""]::before { display: none; }
  .tbl td[data-label=""] { justify-content: flex-end; }
  .tbl td .cv { min-width: 0; display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
  .tbl td:first-child .cv { justify-content: flex-start; }
  .tbl td:has(> .cv:empty) { display: none; }
  .tbl tbody tr:hover td { background: none; }
  .tbl tr.picked { background: var(--lgreen); }
  .tbl tr.picked td { background: none; }
  .tbl .wrap { min-width: 0; }
  .tbl { overflow: visible; }
  .tbl td:first-child, .tbl td.r { white-space: normal; }
}


/* farm map (live) */
.map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.map-card { position: sticky; top: 86px; }
.farm-map { height: min(72vh, 720px); min-height: 420px; background: #1d2a1f; }
.farm-map.drawing, .farm-map.drawing .leaflet-interactive { cursor: crosshair; }
.farm-map .empty { color: #fff; height: 100%; display: grid; place-items: center; }
.leaflet-tooltip.map-label { background: rgba(20, 36, 14, .78); border: 0; box-shadow: none; color: #fff; border-radius: 8px; padding: 4px 8px; font: 500 12px/1.3 var(--f-text); text-align: center; }
.leaflet-tooltip.map-label b { display: block; font-size: 12.5px; font-weight: 700; }
.leaflet-tooltip.map-label::before { display: none; }
.vtx { background: #FFD84D; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0, 0, 0, .45); cursor: grab; }
.map-draw .muted, .map-home .muted { font-size: 13.5px; margin: 6px 0 0; }
.map-draw-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.map-warn { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--red-tint); color: var(--red-text); font-size: 13.5px; }
.map-home { display: flex; gap: 12px; align-items: flex-start; background: var(--lgreen-2); border-color: var(--pale-mint); }
.map-home > svg { color: var(--deep); flex: none; margin-top: 2px; }
.map-detail .facts { margin-top: 12px; }
.map-hint { font-size: 13.5px; margin: 12px 0 0; }
.map-list-h { padding: 16px 18px 6px; }
.map-list { list-style: none; margin: 0; padding: 0 10px 8px; max-height: 420px; overflow-y: auto; }
.map-list li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 10px; }
.map-list li.on { background: var(--lgreen); }
.map-item { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 7px 0; cursor: pointer; display: flex; flex-direction: column; gap: 1px; color: inherit; font: inherit; }
.map-item b { font-weight: 600; font-size: 14.5px; }
.map-item span { font-size: 12.5px; }
.map-list-foot { padding: 4px 18px 16px; display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 1100px) {
  .map-wrap { grid-template-columns: minmax(0, 1fr); }
  .map-card { position: static; }
  .farm-map { height: 62vh; min-height: 360px; }
}

/* animal page */
.animal-page { display: flex; flex-direction: column; gap: 18px; max-width: 1080px; min-width: 0; }
.animal-back { margin: -6px 0 -6px -10px; }
.animal-head { display: flex; align-items: flex-start; gap: 16px; }
.animal-tag { font-size: 40px; line-height: 1.05; color: var(--deep); margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.animal-head p { margin: 6px 0 0; font-size: 15px; }
.animal-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.animal-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.animal-grid .sec { margin-bottom: 12px; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.facts div { min-width: 0; }
.facts dt { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.facts dd { margin: 3px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.facts.two { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.weight-now { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.weight-now b { font: 700 38px/1 var(--f-head); color: var(--ink); font-variant-numeric: tabular-nums; }
.weight-now span { font-weight: 600; color: var(--muted); }
.weight-now small { margin-left: 6px; font-size: 13px; }
.weight-chart { margin-top: 12px; color: var(--primary); }
.weight-chart svg { width: 100%; height: auto; }
.history-h { padding: 18px 20px 6px; }
.history-empty { margin: 0; padding: 8px 20px 20px; font-size: 14.5px; }
.history { list-style: none; margin: 0; padding: 4px 20px 10px; }
.history li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.history li:first-child { border-top: 0; }
.history .isq { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.history .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history b { font-weight: 600; font-size: 14.5px; }
.history .grow .muted { font-size: 13px; }
.history time { font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .animal-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .animal-tag { font-size: 32px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .history li { flex-wrap: wrap; }
  .history time { margin-left: 44px; }
}

/* dashboard */
.dash { display: flex; flex-direction: column; gap: 32px; min-width: 0; max-width: 1240px; }
.sec-row { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sec-row > .link { margin-left: auto; }

.brief { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 40px; flex-wrap: wrap; padding-top: 6px; }
.brief > div:first-child { flex: 1 1 520px; min-width: 0; }
.brief-hello { font: 700 44px/1.04 var(--f-head); color: var(--deep); margin: 0; letter-spacing: -.01em; }
.brief-text { font: 600 22px/1.45 var(--f-head); color: var(--ink); margin: 14px 0 0; max-width: 48ch; text-wrap: pretty; }
.brief-text .hl { color: var(--deep); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; text-decoration-color: var(--mint); text-decoration-skip-ink: none; }
.brief-text .hl:hover { text-decoration-color: var(--primary); }
.brief-text .hl-stop { color: var(--red-text); text-decoration-color: #E59A92; }
.brief-text .hl-stop:hover { text-decoration-color: var(--red); }
.brief-text .hl-warn { color: var(--amber-text); text-decoration-color: var(--amber); }
.brief-acts { display: flex; gap: 8px; flex-wrap: wrap; }

.dash-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.dash-pair > :only-child { grid-column: 1 / -1; }
.card.dcard { padding: 0; }
.dcard-head { display: flex; align-items: baseline; gap: 10px; padding: 18px 20px 12px; border-bottom: 1px solid var(--border); }
.dcard-head > .muted { font-size: 13.5px; }
.dcard-head > .link { margin-left: auto; }
.dcard-empty { margin: 0; padding: 18px 20px 22px; font-size: 14.5px; }

.jobs, .blk { list-style: none; margin: 0; padding: 4px 20px 8px; }
.jobs li { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 11px 0; border-top: 1px solid var(--border); }
.jobs li:first-child, .jobs .now-row + li { border-top: 0; }
.jobs .t { font-size: 13.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.job { text-align: left; background: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-width: 0; color: inherit; font: inherit; }
.job b { font-weight: 600; font-size: 15px; color: var(--ink); }
.job span { color: var(--muted); font-size: 13px; }
.job:hover b { color: var(--deep); text-decoration: underline; text-underline-offset: 3px; }
.jobs li.late .t, .jobs li.late .job span { color: var(--red-text); }
.jobs li.done .job b { color: var(--muted); text-decoration: line-through; }
.jobs .now-row { display: flex; align-items: center; gap: 10px; padding: 2px 0; border-top: 0; font-size: 12.5px; font-weight: 700; color: var(--deep); font-variant-numeric: tabular-nums; }
.jobs .now-row::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: var(--primary); }

.blk li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.blk li:first-child { border-top: 0; }
.blk-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.blk-who > .muted { font-size: 13px; }
.blk-who > .tag { align-self: flex-start; }
.blk-when { display: flex; flex-direction: column; align-items: flex-end; flex: none; text-align: right; }
.blk-when b { color: var(--red-text); font-size: 15px; font-variant-numeric: tabular-nums; }
.blk-when span { font-size: 12.5px; }

/* pasture run: width is area, shade is grass */
.run { display: flex; flex-wrap: wrap; gap: 5px; }
.pad { flex: 1 1 0; min-width: 112px; min-height: 120px; border: 0; border-radius: 12px; padding: 12px 12px 11px; text-align: left; cursor: pointer; display: flex; flex-direction: column; color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.pad:hover { box-shadow: inset 0 0 0 2px var(--deep); }
.pad.on-dark { color: #fff; box-shadow: none; }
.pad.on-dark:hover { box-shadow: inset 0 0 0 2px var(--deep); }
.pad.rest { background: repeating-linear-gradient(135deg, var(--chip) 0 6px, var(--surface) 6px 12px); }
.pad-name { font-weight: 600; font-size: 13.5px; line-height: 1.2; overflow-wrap: break-word; }
.pad-head { font: 700 26px/1 var(--f-head); margin-top: auto; padding-top: 14px; font-variant-numeric: tabular-nums; }
.pad-head small { font: 500 12.5px var(--f-text); }
.pad-meta { font-size: 12.5px; margin-top: 4px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-key { margin: 10px 0 0; font-size: 13px; }

@media (max-width: 980px) {
  .dash-pair { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .dash { gap: 26px; }
  .brief-hello { font-size: 34px; }
  .brief-text { font-size: 19px; }
  .brief-acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .dcard-head { padding: 16px 16px 10px; }
  .jobs, .blk { padding: 4px 16px 8px; }
  .jobs li { grid-template-columns: 64px minmax(0, 1fr); }
  .pad { flex-basis: 40% !important; min-height: 100px; }
}

/* sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ground); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-big);
  padding: 28px 26px; display: flex; flex-direction: column; gap: 16px; }
.login-card .brand { padding: 0 0 4px; color: var(--deep); }
.login-card .brand small { color: var(--muted); }
.login-title { font-size: 26px; margin: 0; }
.login-card .muted { margin: -6px 0 0; font-size: 14px; }
.setup-key { font-size: 18px; letter-spacing: .04em; padding: 12px 14px; background: var(--lgreen-2); border-radius: 12px; word-break: break-all; }
.recovery { columns: 2; margin: 0; padding-left: 22px; font-size: 15px; line-height: 1.9; }
.field.bad > label { color: var(--red-text); }
.field.bad .inp, .inp[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.login-error { margin: 0; color: var(--red-text); background: var(--red-tint); border-radius: 12px; padding: 10px 12px; font-size: 14px; }

/* ───────────── Responsive ───────────── */
@media (max-width: 1360px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > aside { position: static !important; }
  .panes.rev { grid-template-columns: minmax(0, 1fr) minmax(0, min(var(--pane, 340px), 360px)); }
}
@media (max-width: 1180px) {
  .split, .panes.rev { grid-template-columns: minmax(0, 1fr); }
  .split > aside, .panes > aside { position: static !important; }
  .me div, .synced span, .top-spacer, .search kbd { display: none; }
  .synced { padding: 10px; }
  .top { padding-left: 24px; padding-right: 24px; }
  .content { padding-left: 24px; padding-right: 24px; }

  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick { margin-left: 0; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .22s; }
  .app.nav-open .side { transform: none; box-shadow: 10px 0 40px rgba(0, 0, 0, .25); }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--scrim); z-index: 55; }
  .icon-btn.menu-btn { display: grid; }
  .top { padding: 10px 16px; }
  .content { padding: 20px 16px 48px; }
  .g3, .g2, .panes { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: flex-start; }
  .sheet-head, .sheet-body { padding-left: 18px; padding-right: 18px; }
  .sheet-foot { padding-left: 18px; padding-right: 18px; }
  .me div, .synced span, .top .btn-outline span { display: none; }
}

@media (max-width: 720px) {
  /* Tabs scroll sideways instead of wrapping */
  .seg { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); width: 100%; }
  .seg button { padding: 0 10px; white-space: normal; line-height: 1.15; min-height: 38px; height: auto; }
  .toolbar { padding: 14px 16px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar .chips, .chips { flex-wrap: wrap; }
  .chip { height: 34px; padding: 0 13px; font-size: 13.5px; }
  .toolbar .check { margin-left: 0 !important; }
  .card { padding: 16px; }
  .card.flush { padding: 0; }
  .foot { padding: 12px 16px; }
  .pager { margin-left: 0; width: 100%; }
  .pager button:first-child, .pager button:last-child { flex: 1; }
  .stop { padding: 14px 16px; }
  .hero { padding: 18px; }
  .hero h2 { font-size: 26px; }
}
@media (max-width: 640px) {
  .title { font-size: 28px; }
  .g4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .form { grid-template-columns: minmax(0, 1fr); }
  .quick { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .hero-nums { gap: 18px; }
  .top .btn-outline, .synced, .search kbd, .me, .top-spacer { display: none; }
  .board { grid-template-columns: minmax(0, 1fr) !important; overflow: visible; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { height: 40px; padding: 0 14px; font-size: 14px; }
  .page-head .actions .btn-primary { order: -1; flex-basis: 100%; height: 46px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .n { font-size: 26px; }
  .content { gap: 18px; }
  .sheet-foot .btn { height: 48px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
