/* Clara Ranch — Almanac (light) + Almanac Dark.
   Hierarchy from type size, not bold or color. Warm paper, one rust accent,
   serif display numbers, hairline-ruled sections. */

:root, :root[data-theme="light"] {
  --ground: #f3efe6;
  --surface: #fbf8f1;
  --surface2: #eee7d9;
  --border: #e4dbca;
  --ink: #2b2620;
  --muted: #8a7f6b;
  --accent: #b3502e;         /* rust — used sparingly */
  --accent-ink: #fbf8f1;
  --teal: #5f7a53;           /* sage — good / water / money */
  --grape: #5e6b7a;          /* slate — well/soil charts */
  --danger: #a8442e;         /* brick */
  --gold: #a8842b;           /* ochre — watch */
  --chip-ink: #2b2620;
  --shadow: 0 1px 2px rgba(43, 38, 32, .05);
  --glass: rgba(243, 239, 230, .86);
  --num: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
}
:root[data-theme="dark"] {
  --ground: #201c17;
  --surface: #29241d;
  --surface2: #332d24;
  --border: #3d372c;
  --ink: #efe8db;
  --muted: #a99e88;
  --accent: #dd7d55;
  --accent-ink: #201c17;
  --teal: #93a884;
  --grape: #8a97a6;
  --danger: #dd8168;
  --gold: #d3ab5f;
  --chip-ink: #efe8db;
  --shadow: 0 2px 8px rgba(0, 0, 0, .34);
  --glass: rgba(32, 28, 23, .86);
  --num: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;              /* app shell — the window itself never scrolls */
}
button { font-family: inherit; }

/* ---------- app shell: fixed header + fixed bottom menu, only #main scrolls ---------- */
#app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;   /* dvh accounts for mobile browser chrome */
  overflow: hidden;
}

/* ---------- header (pinned top, never scrolls) ---------- */
.hdr {
  flex: 0 0 auto; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--ground);
  border-bottom: 1px solid var(--border);
}
.hdr-brand { display: flex; align-items: center; gap: 10px; }
.hdr-logo { font-size: 28px; }
.hdr-title { font-family: var(--num); font-size: 22px; font-weight: 600; letter-spacing: 0; }
.hdr-sub { font-size: 12px; color: var(--muted); }
.theme-pill {
  display: flex; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; padding: 2px; gap: 2px;
}
.theme-pill button {
  border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 12px;
  width: 30px; height: 26px; border-radius: 5px; cursor: pointer;
}
.theme-pill button.on { background: var(--accent); color: var(--accent-ink); }

/* ---------- content region: fills the viewport, never scrolls as a whole ---------- */
/* The content region — and ONLY this region — scrolls. The header and bottom
   menu are flex siblings outside it, so they stay pinned in every view (iOS
   pattern). overflow-x hidden guarantees there's never any side-to-side scroll. */
#main {
  flex: 1 1 auto; width: 100%; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px;
}
/* the tab is at least a full region tall (so a light tab fills the screen) but may
   grow taller than the region when content is heavy (then #main scrolls) */
.tab {
  width: 100%; max-width: 1820px; margin: 0 auto; min-height: 100%;
  display: flex; flex-direction: column; gap: 10px;
}
.tab > :not(.grid) { flex: 0 0 auto; }
.tab > .grid { flex: 1 1 auto; min-height: 0; }
/* Cards keep their NATURAL height — a short card stays short instead of being
   stretched to match a tall neighbour (that stretching wastes space and forces
   scroll). Dense masonry-style packing tiles them tightly; align-content:start
   keeps them anchored to the top so a light tab doesn't spread rows apart. A card
   never scrolls inside itself; if the whole tab is taller than the region, only
   the region scrolls (chrome stays fixed). */
.grid {
  display: grid; gap: 8px; grid-auto-flow: row dense; align-content: start; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(min(212px, 100%), 1fr));
  grid-auto-rows: min-content;
}
.grid .wide { grid-column: 1 / -1; }
/* Today's quick-glance cards (weather/comfort/turnout/water/colic/pest/outlook/briefing)
   vary a lot in height, and CSS Grid locks a whole ROW to its tallest member — one tall
   card (Fly & pest pressure, or the Ranch briefing once generated) left a big blank gap
   under every shorter neighbor sharing that row. CSS multi-column (like Chores/the print
   PDF) actually balances variable-height cards instead, so short cards backfill properly. */
.today-cols { column-gap: 8px; column-count: 1; }
@media (min-width: 620px) { .today-cols { column-count: 2; } }
@media (min-width: 1000px) { .today-cols { column-count: 3; } }
@media (min-width: 1300px) { .today-cols { column-count: 4; } }
.today-cols > .card { break-inside: avoid; margin-bottom: 8px; }
/* form- and list-heavy tabs read better (and pack shorter) in fewer, wider
   columns — a cramped form field just wraps to a taller card. */
#tab-settings .grid, #animals-content .grid {
  grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr));
}
/* CSS multi-column (not Grid) — a long section (Hay log, Composition reference) was
   locking the whole Grid row to its height, stranding empty space under short
   neighbors (Nights on pasture, General forage considerations). Multi-column balances
   variable-height cards across columns instead, like Chores/Today/Gear. */
#tab-feed .grid { display: block; column-gap: 8px; column-count: 1; }
@media (min-width: 620px) { #tab-feed .grid { column-count: 2; } }
@media (min-width: 1000px) { #tab-feed .grid { column-count: 3; } }
@media (min-width: 1300px) { #tab-feed .grid { column-count: 4; } }
#tab-feed .grid > .card { break-inside: avoid; margin-bottom: 8px; }
/* Directory: a category with one farrier and a category with six vets sat in the
   same Grid row, which locks row height to the tallest cell — the short category's
   card stayed short, but a big blank gap opened up before the next row could start.
   Same fix as Feed: multi-column repacks each short card immediately, no gap. */
#tab-contacts .grid { display: block; column-gap: 8px; column-count: 1; }
@media (min-width: 620px) { #tab-contacts .grid { column-count: 2; } }
@media (min-width: 1000px) { #tab-contacts .grid { column-count: 3; } }
@media (min-width: 1300px) { #tab-contacts .grid { column-count: 4; } }
#tab-contacts .grid > .card { break-inside: avoid; margin-bottom: 8px; }
#tab-contacts .grid > .card.wide { column-span: all; }
#tab-feed .grid > .card.wide { column-span: all; }
/* Animals tab: every horse/dog/cat together in one grid, no species split */
#animals-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#animals-content > .grid { flex: 1 1 auto; min-height: 0; }
.card { min-height: 0; }
@media (min-width: 740px) { .grid .half { grid-column: span 2; } .grid .span3 { grid-column: span 3; } }
/* the two short bottom cards share one full-width row and split it, regardless of
   how many columns the grid has; they stack on narrow screens */
.bottom-pair { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.bottom-pair > .card { margin: 0; }
.bottom-pair .guide-card { flex: 1.6 1 360px; }
.bottom-pair .temp-card { flex: 1 1 300px; }
@media (min-width: 1280px) { #main { padding: 12px 20px; } .grid { gap: 10px; } }
/* the hidden attribute must always win over any author display rule */
#app[hidden], .pin-gate[hidden], .tab[hidden] { display: none !important; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px; box-shadow: var(--shadow); padding: 11px 13px;
}
/* section label — small uppercase, muted, with a hairline rule (almanac); stays
   put while the rest of an overflowing card scrolls under it */
.card h3 {
  margin: 0 0 9px; font-size: 11.5px; font-weight: 700; letter-spacing: .11em;
  text-transform: uppercase; color: var(--muted);
  padding-bottom: 7px; border-bottom: 1px solid var(--border);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- bottom menu: pinned at the bottom in every view, never scrolls ---------- */
.tabbar {
  flex: 0 0 auto; z-index: 30;
  display: flex; justify-content: space-around;
  background: var(--ground);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar button {
  border: 0; background: transparent; color: var(--muted);
  font-size: 10px; font-weight: 600; cursor: pointer; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 4px; border-radius: 7px; min-width: 34px; flex: 1;
}
.tabbar button span { font-size: 19px; filter: grayscale(.55) opacity(.7); }
/* many tabs on a phone — shrink so all fit without overflow or side-scroll */
@media (max-width: 460px) { .tabbar button { font-size: 9px; padding: 5px 2px; min-width: 30px; } .tabbar button span { font-size: 18px; } }
.tabbar button.on { color: var(--accent); }
.tabbar button.on span { filter: none; }
/* desktop/tablet: horizontal row, centered — still pinned to the bottom */
@media (min-width: 900px) {
  .tabbar { justify-content: center; gap: 6px; }
  .tabbar button { flex-direction: row; gap: 6px; font-size: 13px; padding: 7px 14px; flex: 0 0 auto; min-width: 0; }
  .tabbar button span { font-size: 16px; }
  .tabbar button.on { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
}

/* ---------- masthead photo banner ---------- */
.masthead {
  position: relative; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 0;
  background: var(--surface2);
}
.masthead img { width: 100%; height: clamp(46px, 6vw, 78px); object-fit: cover; display: block; }
.masthead .cap {
  position: absolute; left: 14px; bottom: 8px; z-index: 2;
  color: #fff; font-family: var(--num); font-weight: 600; font-size: 17px; letter-spacing: 0;
  text-shadow: 0 1px 6px rgba(0,0,0,.65);
}
.masthead .cap small { display: block; font-family: -apple-system, system-ui, sans-serif; font-size: 11px; font-weight: 500; opacity: .95; text-shadow: 0 1px 5px rgba(0,0,0,.7); }
.masthead::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to top, rgba(0,0,0,.5), rgba(0,0,0,0) 45%);
}
.property-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.property-imgs a { display: block; border-radius: 6px; overflow: hidden; border: 1px solid var(--border); }
.property-imgs img { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--surface2); cursor: zoom-in; }
@media (max-width: 480px) { .property-imgs { grid-template-columns: 1fr; } }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .92);
  padding: 16px; padding-top: calc(16px + env(safe-area-inset-top));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}
.lightbox.show { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-close {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 16px;
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 20px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.lb-close:active { background: rgba(255, 255, 255, .28); }
.lb-hint { position: fixed; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.7); font-size: 12px; font-weight: 500; }
.thumbs img { cursor: zoom-in; }

/* ---------- hero / stats ---------- */
.hero-temp { font-family: var(--num); font-size: 60px; font-weight: 500; letter-spacing: -1px; line-height: .95; font-variant-numeric: tabular-nums; }
.hero-icon { font-size: 40px; }
.hero-row { display: flex; align-items: center; gap: 16px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 7px 20px; margin-top: 12px; }
.stat { font-size: 13px; color: var(--muted); }
.stat b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* chips — quiet paper tags, low weight */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; border-radius: 5px; padding: 3px 9px;
  background: var(--surface2); color: var(--chip-ink); border: 1px solid var(--border);
}
.chip.teal { background: color-mix(in srgb, var(--teal) 14%, var(--surface)); border-color: color-mix(in srgb, var(--teal) 28%, var(--surface)); }
.chip.accent { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 26%, var(--surface)); }
.chip.danger { background: color-mix(in srgb, var(--danger) 13%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 28%, var(--surface)); }
.chip.gold { background: color-mix(in srgb, var(--gold) 16%, var(--surface)); border-color: color-mix(in srgb, var(--gold) 32%, var(--surface)); }

/* badges — status color carries meaning; keep small and light */
.badge { font-size: 12px; font-weight: 600; color: #fff; border-radius: 5px; padding: 2px 9px; letter-spacing: .01em; }
.badge.Low { background: var(--teal); }
.badge.Moderate { background: var(--gold); }
.badge.High { background: var(--accent); }
.badge.VeryHigh, .badge.Dangerous { background: var(--danger); }
.badge.Comfortable { background: var(--teal); }
.badge.Caution { background: var(--gold); }
.badge.Hot { background: var(--accent); }

.alert-banner {
  border-left: 3px solid var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
  border-radius: 6px; padding: 12px 14px; margin-bottom: 6px;
}
.alert-banner b { color: var(--danger); font-weight: 700; }
.alert-banner[data-goto] { cursor: pointer; transition: background .12s; }
.alert-banner[data-goto]:hover { background: color-mix(in srgb, var(--danger) 15%, var(--surface)); }
.alert-banner[data-goto]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.back-link {
  border: 1px solid var(--border); background: var(--surface2); color: var(--accent);
  border-radius: 6px; font-size: 12px; font-weight: 600; padding: 4px 12px; cursor: pointer;
}
.back-link:hover { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.back-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* forecast strip */
.fc-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.fc-day {
  min-width: 86px; text-align: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: 10px 6px; flex: 1;
}
.fc-day .d { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.fc-day .i { font-size: 24px; margin: 4px 0; }
.fc-day .t { font-family: var(--num); font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.fc-day .t .lo { color: var(--muted); }
.fc-day .p { font-size: 11px; color: var(--teal); font-weight: 600; margin-top: 2px; min-height: 14px; }
.fc-day .s { margin-top: 4px; }

/* gauges + charts */
.gauge-wrap { display: flex; align-items: center; gap: 18px; }
.gauge-lbl { font-family: var(--num); font-size: 34px; font-weight: 500; font-variant-numeric: tabular-nums; }
svg.chart { width: 100%; height: auto; display: block; }
.axis { font-size: 10px; fill: var(--muted); font-family: inherit; }

.bar-note { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.55; }
.qw-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink); margin-bottom: 7px; }
.qw-label span { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.qw-chips { display: flex; flex-wrap: wrap; gap: 7px; }

/* big inline numbers (water depth, scores) — serif display via .num */
.num { font-family: var(--num); font-weight: 500; font-variant-numeric: tabular-nums; }

/* risk bars */
.risk-days { display: flex; gap: 8px; align-items: flex-end; height: 130px; }
.risk-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.risk-col .bar { width: 100%; max-width: 46px; border-radius: 4px 4px 2px 2px; min-height: 6px; }
.risk-col .d { font-size: 11px; font-weight: 600; color: var(--muted); }
.risk-col .v { font-family: var(--num); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* lists — hairline rows, no filled pills */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 2px; background: transparent; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.list .row:last-child { border-bottom: 0; }
.row .k { color: var(--muted); }
.row .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
/* API entries are independent (order doesn't matter) — flow two-up on wide screens
   instead of one long single-file list, roughly halving the card's height. */
@media (min-width: 620px) { .api-list { display: block; column-count: 2; column-gap: 22px; } .api-list .row { break-inside: avoid; } }

/* buttons */
.btn {
  border: 0; border-radius: 6px; padding: 10px 16px; font-size: 14px; font-weight: 600;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.btn.ghost { background: var(--surface2); color: var(--ink); border: 1px solid var(--border); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 5px; }
.copy-btn {
  border: 1px solid var(--border); background: var(--surface2); color: var(--muted);
  border-radius: 5px; font-size: 11px; font-weight: 600; padding: 3px 8px; cursor: pointer;
}
.copy-btn.ok { color: var(--teal); border-color: var(--teal); }
a { color: var(--accent); font-weight: 600; text-decoration: none; }

/* segmented range pills */
.seg { display: inline-flex; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 4px; cursor: pointer; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

/* journal */
.drop {
  border: 1px dashed var(--border); border-radius: 6px; padding: 18px; text-align: center;
  color: var(--muted); font-size: 13px; transition: border-color .15s, background .15s;
}
.drop.hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.note-input {
  width: 100%; border: 1px solid var(--border); background: var(--surface2); color: var(--ink);
  border-radius: 6px; padding: 10px 12px; font-family: inherit; font-size: 14px; resize: vertical; min-height: 64px;
}
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.j-entry { border-bottom: 1px solid var(--border); padding: 12px 2px; }
.j-entry:last-child { border-bottom: 0; }
.j-head { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.j-sub { font-family: var(--num); font-weight: 600; font-size: 15px; margin: 3px 0; }
.j-body { font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }

/* settings */
input[type="time"], select {
  border: 1px solid var(--border); background: var(--surface2); color: var(--ink);
  border-radius: 6px; padding: 7px 10px; font-family: inherit; font-size: 13px;
}

/* ---------- PIN gate ---------- */
.pin-gate {
  position: fixed; inset: 0; z-index: 100; background: var(--ground);
  display: flex; align-items: center; justify-content: center;
}
.pin-gate[hidden] { display: none !important; }
.pin-card { text-align: center; padding: 20px; max-height: 100%; }
.pin-logo { font-size: clamp(36px, 7vh, 52px); }
.pin-title { font-family: var(--num); font-size: 26px; font-weight: 600; margin-top: 4px; }
.pin-sub { color: var(--ink); opacity: .75; font-size: 14px; margin: 4px 0 clamp(8px, 2vh, 14px); }
.pin-grp { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.8vh, 18px);
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pin-dots { display: flex; gap: 10px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots span.on { background: var(--ink); }
.pin-grp.busy .pin-dots span.on { animation: pinpulse .9s ease-in-out infinite; }
@keyframes pinpulse { 50% { opacity: .35; } }
.pin-grp.bad .pin-dots { animation: pinshake .35s; }
@keyframes pinshake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-msg { min-height: 1.3em; font-size: 16px; color: var(--ink); text-align: center; }
.pin-pad { --k: clamp(56px, min(22vw, 9vh), 84px); display: grid; grid-template-columns: repeat(3, var(--k)); gap: clamp(8px, 1.5vh, 16px); justify-content: center; }
.pin-pad button { height: var(--k); border-radius: 50%; border: 1px solid var(--border); padding: 0;
  background: var(--surface); color: var(--ink); font-family: var(--num); font-size: clamp(26px, 4vh, 32px); font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pin-pad button:active { background: var(--accent); color: var(--accent-ink); }
.pin-pad button:disabled { opacity: .5; }
.pin-pad .pin-del { border: none; background: transparent; box-shadow: none; font-size: 24px; }

.spin { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }

/* ---------- contacts / directory ---------- */
.contact { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 11px; margin-bottom: 7px; }
.contact.emerg { border-left: 3px solid var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.c-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.c-name { font-family: var(--num); font-size: 17px; font-weight: 600; }
.c-actions { display: flex; gap: 6px; flex-shrink: 0; }
.c-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 13.5px; }
.c-row a { font-weight: 600; }
.c-notes { font-size: 12px; color: var(--muted); line-height: 1.4; margin-top: 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-head { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 4px 2px 10px; padding-bottom: 7px; border-bottom: 1px solid var(--border); }
.c-form input, .c-form select, .c-form textarea {
  width: 100%; border: 1px solid var(--border); background: var(--surface2); color: var(--ink);
  border-radius: 6px; padding: 9px 11px; font-family: inherit; font-size: 14px; margin-bottom: 8px;
}
.c-form textarea { resize: vertical; min-height: 46px; }
.c-form label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 2px; }
.c-form .frow { display: flex; gap: 8px; flex-wrap: wrap; }
.c-form .frow > div { flex: 1; min-width: 130px; }
.call-btn { background: var(--teal); color: #fff; border: 0; border-radius: 5px; padding: 4px 12px; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.contact.emerg .call-btn { background: var(--danger); }
.c-photo { width: 48px; height: 48px; flex-shrink: 0; border-radius: 8px; object-fit: cover; background: var(--surface2); border: 1px solid var(--border); cursor: zoom-in; }
.c-photo-gen { display: flex; align-items: center; justify-content: center; font-size: 20px; cursor: default; animation: c-photo-pulse 1.6s ease-in-out infinite; }
@keyframes c-photo-pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .c-photo-gen { animation: none; } }
.c-hours { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.c-hours-row b { color: var(--ink); font-weight: 600; margin-right: 3px; }
#biz-input { margin-top: 4px; }
.biz-result { display: block; width: 100%; text-align: left; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 8px 11px; margin-top: 6px; cursor: pointer; font-family: inherit; color: var(--ink); }
.biz-result:hover, .biz-result:focus-visible { border-color: var(--accent); }
.biz-result-name { font-weight: 600; font-size: 14px; }

/* ---------- horses ---------- */
.horse-head { display: flex; gap: 14px; align-items: flex-start; }
.avatar {
  width: 72px; height: 72px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--border); background: var(--surface2);
  display: flex; align-items: center; justify-content: center; font-size: 30px; color: var(--muted);
}
/* headshot crop — bias toward the top (where the head usually sits) and zoom in a bit */
.avatar.has-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; transform: scale(1.28); }
.avatar.lg { width: 96px; height: 96px; }
.avatar.xl { width: clamp(96px, 16vw, 140px); height: clamp(96px, 16vw, 140px); font-size: 52px; }
/* placeholder shown when an uploaded image (usually desktop HEIC) can't be decoded —
   keeps the photo visibly "there" instead of a blank box; file is still saved. */
.img-fallback { display: inline-flex; align-items: center; justify-content: center; background: var(--surface2); color: var(--muted); border: 1px solid var(--border); border-radius: 6px; font-size: 22px; box-sizing: border-box; }
.avatar .img-fallback { width: 100%; height: 100%; border: 0; border-radius: 0; font-size: 30px; }
.tile-photos .img-fallback { width: 56px; height: 56px; }
.horse-photos .img-fallback { width: 78px; height: 78px; }
.horse-photos.big .img-fallback { width: clamp(96px, 20vw, 150px); height: clamp(96px, 20vw, 150px); }
/* full-width sub-section divider inside a .grid (e.g. Water within Pasture) */
.sub-divider { grid-column: 1 / -1; font-size: 13px; font-weight: 800; letter-spacing: .03em; color: var(--accent); text-transform: uppercase; margin: 8px 0 -2px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
/* ---------- Tack & Gear ---------- */
.gear-wrap { display: flex; flex-direction: column; gap: 12px; }
.gear-head { display: flex; align-items: baseline; gap: 10px; }
.gear-head h2 { margin: 0; font-size: 19px; }
/* CSS multi-column (not Grid) — Grid's row model let a tall category (Feeders &
   buckets) set the height of its whole row, stranding empty space under short
   neighbors (Fly gear, Bedding…) sharing that row. Multi-column actually balances
   variable-height categories across columns, like Chores/Today. */
.gear-cats { display: block; column-gap: 8px; column-count: 1; }
@media (min-width: 620px) { .gear-cats { column-count: 2; } }
@media (min-width: 1000px) { .gear-cats { column-count: 3; } }
@media (min-width: 1300px) { .gear-cats { column-count: 4; } }
.gear-cats > .card { break-inside: avoid; margin-bottom: 8px; }
.gear-cat-h { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.gear-tile { display: flex; align-items: flex-start; gap: 11px; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.gear-tile:last-child { border-bottom: 0; padding-bottom: 0; }
.gear-thumb { width: 66px; height: 66px; flex-shrink: 0; border-radius: 9px; overflow: hidden; background: var(--surface2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 26px; }
.gear-thumb.has-photo { cursor: zoom-in; }
.gear-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gear-body { flex: 1; min-width: 0; }
.gear-name { font-weight: 700; font-size: 14.5px; line-height: 1.2; }
.gear-owner { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 1px 7px; border-radius: 999px; }
.gear-notes { margin-top: 4px; line-height: 1.35; }
.save-status { font-size: 12px; font-weight: 600; color: var(--muted); }
.save-status.ok { color: var(--accent); }
.gform { display: flex; flex-direction: column; gap: 4px; }
.gform label { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.gform input, .gform select, .gform textarea { width: 100%; box-sizing: border-box; }
.gform .form-actions { display: flex; gap: 8px; margin-top: 12px; }
/* clickable horse tile in the herd grid */
.horse-tile { cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.horse-tile:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0,0,0,.10); }
.horse-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.horse-tile .c-actions { position: relative; z-index: 1; }
.tile-photos { margin-top: 10px; }
.tile-photos img { width: 56px; height: 56px; }
.tile-photos .more { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface2); color: var(--muted); font-size: 13px; font-weight: 600; }
.tile-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.tile-open { font-weight: 600; color: var(--accent); }
/* full-screen single-horse profile */
.horse-detail { display: flex; flex-direction: column; gap: 12px; }
.hd-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hd-hero { display: flex; align-items: center; gap: clamp(14px, 3vw, 26px); }
.hd-name { font-family: var(--num); font-size: clamp(24px, 4vw, 34px); font-weight: 600; line-height: 1.05; }
.hd-name .muted { font-size: .6em; font-weight: 400; }
.hd-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); align-items: start; }
.hd-h { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.horse-photos.big img { width: clamp(96px, 20vw, 150px); height: clamp(96px, 20vw, 150px); }
.horse-photos .lb-thumb { cursor: zoom-in; }
.horse-name { font-family: var(--num); font-size: 21px; font-weight: 600; line-height: 1.1; }
.horse-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.horse-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.horse-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; margin-top: 12px; }
.horse-facts .row { border-bottom: 1px solid var(--border); }
.horse-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.horse-photos .ph { position: relative; }
.horse-photos img { width: 78px; height: 78px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; }
.horse-photos .setshot, .horse-photos .rmph {
  position: absolute; border: 0; border-radius: 5px; font-size: 10px; font-weight: 700; cursor: pointer;
  padding: 2px 5px; background: rgba(0,0,0,.55); color: #fff;
}
.horse-photos .setshot { bottom: 3px; left: 3px; }
.horse-photos .rmph { top: 3px; right: 3px; background: rgba(168,68,46,.85); }
.horse-photos img.is-shot { border-color: var(--accent); border-width: 2px; }
.bday-banner {
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--ink); border-radius: 8px; padding: 11px 14px;
  font-size: 14px; text-align: center;
}
.hf-status { min-height: 16px; margin-top: 8px; color: var(--muted); transition: color .15s; }
.hf-status.ok { color: var(--good, var(--accent)); font-weight: 600; }
.add-horse { border-style: dashed; background: transparent; box-shadow: none; text-align: center; padding: 9px; }
/* ---------- Feed / Forage / Meds ---------- */
.feed-list { display: flex; flex-direction: column; gap: 5px; }
.comp-details summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--accent); list-style: none; }
.comp-details summary::-webkit-details-marker { display: none; }
.comp-details summary::before { content: "▸ "; }
.comp-details[open] summary::before { content: "▾ "; }
.feed-row { display: flex; align-items: flex-start; gap: 9px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); }
.feed-row.inactive { opacity: .6; }
.feed-body { flex: 1 1 auto; min-width: 0; }
.feed-line { font-size: 14.5px; }
.feed-main { font-size: 14px; color: var(--ink); margin-top: 1px; }
.feed-nums { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.hay-num { font-size: 11.5px; padding: 2px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.hay-num b { color: var(--accent); }
.recipe-ings { display: flex; flex-direction: column; gap: 1px; margin-top: 3px; }
.recipe-ing { display: flex; gap: 10px; font-size: 13.5px; }
.recipe-ing .recipe-amt { flex: 0 0 96px; text-align: right; font-weight: 600; color: var(--accent); }
.recipe-edit-row { display: flex; gap: 6px; margin-bottom: 5px; }
.recipe-edit-row .ri-amt { flex: 0 0 100px; }
.recipe-edit-row .ri-item { flex: 1 1 auto; min-width: 0; }
.feed-considerations { width: 100%; min-height: 240px; }
.feed-form textarea { min-height: 54px; }
.feed-editwrap { border-top: 1px dashed var(--border); margin-top: 10px; }
/* ---------- Barn chores ---------- */
.chore-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.chore-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chore-datepick { padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface2); color: var(--ink); font-size: 13px; }
.chore-prog { height: 8px; border-radius: 5px; background: var(--surface2); overflow: hidden; margin-top: 10px; border: 1px solid var(--border); }
.chore-prog.big { height: 12px; }
.chore-prog-bar { height: 100%; background: var(--teal); border-radius: 5px; transition: width .2s; }
.chore-list { display: flex; flex-direction: column; gap: 6px; }
/* sections flow into responsive columns to cut scrolling; rows keep order within a section */
/* CSS multi-column (not Grid) — Grid's row model let the tallest section in a row
   (e.g. Evening) set that whole row's height, stranding empty space under shorter
   neighbors and orphaning a 5th section onto its own near-empty row. Multi-column
   balances variable-height sections across columns properly, like the print PDF. */
.chore-cols { column-gap: 16px; column-count: 1; }
@media (min-width: 620px) { .chore-cols { column-count: 2; } }
@media (min-width: 1000px) { .chore-cols { column-count: 3; } }
@media (min-width: 1300px) { .chore-cols { column-count: 4; } }
.chore-sec { display: flex; flex-direction: column; gap: 5px; break-inside: avoid; margin-bottom: 14px; }
.chore-sec .chore-section-h { margin: 2px 0 3px; }
.chore-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface2); cursor: pointer; transition: background .12s, border-color .12s; }
.chore-row:hover { border-color: var(--accent); }
.chore-row.done { background: color-mix(in srgb, var(--teal) 13%, var(--surface)); border-color: color-mix(in srgb, var(--teal) 45%, var(--border)); }
.chore-row .chk, .cfs-row .chk { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; }
.chore-row.done .chk, .cfs-row.done .chk { background: var(--teal); border-color: var(--teal); }
.chore-body { flex: 1 1 auto; min-width: 0; }
.chore-time { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; color: var(--accent); }
.chore-task { font-size: 14.5px; line-height: 1.35; color: var(--ink); }
.chore-row.done .chore-task { text-decoration: line-through; color: var(--muted); }
.chore-thumb { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 7px; object-fit: cover; border: 1px solid var(--border); cursor: zoom-in; }
.chore-thumb.ph { display: flex; align-items: center; justify-content: center; background: var(--surface2); font-size: 20px; }
.chore-tpl { display: flex; flex-direction: column; gap: 5px; }
.chore-tpl-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); }
.chore-drag { flex: 0 0 auto; touch-action: none; cursor: grab; color: var(--muted); font-size: 16px; padding: 0 1px; user-select: none; }
.chore-drag:active { cursor: grabbing; }
.chore-tpl-row.dragging { opacity: .6; box-shadow: 0 6px 16px rgba(0,0,0,.28); border-color: var(--accent); }
.chore-tpl-row .chore-thumb { width: 38px; height: 38px; }
.chore-tpl-actions { flex: 0 0 auto; display: flex; gap: 3px; }
/* quick per-row photo control */
.chore-photo { flex: 0 0 auto; }
.chore-photo.add { display: inline-flex; cursor: pointer; }
.chore-photo.add .chore-thumb.ph { border: 1px dashed color-mix(in srgb, var(--accent) 55%, var(--border)); color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface2)); }
.chore-photo.has { position: relative; display: inline-block; line-height: 0; }
.chore-photo-change { position: absolute; right: -5px; bottom: -5px; width: 19px; height: 19px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); font-size: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; line-height: 1; }
.chore-photo.uploading { opacity: .45; pointer-events: none; }
/* Keyword-linking: chips under a chore's task text jump to the linked Gear/Feed/Animal
   record; an auto-illustrated thumbnail (borrowed from that record's own photo) gets a
   dashed ring + 🔗 badge so it reads as "linked" rather than "uploaded for this chore". */
.chore-photo.add.linked { position: relative; }
.chore-photo.add.linked .chore-thumb { border-style: dashed; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); opacity: .88; }
.chore-photo-badge { position: absolute; right: -5px; bottom: -5px; width: 17px; height: 17px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 9px; display: flex; align-items: center; justify-content: center; line-height: 1; pointer-events: none; }
.chore-thumb-linked { cursor: pointer; border-style: dashed !important; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)) !important; }
.kw-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.kw-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 3px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface2); color: var(--accent); font-size: 11px; font-weight: 600; cursor: pointer; line-height: 1.6; }
.kw-chip:hover { border-color: var(--accent); }
.kw-chip-thumb { width: 17px; height: 17px; border-radius: 50%; object-fit: cover; }
.kw-chip-icon { font-size: 12px; line-height: 1; }
.kw-flash { animation: kwFlash 1.8s ease-out; }
@keyframes kwFlash { 0%, 35% { outline: 2px solid var(--accent); outline-offset: 2px; background: color-mix(in srgb, var(--accent) 14%, var(--surface2)); } 100% { outline-color: transparent; background: var(--surface2); } }
/* Drop a file straight onto a Gear tile / Chore row / Feed row — no need to open Edit. */
.chore-tpl-row.drop-hover, .gear-tile.drop-hover, .feed-row.drop-hover { outline: 2px dashed var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 10%, var(--surface2)); border-radius: 6px; }
.chore-tpl-row.uploading, .gear-tile.uploading, .feed-row.uploading { opacity: .5; pointer-events: none; }
.chore-section-h { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); margin: 14px 0 5px; padding-bottom: 3px; border-bottom: 1px solid var(--border); }
.chore-list > .chore-section-h:first-child, .cfs-list > .chore-section-h:first-child { margin-top: 0; }
.crit-badge { display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 800; color: #fff; background: var(--danger); border-radius: 4px; padding: 0 5px; letter-spacing: .03em; vertical-align: middle; }
.chore-row.critical, .cfs-row.critical { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.chore-row.critical.done, .cfs-row.critical.done { background: color-mix(in srgb, var(--teal) 13%, var(--surface)); }
.chore-tpl-row.critical { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.cp-table tr.cp-section td { font-weight: 700; font-size: 13px; color: #7a1e12; border-bottom: 2px solid #333; padding-top: 13px; }
.cp-table tr.cp-crit .cp-task { font-weight: 700; }
.chore-days { display: flex; flex-direction: column; gap: 5px; }
.chore-day-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); cursor: pointer; }
.chore-day-row:hover { border-color: var(--accent); }
.chore-day-meta { display: flex; align-items: center; gap: 8px; }
/* full-screen barn mode — takes over the whole screen (chrome included) */
.chore-fs { display: none; position: fixed; inset: 0; z-index: 900; background: var(--ground); flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 12px calc(10px + env(safe-area-inset-bottom)); }
.chore-fs.show { display: flex; }
.cfs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 0 0 auto; }
.cfs-title { font-weight: 700; font-size: 16px; }
.cfs-list { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.cfs-row { display: flex; align-items: center; gap: 14px; padding: 18px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface2); cursor: pointer; }
.cfs-row .chk { width: 34px; height: 34px; font-size: 17px; }
.cfs-row .chore-task { font-size: 17px; }
.cfs-row.done { background: color-mix(in srgb, var(--teal) 15%, var(--surface)); border-color: var(--teal); }
.cfs-row .chore-thumb { width: 60px; height: 60px; }
/* printable one-day checklist */
.chore-print { display: none; position: fixed; inset: 0; z-index: 1000; background: #4a4a4a; overflow: auto; }
.chore-print.show { display: block; }
.cp-toolbar { display: flex; justify-content: space-between; gap: 10px; padding: 12px; position: sticky; top: 0; }
.cp-sheet { background: #fff; color: #1a1a1a; max-width: 800px; margin: 0 auto 30px; padding: 30px 34px; border-radius: 4px; box-shadow: 0 8px 40px rgba(0,0,0,.4); }
.cp-masthead { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.cp-hero-photos { display: flex; gap: 6px; flex: 0 0 auto; }
.cp-hero-photos img { width: 62px; height: 62px; object-fit: cover; object-position: center 25%; border-radius: 9px; border: 1px solid #ccc; }
.cp-title { font-family: Georgia, 'Times New Roman', serif; font-size: 26px; font-weight: 700; line-height: 1.05; }
.cp-sub { font-size: 13px; font-weight: 600; letter-spacing: .04em; color: #444; }
.cp-daterow { display: flex; justify-content: space-between; gap: 20px; font-size: 13px; margin: 4px 0 12px; }
.cp-line { display: inline-block; min-width: 150px; border-bottom: 1.5px solid #333; }
/* two-column chore list so a full day fits on one printed page */
.cp-cols { column-count: 2; column-gap: 22px; }
.cp-sec { break-inside: avoid; break-after: avoid-page; font-weight: 700; font-size: 11.5px; color: #7a1e12; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1.5px solid #333; padding: 5px 0 3px; margin: 7px 0 3px; }
.cp-cols > .cp-sec:first-child { margin-top: 0; }
.cp-item { break-inside: avoid; display: flex; align-items: center; gap: 7px; padding: 3px 0; border-bottom: 1px solid #eee; }
.cp-box { flex: 0 0 auto; font-size: 15px; color: #333; }
.cp-thumb { flex: 0 0 auto; width: 30px; height: 30px; object-fit: cover; border-radius: 4px; border: 1px solid #ccc; }
.cp-task { font-size: 11px; line-height: 1.25; }
.cp-time { color: #7a5c12; font-size: 10px; font-weight: 700; }
.cp-crit .cp-task { font-weight: 700; }
.cp-foot { margin-top: 14px; font-size: 10px; color: #777; text-align: center; }
@media print {
  body { visibility: hidden; }
  #chore-print-ov, #chore-print-ov * { visibility: visible; }
  #chore-print-ov { position: absolute; inset: 0; background: #fff; overflow: visible; }
  #chore-print-ov .no-print { display: none !important; }
  @page { size: letter portrait; margin: 0.4in; }
  .cp-sheet { box-shadow: none; margin: 0; max-width: 100%; padding: 0; }
  .cp-cols { column-count: 2; }
  .chore-fs, .lightbox { display: none !important; }
}
.add-horse .btn { font-size: 13px; padding: 7px 14px; }
.horse-docs { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
/* Settings → All documents list */
.doc-search { width: 100%; padding: 9px 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); color: var(--ink); font-size: 14px; }
.doc-search:focus { outline: none; border-color: var(--accent); }
.doc-list { display: flex; flex-direction: column; gap: 5px; max-height: 360px; overflow-y: auto; }
.doc-row[hidden] { display: none; }
.doc-row .doc-src { flex: 0 0 auto; color: var(--muted); font-size: 11px; background: var(--surface2); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.horse-docs .doc-hd { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 1px; }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface2); font-size: 13px; text-decoration: none; color: var(--ink); }
a.doc-row:hover { border-color: var(--accent); }
.doc-row .doc-ic { font-size: 15px; flex: 0 0 auto; line-height: 1; }
.doc-row .doc-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.doc-row .doc-name { color: var(--accent); }
.doc-row .doc-size { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.doc-row .doc-rm { flex: 0 0 auto; border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 4px; line-height: 1; }
.doc-row .doc-rm:hover { color: var(--danger); }

/* ---------- version badge (index.html, filled from /version.js) ----------
   Top-left, inside the notch, in the header's 10px top padding above the brand; the L/D/A
   pill is on the right. Tiny on purpose. Measured, not eyeballed: --muted is only 3.43:1 on
   the light ground, so it uses --ink: 13.06:1 light on #f3efe6, 13.90:1 dark on #201c17 (the
   PIN gate paints the same ground). Failure --danger: 5.18:1 light, 5.98:1 dark.
   z-index 1100 is above the PIN gate (100), lightbox (200), barn full-screen (900) and the
   print preview (1000). */
.app-version {
  position: fixed; z-index: 1100; pointer-events: none;
  top: calc(env(safe-area-inset-top, 0px) + 1px);
  left: calc(env(safe-area-inset-left, 0px) + 16px);
  font: 500 9px/9px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .2px; color: var(--ink); white-space: nowrap;
}
.app-version.fail { color: var(--danger); font-weight: 700; }
/* The photo lightbox (near-black) and the print preview (#4a4a4a) sit behind it in both
   themes: white is 18.59:1 on the lightbox and 8.86:1 on the print backdrop. */
body:has(.lightbox.show) .app-version:not(.fail),
body:has(.chore-print.show) .app-version:not(.fail) { color: #ffffff; }
@media print { .app-version { display: none; } }
