/* Pig Brother. Palette: spruce barn board, sage paper, ear-tag yellow.
   Money reads red below zero and green above, because the core idea is
   that every animal is an account that starts in the red. */
:root {
  --spruce: #1E3B34;
  --spruce-2: #2A4F45;
  --spruce-3: #3E6B5E;
  --paper: #ECEFE9;
  --card: #FFFFFF;
  --ink: #17201D;
  --muted: #5A6762;
  --line: #CDD5CE;
  --line-2: #E2E7E2;
  --tag: #F4C21F;
  --tag-deep: #C79400;
  --tag-ink: #2B2300;
  --loss: #A8322D;
  --loss-bg: #F7E3E1;
  --gain: #2C7A4B;
  --gain-bg: #E0F0E5;
  --warn-bg: #FCF1CF;
  --info: #2D5F86;
  --info-bg: #E2EDF5;
  --chart-young: #8FB5A6;
  --chart-old: #B07A12;
  --head: "Bahnschrift", "DIN Alternate", "Barlow Semi Condensed", "Roboto Condensed", "Arial Narrow", "DejaVu Sans Condensed", sans-serif;
  --body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, "Noto Sans", sans-serif;
  --r: 6px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--head); font-stretch: semi-condensed; letter-spacing: 0.005em; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: 1.95rem; font-weight: 600; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 .8em; }
a { color: var(--info); }
a:hover { color: var(--ink); }
code, .code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .86em; }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; border-radius: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.neg { color: var(--loss); }
.pos { color: var(--gain); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 38px; padding: 0 16px;
  border-radius: var(--r); border: 1px solid transparent; font: 600 .93rem var(--body); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--spruce); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--spruce-2); color: #fff; }
.btn-tag { background: var(--tag); color: var(--tag-ink); border-color: var(--tag-deep); }
.btn-tag:hover { background: #F7CF45; color: var(--tag-ink); }
.btn-ghost { background: transparent; color: var(--spruce); border-color: var(--line); }
.btn-ghost:hover { background: var(--line-2); color: var(--ink); }
.btn-ghost-light { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn-big { min-height: 52px; font-size: 1.05rem; padding: 0 22px; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: .8rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--info); text-decoration: underline; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  min-height: 40px; padding: 7px 10px; width: 100%; }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--spruce); }
input:disabled, select:disabled { background: var(--line-2); color: var(--muted); }
input::placeholder { color: #8A958F; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label { font-weight: 600; font-size: .86rem; color: var(--ink); }
.field-hint { font-size: .8rem; color: var(--muted); }
.field-wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 16px; align-items: start; margin-bottom: 14px; }
.form-grid.narrow { max-width: 460px; grid-template-columns: 1fr; }
.form-foot { grid-column: 1 / -1; }
.form-error { color: var(--loss); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 180px; }
.filters-btn { padding-bottom: 1px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chips, .type-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 13px; font: 500 .88rem var(--body); cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--spruce-3); }
.chip-on { background: var(--spruce); color: #fff; border-color: var(--spruce); }

/* ---------- ear tag ---------- */
.eartag { position: relative; display: inline-flex; align-items: center; justify-content: center; font-family: var(--head); font-stretch: semi-condensed;
  font-weight: 700; color: var(--tag-ink); background: var(--tag); border: 1px solid var(--tag-deep);
  border-radius: 46% 46% 9px 9px / 34% 34% 9px 9px; font-variant-numeric: tabular-nums; }
.eartag::before { content: ""; position: absolute; top: 4px; left: 50%; width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%;
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--tag-deep); }
.eartag-sm { min-width: 46px; padding: 11px 8px 3px; font-size: .9rem; }
.eartag-md { min-width: 62px; padding: 15px 10px 5px; font-size: 1.1rem; }
.eartag-lg { min-width: 92px; padding: 24px 14px 9px; font-size: 1.75rem; }
.eartag-lg::before { width: 12px; height: 12px; margin-left: -6px; top: 7px; }

/* ---------- badges, banners ---------- */
.badge { display: inline-block; white-space: nowrap; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--line-2); color: var(--muted); margin: 2px 4px 2px 0; }
.badge-gain { background: var(--gain-bg); color: var(--gain); }
.badge-loss { background: var(--loss-bg); color: var(--loss); }
.badge-warn { background: var(--warn-bg); color: #7A5A00; }
.badge-info { background: var(--info-bg); color: var(--info); }
.banner { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r);
  margin-bottom: 16px; border-left: 5px solid; }
.banner-warn { background: var(--warn-bg); border-color: var(--tag-deep); }
.banner-error { background: var(--loss-bg); border-color: var(--loss); }
.banner-ok { background: var(--gain-bg); border-color: var(--gain); }
.loading { padding: 40px; color: var(--muted); }
.empty { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 32px; text-align: center; }
.empty p { color: var(--muted); max-width: 52ch; margin: 0 auto; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--spruce); color: #DCE6E1; padding: 22px 14px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: var(--head); font-weight: 700; font-size: 1.55rem; letter-spacing: .02em; color: #fff; }
.brand-xl { font-size: 3.2rem; }
.brand-row { padding: 0 8px; display: flex; flex-direction: column; }
.brand-sub { font-size: .8rem; color: #A9C0B7; }
.farm-switch select { background: var(--spruce-2); color: #fff; border-color: var(--spruce-3); }
.sidebar nav { display: flex; flex-direction: column; gap: 10px; }
/* grouped menu (update 2026.10.26-a) */
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-head { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: #A9C0B7; font: inherit; font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 6px 10px 4px; margin: 0; cursor: pointer; text-align: left; border-radius: var(--r); }
.nav-head:hover { color: #fff; background: var(--spruce-2); }
.nav-head-static, .nav-head-pinned { cursor: default; }
.nav-head-static:hover, .nav-head-pinned:hover { background: none; color: #A9C0B7; }
.nav-head-pinned { color: var(--tag); }
.nav-caret { width: 10px; display: inline-block; font-size: .8rem; }
.nav-row { display: flex; align-items: stretch; gap: 2px; }
.nav-row .nav-link { flex: 1; min-width: 0; }
.nav-pin { background: none; border: 0; color: #7E9A91; font-size: 1rem; line-height: 1; padding: 0 8px; border-radius: var(--r); cursor: pointer; opacity: 0; }
.nav-row:hover .nav-pin, .nav-pin.on, .nav-pin:focus-visible { opacity: 1; }
.nav-pin:hover { color: var(--tag); background: var(--spruce-2); }
.nav-pin.on { color: var(--tag); }
.nav-row.active .nav-pin { color: var(--tag-deep); }
/* menu layout editor */
.layout-group { padding-top: 10px; }
.layout-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.layout-name { font-family: var(--head); font-weight: 700; font-size: 1.1rem; max-width: 340px; }
.layout-tools { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.layout-tools select { width: auto; padding: 5px 8px; font-size: .85rem; }
.layout-tools .check { white-space: nowrap; }
.layout-list { list-style: none; margin: 0; padding: 0; }
.layout-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 4px; border-top: 1px solid var(--line-2); }
@media (max-width: 640px) { .layout-row { flex-wrap: wrap; } }
.layout-row.off .layout-label { color: var(--muted); }
.layout-label { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; }
.layout-add { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.layout-add input { max-width: 300px; }
.btn-sm { padding: 4px 9px; font-size: .85rem; }
@media (hover: none) { .nav-pin { opacity: .7; } }
.nav-link { color: #DCE6E1; text-decoration: none; padding: 9px 10px; border-radius: var(--r); font-weight: 500; text-align: left; }
.nav-link:hover { background: var(--spruce-2); color: #fff; }
.nav-link.active { background: var(--paper); color: var(--ink); box-shadow: inset 4px 0 0 var(--tag); }
.nav-link.small { font-size: .85rem; padding: 6px 10px; }
.sidebar .linklike { color: #DCE6E1; text-decoration: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.sync-note { color: var(--tag); font-size: .82rem; margin: 6px 10px; }
.main { min-width: 0; }
.topbar { display: none; }
.content { padding: 28px 34px 60px; max-width: 1280px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.lede { color: var(--muted); max-width: 72ch; font-size: 1rem; }
.back { display: inline-block; margin-bottom: 10px; font-weight: 600; text-decoration: none; color: var(--spruce-3); }
.back::before { content: "‹ "; }
.noframe { max-width: 900px; margin: 0 auto; padding: 30px 20px; }

/* ---------- panels, stats ---------- */
.panel { background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; min-width: 0; overflow-x: auto; }
/* update 2026.11.02-k (review E): a wide table scrolls inside its panel instead of pushing the page past the window; panels that
   hold a sticky save bar or a map keep normal overflow so those still work */
.panel:has(.save-bar), .panel:has(.sticky-save), .panel:has(.map-canvas), .panel:has(.tilemap) { overflow: visible; }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.chip, .tag, .eartag { white-space: nowrap; }
.table select { min-width: 11em; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 { margin-bottom: 18px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0; margin-bottom: 18px;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; }
.stat { padding: 16px 20px; border-left: 1px solid var(--line-2); }
.stat:first-child { border-left: 0; }
.stat-value { font-family: var(--head); font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-weight: 600; font-size: .88rem; }
.stat-sub { font-size: .82rem; color: var(--muted); }
.stat-loss .stat-value { color: var(--loss); }
.stat-tag { box-shadow: inset 0 -4px 0 var(--tag); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-bottom: 8px; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: middle; }
.table thead th { font-size: .8rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody th { font-weight: 600; font-size: .9rem; }
.table .num { text-align: right; }
.table.nowrap td { white-space: nowrap; }
.table.compact th, .table.compact td { padding: 6px 7px; font-size: .9rem; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #F4F7F3; }
.table .row-sub td { color: var(--muted); background: #F8FAF7; }
.table input, .table select { min-height: 34px; padding: 4px 8px; }

/* ---------- charts ---------- */
.chart { margin: 0 0 6px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart figcaption { font-weight: 600; margin-bottom: 4px; }
.chart .grid { stroke: var(--line-2); }
.chart .zero { stroke: var(--ink); stroke-width: 1.5; }
.chart .tick { font-size: 12px; fill: var(--muted); font-family: var(--body); }
.chart .axis-label { font-size: 12.5px; fill: var(--ink); font-weight: 600; font-family: var(--body); }
.chart .pt-label { font-size: 12px; fill: var(--ink); font-weight: 600; font-family: var(--body); }
.chart .area-gain { fill: var(--gain); opacity: .16; }
.chart .area-loss { fill: var(--loss); opacity: .16; }
.chart .dot-gain { fill: var(--gain); stroke: #fff; stroke-width: 2; }
.chart .dot-loss { fill: var(--loss); stroke: #fff; stroke-width: 2; }
.chart .tip-bg { fill: var(--ink); }
.chart .tip { fill: #fff; font-size: 12px; font-family: var(--body); }
.chart-empty { padding: 26px; text-align: center; color: var(--muted); background: var(--paper); border-radius: var(--r); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 4px 0 0; font-size: .86rem; }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.swatch { width: 22px; height: 0; border-top: 3px solid; display: inline-block; }
.swatch.dashed { border-top-style: dashed; }
.swatch.dot { width: 11px; height: 11px; border: 0; border-radius: 50%; }

/* ---------- sow page ---------- */
.sow-head { display: flex; align-items: center; gap: 22px; margin-bottom: 18px; flex-wrap: wrap; }
.sow-head > div:nth-child(2) { flex: 1; min-width: 240px; }
.sow-head h1 { margin-bottom: .15em; }
.verdict { padding: 12px 18px; border-radius: 10px; background: var(--card); border: 1px solid var(--line-2); display: flex; flex-direction: column; min-width: 200px; }
.verdict-num { font-family: var(--head); font-size: 2rem; font-weight: 700; line-height: 1.1; }
.verdict-loss { background: var(--loss-bg); border-color: #EBC3BF; }
.verdict-gain { background: var(--gain-bg); border-color: #BFDDCA; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 96px 130px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-2); align-items: baseline; }
.tl-date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .88rem; }
.tl-type { font-weight: 600; }
.plain { list-style: none; padding: 0; margin: 0; }
.cohort-name { font-family: var(--head); font-size: 1.3rem; font-weight: 600; }
.cohort-facts { display: flex; flex-wrap: wrap; gap: 6px 26px; margin-bottom: 12px; }
.whatif { margin-top: 10px; padding: 12px 16px; background: var(--info-bg); border-radius: var(--r); }

/* ---------- actions & rules ---------- */
.action-list { list-style: none; padding: 0; margin: 0; }
.action { border: 1px solid var(--line-2); border-left: 5px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 8px; background: var(--card); }
.action-critical { border-left-color: var(--loss); }
.action-warning { border-left-color: var(--tag-deep); }
.action-info { border-left-color: var(--info); }
.action-main { display: flex; gap: 12px; align-items: flex-start; }
.action-text { flex: 1; min-width: 0; }
.action-text p { margin: 2px 0; }
.action-text > span { display: block; }
.action-impact { text-align: right; display: flex; flex-direction: column; font-family: var(--head); font-size: 1.2rem; font-weight: 600; }
.action-respond { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: grid; gap: 12px; }
.rule-strip { margin-top: 12px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.rule { background: var(--card); border: 1px solid var(--line-2); border-top: 4px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.rule-active { border-top-color: var(--gain); }
.rule-needs_definition { border-top-color: var(--tag); }
.rule header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.rule-options { margin: 6px 0 12px; font-size: .9rem; }
.rule-options summary { cursor: pointer; color: var(--spruce-3); font-weight: 600; }
.rule-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px 22px; }
.setting { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--r); background: #FAFBF9; border: 1px solid var(--line-2); }
.setting-missing { background: var(--warn-bg); border-color: #E9D48A; }
.setting-wide { grid-column: 1 / -1; }
.setting-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.save-bar { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--paper) 40%); }
.code { background: var(--spruce); color: #E8F0EC; padding: 14px 16px; border-radius: var(--r); overflow-x: auto; white-space: pre; }
.keybox { font-size: 1.05rem; white-space: pre-wrap; word-break: break-all; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 0; }
.roles dt { font-weight: 700; }
.roles dd { margin: 2px 0 0; color: var(--muted); }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(23, 32, 29, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 14px; z-index: 50; overflow-y: auto; }
.modal { color: var(--ink); background: var(--card); border-radius: 12px; width: 100%; max-width: 620px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-wide { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px 20px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 12px 20px; border-radius: 8px; color: #fff; font-weight: 600; z-index: 60;
  max-width: calc(100vw - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast-ok { background: var(--spruce); }
.toast-warn { background: #6E5300; }
.toast-error { background: var(--loss); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-brand { background: var(--spruce); color: #DCE6E1; padding: 9vh 7vw; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-brand p { font-size: 1.25rem; max-width: 30ch; line-height: 1.45; margin-top: 12px; }
.auth-card { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card form { width: 100%; max-width: 380px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.center-card { max-width: 420px; margin: 18vh auto; padding: 24px; text-align: center; }
.center-card .brand { color: var(--spruce); }

/* ---------- barn mode ---------- */
.barn { min-height: 100vh; background: var(--spruce); color: #fff; display: flex; flex-direction: column; }
.barn-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; gap: 10px; }
.barn-head > div { display: flex; flex-direction: column; }
.barn-farm { background: var(--spruce-2); color: #fff; border-color: var(--spruce-3); margin-top: 2px; min-height: 36px; }
.barn-farm-name { color: #A9C0B7; font-size: .9rem; }
.sync-bar { margin: 0 16px; padding: 9px 12px; border-radius: var(--r); background: rgba(255,255,255,.08); font-size: .92rem; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sync-wait { background: rgba(244,194,31,.18); color: #FFE7A0; }
.sync-off { background: var(--tag); color: var(--tag-ink); font-weight: 600; }
.barn-errors { margin: 10px 16px 0; padding: 10px 12px; border-radius: var(--r); background: #6E2420; font-size: .9rem; }
.barn-errors ul { margin: 6px 0; padding-left: 18px; }
.barn-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 16px 0; background: rgba(0,0,0,.2); border-radius: 10px; padding: 4px; gap: 4px; }
.barn-tabs button { background: transparent; color: #DCE6E1; border: 0; border-radius: 8px; min-height: 48px; font: 600 1rem var(--body); cursor: pointer; }
.barn-tabs button.on { background: var(--paper); color: var(--ink); }
.barn-body { flex: 1; background: var(--paper); color: var(--ink); margin-top: 14px; border-radius: 18px 18px 0 0; padding: 20px 16px 40px; }
.barn-label { display: block; font-weight: 700; margin: 0 0 6px; font-size: 1rem; }
.barn-input { font-size: 1.6rem; min-height: 62px; font-family: var(--head); letter-spacing: .04em; }
.tag-hits { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.tag-hit { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 64px; cursor: pointer; font: inherit; color: var(--ink); }
.group-hits { display: flex; flex-wrap: wrap; gap: 8px; }
.group-hit { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0 18px; min-height: 52px; font: 600 1rem var(--body); cursor: pointer; color: var(--ink); }
.barn-note { color: var(--muted); margin-top: 14px; }
.barn-subject { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.barn-subject .btn-ghost-light { color: var(--spruce); border-color: var(--line); }
.group-name { font-family: var(--head); font-size: 1.6rem; }
.barn .event-form .chip { min-height: 46px; padding: 0 16px; font-size: .98rem; }
.barn .event-form .form-grid { grid-template-columns: 1fr 1fr; }
.barn .event-form input, .barn .event-form select { min-height: 52px; font-size: 1.1rem; }
.barn .event-form .btn-big { width: 100%; min-height: 60px; font-size: 1.15rem; background: var(--tag); color: var(--tag-ink); border-color: var(--tag-deep); }
.barn-check { margin-bottom: 12px; }
.barn-actions .action-main { flex-wrap: wrap; }
.sow-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.sow-facts div { background: var(--card); border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line-2); }
.sow-facts dt { font-size: .82rem; color: var(--muted); }
.sow-facts dd { margin: 0; font-weight: 700; font-size: 1.05rem; }
.sow-facts .next { grid-column: 1 / -1; background: var(--warn-bg); border-color: #E9D48A; }
.barn-flag { background: var(--card); border-radius: var(--r); padding: 8px 10px; }
.barn-h { margin-top: 16px; }
.event-form.compact .type-picker { margin-bottom: 14px; }
.event-form .type-picker { margin-bottom: 14px; }

/* ---------- performance vs model ---------- */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.skipped { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 18px; }
.chip-muted { background: transparent; border-style: dashed; color: var(--muted); text-decoration: none; }
.problems { margin-bottom: 26px; }
.problems > h2, .section-h { font-size: 1.35rem; margin: 6px 0 12px; }
.problem-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.problem { display: grid; grid-template-columns: 54px 1fr; background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.problem-rank { background: var(--loss); color: #fff; font-family: var(--head); font-size: 1.9rem; font-weight: 700; display: flex; align-items: flex-start; justify-content: center; padding-top: 12px; }
.problem-body { padding: 12px 16px 14px; min-width: 0; }
.problem-where { font-size: 1.15rem; font-family: var(--head); }
.problem-where strong { font-weight: 700; }
.problem-what { font-weight: 600; margin-bottom: 6px; }
.problem-nums { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 8px; }
.problem-gap { font-family: var(--head); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.subject-chip:hover { border-color: var(--spruce-3); background: #fff; }
.subject-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.subject-chip { color: var(--ink); text-decoration: none; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 1px 7px; font-size: .8rem; font-variant-numeric: tabular-nums; }
.metric-head { display: flex; flex-wrap: wrap; gap: 14px 30px; align-items: center; margin-bottom: 14px; }
.metric-big { display: flex; flex-direction: column; }
.metric-gap { font-family: var(--head); font-size: 2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric-share { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.share-bar { height: 10px; border-radius: 5px; background: var(--gain-bg); overflow: hidden; width: 220px; }
.share-bar span { display: block; height: 100%; background: var(--loss); }
.dim-chips { margin-bottom: 10px; }
.sortbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.seg-table td:first-child { white-space: nowrap; }
.row-problem td { background: var(--loss-bg); }
.gapbar { position: relative; display: block; width: 160px; height: 12px; }
.gapbar-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--ink); }
.gapbar-fill { position: absolute; top: 1px; bottom: 1px; border-radius: 2px; }
.gapbar-fill.bad { background: var(--loss); }
.gapbar-fill.good { background: var(--gain); }
.method { background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 18px; }
.method summary { cursor: pointer; font-weight: 600; color: var(--spruce-3); }
.method p, .method ul { margin-top: 10px; max-width: 90ch; }
.topgaps { list-style: none; padding: 0; margin: 0; }
.topgaps li { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.topgap-gap { white-space: nowrap; font-family: var(--head); font-size: 1.3rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }

/* ---------- insights ---------- */
.tabs { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; }
.tab { padding: 10px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--tag-deep); }
.insight-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.insight-head .lede { margin: 0; flex: 1 1 420px; }
.timing { background: var(--warn-bg); border-left: 5px solid var(--tag-deep); border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px; font-size: 1.02rem; }
.move-list { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.move { background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; padding: 14px 16px; }
.move-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.move-line a { text-decoration: none; }
.move-n { font-family: var(--head); font-size: 1.35rem; font-weight: 700; }
.move-arrow { font-size: 1.6rem; font-weight: 700; color: var(--spruce-3); }
.move-why { margin-bottom: 8px; }
.move-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 0; font-size: .9rem; }
.move-facts dt { color: var(--muted); font-size: .8rem; }
.move-facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.score { display: inline-block; width: 54px; height: 8px; background: var(--line-2); border-radius: 4px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.score span { display: block; height: 100%; background: var(--spruce-3); }
.explain { background: var(--info-bg); border-radius: var(--r); padding: 10px 14px; margin: 0; }
.evidence { align-items: start; margin-bottom: 0; }
.row-cap td { background: var(--warn-bg); font-weight: 700; }
.todo { margin: 0; padding-left: 20px; }
.todo li { margin-bottom: 6px; }
.chart .band { fill: var(--gain); opacity: .09; }
.chart .normal { stroke: var(--gain); stroke-dasharray: 5 4; stroke-width: 1.5; }
.chart .dot-plain { fill: var(--ink); }
.series-grid { display: grid; gap: 0; }
.issue-list li, .flag-list li { padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.insight-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.insight-tile { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line-2); text-decoration: none; color: var(--muted); }
.insight-tile.on { color: var(--ink); background: var(--warn-bg); border-color: #E9D48A; }
.insight-n { font-family: var(--head); font-size: 1.7rem; font-weight: 700; color: var(--ink); }
.teats { margin: 4px 0 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.teats-edit { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.teats-edit input { width: 90px; min-height: 32px; }
.barn-foster { background: var(--card); border: 2px solid var(--tag); border-radius: 12px; padding: 14px; margin-bottom: 18px; }
.barn-foster h2 { margin-bottom: 6px; }
.barn-timing { font-size: .92rem; background: var(--warn-bg); border-radius: 6px; padding: 8px 10px; }
.move-big .move-n { flex-basis: 100%; }
.barn-foster .move-list { grid-template-columns: 1fr; margin-bottom: 6px; }
.barn-foster .move { padding: 10px 0; border: 0; border-top: 1px solid var(--line-2); border-radius: 0; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 40px 24px 28px; }
  .brand-xl { font-size: 2.4rem; }
}
/* update 2026.11.05-e: the drawer's pin / close buttons show only when the menu is a drawer (narrow window or phone) */
.nav-tools { display: none; gap: 6px; position: absolute; top: 0; right: 8px; }
.brand-row { position: relative; }
.nav-backdrop { display: none; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-open .sidebar { transform: none; }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.35); }
  .nav-tools { display: inline-flex; }
  .nav-pin-btn, .nav-close-btn { color: #DCE6E1; border-color: rgba(220,230,225,.4); }
  .nav-pin-btn.btn-primary { color: #fff; }
  .nav-pinned .nav-close-btn { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--spruce); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
  .topbar-farm { font-family: var(--head); font-weight: 600; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .content { padding: 18px 16px 50px; }
  h1 { font-size: 1.6rem; }
  .stat { border-left: 0; border-top: 1px solid var(--line-2); }
  .stat:first-child { border-top: 0; }
  .stat-value { font-size: 1.6rem; }
  .rule-grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 96px 1fr auto; }
  .timeline li .tl-detail { grid-column: 1 / 3; }
  .timeline li .tl-detail { grid-column: 1 / -1; }
  .filters .field { min-width: 0; flex: 1 1 150px; }
  .panel { padding: 14px; }
  .settings-grid { grid-template-columns: 1fr; }
  .action-main { flex-wrap: wrap; }
  .problem-list { grid-template-columns: 1fr; }
  .move-list { grid-template-columns: 1fr; }
  .insight-strip { grid-template-columns: 1fr 1fr; }
  .tab { padding: 8px 10px; }
  .problem { grid-template-columns: 40px 1fr; }
  .problem-rank { font-size: 1.5rem; }
  .gapbar { width: 90px; }
  .share-bar { width: 100%; }
}
@media (max-width: 420px) {
  .barn .event-form .form-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* Delete farm (destructive actions) */
.btn-danger { background: var(--loss); color: #fff; border-color: var(--loss); }
.btn-danger:hover:not(:disabled) { background: #8E2925; color: #fff; }
.btn-ghost.btn-danger { background: transparent; color: var(--loss); border-color: var(--line); }
.btn-ghost.btn-danger:hover { background: var(--loss-bg); color: var(--loss); }
.row-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.error-text { color: var(--loss); margin: 8px 0 0; }

/* heat stress */
.banner-info { background: var(--info-bg); border-color: var(--info); }
.table tr.row-warn td { background: var(--warn-bg); }
.table tr.total-row th, .table tr.total-row td { border-top: 2px solid var(--line); font-weight: 600; }
.plain-list { margin: 0; padding-left: 18px; }
.plain-list li { margin: 4px 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* targets & benchmarks */
.basis-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.basis-pick label { font-weight: 600; }
.table tr.muted-row td { color: var(--muted); }
.warn-text { color: var(--tag-deep); font-weight: 600; }

/* workers, sow days, fostering */
.good-text { color: var(--gain); }
.bad-text { color: var(--loss); }
.worker-card { border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; }
.worker-card h3 { margin: 0 0 6px; }
.inline-form { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: 6px; }
.stack-bar { display: flex; height: 34px; border-radius: var(--r); overflow: hidden; margin: 6px 0 10px; }
.stack-bar span { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-cell { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: inherit; }
.done-by { margin: 8px 0; }
.fn-pick { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
.test-out { max-height: 260px; overflow: auto; background: var(--paper); padding: 8px; font-size: 12px; white-space: pre-wrap; }

/* Voice memo (Travis 2026-10-22) */
.voice { max-width: 760px; }
.voice-langs { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.voice-engine select { margin-left: 4px; }
.voice-mic { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 96px; margin: 14px 0 6px;
  border: 0; border-radius: 18px; background: var(--spruce); color: #fff; font: 700 1.3rem var(--head); cursor: pointer; }
.voice-mic:disabled { opacity: .45; cursor: not-allowed; }
.voice-mic.on { background: var(--loss); animation: voicepulse 1.2s ease-in-out infinite; }
@keyframes voicepulse { 50% { box-shadow: 0 0 0 10px rgba(180, 60, 50, .18); } }
@media (prefers-reduced-motion: reduce) { .voice-mic.on { animation: none; } }
.voice-hint { margin: 0 0 14px; color: var(--muted); }
.voice-text { width: 100%; font-size: 1.05rem; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin: 4px 0 8px; box-sizing: border-box; }
.voice-row { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-note { background: #FFF6DD; border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.voice-err { color: var(--loss); font-weight: 600; }
.voice-recs { margin-top: 16px; display: grid; gap: 10px; }
.voice-rec { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.voice-rec.blocked { border-color: var(--loss); }
.voice-rec.skipped { opacity: .5; }
.voice-rec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.voice-date { margin-left: auto; width: auto; min-width: 150px; }
.voice-fields { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.voice-fields label { display: grid; gap: 3px; font-size: .85rem; font-weight: 600; }
.voice-fields input, .voice-fields select { width: 120px; min-height: 40px; font-size: 1.05rem; }
.voice-fields input:not([type=number]) { width: 220px; }
.voice-warn { color: var(--loss); margin: 6px 0 0; padding-left: 18px; font-size: .9rem; }
.voice-said { margin: 6px 0 0; }
.voice-phrases { margin-top: 18px; }
.voice-phrases ul { padding-left: 18px; }
.voice-phrases code { font-size: .9rem; }
.voice-barn { padding: 4px 0; }
.voice-barn .btn-lg { min-height: 56px; font-size: 1.15rem; }
/* language switch (2026-10-22) */
.lang-switch { display: flex; align-items: center; gap: 6px; padding: 6px 12px; color: inherit; opacity: .85; }
.lang-switch select { font-size: .85rem; }
.barn-head-right { display: flex; gap: 8px; align-items: center; }
.barn-lang { font-size: .95rem; min-height: 40px; border-radius: 8px; }
.withdrawal-warn { background: #FCE9E6; border: 1px solid var(--loss); border-radius: 10px; padding: 10px 12px; margin: 8px 0; display: grid; gap: 6px; }
/* Health (2026-10-22) */
.bar-fill { display: block; height: 10px; border-radius: 5px; background: var(--loss); opacity: .7; }
.num-in { width: 70px; text-align: right; }
.audit-report h2 { margin-top: 12px; }
.audit-report h3 { margin: 18px 0 6px; }
@media print {
  .sidebar, .topbar, .tabs, .page-head, .no-print { display: none !important; }
  .main, .content { margin: 0 !important; padding: 0 !important; }
  .audit-report .table { font-size: 9pt; }
}
/* Biosecurity (2026-10-22) */
.inline-form.wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.inline-form.wrap label { display: grid; gap: 3px; font-size: .85rem; font-weight: 600; }
.stack-form { display: grid; gap: 10px; }
.stack-form label { display: grid; gap: 3px; font-size: .85rem; font-weight: 600; }
.break-band { fill: var(--loss); opacity: .10; }
.bar-mort { fill: var(--chart-young, #8FB6A8); opacity: .8; }
.line-uvc { stroke: var(--spruce); stroke-width: 2.5; }
.dot-uvc { fill: var(--spruce); }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.chart-legend .key { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.key-uvc { background: var(--spruce); } .key-mort { background: var(--chart-young, #8FB6A8); } .key-break { background: var(--loss); opacity: .25; }
/* Batch 4 (2026-10-22) */
.row-loss td { background: #FCE9E6; }
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 90px; margin: 8px 0; }
.mini-bars span { flex: 1; background: #7FA7C9; border-radius: 2px 2px 0 0; min-height: 2px; }
.mini-bars span.low { background: var(--loss); }
.stack-form.narrow { max-width: 460px; }
.stack-form label.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }

/* ---------- barn map (Travis 2026-10-23) ---------- */
.map-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.map-toolbar .crumbs select { font-weight: 600; }
.map-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.map-layout.with-side { grid-template-columns: minmax(0, 1fr) 340px; }
.map-stats { margin-bottom: 12px; }
.map-canvas { position: relative; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; user-select: none; }
.map-canvas img { display: block; width: 100%; height: auto; }
.map-canvas svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-canvas.editing { cursor: crosshair; }
.map-canvas .shape { cursor: pointer; }
.map-canvas .shape rect:hover { stroke: var(--tag-deep); stroke-width: 6; }
.map-canvas .shape-label rect { pointer-events: none; }
.map-blank { display: flex; align-items: center; justify-content: center; background: var(--paper); color: var(--muted); min-height: 240px; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin: 10px 0 6px; font-size: .85rem; color: var(--muted); }
.legend-item i { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--line); vertical-align: -2px; margin-right: 4px; border-radius: 3px; }
.map-side { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; position: sticky; top: 12px; max-height: calc(100vh - 40px); overflow-y: auto; }
.map-side .panel-head { padding: 0 0 10px; }
.map-side .stat-row { grid-template-columns: repeat(3, 1fr); }
.map-side .form-grid.one { grid-template-columns: 1fr; }
.map-side .map-fill .form-grid { grid-template-columns: 1fr 1fr; }
.map-edit-actions { margin-top: 10px; }
.btn.danger { color: var(--loss); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-cloud .badge { text-decoration: none; }
@media (max-width: 900px) {
  .map-layout.with-side { grid-template-columns: 1fr; }
  .map-side { position: static; max-height: none; }
}

/* ---------- sow card (Travis 2026-10-23) ---------- */
.sow-card .sow-head { margin-bottom: 10px; }
.sow-card-title { margin: 0 0 4px; }
.sow-card-title .small { font-weight: 400; margin-left: 8px; }
.sow-card-stats .stat-value { font-size: 1.4rem; }
.who-when { display: block; color: var(--muted); font-size: .78rem; }
.row-warn td { background: var(--warn-bg); }
.linkbadge { border: 0; cursor: pointer; font: inherit; }
.linkbadge:hover { background: var(--info); color: #fff; }

/* ---------- genetics (Travis 2026-10-23) ---------- */
.line-card { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.line-card:last-child { border-bottom: 0; }
.line-head { display: flex; gap: 10px; align-items: baseline; }
.line-head .btn { margin-left: auto; }
.inline-num { width: 90px; padding: 2px 6px; }
.rank-list { list-style: none; padding: 0; margin: 0; }
.rank-list li { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line-2); }
.rank-n { font-family: var(--head); font-size: 1.3rem; font-weight: 700; color: var(--tag-deep); }
.rank-val { font-family: var(--head); font-size: 1.2rem; font-weight: 700; }


/* legend toggles (tracker #26) */
.legend-toggles li { list-style: none; }
.legend-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .4em; padding: .1em .35em; border-radius: 4px; }
.legend-btn:hover { background: var(--panel-alt, rgba(0,0,0,.05)); }
.legend li.off .legend-btn { opacity: .45; text-decoration: line-through; }
.legend li.off .swatch { background: transparent !important; }
/* "show on map" highlight (tracker #24) */
.shape.shape-hl rect { stroke: #C79400 !important; }
.map-hl .hl-ring { animation: hlpulse 1.2s ease-in-out infinite; }
@keyframes hlpulse { 0%,100% { stroke-opacity: 1; } 50% { stroke-opacity: .25; } }
.where-line { display: flex; flex-wrap: wrap; gap: .5em 1em; align-items: center; margin: .25rem 0 .5rem; }

/* standard report (tracker #15) */
.std-table td.muted, .std-table tr.muted td { color: var(--muted); }
.std-detail td { background: var(--panel-alt, rgba(0,0,0,.03)); }
.std-formula code { font-size: .85rem; word-break: break-all; }
.std-inputs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.std-inputs .chip { font-size: .78rem; background: var(--card); border: 1px solid var(--line, #ddd); border-radius: 12px; padding: 2px 8px; }
.std-period { align-self: end; }

/* inventory (tracker #1/#12) */
.stock-line { display: block; margin-top: 4px; color: var(--muted); }
.stock-line.warn { color: var(--loss); }
.lot-pick { margin-left: 8px; font-size: .85rem; }
.inv-flag { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: 10px; margin-left: 4px; background: var(--panel-alt, #eee); }
.inv-flag.reorder, .inv-flag.negative { background: #FBE9B6; color: #6A4D00; }
.inv-flag.expired { background: #F6D3D1; color: #7A1F1A; }
.inv-flag.expiring { background: #DCEBE4; color: #1E3B34; }
.inv-detail td { background: var(--panel-alt, rgba(0,0,0,.03)); }

/* work orders (tracker #30) */
.wo-table .btn-xs { margin: 2px 4px 2px 0; }
.wo-detail dl.sow-facts { margin-bottom: 8px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li + li { margin-top: 4px; }
.wo-detail .timeline .tl-date { min-width: 130px; white-space: nowrap; }

/* regional risk (tracker #31/#32) */
.plume-map svg { width: 100%; max-width: 640px; height: auto; border: 1px solid var(--line-2, #ddd); border-radius: 8px; }
.region-grid { align-items: start; }
.badge-ok { background: #DCEBE4; color: #1E3B34; }

/* gilt / sow selection (tracker #52) */
.sel-head { align-items: flex-start; }
.sel-trait { border-top: 1px solid var(--line-2, #e4e2da); padding: 12px 0 6px; }
.sel-trait h3 { margin: 0 0 2px; font-size: 1rem; }
.sel-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 6px; }
@media (max-width: 900px) { .sel-levels { grid-template-columns: 1fr; } }
.sel-level { border: 1px solid var(--line-2, #e4e2da); border-radius: 10px; padding: 8px; background: var(--card); }
.sel-level.lv5 { border-color: #2E7D5B66; } .sel-level.lv1 { border-color: #C4502F66; } .sel-level.lv3 { border-color: #C7940066; }
.sel-level-head strong { font-size: 1.2rem; }
.sel-art { width: 100%; height: auto; background: #faf9f5; border-radius: 6px; margin: 4px 0; }
.sel-photos { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.sel-photos figure { margin: 0; width: 120px; }
.sel-photos img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-2, #ddd); }
.sel-score-grid { display: grid; gap: 6px; }
.sel-score-row { display: grid; grid-template-columns: 200px auto 1fr; gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px dashed var(--line-2, #eee); }
@media (max-width: 760px) { .sel-score-row { grid-template-columns: 1fr; } }
.sel-score-btns .btn { min-width: 34px; margin-right: 3px; }
.sel-preview { padding: 10px 12px; border-radius: 8px; background: var(--panel-alt, #f3f1ea); }
.sel-preview.select { background: #DCEBE4; } .sel-preview.cull { background: #F6D3D1; } .sel-preview.recheck { background: #FBE9B6; }

/* tile map (satellite / map view) */
.tilemap { position: relative; overflow: hidden; border-radius: 8px; border: 1px solid var(--line-2, #ddd); background: #dfe6e1; cursor: grab; user-select: none; max-width: 100%; }
.tilemap:active { cursor: grabbing; }
.tilemap-tiles img { position: absolute; width: 256px; height: 256px; }
.tilemap-overlay { position: absolute; left: 0; top: 0; pointer-events: none; }
.tilemap-zoom { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 4px; }
.tilemap-zoom button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #999; background: #fff; font-size: 16px; cursor: pointer; }
.tilemap-attr { position: absolute; right: 4px; bottom: 2px; font-size: 10px; background: rgba(255,255,255,.75); padding: 1px 5px; border-radius: 4px; color: #333; }
.manure-app { border-top: 1px solid var(--line-2, #e4e2da); padding: 8px 0; }
.manure-app.warn { background: #FBE9B6; border-radius: 8px; padding: 8px; }

/* field guides (tracker #53) */
.guides-home .guide-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 8px 0; }
.guide-card { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: inherit; }
.guide-card:hover { background: rgba(255,255,255,.14); }
.guide-card.draft { opacity: .45; cursor: default; }
.guide-icon { font-size: 1.8rem; } .guide-title { font-weight: 700; font-size: 1.05rem; } .guide-for { opacity: .8; }
.guide-run .guide-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.guide-q { font-size: 1.35rem; margin: 6px 0 8px; line-height: 1.3; }
.guide-help { opacity: .85; margin: 0 0 8px; }
.guide-crumbs { opacity: .6; }
.guide-options { display: grid; gap: 8px; margin: 10px 0; }
.guide-opt { all: unset; cursor: pointer; padding: 14px 16px; border-radius: 10px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); font-size: 1.05rem; color: inherit; }
.guide-opt:hover { background: rgba(255,255,255,.2); }
.guide-opt.danger { border-color: #F6A5A0; background: rgba(196,80,47,.35); }
.guide-photo { margin-top: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.guide-input { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; margin-bottom: 8px; }
.guide-input .barn-input { max-width: 160px; }
.guide-outcome { border-radius: 12px; padding: 14px; background: rgba(255,255,255,.1); border: 2px solid rgba(255,255,255,.25); }
.guide-outcome.urg-critical { border-color: #F6A5A0; background: rgba(196,80,47,.3); }
.guide-outcome.urg-high { border-color: #F4C21F; }
.guide-outcome h3 { margin: 10px 0 4px; }
.guide-do { padding-left: 20px; } .guide-do li { margin: 4px 0; }
.guide-vet { background: rgba(0,0,0,.2); padding: 8px 10px; border-radius: 8px; }
.guide-saved { color: #DCEBE4; }
.guide-path { padding-left: 18px; } .guide-path li { margin: 2px 0; font-size: .9rem; }
.sel-inline { background: var(--card); color: var(--ink); border-radius: 10px; padding: 12px; margin-top: 10px; }

/* ---- barn map on the phone (tracker #25, update l) ---------------------------------------------------------- */
.bmp { padding: 0 16px 24px; }
.bmp-find { margin: 12px 0 8px; }
.bmp-find-row { display: flex; gap: 8px; }
.bmp-find-row .barn-input { flex: 1; }
.bmp-find-row .btn { min-height: 52px; white-space: nowrap; }
.bmp-hits { margin-bottom: 10px; }
.bmp-hits .tag-hit span { font-size: .85rem; color: var(--muted); text-align: left; }
.bmp-mapsel { width: 100%; min-height: 48px; font: 600 1rem var(--body); border-radius: 10px; border: 1px solid var(--line); padding: 0 10px; background: var(--paper); color: var(--ink); margin-bottom: 10px; }
.bmp-pinned { background: rgba(244,194,31,.16); border: 1px solid rgba(199,148,0,.45); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.bmp-pinned strong { display: block; margin-bottom: 6px; font-size: .95rem; }
.bmp-pins { display: flex; flex-wrap: wrap; gap: 6px; }
.bmp-pin { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; min-height: 40px; padding: 0 12px; font: 600 .9rem var(--body); cursor: pointer; color: var(--ink); }
.bmp-pin.crit { border-color: var(--loss); color: var(--loss); }
.bmp-pin span { display: inline-block; margin-left: 6px; background: var(--ink); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .8rem; }
.bmp-pin.crit span { background: var(--loss); }
.bmp-views { display: flex; gap: 6px; margin-bottom: 8px; }
.bmp-views button { flex: 1; min-height: 42px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 600 .85rem var(--body); cursor: pointer; }
.bmp-views button.on { background: var(--spruce); color: #fff; border-color: var(--spruce); }
.bmp-canvas { border: 1px solid var(--line); border-radius: 10px; overflow: auto; background: var(--paper); max-height: 62vh; -webkit-overflow-scrolling: touch; }
.bmp-zoomwrap { min-width: 100%; }
.bmp-zoom { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.bmp-zoom > div { display: flex; align-items: center; gap: 4px; }
.bmp-zoom button { min-width: 44px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 700 1.2rem var(--body); cursor: pointer; }
.bmp-zoom button:disabled { opacity: .4; }
.bmp-zoom > div > span { min-width: 34px; text-align: center; font: 600 .9rem var(--body); }
.bmp-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--paper); border-top-left-radius: 16px; border-top-right-radius: 16px;
  box-shadow: 0 -8px 28px rgba(0,0,0,.28); padding: 12px 16px 24px; max-height: 70vh; overflow: auto; }
.bmp-sheet header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.bmp-sheet h2 { font-size: 1.1rem; margin: 0; }
.bmp-tasks { margin-bottom: 10px; }
.bmp-tasks li { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.bmp-sheet .tag-cloud .badge { min-height: 40px; display: inline-flex; align-items: center; }

/* find-sow: the searched sow stands out in the crate/room sheet (tracker #25) */
.bmp-found-note { margin: .2rem 0 .5rem; font-weight: 700; color: var(--spruce); }
.badge.bmp-found { outline: 3px solid var(--amber, #e0a500); outline-offset: 2px; font-weight: 800; }

/* report an issue / suggest an improvement (update 2026.10.26-b) */
.small-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.small-tabs button { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 12px; font: inherit; cursor: pointer; }
.small-tabs button.on { background: var(--spruce); color: #fff; border-color: var(--spruce); }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.choice-row-3 { grid-template-columns: repeat(3, 1fr); }
.choice { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--paper); border: 2px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; cursor: pointer; min-height: 56px; }
.choice.on { border-color: var(--spruce); background: #fff; box-shadow: inset 0 0 0 1px var(--spruce); }
.choice-sm { padding: 8px 10px; font-size: .9rem; min-height: 44px; justify-content: center; }
.report-row { border-top: 1px solid var(--line-2); padding: 10px 0; }
.report-row p { margin: 6px 0; }
.report-row.is-new { background: var(--gain-bg, #f3f7f4); margin: 0 -8px; padding: 10px 8px; border-radius: var(--r); }
.report-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-reply { background: var(--paper); border-left: 3px solid var(--tag); padding: 6px 10px; border-radius: var(--r); }
.report-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.report-tools select, .report-tools input { width: auto; flex: 1; min-width: 120px; }
.ctx-list { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; font-size: .82rem; color: var(--muted); margin: 6px 0; }
.ctx-list dt { font-weight: 600; } .ctx-list dd { margin: 0; word-break: break-all; }
.sidebar .linklike.small { font-size: .85rem; padding: 6px 10px; background: none; border: 0; cursor: pointer; text-align: left; border-radius: var(--r); }
.sidebar .linklike.small:hover { background: var(--spruce-2); color: #fff; }
@media (max-width: 640px) { .choice-row-3 { grid-template-columns: 1fr; } }

/* Stephen's full catalogue (update 2026.10.26-c) */
.cat-table tr.not-approved td { color: var(--muted); font-style: italic; }
.cat-table tr.not-approved td strong { font-weight: 500; }
.cat-table .badge { margin-left: 6px; font-style: normal; }
.cat-table td.pos { color: var(--gain); } .cat-table td.neg { color: var(--loss); }
.filters .check { align-self: end; padding-bottom: 8px; }

/* dictation (update 2026.10.26-e) */
.dictate { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dictate-live { color: var(--muted); font-style: italic; }
.report-audio { height: 32px; max-width: 260px; vertical-align: middle; }

/* sow card in Stephen's layout (update 2026.10.26-f) */
.stephen-card .card-grid { width: 100%; border-collapse: collapse; font-size: .78rem; margin-bottom: 10px; background: #fff; }
.stephen-card .card-grid th, .stephen-card .card-grid td { border: 1px solid #9aa8a2; padding: 3px 5px; text-align: left; vertical-align: top; }
.stephen-card .card-grid thead tr:first-child th { background: var(--spruce); color: #fff; font-weight: 700; }
.stephen-card .card-grid thead tr:last-child th { background: var(--paper); font-weight: 600; font-size: .72rem; }
.stephen-card .card-grid td.tag { font-weight: 700; }
.stephen-card .litter-block { margin-top: 14px; page-break-inside: avoid; }
.stephen-card .litter-block h2 { font-size: 1rem; margin: 0 0 4px; }
.stephen-card .print-foot { margin-top: 12px; }
@media print {
  .stephen-card { font-size: 10pt; }
  .stephen-card .card-grid th, .stephen-card .card-grid td { padding: 2px 4px; }
  .stephen-card .card-grid thead tr:first-child th { background: #333 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: landscape; margin: 10mm; }
}

/* Import review & reconciliation (update 2026.10.26-g) */
.import-review h3 { margin-top: 18px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.import-review .explain { margin: 6px 0 8px; }
.table.recon th.small, .table.recon td.small { font-weight: 400; color: var(--muted, #667); }
.table.recon td.neg { color: var(--loss, #b42318); font-weight: 600; }
.saved-layouts .chip { margin-right: 6px; }

/* History backtest (update 2026.10.26-g) */
.backtest .headline { font-size: 1.08rem; line-height: 1.55; margin: 0 0 12px; }
.backtest h4 { margin: 18px 0 6px; }
.backtest .stat-row { margin-bottom: 8px; }
@media print {
  .backtest .panel { break-inside: avoid-page; box-shadow: none; }
  .backtest .table { font-size: 8.5pt; }
  .backtest .headline { font-size: 11pt; }
}

/* US / EU units switch in the sidebar foot (update 2026.10.29-j) */
.units-switch { display: flex; align-items: center; gap: 6px; padding: 6px 12px; color: inherit; opacity: .9; flex-wrap: wrap; }
.units-switch .btn-xs { padding: 2px 8px; }
.units-switch .btn-ghost { color: inherit; border: 1px solid rgba(255,255,255,.35); background: transparent; opacity: .8; }
.units-switch .btn-primary { background: #DCE6E1; color: var(--spruce); border-color: #DCE6E1; font-weight: 700; }

/* Gilt Watch check cells (update 2026.10.29-k) */
td.ok { color: var(--ok, #2E7D32); }
td.warn { color: var(--tag-deep, #8A5A00); font-weight: 600; }
td.loss { color: var(--loss, #A8322D); font-weight: 700; }

/* which farm is this file for (update 2026.10.29-m) */
.farm-for-file { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.farm-for-file label.check { white-space: nowrap; margin: 0; }
.farm-for-file select, .farm-for-file input[type=text], .farm-for-file input:not([type]) { width: auto; min-width: 200px; }

/* historical farm note under the farm switch (update 2026.10.29-p) */
.farm-mode-note { margin: -6px 0 6px; padding: 0 12px; color: #DCE6E1; opacity: .85; }

/* update 2026.10.30-a: locked tabs (feature pack not included) and the barn-mode tab strip with more or fewer tabs */
.nav-link.nav-locked { color: #8DA39B; display: flex; align-items: center; gap: 6px; }
.nav-link.nav-locked:hover { background: rgba(255,255,255,.06); color: #B7C7C0; }
.nav-lock { font-size: .8rem; opacity: .8; }
.nav-pack { margin-left: auto; font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #7E9A91; border: 1px solid #456B60; border-radius: 999px; padding: 1px 6px; }
.locked-page { max-width: 640px; }
.locked-page .lock-big { font-size: 2.4rem; margin-bottom: 6px; }
.barn-tabs.n2 { grid-template-columns: repeat(2, 1fr); }
.barn-tabs.n4 { grid-template-columns: repeat(4, 1fr); }
.barn-tabs.n5, .barn-tabs.n6 { grid-template-columns: repeat(3, 1fr); }
.roles-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.role-card { border: 1px solid var(--line-2); border-radius: var(--r); padding: 12px 14px; }
.role-card h3 { margin: 0 0 4px; }
.role-caps { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0; }
.role-tabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 12px; margin: 6px 0; }
.pack-row { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.pack-row label { display: inline-flex; gap: 6px; align-items: center; }
.layout-na { opacity: .85; }

/* update 2026.10.30-c: show / hide password */
.pw-wrap { display: flex; gap: 6px; align-items: center; }
.pw-wrap input { flex: 1; min-width: 0; }
.pw-toggle { white-space: nowrap; }

/* update 2026.11.02-c: daily sheet in barn mode */
.daily-today { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 14px; }
.daily-cell { background: rgba(255,255,255,.08); border-radius: 10px; padding: 10px; text-align: center; }
.daily-n { font-size: 1.8rem; font-weight: 700; }
.daily-l { font-size: .8rem; opacity: .85; }
.daily-buttons { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.daily-buttons .btn-big { min-height: 56px; font-size: 1.05rem; }
.group-hit.on { outline: 3px solid var(--tag-deep); }
.barn-tabs.n7 { grid-template-columns: repeat(4, 1fr); }

/* Site profile (update 2026.11.02-d, #103) */
.site-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.site-grid textarea { width: 100%; min-height: 72px; resize: vertical; }
.day-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.day-picks .group-hit { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.day-picks .group-hit:disabled { cursor: default; opacity: .8; }
.hours-pair { display: flex; align-items: center; gap: 8px; }
.hours-pair input { max-width: 150px; }
.sticky-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; padding: 8px 0; }

/* Manure & pits (update 2026.11.02-e, #101) */
.pit-bar { position: relative; height: 18px; background: var(--line-2); border-radius: 9px; overflow: hidden; margin: 10px 0 14px; }
.pit-fill { height: 100%; background: var(--spruce); border-radius: 9px; transition: width .3s; }
.pit-fill.gain { background: var(--spruce); } .pit-fill.warn { background: #c99a1a; } .pit-fill.loss { background: var(--loss); } .pit-fill.neutral { background: var(--muted); }
.pit-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .5; }
.pit-mark.full { opacity: .85; }

/* Organization farms table (update 2026.11.02-f): controls under the farm name */
.farm-row-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.farm-row-actions select { font-size: .85rem; padding: 3px 6px; }
.nowrap { white-space: nowrap; }
.fallouts { white-space: nowrap; font-size: .75rem; margin-top: 3px; }
.fallout-tag { display: inline-block; background: var(--line-2); border-radius: 6px; padding: 0 5px; margin: 1px 2px 1px 0; }
.group-cell { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .02em; }
.key-show { margin-top: 6px; padding: 8px 10px; background: var(--line-2); border-radius: 8px; font-size: .9rem; word-break: break-all; white-space: normal; max-width: 300px; }
.media-wait { display: inline-block; width: 64px; height: 48px; background: var(--line-2); border-radius: 4px; }

/* View as (update 2026.11.03-n): the bar across the top while looking at Pig Brother as another person or role */
.viewbar { position: sticky; top: 0; z-index: 40; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 16px;
  background: var(--tag); color: var(--tag-ink); border-bottom: 2px solid var(--tag-deep); }
.viewbar-eye { font-size: 1.15rem; }
.viewbar-who { display: flex; flex-direction: column; flex: 1 1 260px; min-width: 0; line-height: 1.3; }
.viewbar-note { font-size: .85rem; }
.viewbar .btn-ghost { color: var(--tag-ink); border-color: rgba(43,35,0,.4); background: transparent; }
.viewbar .btn-primary { background: var(--spruce); border-color: var(--spruce); color: #fff; }
.viewbar-exit { background: var(--spruce); color: #fff; border-color: var(--spruce); font-weight: 600; }
.viewbar .units-switch { margin: 0; }
@media print { .viewbar { display: none !important; } }
@media (max-width: 820px) { .viewbar { position: static; } }

/* Actions overview + categories (update 2026.11.03-p) */
.action-overview { margin: 4px 0 18px; }
.action-overview-line { margin-bottom: 10px; }
.action-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.action-cat { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--spruce-3); border-radius: var(--r); cursor: pointer; font: inherit; color: inherit; }
.action-cat.has-urgent { border-left-color: var(--loss); }
.action-cat.on { outline: 2px solid var(--spruce); background: var(--gain-bg); }
.action-cat:hover { border-color: var(--spruce-3); }
.action-cat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.action-cat-label { font-family: var(--head); font-weight: 600; font-size: 1.02rem; }
.action-cat-n { font-family: var(--head); font-size: 1.5rem; font-weight: 600; line-height: 1; }
.action-cat-top { color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.action-group { margin-bottom: 18px; }
.action-group-head { font-size: 1.1rem; margin: 6px 0 8px; }

/* Problem-area details (update 2026.11.03-p) */
.problem-open { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.problem-open .problem-where, .problem-open .problem-what { display: block; }
.problem-open:hover .problem-where strong, .problem-open:focus-visible .problem-where strong { text-decoration: underline; }
.problem-open-hint { color: var(--info); font-weight: 600; white-space: nowrap; }
.problem-detail { margin-top: 12px; padding: 12px; background: var(--paper); border-radius: var(--r); border: 1px solid var(--line-2); }
.problem-detail p { margin-bottom: 8px; }

/* Organization: finishing sites table (update 2026.11.03-r) */
.org-sub { margin: 14px 0 8px; font-size: 1.05rem; }
td.loss, .small.loss { color: var(--loss); }

/* Genetics: finishing by line (update 2026.11.04-s) */
.tb-bar { display: block; height: 6px; margin: 3px 0 2px; background: var(--tag-deep); border-radius: 3px; max-width: 160px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--paper); }
tr.subrow td { background: var(--paper); }
tr.clickable .linklike { text-align: left; }

/* Data checks / out-of-range warning (update 2026.11.04-t) */
.range-list { margin: 8px 0 12px; padding-left: 18px; }
.range-list li { margin-bottom: 4px; }
.input-num { width: 92px; text-align: right; }
.seg { display: inline-flex; gap: 4px; }
.review-note { margin: 0 0 14px; }
.notice { padding: 10px 14px; border-radius: var(--r); background: var(--info-bg); }
.notice-warn { background: var(--warn-bg); color: #5A4300; }

/* Farm picker + Report / suggest on every page (update 2026.11.04-u) */
.farm-picker { display: flex; flex-direction: column; gap: 6px; }
.farm-picker .farm-switch { display: flex; flex-direction: column; gap: 2px; }
.farm-picker .farm-switch select { width: 100%; }
.picker-label { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: #A9BDB5; }
.picker-account { margin: 0; color: #DCE6E1; font-weight: 600; }
.picker-detail { margin: 0; color: #A9BDB5; }
.picker-search { width: 100%; background: var(--spruce-2); color: #fff; border: 1px solid var(--spruce-3); border-radius: var(--r); padding: 6px 8px; }
.picker-search::placeholder { color: #A9BDB5; }
.page-tools { display: flex; justify-content: flex-end; padding: 12px 28px 0; }
.btn-report { background: #fff; color: var(--spruce); border: 1px solid var(--line); font-weight: 600; }
.btn-report:hover { background: var(--line-2); }
@media (max-width: 820px) { .page-tools { display: none; } }
/* Feed budget (update 2026.11.04-v) */
tr.row-on td { background: var(--info-bg); }
tr.row-future td { color: var(--ink-2, #5b6b66); }
/* Service groups advice (update 2026.11.04-w) */
tr.row-amber td { background: #FCEBC4; }
tr.row-blue td { background: #DCE8F5; }

/* update 2026.11.04-z: reason box when the cause is Unknown / Other */
.cause-reason { display: block; margin-top: .4rem; font-weight: 600; }
.cause-reason input { display: block; width: 100%; margin-top: .25rem; }

/* Schedule (update 2026.11.05-a) */
.schedule-site { margin-bottom: 14px; }
.schedule-site > summary { cursor: pointer; margin: 8px 0 6px; font-size: 1.05em; }
.schedule-board td, .schedule-board th { vertical-align: top; }
.schedule-board td:nth-child(-n+5) { white-space: nowrap; }
.schedule-board .small { line-height: 1.5; }
.schedule-board .mv { white-space: nowrap; }
.schedule-board td:last-child { white-space: nowrap; }
.schedule-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.form-span { grid-column: 1 / -1; }
fieldset.form-span { border: 1px solid var(--line, #d9e0dc); border-radius: 8px; padding: 8px 12px 2px; margin: 0; }
fieldset.form-span legend { font-weight: 600; padding: 0 6px; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.schedule-moves td:nth-child(1), .schedule-moves td:nth-child(3), .schedule-moves td:nth-child(4), .schedule-moves td:nth-child(8), .schedule-moves td:last-child { white-space: nowrap; }
.schedule-moves td { vertical-align: top; }
.cause-pick { margin: 8px 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.cause-pick .group-hits { margin: 6px 0 10px; }

/* pinned menu (update 2026.11.05-e): docked beside the page on windows 600 px and wider; on a narrower phone the pin is hidden */
@media (max-width: 820px) and (min-width: 600px) {
  .nav-pinned.shell { grid-template-columns: 240px 1fr; }
  .nav-pinned .sidebar { position: sticky; top: 0; transform: none; width: 240px; height: 100vh; z-index: 1; }
  .nav-pinned .nav-backdrop { display: none; }
  .nav-pinned .menu-btn[aria-expanded] { display: none; }
}
@media (max-width: 599px) { .nav-pin-btn { display: none; } }

/* feed bin silos (update 2026.11.06-a) */
.bin-row { display: flex; flex-wrap: wrap; gap: 14px 22px; margin: 4px 0 14px; }
.bin-silo { width: 150px; text-align: center; font-size: .85rem; }
.bin-silo svg { display: block; margin: 0 auto 4px; }
.bin-silo .silo-body { fill: #fff; stroke: var(--line-strong, #9aa5a0); stroke-width: 2; }
.bin-silo .silo-roof { fill: #cfd6d2; stroke: var(--line-strong, #9aa5a0); stroke-width: 1.5; }
.bin-silo .silo-fill { fill: #7FA7C9; opacity: .85; }
.bin-ok .silo-fill { fill: #7FB69A; }
.bin-warn .silo-fill { fill: #E3B341; }
.bin-loss .silo-fill { fill: var(--loss, #C0392B); }
.bin-silo .silo-pct { fill: #17201D; paint-order: stroke; stroke: #fff; stroke-width: 3px; }
.bin-silo .silo-tag { fill: #5a6660; font-style: italic; }
.bin-silo .silo-none { fill: #8a948f; }
.bin-silo .bin-name { font-weight: 600; margin-top: 2px; }
.bin-silo .bin-est { font-style: italic; }

/* capital reserve progress (update 2026.11.06-a) */
.reserve-bar { position: relative; height: 22px; background: var(--paper, #eef1ee); border: 1px solid var(--line); border-radius: 11px; overflow: hidden; margin: 6px 0 16px; }
.reserve-bar span { display: block; height: 100%; background: #7FB69A; }
.reserve-bar em { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-style: normal; font-size: .8rem; color: #17201D; }

/* placement score pill (update 2026.11.06-a) */
.score-pill { display: inline-block; min-width: 2.4em; padding: 2px 8px; border-radius: 999px; font-weight: 700; text-align: center; }
.score-pill.ok { background: #DDF0E5; color: #1F5B3F; }
.score-pill.mid { background: #FBF0CC; color: #6E5200; }
.score-pill.low { background: #F7DAD6; color: #8B2A20; }
.table .gain { color: #1F5B3F; }
.compare-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.compare-controls select { width: auto; min-width: 0; }

/* calendar (update 2026.11.06-a) */
.cal-controls { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.cal-title { min-width: 11em; text-align: center; display: inline-block; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 4px 0 12px; }
.cal-kind.off { opacity: .55; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cal-dow { background: var(--paper, #eef1ee); padding: 6px 8px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.cal-cell { background: var(--card, #fff); min-height: 108px; padding: 4px 6px 6px; font-size: .8rem; }
.cal-cell.other { background: #f6f7f5; color: var(--muted); }
.cal-cell.weekend { background: #fbfbf8; }
.cal-cell.today { outline: 2px solid var(--tag-deep, #C79400); outline-offset: -2px; }
.cal-cell.today .cal-daynum { font-weight: 700; color: #17201D; }
.cal-daynum { font-size: .8rem; color: var(--muted); margin-bottom: 3px; }
.cal-ev { display: block; margin: 2px 0; padding: 2px 5px; border-radius: 4px; background: #eef1ee; color: #17201D; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid #9aa5a0; }
.cal-ev:hover { filter: brightness(.95); }
.cal-ev.done { opacity: .55; text-decoration: line-through; }
.cal-move { background: #E3EEF7; border-left-color: #4F86B8; }
.cal-job { background: #ECECEC; border-left-color: #6E6E6E; }
.cal-task { background: #FBF0CC; border-left-color: #C79400; }
.cal-pickup { background: #DDF0E5; border-left-color: #2F7A55; }
.cal-maintenance { background: #F3E8DC; border-left-color: #A86A2B; }
.cal-more summary { cursor: pointer; color: var(--muted); font-size: .75rem; }
.feed-url { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.feed-url input { flex: 1 1 320px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
@media (max-width: 820px) { .cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } .cal-cell { min-height: 64px; padding: 2px 3px; } .cal-ev { font-size: .68rem; padding: 1px 3px; } .cal-controls { align-items: flex-start; } }

/* integrator dashboard (update 2026.11.06-c) - Organization page only */
.org-page .lede { margin-bottom: 8px; }
.org-page .panel { padding: 12px 14px; }
.org-page .table.compact td, .org-page .table.compact th { padding: 4px 8px; font-size: .84rem; }
.org-page .table.tight td, .org-page .table.tight th { padding: 3px 7px; font-size: .82rem; }
.org-page .org-sub { margin: 10px 0 6px; font-size: .98rem; }
.org-page .cohort-facts { margin-bottom: 8px; font-size: .88rem; }
.org-sub-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--card, #fff); padding: 4px 11px; font-size: .82rem; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--spruce, #1F3B34); color: #fff; }
.tile-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 2px 0 12px; }
.tile { background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; border-top: 3px solid #9aa5a0; }
.tile-ok { border-top-color: #2F7A55; } .tile-warn { border-top-color: #C79400; } .tile-loss { border-top-color: #B4332A; }
.tile-v { font-size: 1.45rem; font-weight: 700; line-height: 1.15; color: #17201D; }
.tile-l { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.tile-s { font-size: .74rem; color: var(--muted); }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; margin-bottom: 8px; }
.site-card { text-align: left; background: var(--card, #fff); border: 1px solid var(--line); border-left: 4px solid #9aa5a0; border-radius: 10px; padding: 9px 11px 8px; cursor: pointer; font: inherit; color: inherit; display: flex; flex-direction: column; gap: 6px; }
.site-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.site-card.tone-ok { border-left-color: #2F7A55; } .site-card.tone-warn { border-left-color: #C79400; } .site-card.tone-loss { border-left-color: #B4332A; background: #FFF8F7; }
.site-head { display: flex; align-items: center; gap: 7px; font-size: .9rem; }
.site-head strong { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-badge { font-size: .68rem; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.badge-ok { background: #DDF0E5; color: #1F5B3F; } .badge-warn { background: #FBF0CC; color: #6E5200; } .badge-loss { background: #F7DAD6; color: #8B2A20; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #9aa5a0; vertical-align: middle; }
.dot-ok { background: #2F7A55; } .dot-warn { background: #E3B341; } .dot-loss { background: #B4332A; }
.site-nums { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.site-nums div { display: flex; flex-direction: column; min-width: 0; }
.site-nums b { font-size: .98rem; line-height: 1.1; }
.site-nums span { font-size: .68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-nums .loss b { color: #B4332A; } .site-nums .warn-t b { color: #8A6400; }
.site-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .76rem; }
.site-spark { display: inline-flex; align-items: center; gap: 6px; } .site-spark em { font-style: normal; font-size: .66rem; color: var(--muted); }
.site-why { color: #6b4e00; }
.tone-loss .site-why { color: #8B2A20; }
.spark path { stroke: #6E6E6E; } .spark circle { fill: #6E6E6E; }
.spark-ok path { stroke: #2F7A55; } .spark-ok circle { fill: #2F7A55; }
.spark-warn path { stroke: #C79400; } .spark-warn circle { fill: #C79400; }
.spark-loss path { stroke: #B4332A; } .spark-loss circle { fill: #B4332A; }
.org-key .dot { margin: 0 2px; }
@media (max-width: 600px) { .site-nums { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile-v { font-size: 1.2rem; } }
.add-farm-fold { margin-bottom: 10px; } .add-farm-fold summary { list-style: none; display: inline-block; } .add-farm-fold summary::-webkit-details-marker { display: none; } .add-farm-fold[open] summary { margin-bottom: 6px; }
.site-nums span { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; }

/* update 2026.11.06-g: PRRS risk panel */
.callout { border: 1px solid var(--line); border-left: 4px solid #9aa5a0; border-radius: 8px; padding: 8px 12px; margin: 10px 0; background: var(--card, #fff); }
.callout.warn { border-left-color: #C79400; background: var(--warn-bg); }
.callout ol { margin: 6px 0 0 18px; }

/* ---- Getting started (update 2026.11.09-a, #153) ---- */
.gs-panel { border-left: 4px solid var(--accent, #2f6f4e); }
.gs-list { list-style: none; margin: 8px 0; padding: 0; }
.gs-step { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line-2); }
.gs-step:first-child { border-top: 0; }
.gs-list.compact .gs-step { padding: 5px 0; }
.gs-tick { flex: 0 0 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; color: #fff; }
.gs-step.done .gs-tick { background: var(--gain, #2f6f4e); border-color: var(--gain, #2f6f4e); }
.gs-step.required:not(.done) .gs-tick { border-color: var(--warn, #c98a00); }
.gs-body { flex: 1; min-width: 0; }
.gs-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gs-step.done .gs-title a { color: var(--muted); text-decoration: line-through; }
.gs-why, .gs-unlock { margin: 2px 0 0; }
.gs-group { margin-top: 14px; }
.gs-group h3 { margin: 0 0 2px; }
.basis-note { padding: 6px 10px; border-radius: 6px; margin: 6px 0 10px; }
.basis-note.basis-own { background: rgba(47, 111, 78, .10); }
.basis-note.basis-model { background: rgba(201, 138, 0, .12); }
.gs-line { margin: 0 0 8px; }
.gs-line .linklike { margin-left: 8px; }
.gs-role { padding: 8px 0; border-top: 1px solid var(--line-2); }
.gs-role summary { cursor: pointer; }
.gs-guide li { margin: 4px 0; }
.print-only { display: none; }
@media print { .print-only { display: block; } .gs-page .panel { border: 0; padding: 0; } .gs-role { break-inside: avoid; } .gs-role summary::-webkit-details-marker { display: none; } }

/* ---- Integrator inbox / procurement / settlements (update 2026.11.09-a) ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 2px 10px; font-size: .82rem; cursor: pointer; }
.chip.on { background: var(--ink, #222); color: #fff; border-color: var(--ink, #222); }
.table.inbox td { vertical-align: top; }
.settle-card { border: 1px solid var(--line-2); border-radius: 8px; margin: 8px 0; }
.settle-card.so-far { border-style: dashed; }
.settle-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: none; border: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.settle-sum { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.settle-body { padding: 0 12px 12px; }
.settle-body h4 { margin: 8px 0 4px; }
.table.kv td:first-child { width: 60%; }
.settle-add { margin-top: 8px; }
.settle-add input { min-width: 160px; }
.settle-actions { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.settle-int { margin-top: 8px; }
.gs-locked { border-left: 4px solid var(--line); opacity: .96; }
.gs-step.frozen .gs-title { color: var(--ink, #222); }
.gs-step.frozen.done .gs-title span:first-child { color: var(--muted); }
