/* Amanah dashboard prototype. Shares the landing palette (pine, sage, hay) so it reads as one product.
   Signature element: the ear tag chip, styled after the yellow plastic tags on real goats. */

@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/assets/fonts/manrope-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("/assets/fonts/cormorant-garamond-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --pine: #17301f;
  --pine-2: #234430;
  --moss: #3f6b4c;
  --sage: #e4ebdf;
  --sage-2: #d3dfcc;
  --paper: #f3f5f0;
  --white: #ffffff;
  --hay: #d9a441;
  --hay-soft: #f6e7c4;
  --tag: #f2c230;
  --ink: #18221b;
  --ink-2: #44514a;
  --ink-3: #5f6b64;
  --line: #d3dbd0;
  --ok: #2f7a45;
  --ok-soft: #e1f0e4;
  --warn: #8a5200;
  --warn-soft: #fbecd2;
  --bad: #a3321f;
  --bad-soft: #f8e1dc;
  --on-pine: #eef2ea;
  --on-pine-2: #b9c7bb;
  --wa-bg: #ece5dd;
  --wa-out: #d9fdd3;

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-text: "Manrope", "Segoe UI", system-ui, sans-serif;
  --r-sm: 6px;
  --r-md: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-text); font-size: 1rem; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--moss); text-underline-offset: 3px; }
a:hover { color: var(--pine); }
:focus-visible { outline: 3px solid var(--hay); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--pine); color: var(--on-pine); padding: .7rem 1rem; border-radius: var(--r-sm); }
.skip-link:focus { top: 1rem; }

/* Shell */
.shell { display: grid; grid-template-columns: 15.5rem 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.25rem; padding: 1.25rem 1rem; background: var(--pine); color: var(--on-pine); }
.side-brand { display: flex; align-items: center; gap: .6rem; color: var(--on-pine); text-decoration: none; padding: 0 .5rem; }
.side-brand img { width: 40px; }
.side-brand span { font-family: var(--font-display); font-size: 1.5rem; font-weight: 600; line-height: 1; }
.side-brand:hover { color: #fff; }
.side-farm { display: grid; padding: .75rem; border-radius: var(--r-md); background: rgb(255 255 255 / .06); }
.side-farm strong { font-weight: 600; }
.side-farm span { color: var(--on-pine-2); font-size: .875rem; }
.nav { display: grid; gap: .15rem; }
.nav-item { display: flex; align-items: center; gap: .7rem; min-height: 44px; padding: .5rem .75rem; border-radius: var(--r-sm); color: var(--on-pine-2); text-decoration: none; font-weight: 500; }
.nav-item svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { color: #fff; background: rgb(255 255 255 / .07); }
.nav-item[aria-current="page"] { color: var(--pine); background: var(--on-pine); }
.nav-item-sep { margin-top: .75rem; position: relative; }
.nav-item-sep::before { content: ""; position: absolute; left: .75rem; right: .75rem; top: -.45rem; border-top: 1px solid rgb(255 255 255 / .12); }
.nav-count { margin-left: auto; min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px; background: var(--hay); color: var(--pine); font-size: .8rem; font-weight: 700; text-align: center; }
.nav-count:empty { display: none; }
.side-back { margin-top: auto; padding: .5rem; color: var(--on-pine-2); font-size: .875rem; font-weight: 600; text-decoration: none; }
.side-back:hover { color: #fff; }
.side-foot { color: var(--on-pine-2); font-size: .8rem; padding: 0 .5rem; }

.main { min-width: 0; }


.preview-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .6rem clamp(1rem, 3vw, 2rem); background: var(--hay-soft); color: #5a3d00; font-size: .875rem; }
.preview-bar a { color: #5a3d00; font-weight: 700; }
#view { padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2.25rem) 4rem; max-width: 76rem; }
#view:focus { outline: none; }

/* Page head */
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.page-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(2rem, 3.5vw, 2.6rem); line-height: 1.05; color: var(--pine); letter-spacing: -.01em; }
.page-head p { color: var(--ink-2); margin-top: .35rem; max-width: 60ch; }
.back { display: inline-flex; align-items: center; gap: .35rem; margin-bottom: .75rem; font-weight: 600; font-size: .9rem; text-decoration: none; }

/* Panels */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.25rem; }
.panel > h2 { font-size: 1.05rem; font-weight: 700; color: var(--pine); margin-bottom: .9rem; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.panel-head h2 { font-size: 1.05rem; font-weight: 700; color: var(--pine); }
.panel-head a { font-size: .9rem; font-weight: 600; }
.grid-today { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.25rem; align-items: start; }
.stack { display: grid; gap: 1.25rem; }

/* Ear tag chip */
.tag { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem .1rem .45rem; border-radius: 4px 10px 10px 4px; background: var(--tag); color: #3d2c00; font-weight: 700; font-size: .8rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: rgb(0 0 0 / .25); }

/* Status pill */
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-mute { background: var(--sage); color: var(--ink-2); }

/* Herd strip */
.herd { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem 2rem; padding: 1rem 1.25rem; border-radius: var(--r-md); background: var(--sage); margin-bottom: 1.25rem; }
.herd div { display: grid; }
.herd strong { font-size: 1.35rem; font-weight: 700; color: var(--pine); font-variant-numeric: tabular-nums; line-height: 1.2; }
.herd span { color: var(--ink-2); font-size: .875rem; }

/* Action list */
.act-list { list-style: none; padding: 0; display: grid; gap: .6rem; }
.act { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: .85rem; border-radius: var(--r-sm); border: 1px solid var(--line); text-decoration: none; color: inherit; }
.act:hover { border-color: var(--moss); color: inherit; }
.act-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--hay); }
.act-bar.bad { background: var(--bad); }
.act-title { font-weight: 700; }
.act-meta { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; color: var(--ink-3); font-size: .875rem; margin-top: .15rem; }

/* Feed */
.feed { list-style: none; padding: 0; display: grid; }
.feed li { display: grid; grid-template-columns: 3.2rem 1fr; gap: .75rem; padding: .65rem 0; border-top: 1px solid var(--line); font-size: .925rem; }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed time { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Checklist */
.check-list { list-style: none; padding: 0; display: grid; gap: .25rem; }
.check { display: flex; gap: .7rem; align-items: flex-start; padding: .5rem; border-radius: var(--r-sm); cursor: pointer; }
.check:hover { background: var(--paper); }
.check input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--moss); flex: none; }
.check input:checked + span { color: var(--ink-3); text-decoration: line-through; }
.check small { display: block; color: var(--ink-3); font-size: .825rem; text-decoration: none; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 42px; padding: .5rem 1rem; border-radius: 999px; border: 1.5px solid transparent; font-weight: 600; font-size: .925rem; text-decoration: none; white-space: nowrap; transition: background-color .15s var(--ease), border-color .15s var(--ease); }
.btn-primary { background: var(--pine); color: var(--on-pine); }
.btn-primary:hover { background: var(--pine-2); color: #fff; }
.btn-ghost { border-color: var(--line); background: var(--white); color: var(--pine); }
.btn-ghost:hover { border-color: var(--pine); color: var(--pine); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Segmented filter */
.seg { display: inline-flex; padding: .2rem; border-radius: 999px; background: var(--sage); }
.seg button { min-height: 36px; padding: .3rem .9rem; border: 0; border-radius: 999px; background: transparent; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--pine); box-shadow: 0 1px 2px rgb(23 48 31 / .15); }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .75rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: .825rem; font-weight: 600; color: var(--ink-3); background: var(--paper); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #f8faf6; }
td a { font-weight: 600; text-decoration: none; color: var(--ink); }
td .num { font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.search { min-height: 42px; min-width: min(100%, 18rem); padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.search:focus-visible { outline-offset: 0; border-color: var(--pine); }
.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-3); }

/* Case detail */
.case-grid { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.wa { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--wa-bg); }
.wa-head { display: flex; gap: .6rem; align-items: center; padding: .7rem .9rem; background: #1f5e3a; color: #fff; }
.wa-head b { display: block; font-weight: 600; }
.wa-head small { color: #cfe5d6; font-size: .8rem; }
.wa-ava { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--on-pine); color: var(--pine); font-weight: 700; font-size: .85rem; }
.wa-body { display: grid; gap: .45rem; padding: .9rem; max-height: 34rem; overflow-y: auto; }
.wa-day { justify-self: center; padding: .15rem .6rem; border-radius: 6px; background: rgb(255 255 255 / .8); color: var(--ink-3); font-size: .75rem; }
.bub { max-width: 86%; padding: .45rem .65rem .3rem; border-radius: 8px; background: var(--white); font-size: .9rem; box-shadow: 0 1px 1px rgb(0 0 0 / .08); }
.bub.out { justify-self: end; background: var(--wa-out); }
.bub img { border-radius: 6px; margin-bottom: .35rem; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.bub time { display: block; text-align: right; color: var(--ink-3); font-size: .7rem; }
.bub-voice { display: flex; align-items: center; gap: .5rem; }
.bub-voice i { flex: 1; height: 4px; border-radius: 2px; background: repeating-linear-gradient(90deg, #7a8a80 0 3px, transparent 3px 5px); min-width: 7rem; }

.dx { display: grid; gap: .25rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.dx h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.9rem; line-height: 1.1; color: var(--pine); }
.dx-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .75rem 1.25rem; margin-bottom: 1.25rem; }
.kv dt { color: var(--ink-3); font-size: .825rem; }
.kv dd { font-weight: 600; }
.sub-h { font-size: .95rem; font-weight: 700; color: var(--pine); margin: 1.25rem 0 .5rem; }
.why { color: var(--ink-2); max-width: 62ch; }
.alt { color: var(--ink-2); font-size: .925rem; }

.track { list-style: none; padding: 0; display: grid; gap: 0; }
.track li { position: relative; display: grid; grid-template-columns: 1.4rem 1fr; gap: .6rem; padding-bottom: .9rem; }
.track li::before { content: ""; position: absolute; left: .62rem; top: 1.15rem; bottom: 0; width: 2px; background: var(--line); }
.track li:last-child::before { display: none; }
.track .dot { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--line); background: var(--white); margin-top: .1rem; }
.track .done .dot { border-color: var(--ok); background: var(--ok); box-shadow: inset 0 0 0 3px var(--white); }
.track .now .dot { border-color: var(--hay); background: var(--hay-soft); }
.track b { font-weight: 600; display: block; }
.track small { color: var(--ink-3); font-size: .825rem; }

.vet-box { margin-top: 1.25rem; padding: 1rem; border-radius: var(--r-md); background: var(--sage); display: grid; gap: .75rem; }
.vet-box p { color: var(--ink-2); font-size: .925rem; }
.vet-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Goat profile */
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.profile-top { display: grid; grid-template-columns: 9rem 1fr; gap: 1.25rem; align-items: center; margin-bottom: 1.25rem; }
.profile-top img { border-radius: var(--r-md); aspect-ratio: 1; object-fit: cover; width: 100%; }
.chart { width: 100%; height: 160px; }
.chart .ln { fill: none; stroke: var(--moss); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .ar { fill: var(--sage); }
.chart text { font-size: 11px; fill: var(--ink-3); font-family: var(--font-text); }
.chart .pt { fill: var(--white); stroke: var(--moss); stroke-width: 2; }
.goat-name { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.9rem, 3vw, 2.4rem); line-height: 1.1; color: var(--pine); margin: .4rem 0 .2rem; }
.withdraw { padding: .75rem 1rem; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: .925rem; margin-bottom: 1rem; }

/* Schedule */
.day-group + .day-group { margin-top: 1.5rem; }
.day-group h2 { font-size: 1rem; font-weight: 700; color: var(--pine); margin-bottom: .5rem; }
.day-group h2 span { color: var(--ink-3); font-weight: 500; margin-left: .4rem; }
.sched { list-style: none; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); }
.sched li { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: .8rem 1rem; border-top: 1px solid var(--line); }
.sched li:first-child { border-top: 0; }
.sched input { width: 1.2rem; height: 1.2rem; accent-color: var(--moss); }
.sched .done .s-title { color: var(--ink-3); text-decoration: line-through; }
.s-title { font-weight: 600; }
.s-meta { color: var(--ink-3); font-size: .875rem; }

/* Feed calculator */
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field label, .field legend { font-weight: 600; font-size: .925rem; }
.field input[type="number"] { min-height: 44px; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--white); width: 100%; max-width: 12rem; }
fieldset { border: 0; padding: 0; }
.feed-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-top: .35rem; }
.feed-opt { display: flex; gap: .55rem; align-items: center; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; background: var(--white); }
.feed-opt:has(input:checked) { border-color: var(--moss); background: var(--ok-soft); }
.feed-opt input { accent-color: var(--moss); }
.feed-opt small { display: block; color: var(--ink-3); font-size: .8rem; }
.mix { list-style: none; padding: 0; display: grid; gap: .7rem; }
.mix li { display: grid; gap: .3rem; }
.mix-row { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; }
.mix-row span:last-child { font-variant-numeric: tabular-nums; }
.mix-bar { height: 8px; border-radius: 4px; background: var(--sage); overflow: hidden; }
.mix-bar i { display: block; height: 100%; background: var(--moss); border-radius: 4px; }
.mix-bar i.conc { background: var(--hay); }
.note { margin-top: 1rem; padding: .75rem 1rem; border-radius: var(--r-sm); background: var(--paper); color: var(--ink-2); font-size: .875rem; }

/* Flow page */
.flow-rail { position: relative; list-style: none; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; margin-bottom: 1.5rem; counter-reset: st; }
.flow-rail button { width: 100%; height: 100%; display: grid; gap: .3rem; align-content: start; text-align: left; padding: .8rem .8rem .9rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--white); font-weight: 600; font-size: .9rem; color: var(--ink-2); position: relative; }
.flow-rail button::before { counter-increment: st; content: counter(st); width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--sage); color: var(--pine); font-size: .8rem; font-weight: 700; }
.flow-rail button:hover { border-color: var(--moss); }
.flow-rail button[aria-current="step"] { border-color: var(--pine); background: var(--pine); color: var(--on-pine); }
.flow-rail button[aria-current="step"]::before { background: var(--hay); color: var(--pine); }
.flow-rail button.seen::before { background: var(--moss); color: #fff; }
.flow-rail small { font-weight: 500; font-size: .8rem; color: var(--ink-3); }
.flow-rail button[aria-current="step"] small { color: var(--on-pine-2); }

.flow-stage { display: grid; grid-template-columns: minmax(0, 20rem) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.flow-stage .wa-body { min-height: 18rem; }
.side-label { font-size: .85rem; font-weight: 700; color: var(--ink-3); margin-bottom: .5rem; }
.flow-desc { font-size: 1.05rem; color: var(--ink); max-width: 60ch; margin-bottom: 1rem; }
.sys { list-style: none; padding: 0; display: grid; gap: .5rem; margin-bottom: 1rem; }
.sys li { display: grid; grid-template-columns: 1.6rem 1fr; gap: .6rem; align-items: start; color: var(--ink-2); }
.sys svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: var(--moss); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-top: .15rem; }
.record { border: 1px dashed var(--moss); border-radius: var(--r-sm); padding: .9rem 1rem; background: #fbfcfa; display: grid; gap: .3rem; font-size: .9rem; }
.record-row { display: grid; grid-template-columns: 8.5rem 1fr; gap: .75rem; }
.record-row span:first-child { color: var(--ink-3); }
.record-row span:last-child { font-weight: 600; }
.flow-nav { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; }
.branch { margin-top: 1.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.branch .panel h3 { font-size: 1rem; font-weight: 700; color: var(--pine); margin-bottom: .35rem; }
.branch .panel p { color: var(--ink-2); font-size: .925rem; }
.branch .bad-edge { border-left: 4px solid var(--bad); }
.branch .warn-edge { border-left: 4px solid var(--hay); }

/* Typing indicator for the flow stage */
.typing { display: inline-flex; gap: 3px; padding: .6rem .7rem; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #7a8a80; }
@media (prefers-reduced-motion: no-preference) {
  .typing i { animation: blink 1s infinite; }
  .typing i:nth-child(2) { animation-delay: .15s; }
  .typing i:nth-child(3) { animation-delay: .3s; }
  .bub.enter { animation: rise .25s var(--ease) both; }
}
@keyframes blink { 50% { opacity: .3; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* Case head + emergency bar */
.case-head { margin-bottom: 1.25rem; }
.case-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(2.1rem, 4vw, 2.8rem); line-height: 1.05; color: var(--pine); margin: .5rem 0 .3rem; letter-spacing: -.01em; }
.case-sub { color: var(--ink-3); font-size: .925rem; }
.urgent { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; margin-bottom: 1.25rem; border-radius: var(--r-md); background: var(--bad); color: #fff; }
.urgent strong { font-size: 1.05rem; }
.urgent p { color: #fbe3dd; font-size: .925rem; }
.btn-urgent { min-height: 52px; padding: .7rem 1.4rem; background: #fff; color: var(--bad); font-size: 1rem; font-weight: 700; }
.btn-urgent:hover { background: #fff3f0; color: var(--bad); }
.btn-urgent svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.sub-h-first { margin-top: 0; }

/* Mobile chrome (hidden on desktop) */
.tabbar, .sheet, .pb-short { display: none; }
.g-m { display: none; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); padding: .7rem 1.1rem; border-radius: 999px; background: var(--pine); color: var(--on-pine); font-weight: 600; font-size: .925rem; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease); z-index: 80; max-width: calc(100% - 2rem); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Responsive */
@media (max-width: 1080px) {
  .flow-rail { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
  .grid-today, .case-grid, .profile-grid, .calc-grid, .flow-stage { grid-template-columns: 1fr; }
  .case-grid .wa, .flow-stage .wa { max-width: 26rem; }
}
@media (max-width: 760px) {
  body { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)); }
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }

  .preview-bar { padding: .45rem 1rem; font-size: .8rem; flex-wrap: nowrap; }
  .pb-long { display: none; }
  .pb-short { display: inline; }

  /* Bottom tab bar, thumb reach */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: var(--white); border-top: 1px solid var(--line); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); }
  .tab { position: relative; display: grid; justify-items: center; gap: .1rem; min-height: 56px; padding: .35rem 0 .2rem; border: 0; background: none; color: var(--ink-3); font-size: .75rem; font-weight: 600; text-decoration: none; }
  .tab-ico { display: grid; place-items: center; width: 3.2rem; height: 1.9rem; border-radius: 999px; }
  .tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tab[aria-current="page"] { color: var(--pine); }
  .tab[aria-current="page"] .tab-ico { background: var(--sage); }
  .tab:hover { color: var(--pine); }
  .tab-count { position: absolute; top: .15rem; left: calc(50% + .45rem); min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem; border-radius: 999px; background: var(--bad); color: #fff; font-size: .68rem; line-height: 1.15rem; text-align: center; }
  .tab-count:empty { display: none; }
  .sheet:not([hidden]) { display: grid; position: fixed; right: .5rem; bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 61; min-width: 14rem; padding: .35rem; border-radius: var(--r-md); background: var(--white); border: 1px solid var(--line); box-shadow: 0 12px 32px -12px rgb(23 48 31 / .35); }
  .sheet a { display: flex; align-items: center; min-height: 48px; padding: 0 .9rem; border-radius: var(--r-sm); color: var(--ink); font-weight: 600; text-decoration: none; }
  .sheet a:hover { background: var(--paper); }
  .toast { bottom: calc(5rem + env(safe-area-inset-bottom)); }

  #view { padding: 1.1rem 1rem 2rem; }
  .page-head { margin-bottom: 1.1rem; }
  .herd { grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }

  /* Tables become stacked cards */
  .table-wrap { border: 0; background: none; overflow: visible; }
  .rtable thead { display: none; }
  .rtable, .rtable tbody { display: block; }
  .rtable tbody { display: grid; gap: .6rem; }
  .rtable tr { display: grid; gap: .3rem .6rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--white); }
  .rtable td { display: block; padding: 0; border: 0; white-space: normal; }
  .rtable tbody tr:hover td { background: none; }
  .rtable .empty { padding: 1.5rem .5rem; }
  .case-row { grid-template-columns: 1fr auto; grid-template-areas: "title pill" "tag tag" "state state" "date date"; }
  .c-title { grid-area: title; font-size: 1.05rem; }
  .c-pill { grid-area: pill; justify-self: end; }
  .c-tag { grid-area: tag; }
  .c-state { grid-area: state; color: var(--ink-2); font-size: .9rem; }
  .c-date { grid-area: date; color: var(--ink-3); font-size: .825rem; }
  .goat-row { grid-template-columns: 1fr auto; grid-template-areas: "tag status" "meta meta" "w w"; }
  .g-tag { grid-area: tag; }
  .g-s { grid-area: status; justify-self: end; }
  .g-d { display: none !important; }
  .g-m { display: block; grid-area: meta; font-weight: 600; }
  .g-w { grid-area: w; color: var(--ink-3); font-size: .875rem; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar .btn { flex: 1 1 100%; }

  /* Case */
  .urgent { position: sticky; top: .5rem; z-index: 20; padding: .9rem 1rem; box-shadow: 0 10px 24px -14px rgb(163 50 31 / .7); }
  .urgent p { display: none; }
  .btn-urgent { width: 100%; }
  .case-grid .wa { max-width: none; }
  .wa-body { max-height: 22rem; }

  /* Flow: compact horizontal stepper so the chat stays above the fold */
  .flow-rail { display: flex; gap: .4rem; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -1rem 1rem; padding: 0 1rem .25rem; scrollbar-width: none; }
  .flow-rail::-webkit-scrollbar { display: none; }
  .flow-rail li { flex: none; scroll-snap-align: center; }
  .flow-rail button { display: flex; align-items: center; gap: .45rem; padding: .45rem .8rem .45rem .45rem; border-radius: 999px; white-space: nowrap; }
  .flow-rail small { display: none; }
  .flow-stage .wa-body { min-height: 0; max-height: 20rem; }
  .flow-nav { position: sticky; bottom: calc(4.5rem + env(safe-area-inset-bottom)); z-index: 20; padding: .6rem 0; background: linear-gradient(transparent, var(--paper) 30%); }
  .flow-nav .btn { flex: 1; }

  .profile-top { grid-template-columns: 6rem 1fr; }
  .feed-opts, .branch { grid-template-columns: 1fr; }
  .record-row { grid-template-columns: 1fr; gap: 0; }
  .sched li { grid-template-columns: auto 1fr; }
  .sched li .btn { grid-column: 2; justify-self: start; min-height: 36px; }
}
