/* =====================================================================
 * CattleBase — app.css: the single stylesheet for the SPA shell (index.html)
 * and the UI app.js builds at runtime (modals, menus, toasts, wizard, etc.).
 *
 * Layout of this file:
 *   1. Theme tokens (:root CSS variables) and base reset
 *   2. Shell: sidebar, top bar, language/farm menus, screen switching
 *   3. Shared components: panels, tags, pills, tables, buttons
 *   4. Per-screen rules: dashboard, animals (register + filters), record,
 *      service, pipeline (mating work list), herds/camps, reports, setup,
 *      contacts, diary
 *   5. Responsive: a <=1100px tablet step, then the <=768px phone layout
 *      (off-canvas nav drawer, single-column grids, scrolling tables)
 *   6. Late additions: catalogue lot picker + print rules
 *
 * Mobile-first note: the base rules are the desktop layout; the @media
 * blocks collapse it for narrower screens (this branch's focus). Menus
 * that must escape a clipping container use position:fixed, positioned by
 * app.js (floatMenu). Dark mode is not implemented; all colour comes from
 * the tokens below so a theme can be swapped by redefining them.
 *
 * Restyle (feat/ui-restyle): the real tokens now live in css/tokens.css,
 * copied from design/ui-guide.html and loaded before this file. The block
 * below keeps this file's older token names as ALIASES of those tokens, so
 * every existing rule re-themes at once. New and restyled rules use the
 * design tokens directly (--text-1, --accent, --radius-md ...); an alias is
 * deleted once nothing references it any more.
 * ===================================================================== */

/* ---------- legacy token aliases (restyle foundation) ----------
   Each old name points at the design token that replaces it (design/DESIGN.md,
   "Design Tokens"). Notes on the ones that are not one-to-one:
   - --green is used as text and borders far more than as a fill, and the brand
     lime (--accent) must never be text on white (2.1:1). So it maps to the
     accessible --accent-strong; fills that should be lime move to --accent with
     --on-accent text in the buttons and forms slice.
   - --brass maps to --warning (a dark burnt orange, text-grade). Any rule that
     used brass as a FILL under dark text was switched to --warning-tint here or
     in app.js, or it would drop to about 1.6:1.
   - --radius-sm is NOT redefined: tokens.css owns it (3px). The old 7px uses
     were renamed to --radius-md (6px) throughout this file and app.js.
   - --surface and --surface-2 keep their names: tokens.css defines them.
   - --shadow is none: cards and panels are flat with a 1px border (DESIGN.md,
     "Elevation and shadows"); only floating layers keep a shadow.
   - .theme-light (dark mode) is a subtree that stays light in every theme (the report
     sheet, which is paper). tokens.css gives it the light token values; it is listed here
     too so these aliases re-resolve against those light values inside it. */
:root,.theme-light{
    --ink:var(--text-1); --muted:var(--text-3); --faint:var(--text-3);
    --paper:var(--bg);
    --line:var(--border); --line-soft:var(--border);
    --green:var(--accent-strong); --green-deep:var(--frame); --green-tint:var(--accent-tint);
    --brass:var(--warning); --brass-deep:var(--warning); /* not --warning-hover: it has no dark value (dark mode) */ --brass-tint:var(--warning-tint);
    --ox:var(--error); --ox-tint:var(--error-tint);
    --teal:var(--info); --teal-tint:var(--info-tint);
    --tag:var(--tag-yellow); --tag-edge:var(--tag-yellow-edge);
    --radius:var(--radius-lg);
    --shadow:none;
    --sans:var(--font-body); --serif:var(--font-display);
  }
  /* ---------- status and control icons as CSS masks (restyle slice 2) ----------
     Phosphor Regular shapes, copied from the symbols in design/ui-guide.html. Used as
     `mask-image` on a pseudo-element or an existing empty <i>, painted with currentColor, so
     pills, the toast and the select tick get the guide's icons with NO markup change (the
     builders in app.js stay as they are; Caleb owns those this week). The Phosphor icon font
     replaces these when the icons slice vendors it. Status mapping (DESIGN.md, Icon system):
     success check-circle, warning clock, error warning, info info. */
  :root{
    --ic-check-circle:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z'/%3E%3C/svg%3E");
    --ic-clock:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm64-88a8,8,0,0,1-8,8H128a8,8,0,0,1-8-8V72a8,8,0,0,1,16,0v48h48A8,8,0,0,1,192,128Z'/%3E%3C/svg%3E");
    --ic-warning:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z'/%3E%3C/svg%3E");
    --ic-info:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z'/%3E%3C/svg%3E");
    --ic-check:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
    --ic-caret-right:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z'/%3E%3C/svg%3E");
    --ic-star:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M239.18,97.26A16.38,16.38,0,0,0,224.92,86l-59-4.76L143.14,26.15a16.36,16.36,0,0,0-30.27,0L90.11,81.23,31.08,86a16.46,16.46,0,0,0-9.37,28.86l45,38.83L53,211.75a16.38,16.38,0,0,0,24.5,17.82L128,198.49l50.53,31.08A16.4,16.4,0,0,0,203,211.75l-13.76-58.07,45-38.83A16.43,16.43,0,0,0,239.18,97.26Zm-15.34,5.47-48.7,42a8,8,0,0,0-2.56,7.91l14.88,62.8a.37.37,0,0,1-.17.48c-.18.14-.23.11-.38,0l-54.72-33.65a8,8,0,0,0-8.38,0L69.09,215.94c-.15.09-.19.12-.38,0a.37.37,0,0,1-.17-.48l14.88-62.8a8,8,0,0,0-2.56-7.91l-48.7-42c-.12-.1-.23-.19-.13-.5s.18-.27.33-.29l63.92-5.16A8,8,0,0,0,103,91.86l24.62-59.61c.08-.17.11-.25.35-.25s.27.08.35.25L153,91.86a8,8,0,0,0,6.75,4.92l63.92,5.16c.15,0,.24,0,.33.29S224,102.63,223.84,102.73Z'/%3E%3C/svg%3E");
    --ic-x:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z'/%3E%3C/svg%3E");
    --ic-pencil:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z'/%3E%3C/svg%3E");
    --ic-circle:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z'/%3E%3C/svg%3E");
    /* the offline notice banner's icon (UI guide #banner, ph-wifi-slash) */
    --ic-wifi-slash:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='currentColor' d='M213.92,210.62a8,8,0,1,1-11.84,10.76l-52-57.15a60,60,0,0,0-57.41,7.24,8,8,0,1,1-9.42-12.93A75.43,75.43,0,0,1,128,144c1.28,0,2.55,0,3.82.1L104.9,114.49A108,108,0,0,0,61,135.31,8,8,0,0,1,49.73,134,8,8,0,0,1,51,122.77a124.27,124.27,0,0,1,41.71-21.66L69.37,75.4a155.43,155.43,0,0,0-40.29,24A8,8,0,0,1,18.92,87,171.87,171.87,0,0,1,58,62.86L42.08,45.38A8,8,0,1,1,53.92,34.62ZM128,192a12,12,0,1,0,12,12A12,12,0,0,0,128,192ZM237.08,87A172.3,172.3,0,0,0,106,49.4a8,8,0,1,0,2,15.87A158.33,158.33,0,0,1,128,64a156.25,156.25,0,0,1,98.92,35.37A8,8,0,0,0,237.08,87ZM195,135.31a8,8,0,0,0,11.24-1.3,8,8,0,0,0-1.3-11.24,124.25,124.25,0,0,0-51.73-24.2A8,8,0,1,0,150,114.24,108.12,108.12,0,0,1,195,135.31Z'/%3E%3C/svg%3E");
  }
  /* Keyboard focus (DESIGN.md, Interaction tokens): the double ring on every control that has no
     edge of its own. Text fields override it with the single thick edge (--focus-ring-input). */
  button:focus-visible,a:focus-visible,[role="button"]:focus-visible,[role="switch"]:focus-visible,[role="tab"]:focus-visible,[tabindex]:focus-visible{outline:none;box-shadow:var(--focus-ring)}
  /* ---------- base reset ---------- */
  *{box-sizing:border-box}
  /* Native checkboxes and radios in the brand colour, never the browser's default blue (Andre,
     20 Nov 2026). One rule for every tick box and radio the app builds (register and work-list
     selection, report options, form-modal checkboxes, setup toggles). --accent-strong is the guide's
     tick colour (DESIGN.md, Selection: a filled --accent-strong tick); it flips to the light lime in
     dark mode, and the browser picks a tick colour that contrasts with it, so the pair reads in both
     themes. color-scheme on :root (tokens.css) already draws the empty box dark in dark mode.
     A role="switch" checkbox gets the same colour, which is right: on is the accent. */
  input[type="checkbox"],input[type="radio"]{accent-color:var(--accent-strong)}
  /* The app toggles visibility with the `hidden` attribute (?hidden bindings and the
     initial .app hide). This must win over an element's own display (grid/flex), so it is
     !important. Served from app.css (not a JS-injected <style>) so a strict CSP keeps it. */
  [hidden]{display:none!important}
  /* Every hand-drawn stroke icon (inline <svg stroke=...> in index.html and app.js) gets round ends and
     corners. Their dots are drawn as zero-length lines ("M12 8h.01": the dot of the info "i", the "!" in
     the warning triangle), and with SVG's default "butt" cap a zero-length line paints nothing, so those icons looked broken (Kobus, 9 Nov, dashboard Needs attention). One rule here
     instead of an attribute on ~70 icons; an icon that sets its own cap attribute is unaffected, as CSS
     only changes the look the default would give. The Phosphor swap (audit slice 5) replaces these later. */
  svg[stroke]{stroke-linecap:round;stroke-linejoin:round}
  html,body{margin:0}
  /* Body text is a fixed 16px (--text-body): DESIGN.md keeps body and inputs at 16px so
     nothing reads small in sun and iOS does not zoom. Rules with their own px size keep it
     until their slice moves them onto the type scale. */
  /* padding-top: the offline push-down. --offline-h is set on <html> by setOffline() in app.js to the
     offline banner's height while it shows, and is absent (0px fallback) otherwise. The banner is
     fixed over the very top of the viewport, so the page starts below it instead of under it; the
     sticky top bar, drawer and list headers add the same offset (search "--offline-h"). */
  /* padding-bottom: the same idea at the bottom. --sync-h is set on <html> by syncPanelOffset() in
     app.js to how much of the viewport the floating sync panel (#cb-sync) covers while it shows. The
     page can then always scroll its last row clear of the panel, and bottom-sticky bars lift by the
     same amount (search "--sync-h"), so the panel never sits on a control (offline notes, 2026-11-20). */
  body{background:var(--paper);color:var(--ink);font-family:var(--sans);font-size:var(--text-body);line-height:1.5;-webkit-font-smoothing:antialiased;padding-top:var(--offline-h, 0px);padding-bottom:var(--sync-h, 0px)}
  /* Both faces are loaded at 400 and 600 only (index.html font link), so bold text must ask
     for 600: a 700 request would be a browser-synthesised "faux bold". */
  b,strong{font-weight:600}
  .num{font-variant-numeric:tabular-nums}

  /* Shell grid (UI guide, App shell; restyle slice 3): the white top bar runs the full width on
     row 1; row 2 is the 240px charcoal sidebar (--sidebar-w) and the content. The sidebar sticks
     under the top bar and is exactly one viewport minus the bar tall, so its nav scrolls on its own.
     Below 1024px (DESIGN.md --bp-lg) it is one column and the sidebar is an off-canvas drawer
     (see the drawer block further down). */
  /* ---------- shell ---------- */
  .app{display:grid;grid-template-columns:var(--sidebar-w) minmax(0,1fr);grid-template-rows:auto 1fr;min-height:100vh}
  .app > .top{grid-column:1 / -1}
  /* Desktop sidebar sticks under the top bar, and under the offline banner too when it shows
     (--offline-h, see body), so its bottom (footer) never runs off the screen. */
  .side{background:var(--frame);color:var(--frame-text);display:flex;flex-direction:column;position:sticky;top:calc(var(--topbar-h) + var(--offline-h, 0px));height:calc(100vh - var(--topbar-h) - var(--offline-h, 0px));padding-top:var(--space-4)}
  /* farm picker (sidebar) and its dropdown menu — the menu element is created by app.js */
  /* Farm switcher heads the frame (UI guide, App shell .sb-farm): a 52px tile on --frame-hover,
     muted caption over the farm name in --frame-text. Focus ring is drawn on the frame colour. */
  .farmpick{position:relative;margin:0 var(--space-3) var(--space-3);min-height:52px;padding:var(--space-2) var(--space-3);background:var(--frame-hover);border:0;border-radius:var(--radius-md);cursor:pointer;display:flex;flex-direction:column;justify-content:center}
  .farmpick:focus-visible{outline:none;box-shadow:0 0 0 2px var(--frame),0 0 0 4px var(--accent)}
  .farmpick .lbl{font-size:var(--text-caption);color:var(--frame-muted)}
  .farmpick .val{display:flex;justify-content:space-between;align-items:center;gap:var(--space-2);color:var(--frame-text);font-size:var(--text-small);font-weight:600;margin-top:1px}
  .farmpick .val svg{flex:none;transition:transform var(--duration-base) var(--ease-out)}
  .farmpick[aria-expanded="true"] .val svg{transform:rotate(180deg)}
  .farmmenu{position:absolute;left:0;right:0;top:calc(100% + 4px);z-index:45;max-height:300px;overflow-y:auto;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:var(--space-1)}
  .farmmenu[hidden]{display:none}
  /* farm menu options: the dropdown option look from slice 2 (44px, tint + ring + tick when chosen) */
  .farmopt{position:relative;display:block;width:100%;min-height:var(--touch-min);text-align:left;border:none;background:none;font-family:inherit;font-size:var(--text-body);color:var(--text-1);padding:12px 36px 12px var(--space-3);border-radius:var(--radius-sm);cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .farmopt:hover{background:var(--hover-tint)}
  .farmopt.on{background:var(--accent-selected);box-shadow:var(--selected-ring);color:var(--text-1);font-weight:600}
  .farmopt.on::after{content:"";position:absolute;right:var(--space-3);top:50%;width:var(--icon-sm);height:var(--icon-sm);transform:translateY(-50%);background:var(--accent-strong);-webkit-mask:var(--ic-check) center/contain no-repeat;mask:var(--ic-check) center/contain no-repeat}
  .farmopt.muted{color:var(--text-3);cursor:default}
  /* sidebar navigation */
  /* Nav (UI guide, sidebar): 44px rows, --frame-text at 600 on the small size, the active screen
     a lime fill with ink text (the app's active-nav treatment), hover --frame-hover. Group labels
     are Barlow Condensed overlines in --frame-muted (the only capitals besides overlines). */
  nav{padding:var(--space-1) var(--space-3);display:flex;flex-direction:column;gap:2px;overflow-y:auto}
  .navitem{display:flex;align-items:center;gap:var(--space-3);min-height:var(--touch-min);padding:0 var(--space-3);border-radius:var(--radius-md);color:var(--frame-text);cursor:pointer;font-weight:600;border:none;background:none;width:100%;text-align:left;font-size:var(--text-small);font-family:inherit;flex:none}
  .navitem svg{width:var(--icon-md);height:var(--icon-md);flex:none}
  .navitem:hover{background:var(--frame-hover);color:var(--frame-text)}
  .navitem.on{background:var(--accent);color:var(--on-accent)}
  .navitem:focus-visible{box-shadow:0 0 0 2px var(--frame),0 0 0 4px var(--accent)}
  .navsec{font-family:var(--font-display);font-weight:600;font-size:var(--text-overline);letter-spacing:.06em;line-height:1.55;color:var(--frame-muted);padding:var(--space-4) var(--space-3) var(--space-1);text-transform:uppercase}
  /* With a mouse the 13 nav rows drop to the dense 36px (--h-control-dense) with tighter group labels,
     so all four groups and the user footer fit under the top bar on a 1280×800 laptop without the nav
     scrolling. Touch screens keep the full 44px rows (DESIGN.md: dense sizes only with a fine pointer). */
  @media (hover:hover) and (pointer:fine){
    .navitem{min-height:var(--h-control-dense)}
    nav{gap:0}
    /* Fable pass (Kobus 2026-11-02, the middle setting): the dense mode only shortens the rows; the
       group labels keep their 16px above and 4px below (a 43px block), the farm tile gives up its
       bottom margin instead. Total about 720px, so all 13 rows still fit a 1280x800 laptop. */
    .side{padding-top:var(--space-3)}
    .side .farmpick{margin-bottom:0}
  }

  main{min-width:0;display:flex;flex-direction:column}
  /* Top bar (UI guide, top bar; restyle slice 3): full width, white, hairline below, 56px
     (--topbar-h), sticky on --z-topbar. Left: menu button (drawer widths), the colour logo, the
     working farm's name; right: global search (the guide's dense field, 36px, 16px text so iOS does
     not zoom), language menu, avatar. It sticks at --offline-h, not 0: the offline banner is on a
     higher layer, so at top:0 it covered the whole bar on a phone (menu, logo, language, account all
     unreachable while offline). Do not set this back to top:0. */
  .top{display:flex;align-items:center;gap:var(--space-3);height:var(--topbar-h);padding:0 var(--space-4);background:var(--surface);border-bottom:1px solid var(--border);position:sticky;top:var(--offline-h, 0px);z-index:var(--z-topbar)}
  /* 32px: the lockup's disc is tall beside its wordmark (guide .topbar .logo) */
  .tb-logo{display:block;height:32px;width:auto;flex:none}
  .tb-farm{display:none;font-weight:600;color:var(--text-1);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
  @media (min-width:600px){ .tb-farm{display:block} }
  /* 769 to 879px: the global search is back in the top bar (it is hidden up to 768px) and leaves the
     farm name only a few pixels, so it is left out there; the drawer's farm picker still names the farm. */
  @media (min-width:769px) and (max-width:879px){ .tb-farm{display:none} }
  /* avatar: the user's initial in a 32px circle on the selected tint, inside a 44px hit area. The
     6px transparent border is the extra hit area; the background stops at the padding box (the
     circle) and the inset shadow draws the circle's 3:1 edge inside it. */
  .tb-avatar{flex:none;display:grid;place-items:center;width:var(--touch-min);height:var(--touch-min);padding:0;border:8px solid transparent;border-radius:50%;background:var(--surface-2) padding-box;box-shadow:inset 0 0 0 1px var(--border);cursor:pointer;font:600 .6875rem/1 var(--font-body);color:var(--text-1)}   /* 28px circle in a 44px hit area (guide .avatar.av-sm; Kobus 2026-11-02) */
  .tb-avatar:hover{background-color:var(--hover-tint)}
  /* Account menu (UI guide .tb-acc; restyle slice 4a, replaces the sidebar footer): opens under the
     avatar and to the LEFT so it never runs off the right edge; the guide's menu look (floating,
     --shadow-md, 44px items). The head shows who is signed in; it is not a menu item. */
  .tb-acc{position:relative;flex:none}
  .acc-menu{position:absolute;top:calc(100% + var(--space-1));right:0;z-index:var(--z-dropdown);min-width:220px;padding:var(--space-1);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md)}
  .acc-head{display:grid;gap:2px;padding:var(--space-2) var(--space-3);color:var(--text-1)}
  .acc-head .acc-name{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .acc-head .acc-cap{font-size:var(--text-caption);color:var(--text-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .acc-head .acc-farm:not(:empty)::before{content:"\00A0\00B7\00A0"}   /* "Owner · Rietvlei Boerdery" (no-break spaces: a plain space right after a CSS escape is swallowed) */
  .acc-sep{height:1px;margin:var(--space-1) 0;background:var(--border)}
  .acc-item svg{flex:none;width:var(--icon-md);height:var(--icon-md);margin-right:var(--space-3);color:var(--text-2)}
  .acc-item{display:flex;align-items:center;width:100%;min-height:var(--touch-min);padding:0 var(--space-3);background:none;border:0;border-radius:var(--radius-sm);color:var(--text-1);font:400 var(--text-body)/1 var(--font-body);text-align:left;cursor:pointer}
  .acc-item:hover{background:var(--hover-tint)}
  /* An account-menu item with a quiet status line under its label ("Save farm to phone" with
     "Saved on this phone · 09:06", offline field mode). */
  .acc-item .acc-label{display:flex;flex-direction:column;gap:var(--space-1);padding:var(--space-2) 0}
  .acc-item .acc-note{font-size:var(--text-caption);line-height:1.2;color:var(--text-3)}
  .acc-item:focus-visible{box-shadow:inset 0 0 0 2px var(--accent-strong)}
  /* Theme rows in the account menu (dark mode): a small caption, then Light / Dark / Auto as
     menuitemradio rows. The chosen row gets the guide's selected look (as .langopt.on) and a tick at
     the right edge; the tick is the row's last svg, so it drops the icon margin the leading one has. */
  .acc-glabel{display:block;padding:var(--space-2) var(--space-3) var(--space-1);font-size:var(--text-caption);font-weight:600;color:var(--text-3)}
  .themeopt{white-space:nowrap}   /* "Auto (match device)" on one line: the menu widens to fit it */
  .themeopt .tick{margin:0 0 0 auto;width:var(--icon-sm);height:var(--icon-sm);color:var(--accent-strong);opacity:0}
  .themeopt.on{font-weight:600;background:var(--accent-selected);box-shadow:var(--selected-ring)}
  .themeopt.on .tick{opacity:1}
  /* Top-bar search results (UI guide .tbs-list; restyle slice 4a): up to five closest animals under
     the field (tag, name, what it is), then one line into the register filtered to the search. A
     floating panel as wide as the field; the highlighted option (keyboard or hover) gets the hover
     tint. The search box is the positioning context. */
  .search{position:relative}
  .tbs-list{position:absolute;top:calc(100% + var(--space-1));left:-1.5px;right:-1.5px;z-index:var(--z-dropdown);margin:0;padding:var(--space-1);list-style:none;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md)}
  .tbs-list > li{display:flex;align-items:center;gap:var(--space-3);min-height:var(--touch-min);padding:var(--space-2) var(--space-3);border-radius:var(--radius-sm);cursor:pointer;color:var(--text-1)}
  .tbs-list > li:hover,.tbs-list > li[aria-selected="true"]{background:var(--accent-tint)}
  .tbs-list .tbs-m{display:grid;min-width:0}
  .tbs-list .tbs-m b{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .tbs-list .tbs-m span{font-size:var(--text-caption);color:var(--text-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .tbs-list .tbs-empty{cursor:default;color:var(--text-3)}
  .tbs-list .tbs-empty:hover{background:none}
  .tbs-all{margin-top:var(--space-1);border-top:1px solid var(--border);color:var(--accent-strong);font-weight:600;font-size:var(--text-small)}
  .tbs-all span{flex:1}
  .tbs-all::after{content:"";flex:none;width:var(--icon-sm);height:var(--icon-sm);background:var(--text-3);-webkit-mask:var(--ic-caret-right) center/contain no-repeat;mask:var(--ic-caret-right) center/contain no-repeat}
  /* Page header (UI guide .ph): the screen title in Barlow at H1 with its caption UNDER it (the
     caption node comes first in the DOM for app.js, so the h1 is a reversed column), the screen's
     main action on the right, wrapping under the title on phones. */
  .ph{display:flex;flex-wrap:wrap;align-items:flex-end;gap:var(--space-3) var(--space-4);padding:var(--space-6) var(--space-6) 0}
  .ph-acts{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-left:auto}
  /* Record Back link (#recBack, index.html; app.js RECORD BACK LINK). Review feedback, Nov 2026: older
     farmers need a plain, worded way back to the list they came from. Mobile-first: the base rule is
     the phone (16px gutter, the .ph phone padding); from 769px it lines up with the desktop .ph gutter.
     Body-size bold text in --accent-strong (the lime family's text shade, 6,1:1 on white; the dark
     theme redefines it) with an underline, so it reads as a link without colour alone, and a 48px tall
     hit area (bigger than --touch-min) for a thumb in the field. The header under it loses most of its
     top padding while the link shows, so the link and the animal's name read as one block. */
  .rec-back{display:inline-flex;align-items:center;gap:var(--space-2);align-self:flex-start;min-height:48px;margin:var(--space-3) var(--space-4) 0;padding:0 var(--space-3) 0 var(--space-1);background:none;border:0;border-radius:var(--radius-md);font:600 var(--text-body)/1.2 var(--font-body);color:var(--accent-strong);text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:4px;cursor:pointer;transition:background var(--duration-base) var(--ease-out),color var(--duration-base) var(--ease-out)}
  .rec-back[hidden]{display:none}
  .rec-back svg{flex:none;width:var(--icon-md);height:var(--icon-md)}
  .rec-back:hover{background:var(--accent-tint);color:var(--accent-strong-hover)}
  .rec-back:focus-visible{outline:2px solid var(--accent-strong);outline-offset:2px}
  .rec-back:not([hidden]) + .ph{padding-top:var(--space-1)}
  @media (min-width:769px){ .rec-back{margin:var(--space-4) var(--space-6) 0} }
  /* The register row of the animal the farmer just came back from (app.js flashReturnedRow): the
     selected fill PLUS an inset lime bar, because DESIGN.md says the selected fill is never the only
     cue. It holds, then fades over about 2,5 s; app.js removes the class after the same time. With
     reduced motion there is no fade: the cue simply shows and is then removed. */
  tr.row-returned > td{animation:row-returned 2.6s var(--ease-out)}
  tr.row-returned > td:first-child{box-shadow:inset 4px 0 0 var(--accent-strong)}
  @keyframes row-returned{0%,55%{background:var(--accent-selected)}100%{background:transparent}}
  @media (prefers-reduced-motion:reduce){ tr.row-returned > td{animation:none;background:var(--accent-selected)} }
  .crumb{display:flex;flex-direction:column-reverse;flex:1 1 240px;min-width:0;margin:0;font-family:var(--serif);font-size:var(--text-h1);font-weight:600;line-height:1;color:var(--text-1)}
  .crumb small{font-family:var(--sans);font-weight:400;font-size:var(--text-caption);line-height:1.45;color:var(--text-3);display:block;margin-top:var(--space-1)}
  .search{margin-left:auto;display:flex;align-items:center;gap:var(--space-3);background:var(--input-bg);border:1.5px solid var(--input-border);border-radius:var(--radius-md);min-height:var(--h-control-dense);padding:0 var(--space-3);color:var(--text-3);width:min(360px,32vw);min-width:220px;transition:border-color var(--duration-fast) var(--ease-out),box-shadow var(--duration-fast) var(--ease-out)}
  .search:hover{border-color:var(--input-border-hover)}
  .search:focus-within{border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  .search svg{flex:none;width:var(--icon-sm);height:var(--icon-sm)}
  .search input{border:none;background:none;outline:none;font-family:inherit;font-size:var(--text-body);color:var(--text-1);width:100%;min-width:0}
  .search input::placeholder{color:var(--placeholder-color);opacity:1}
  /* justify-content + text-align centre the label on both axes: on phones many buttons
     stretch to share a row (mating-card Pregnant / Not, Record weaning…) and a two-line
     label wraps, so a start-aligned label read as off-centre. */
  /* Buttons (UI guide, Buttons; restyle slice 2). The app's class names stay (.btn = the
     guide's secondary, .btn.primary = primary, .btn.ghost = dense, .btn.danger = a secondary
     with error text) so no builder in app.js changes. Fills are fill-based for gloved, muddy
     fingers: lime with ink text for the one main action, white with a 3:1 edge for the rest.
     44px tall by default (--h-control); .btn.ghost drops to the 36px dense height only with a
     mouse, and keeps a 44px hit area through its ::after. */
  .btn{position:relative;font-family:inherit;font-size:var(--text-body);font-weight:600;line-height:1;border-radius:var(--radius-md);min-height:var(--h-control);padding:0 var(--space-5);border:1.5px solid var(--border-strong);background:var(--surface);color:var(--text-1);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;text-align:center;gap:var(--space-2);transition:background var(--duration-fast) var(--ease-out),border-color var(--duration-fast) var(--ease-out),color var(--duration-fast) var(--ease-out)}
  .btn:hover{background:var(--hover-tint);border-color:var(--text-3)}
  .btn:active{background:var(--accent-selected)}
  /* primary: the brand lime is a fill only, so its text is always --on-accent (ink), 7.75:1 */
  .btn.primary{background:var(--accent);border-color:transparent;color:var(--on-accent)}
  .btn.primary:hover{background:var(--accent-hover)}
  .btn.primary:active{background:var(--accent-active)}
  /* A disabled action (e.g. Add lot / Print catalogue with no catalogue selected) must LOOK unavailable. */
  .btn:disabled,.btn:disabled:hover{opacity:var(--disabled-opacity);cursor:not-allowed;background:var(--surface);border-color:var(--border-strong)}
  .btn.primary:disabled,.btn.primary:disabled:hover{background:var(--accent);border-color:transparent}
  /* ghost (guide .btn-ghost.btn-dense; Fable pass): no edge until hovered, small text, 16px sides */
  .btn.ghost{font-size:var(--text-small);border-color:transparent;padding:0 var(--space-4);background:transparent}
  .btn.ghost:hover{border-color:var(--border-strong);background:var(--hover-tint)}
  .btn.ghost:disabled,.btn.ghost:disabled:hover{border-color:transparent;background:transparent}
  @media (hover:hover) and (pointer:fine){
    .btn.ghost{min-height:var(--h-control-dense)}
    .btn.ghost::after{content:"";position:absolute;left:0;right:0;top:50%;height:var(--touch-min);transform:translateY(-50%)}
  }
  /* .btn.danger is the quiet "Remove" style: error text on a white button. The solid destructive
     fill (--error-fill) is kept for the confirm step (.cb-confirm-danger), per the guide. */
  .btn.danger{color:var(--error);border-color:var(--border-strong)}
  .btn.danger:hover{background:var(--error-tint);border-color:var(--error)}
  .btn svg{width:var(--icon-md);height:var(--icon-md);flex:none}
  /* language dropdown (EN/AF) in the top bar */
  /* language button (guide .tb-lang; Fable pass): borderless, hover tint, 4px gap */
  .langbtn{gap:4px;padding:0 var(--space-2);color:var(--text-2);border-color:transparent;font-size:var(--text-small)} .langbtn:hover{border-color:transparent;background:var(--hover-tint)} .langbtn svg{width:var(--icon-sm);height:var(--icon-sm)} .langbtn #langCode{font-weight:600;color:var(--text-1)}
  .langbtn .chev{transition:transform .18s ease}
  /* "EN" sat about 1.25px above the globe and caret (Kobus, 9 Nov; measured on the rendered ink). Atkinson's
     ascent (14) is much taller than its descent (5), so capitals with no descender float above the middle of
     their line box. Top padding on a flex-centred item moves its text down by half the padding, so 2.5px
     lines the caps' centre up with the icons'. */
  .langbtn #langCode{padding-top:2.5px}
  .langbtn[aria-expanded="true"] .chev{transform:rotate(180deg)}
  .langwrap{position:relative}
  .langmenu{position:absolute;top:calc(100% + 6px);right:0;min-width:200px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:var(--space-1);z-index:var(--z-dropdown)}
  .langmenu[hidden]{display:none}
  /* language options: 44px rows; the chosen one gets the selection tint, ring and its tick */
  .langopt{display:flex;align-items:center;gap:var(--space-2);width:100%;min-height:var(--touch-min);text-align:left;border:none;background:none;font-family:inherit;font-size:var(--text-body);color:var(--text-1);padding:0 var(--space-3);border-radius:var(--radius-sm);cursor:pointer}
  .langopt:hover{background:var(--hover-tint)}
  .langopt .tick{width:var(--icon-sm);height:var(--icon-sm);flex:none;opacity:0;color:var(--accent-strong)}
  .langopt.on{font-weight:600;background:var(--accent-selected);box-shadow:var(--selected-ring)}
  .langopt.on .tick{opacity:1}
  .langopt .code{margin-left:auto;font-size:var(--text-caption);font-weight:600;color:var(--text-3)}
  /* ---------- one logo per theme (dark mode) ----------
     index.html and the sign-in card carry two <img>s: the colour lockup (.logo-on-light) and the white
     lockup (.logo-on-dark; DESIGN.md, Logo: "the white mark on charcoal"). Exactly one shows, decided
     by the same rules as the dark tokens in tokens.css: the OS in dark with no forced Light, or a
     forced Dark. img. in the selector outranks .tb-logo / .auth-logo's own display:block. */
  img.logo-on-dark{display:none}
  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]) img.logo-on-light{display:none}
    :root:not([data-theme="light"]) img.logo-on-dark{display:block}
  }
  :root[data-theme="dark"] img.logo-on-light{display:none}
  :root[data-theme="dark"] img.logo-on-dark{display:block}

  /* screens: only the one with .on is displayed (app.js toggles it from the router) */
  /* 20px under the page header (restyle slice 3), 24px at the sides and bottom */
  .screen{padding:var(--space-5) var(--space-6) var(--space-6);display:none;animation:rise .35s ease both}
  .screen.on{display:block}
  /* opacity-only: a transform here (even the identity matrix the animation
     freezes with fill-mode both) would make descendant position:fixed popups
     resolve against .screen instead of the viewport */
  @keyframes rise{from{opacity:0}to{opacity:1}}
  @media (prefers-reduced-motion:reduce){.screen,.screen.on{animation:none}}

  /* ---------- shared bits ---------- */
  /* panels and ear-tag chip: .tag is the signature brass ear-tag look used for animal ids */
  .panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
  /* A table wider than its panel scrolls sideways INSIDE the panel, at every width, never the whole
     window (Kobus, 20 Nov 2026: the register pushed a 950px window sideways by 20px). Phones already
     did this for every panel (the max-width:768px block); from 769px up only a panel or tab pane that
     holds a table does, so the dropdown menus inside other panels are never clipped. */
  .panel:has(> table),.tabpane:has(> table){overflow-x:auto}
  .panel-h{display:flex;align-items:center;gap:var(--space-2) var(--space-3);padding:var(--space-4);border-bottom:1px solid var(--border)}   /* guide .panel-h (Fable pass) */
  .panel-h h3{margin:0;font-family:var(--serif);font-size:var(--text-h2);font-weight:600}
  .panel-h .btn{margin-left:auto}
  /* UI guide utilities (restyle slice 4b): a padded panel for content that is not a list (a form, a
     chart, a record), a caption line (small, muted) and the small text size. */
  .panel-body{padding:var(--space-5)}
  .caption{font-size:var(--text-caption);line-height:1.45;color:var(--text-3)}
  .small{font-size:var(--text-small)}
  /* Inline ear tag (DESIGN.md, Ear tag component, variant A; restyle slice 2): the squared-left,
     rounded-right chip in the tag's own colours, number in Barlow Condensed with tabular figures.
     No ring or stud (owner decision 2026-10-29: the shape alone reads as a tag). Colours are the
     tag-yellow set: an ear tag is a physical object, the same in both themes. */
  .tag{display:inline-flex;align-items:center;white-space:nowrap;vertical-align:middle;font:600 1.0625rem/1 var(--font-display);letter-spacing:.03em;font-variant-numeric:tabular-nums;color:var(--tag-yellow-text);background:var(--tag-yellow);border:1.5px solid var(--tag-yellow-edge);padding:4px 8px 3px 7px;border-radius:var(--radius-tag);position:relative}
  /* Status pills (UI guide: always icon plus word, text on tint). The existing empty <i> in each
     pill becomes the status icon through a CSS mask, so meaning survives colour blindness and
     greyscale print without touching the builders. Old class to guide role:
     p-green ok (check-circle), p-brass due (clock), p-ox bad (warning), p-teal info, p-grey neutral. */
  .pill{display:inline-flex;align-items:center;gap:5px;font:600 var(--text-caption)/1 var(--font-body);padding:5px 10px 5px 8px;border-radius:var(--radius-full);white-space:nowrap}
  .pill i{width:var(--icon-sm);height:var(--icon-sm);flex:none;background:currentColor;-webkit-mask:var(--ic-circle) center/contain no-repeat;mask:var(--ic-circle) center/contain no-repeat}
  .p-green{background:var(--success-tint);color:var(--success)} .p-green i{-webkit-mask-image:var(--ic-check-circle);mask-image:var(--ic-check-circle)}
  .p-brass{background:var(--warning-tint);color:var(--warning)} .p-brass i{-webkit-mask-image:var(--ic-clock);mask-image:var(--ic-clock)}
  .p-teal{background:var(--info-tint);color:var(--info)} .p-teal i{-webkit-mask-image:var(--ic-info);mask-image:var(--ic-info)}
  .p-ox{background:var(--error-tint);color:var(--error)} .p-ox i{-webkit-mask-image:var(--ic-warning);mask-image:var(--ic-warning)}
  .p-grey{background:var(--surface-2);color:var(--text-2);box-shadow:inset 0 0 0 1px var(--border)}
  .muted{color:var(--muted)}

  /* ---------- system feedback: toast, offline banner, sync panel (restyle slice 2) ----------
     All three were inline-styled in app.js; they now carry these classes so the tokens theme them.
     Toast (UI guide #toast, matched to the guide on 26 Nov 2026): an ink chip in BOTH themes so its
     icon keeps contrast, on --z-toast above modals; full width in the 16px gutter on phones, a 380px
     chip in the BOTTOM-RIGHT corner from 600px (it used to sit centred). The icon is a mask on
     ::before: a tick for success, the info sign for .is-info, the warning sign in the error colour for
     .is-bad. Every chip ends in a Dismiss button, as in the guide.
     .cb-toast is the chip look and a fixed position for a toast that stands alone (the Mating cycle's
     undo message #wl-undo and the Add animal "saved" note #aa-saved); showToast's messages are
     .cb-toast-item chips stacked in the #cb-toast wrap (.cb-toast-wrap) below. */
  .cb-toast,.cb-toast-item{display:flex;align-items:center;gap:var(--space-3);padding:var(--space-3) var(--space-3) var(--space-3) var(--space-4);border-radius:var(--radius-md);background:var(--toast-bg);color:var(--toast-text);outline:1px solid rgb(255 255 255 / 0.08);box-shadow:var(--shadow-lg);font-size:var(--text-small)}
  .cb-toast{position:fixed;z-index:var(--z-toast);left:var(--space-4);right:var(--space-4);bottom:calc(var(--space-4) + env(safe-area-inset-bottom, 0px))}
  .cb-toast::before,.cb-toast-item::before{content:"";flex:none;width:var(--icon-md);height:var(--icon-md);background:var(--toast-ok);-webkit-mask:var(--ic-check-circle) center/contain no-repeat;mask:var(--ic-check-circle) center/contain no-repeat}
  .cb-toast.is-bad::before,.cb-toast-item.is-bad::before{background:var(--toast-bad);-webkit-mask-image:var(--ic-warning);mask-image:var(--ic-warning)}
  /* neutral news (showToast kind 'info': saved offline, still offline, undone): the guide's info icon */
  .cb-toast-item.is-info::before{background:var(--toast-info);-webkit-mask-image:var(--ic-info);mask-image:var(--ic-info)}
  /* the message, then Dismiss (the guide's .toast p and .toast button) */
  .cb-toast-t{flex:1;margin:0}
  .cb-toast-x{flex:none;min-height:var(--touch-min);padding:0 var(--space-3);background:none;border:0;border-radius:var(--radius-md);color:var(--toast-text);font:600 var(--text-small)/1 var(--font-body);cursor:pointer}
  .cb-toast-x:hover{background:color-mix(in srgb, var(--toast-text) 10%, transparent)}
  .cb-toast-x:focus-visible{outline:none;box-shadow:var(--focus-ring)}
  @media (min-width:600px){ .cb-toast{left:auto;right:var(--space-6);bottom:var(--space-6);width:380px} }
  /* The stack (#cb-toast, the guide's .toast-wrap): one polite live region, newest at the bottom.
     It lets every tap pass through to what lies under it, chips included: on a phone it spans the
     bottom strip on the top layer, and for its seconds it swallowed taps on the drawer's last links
     (Setup) and on the sync panel (offline field mode Bug 10). Only each Dismiss button takes a tap.
     It also sits above the sync panel (--sync-h, set by syncPanelOffset in app.js) rather than on top
     of it, so a message never hides Sync now; from 600px both live in the bottom-right corner. */
  .cb-toast-wrap{position:fixed;z-index:var(--z-toast);left:var(--space-4);right:var(--space-4);bottom:calc(var(--space-4) + max(env(safe-area-inset-bottom, 0px), var(--sync-h, 0px)));display:grid;gap:var(--space-2);pointer-events:none}
  .cb-toast-wrap[hidden]{display:none}
  .cb-toast-wrap .cb-toast-x{pointer-events:auto}
  @media (min-width:600px){ .cb-toast-wrap{left:auto;right:var(--space-6);bottom:calc(var(--space-6) + var(--sync-h, 0px));width:380px} }
  /* Offline banner (showOfflineBanner, #cb-offline): the guide's offline notice banner (UI guide
     #banner, .banner-bad), pinned to the top over everything. The whole strip is on the error tint,
     no edge stripe; the wifi-slash icon on the left in the error colour; then a bold "No signal."
     and the sentence, left-aligned; then a pill with how many changes are waiting, when there are
     any (26 Nov 2026: it was a centred, all-bold line on the warning tint with a typed warning sign).
     It must never cover the app's own controls: while it shows, setOffline publishes its height as
     --offline-h and the body, top bar, drawer, sticky list headers and the test-session layer all
     move down by that much (search "--offline-h"). Anything new that is fixed/sticky at the top needs
     the same offset. */
  .cb-offline{position:fixed;top:0;left:0;right:0;z-index:var(--z-toast);display:flex;align-items:center;gap:var(--space-3);min-height:52px;padding:var(--space-3) var(--space-4);background:var(--error-tint);color:var(--text-1);font-size:var(--text-small)}
  .cb-offline[hidden]{display:none}
  .cb-offline::before{content:"";flex:none;width:var(--icon-lg);height:var(--icon-lg);background:var(--error);-webkit-mask:var(--ic-wifi-slash) center/contain no-repeat;mask:var(--ic-wifi-slash) center/contain no-repeat}
  .cb-offline-t{flex:1;margin:0}
  .cb-offline-t b{font-weight:600}
  /* "2 waiting": the guide's neutral pill on the page surface, so it reads on the tinted strip */
  .cb-offline-n{flex:none;padding:2px var(--space-3);border-radius:var(--radius-full);background:var(--surface);color:var(--text-2);font-weight:600;font-size:var(--text-caption);font-variant-numeric:tabular-nums;white-space:nowrap}
  .cb-offline-n[hidden]{display:none}
  /* Sync panel (updateSyncBadge, #cb-sync): a floating white card (border + --shadow-lg) with a
     tinted strip per section: pending writes on the warning tint, rejected ones on the error tint,
     text in the matching colour; actions are the ordinary secondary buttons.
     Layer: just BELOW the modal backdrop (offline field mode bug 2). It is a panel, not a toast: on the
     toast layer it sat on top of every modal and covered the edit wizard's Save changes button once a
     change was queued. Above the top bar and the phone drawer; any open modal and its scrim cover it. */
  .cb-sync{position:fixed;z-index:calc(var(--z-modal-backdrop) - 1);left:var(--space-4);right:var(--space-4);bottom:calc(var(--space-4) + env(safe-area-inset-bottom, 0px));background:var(--surface);color:var(--text-1);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);font-size:var(--text-small);overflow:hidden}
  @media (min-width:600px){ .cb-sync{left:auto;right:var(--space-6);bottom:var(--space-6);width:360px} }
  .cb-sync-row{display:flex;align-items:center;gap:var(--space-3);padding:var(--space-2) var(--space-2) var(--space-2) var(--space-4)}
  .cb-sync-pending{background:var(--warning-tint);color:var(--warning)}
  .cb-sync-bad{background:var(--error-tint);color:var(--error)}
  .cb-sync-t{flex:1;font-weight:600}
  .cb-sync-list{max-height:240px;overflow:auto}
  .cb-sync-item{padding:var(--space-3) var(--space-4);border-top:1px solid var(--border)}
  .cb-sync-item-t{font-weight:600;margin-bottom:2px}
  .cb-sync-item-err{color:var(--text-2);margin-bottom:var(--space-2)}
  /* a parked mating write's warnings, one per line (renderSyncPanel, needs_confirm) */
  .cb-sync-item-err.cb-pre-line{white-space:pre-line}
  .cb-sync-acts{display:flex;gap:var(--space-2)}

  /* ---------- dashboard ---------- */
  /* dark mode: the old hard-coded green became --success, which has a dark value */
  .up{color:var(--success)} .down{color:var(--ox)}
  .grid2{display:grid;grid-template-columns:1.35fr 1fr;gap:16px}
  /* ---------- cards, farm cards, key-value lists (UI guide #cards / #farms; restyle slice 4d) ---------- */
  .card{display:flex;flex-direction:column;gap:var(--space-2);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);padding:var(--space-5);color:var(--text-2);min-width:0}
  .card-t{display:flex;align-items:center;flex-wrap:wrap;gap:var(--space-2);margin:0;font-size:var(--text-h3);font-family:var(--font-display);font-weight:600;color:var(--text-1)}
  .card-foot{display:flex;align-items:center;justify-content:space-between;gap:var(--space-3);margin-top:auto;padding-top:var(--space-3)}
  .farm-grid{display:grid;gap:var(--space-4)}
  @media (min-width:600px){ .farm-grid{grid-template-columns:repeat(2,minmax(0,1fr))} }
  /* scoped to dl.kv: .kv is also the record screen's fact row class (its own rules further down) */
  /* grid-template-columns + justify-content: the generic .kv rule below sets justify-content:space-between
     (for the record's flex rows); on this grid it shrank the one column to its content, so a farm card's
     facts stopped well short of the card's edge (Kobus, 20 Nov 2026). One full-width column instead. */
  dl.kv{margin:0;display:grid;grid-template-columns:minmax(0,1fr);justify-content:stretch;gap:0;padding:0;border:0;font-size:inherit}   /* undo the record .kv row look */
  dl.kv > div{display:grid;grid-template-columns:minmax(96px,35%) 1fr;gap:var(--space-3);padding:var(--space-3) 0;border-top:1px solid var(--border);align-items:center}
  dl.kv > div:first-child{border-top:0}
  dl.kv dt{color:var(--text-3);font-size:var(--text-small)}
  dl.kv dd{margin:0;color:var(--text-1);overflow-wrap:anywhere}
  dl.kv dd.is-gap,.sale-facts dd.is-gap{color:var(--text-3);font-weight:400}
  .farm-card dl.kv{margin-top:var(--space-1)}
  /* the Default pill carries a star (neutral: a fact, not a status) */
  .pill-star i{-webkit-mask-image:var(--ic-star);mask-image:var(--ic-star)}
  /* a dense secondary button (36px with a mouse, 44px on touch), e.g. Edit on a card */
  .btn.dense{font-size:var(--text-small);padding:0 var(--space-4)}
  @media (hover:hover) and (pointer:fine){ .btn.dense{min-height:var(--h-control-dense)} }
  .btn.btn-edit::before{content:"";width:var(--icon-sm);height:var(--icon-sm);background:currentColor;-webkit-mask:var(--ic-pencil) center/contain no-repeat;mask:var(--ic-pencil) center/contain no-repeat}
  /* icon-only button (remove a lot): a 44px square holding the X */
  .btn.icon-only{padding:0;width:var(--touch-min);min-width:var(--touch-min)}
  .btn.icon-only.cb-lot-x::before{content:"";width:var(--icon-md);height:var(--icon-md);background:currentColor;-webkit-mask:var(--ic-x) center/contain no-repeat;mask:var(--ic-x) center/contain no-repeat}

  /* ---------- sale facts and lots (UI guide #lots; restyle slice 4d) ----------
     The catalogue's facts above the lots; then one lot per row in catalogue order. A container query
     lays a lot out in one line from 720px of panel width (number, tag, animal, remark, reserve, acts). */
  .sale-facts{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-6);margin:0;padding:var(--space-4);border-bottom:1px solid var(--border)}
  .sale-facts div{display:grid}
  .sale-facts dt{font-size:var(--text-caption);color:var(--text-3)}
  .sale-facts dd{margin:0;color:var(--text-1);font-weight:600;white-space:nowrap}
  .lots{container:lots / inline-size;margin:0;padding:0;list-style:none}
  .lot{display:grid;gap:var(--space-1) var(--space-3);padding:var(--space-3) var(--space-4);border-top:1px solid var(--border);align-items:center;grid-template-columns:32px minmax(0,1fr) auto;grid-template-areas:"no tag price" "no who who" "no note note"}
  .lot:first-child{border-top:0}
  .lot.is-link{cursor:pointer}
  .lot:hover{background:var(--hover-tint)}
  .lot:focus-visible{outline:2px solid var(--accent-strong);outline-offset:-2px;box-shadow:none}
  .lot-no{grid-area:no;font:600 var(--text-figure-sm)/1 var(--font-display);color:var(--text-1)}
  .lot-tag{grid-area:tag;justify-self:start}
  .lot-who{grid-area:who;display:grid;min-width:0}
  .lot-who b{color:var(--text-1);font-weight:600}
  .lot-note{grid-area:note;margin:0;color:var(--text-2);font-size:var(--text-small)}
  .lot-note:empty{display:none}
  .lot-price{grid-area:price;text-align:right;white-space:nowrap;font-weight:600;color:var(--text-1)}
  .lot-price small{display:block;font-weight:400;color:var(--text-3);font-size:var(--text-caption)}
  .lot-acts{display:none}
  .lot-empty{padding:var(--space-5) var(--space-4)}
  @container lots (min-width:720px){
    .lot{grid-template-columns:48px 96px minmax(0,1.2fr) minmax(0,1.6fr) 120px auto;grid-template-areas:"no tag who note price acts"}
    .lot-acts{display:block;grid-area:acts}
  }
  .sale-foot{display:flex;justify-content:flex-end;padding:var(--space-3) var(--space-4);border-top:1px solid var(--border)}
  /* Studbook: three figures in a row from 600px */
  @media (min-width:600px){ dl.metrics-dash.sb-metrics{grid-template-columns:repeat(3,minmax(0,1fr))} }
  #studbook .dash-metrics{margin-bottom:var(--space-5)}

  /* ---------- dashboard (UI guide #dashboard; restyle slice 4c) ----------
     Figures: the guide's un-boxed .metrics in one white panel (no KPI tiles): a caption-size label
     with its icon, the number in Barlow at figure size, a caption under it. Two per row on phones,
     four from 600px. */
  /* scoped to dl.metrics-dash: .metrics is also the record screen's metric tiles (its own rules below) */
  dl.metrics-dash{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;margin:0}
  @media (min-width:600px){ dl.metrics-dash{grid-template-columns:repeat(4,minmax(0,1fr))} }
  dl.metrics-dash > div{padding:var(--space-3) var(--space-3) var(--space-3) 0;min-width:0}
  /* Figures in one row line up even when a label wraps (click-through, 20 Nov 2026: in Afrikaans on a
     phone "Kalwers om te speen" took two lines, so its 97 sat lower than the 0 beside it). Each figure
     is a subgrid over three shared rows (label, figure, the optional caption under it), so a row of
     labels is as tall as its tallest label and every figure in that row starts on the same line. */
  dl.metrics-dash{grid-auto-rows:auto}
  dl.metrics-dash > div{display:grid;grid-row:span 3;grid-template-rows:subgrid;row-gap:0;align-content:start}
  dl.metrics-dash dt{align-self:start}
  dl.metrics-dash dt{display:flex;align-items:center;gap:var(--space-2);font-size:var(--text-caption);color:var(--text-3)}
  dl.metrics-dash dt svg{flex:none;width:var(--icon-sm);height:var(--icon-sm)}
  dl.metrics-dash dd{margin:0;font:600 var(--text-figure)/1 var(--font-display);color:var(--text-1);font-variant-numeric:tabular-nums}
  dl.metrics-dash .delta{margin:var(--space-1) 0 0}
  .dash-metrics{padding-top:var(--space-2);padding-bottom:var(--space-2)}
  .dash-attn .panel-h .caption{margin-left:auto}
  .dash-attn .panel-h .btn{margin-left:0}
  /* attention rows (scoped to the dashboard: .attn-list is also the drill-down overlay's list) */
  .dash-attn .attn-list,.diary-rem .attn-list{display:block;gap:0;margin:0;padding:0;list-style:none}   /* the Diary's reminders use the same rows (slice 4e) */
  .dash-attn .attn-list > li + li,.diary-rem .attn-list > li + li{border-top:1px solid var(--border)}
  .attn-row{display:flex;align-items:center;gap:var(--space-3);width:100%;min-height:var(--touch-min);padding:var(--space-3) var(--space-4);background:none;border:0;font:inherit;text-align:left;color:var(--text-1);cursor:pointer}
  .attn-row:hover{background:var(--hover-tint)}
  .attn-row:focus-visible{box-shadow:none;outline:2px solid var(--accent-strong);outline-offset:-2px}
  .attn-row .pick-m{display:grid;gap:2px;flex:1;min-width:0}
  .attn-row .pick-m b{font-weight:600}
  .attn-row > svg{flex:none;width:var(--icon-sm);height:var(--icon-sm);color:var(--text-3)}
  .attn-ic{flex:none;display:grid;place-items:center;width:36px;height:36px;border-radius:var(--radius-full)}
  .attn-ic svg{width:var(--icon-md);height:var(--icon-md)}
  .attn-ic.is-bad{background:var(--error-tint);color:var(--error)}
  .attn-ic.is-due{background:var(--warning-tint);color:var(--warning)}
  .attn-ic.is-info{background:var(--info-tint);color:var(--info)}
  .attn-ic.is-ok{background:var(--success-tint);color:var(--success)}   /* dashboard All clear (redesign) */
  .attn-st{font-weight:600}
  .attn-st.is-bad{color:var(--error)} .attn-st.is-due{color:var(--warning)} .attn-st.is-info{color:var(--info)} .attn-st.is-ok{color:var(--success)}
  .attn-n{flex:none;min-width:2ch;text-align:right;font:600 var(--text-h3)/1 var(--font-display);color:var(--text-1);font-variant-numeric:tabular-nums}
  .attn-quiet{display:flex;align-items:center;gap:var(--space-2);padding:var(--space-3) var(--space-4);color:var(--text-3);font-size:var(--text-small)}
  .attn-quiet svg{flex:none;width:var(--icon-sm);height:var(--icon-sm);color:var(--success)}
  /* activity feed: newest first, icon in a neutral circle, the line, a relative time on the right */
  .feed{margin:0;padding:0;list-style:none}
  .feed > li{display:flex;align-items:center;gap:var(--space-3);padding:var(--space-3) var(--space-4)}
  .feed > li + li{border-top:1px solid var(--border)}
  .feed-ic{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:var(--radius-full);background:var(--surface-2);color:var(--text-2);box-shadow:inset 0 0 0 1px var(--border)}
  .feed-ic svg{width:var(--icon-sm);height:var(--icon-sm)}
  .feed-t{flex:1;min-width:0;color:var(--text-1);font-size:var(--text-small);font-variant-numeric:tabular-nums}
  .feed time{flex:none;white-space:nowrap}
  /* the animal's tag in a feed line links to its record (guide: --accent-strong, underlined) */
  .feed-t .feed-tag{padding:0;background:none;border:0;font:inherit;font-weight:600;color:var(--accent-strong);text-decoration:underline;text-underline-offset:3px;cursor:pointer;border-radius:var(--radius-sm)}
  .feed-t .feed-tag:hover{color:var(--accent-strong-hover)}
  .feed .feed-empty{display:block}

  /* ---------- Dashboard redesign (Kobus's proposal, 24 Nov 2026; features/dashboard-redesign.md) ----------
     Phone first: one column with What needs you on top. From 1024px the herd figures run as one strip
     across the top, What needs you on the left (3 parts) and the pinned notes and activity on the right
     (2 parts). Rows, ear tags, note papers and the feed are the UI guide's own pieces (.attn-ic, .tag,
     .snote, .feed); the classes below only place them. */
  /* Order (Caleb, 25 Nov 2026). Phone: What needs you, Coming up, pinned notes, herd figures, activity.
     Laptop: the figures strip on top; What needs you on the left; Coming up, notes and activity down the
     right. .dash-side is display:contents so the notes and the feed are grid items of their own. The
     last row takes the spare height, so a long What needs you never spreads the right column apart. */
  .dash-grid{display:grid;gap:var(--space-5);grid-template-columns:minmax(0,1fr);grid-template-areas:"need" "coming" "notes" "herd" "feed"}
  .dash-need{grid-area:need}
  .dash-herd{grid-area:herd}
  .dash-coming{grid-area:coming}
  .dash-side{display:contents}
  .dash-notes{grid-area:notes}
  .dash-feed{grid-area:feed}
  .dash-grid > [hidden]{display:none}
  @media (min-width:1024px){
    .dash-grid{grid-template-columns:minmax(0,3fr) minmax(0,2fr);grid-template-rows:auto auto auto auto 1fr;
      grid-template-areas:"herd herd" "need coming" "need notes" "need feed" "need .";align-items:start}
    /* The figures run as one strip across the top: no panel heading there (it shows on a phone only). */
    .dash-herd > .panel-h{display:none}
  }
  /* Panel heads keep one height with or without a button (the proposal's UI guide addition). */
  #dash .panel-h{min-height:calc(var(--h-control-dense) + var(--space-4))}
  #dash .panel-h .btn{margin-left:auto}

  /* Find a cow: phones only (the top bar's search is hidden below 769px). Same look as the top-bar box. */
  .dash-find{display:flex;align-items:center;gap:var(--space-3);margin:0 0 var(--space-4);min-height:var(--h-control);padding:0 var(--space-3);background:var(--input-bg);border:1.5px solid var(--input-border);border-radius:var(--radius-md);color:var(--text-3)}
  .dash-find:focus-within{border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  .dash-find svg{flex:none;width:var(--icon-sm);height:var(--icon-sm)}
  .dash-find input{flex:1;min-width:0;border:0;background:none;outline:none;font:inherit;font-size:var(--text-body);color:var(--text-1)}
  .dash-find input::placeholder{color:var(--placeholder-color);opacity:1}
  @media (min-width:769px){ .dash-find{display:none} }

  /* Could-not-reach notice (warning tint, never colour alone: it says so in words). */
  .dash-notice{display:flex;align-items:flex-start;gap:var(--space-3);margin:0 0 var(--space-4);padding:var(--space-3) var(--space-4);border:1px solid var(--border);border-radius:var(--radius-md);background:var(--warning-tint);font-size:var(--text-small);color:var(--text-2)}
  .dash-notice[hidden]{display:none}
  .dash-notice > svg{flex:none;width:18px;height:18px;margin-top:1px;color:var(--warning)}
  .dash-notice-t{flex:1;min-width:0}
  .dash-notice b{color:var(--text-1);font-weight:600}
  .dash-notice .btn{flex:none;align-self:center}

  /* Group heading: a coloured dot and an overline word (Act now / Costing you / Coming up / All clear). */
  .dash-gh{display:flex;align-items:center;gap:var(--space-2);margin:0;padding:var(--space-4) var(--space-4) 2px;font:600 var(--text-overline)/1.2 var(--font-body);letter-spacing:.06em;text-transform:uppercase;color:var(--text-3)}
  .dash-gh::before{content:"";width:8px;height:8px;border-radius:var(--radius-full);background:currentColor}
  .dash-gh.g-bad{color:var(--error)} .dash-gh.g-due{color:var(--warning)} .dash-gh.g-info{color:var(--info)} .dash-gh.g-ok{color:var(--success)}
  .dash-grp + .dash-grp{border-top:1px solid var(--border)}
  .dash-rows{margin:0;padding:0;list-style:none}
  .dash-rows > li + li{border-top:1px solid var(--border)}
  .dash-empty{margin:0;padding:var(--space-1) var(--space-4) var(--space-4);color:var(--text-2);font-size:var(--text-small)}
  .dash-lede{margin:0;padding:var(--space-3) var(--space-4) var(--space-1);color:var(--text-2);font-size:var(--text-small)}

  /* One "What needs you" row: icon, name over its rule, count, caret; the named cows sit under it.
     A real <button> (or a plain row when there is nowhere to go), so it is keyboard reachable. */
  .dash-row{display:grid;grid-template-columns:36px minmax(0,1fr) auto 16px;column-gap:var(--space-3);align-items:start;width:100%;min-height:var(--touch-min);padding:var(--space-3) var(--space-4);background:none;border:0;font:inherit;text-align:left;color:var(--text-1)}
  button.dash-row{cursor:pointer}
  button.dash-row:hover{background:var(--hover-tint)}
  button.dash-row:focus-visible{outline:2px solid var(--accent-strong);outline-offset:-2px}
  .dash-row .attn-ic{margin-top:2px}
  .dash-row-t{display:grid;gap:2px;min-width:0;padding-top:6px}
  .dash-row-t b{font-weight:600}
  .dash-row .attn-n{padding-top:8px}
  .dash-row > svg{width:var(--icon-sm);height:var(--icon-sm);margin-top:12px;color:var(--text-3)}
  .dash-cows{grid-column:2 / 4;margin:var(--space-2) 0 0;padding:0;list-style:none}
  .dash-cows > li{display:flex;align-items:center;gap:var(--space-3);min-height:36px;padding:4px 0;border-top:1px solid var(--border);font-size:var(--text-small)}
  .dash-cows .tag{font-size:var(--text-small);padding:3px 6px 2px 5px}
  /* UI guide "Labels without a number": an animal with no tag, calf number or dam gets a dashed white
     "No ID" tag, so the gap is visible, not a blank yellow chip (white = the farm's white tag tokens).
     The guide greys the text with --text-3; that token turns light in dark mode and reads about 2.3:1
     on the white tag, so the tag keeps its own dark text and the dashed edge carries "missing". */
  .tag.white{color:var(--tag-white-text);background:var(--tag-white);border-color:var(--tag-white-edge)}
  .tag.tag-none{border-style:dashed}
  .dash-cow-n{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text-1)}
  .dash-cow-why{flex:none;color:var(--text-2);font-variant-numeric:tabular-nums}
  .dash-cows > li.dash-more-cows{display:block;padding:7px 0 0;font-weight:600;color:var(--accent-strong)}
  /* Phones: the named cows use the row's full width (under the icon too), so a long reason such as
     "142 days since service" leaves room for the cow's name instead of cutting it to one letter. */
  @media (max-width:599px){
    /* The tags start under the row's name, not under its icon (Caleb, 25 Nov 2026); the list also takes
       the caret's column, and a long reason wraps onto a second line instead of squeezing the name. */
    .dash-cows{grid-column:2 / -1}
    .dash-cow-n{min-width:5ch}
    .dash-cow-why{white-space:normal;text-align:right;max-width:55%}
  }
  /* The worst late calvers under the calving-interval figure: a phone shows them (the proposal's
     list), the laptop strip keeps only the "Show the N cows" link. */
  .dash-figs .dash-cows{grid-column:auto;margin:0 0 var(--space-1)}   /* between the title and the days count */
  @media (min-width:1024px){ .dash-figs .dash-cows{display:none} }

  /* Pinned notes on the Dashboard (Caleb, 25 Nov 2026): shorter papers (the note text is cut to two lines;
     the Diary shows it whole), and Add note as one wide dashed bar under them, as in the proposal. On a
     laptop two notes sit side by side; on a phone one note is about 65% of the screen wide (below). */
  #dash .notes-strip > li{flex:0 0 calc(50% - var(--space-2))}
  /* Phones (Caleb, 25 Nov 2026): a bit wider and taller than the first cut. One note is about 65% of the
     screen (65vw), at least 180px tall, and shows four lines of its text before it is cut. */
  @media (max-width:1023px){
    #dash .notes-strip > li{flex-basis:65vw}
    #dash .snote{min-height:180px}
    #dash .notes-strip .snote-b{-webkit-line-clamp:4;line-clamp:4}   /* more specific: the two-line rule comes later */
  }
  #dash .snote{padding-top:var(--space-4)}
  #dash .snote-b{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}
  .dash-note-add{padding:0 var(--space-4) var(--space-4)}
  .dash-note-add .snote-add{display:flex;align-items:center;justify-content:center;gap:var(--space-2);aspect-ratio:auto;width:100%;min-height:var(--touch-min);padding:var(--space-2) var(--space-3)}
  .dash-note-add .snote-add svg{width:var(--icon-sm);height:var(--icon-sm)}

  /* Service animals: the cows a Dashboard row sent here (Not served again, Heifers ready for the bull)
     are highlighted and listed first, NOT ticked, so no service is recorded by accident. The reason is
     also written in the row (.svc-hl-why), so the highlight is never colour alone. */
  .cowrow.svc-hl{background:var(--info-tint);box-shadow:inset 3px 0 0 var(--info)}
  .cowrow .svc-hl-why{color:var(--info);font-weight:600}

  /* First steps (new farm) and "your herd is in" (no breeding yet). */
  .dash-steps{list-style:none;margin:0;padding:var(--space-1) 0 var(--space-2)}
  .dash-step{display:flex;align-items:flex-start;gap:var(--space-3);padding:var(--space-3) var(--space-4)}
  .dash-step + .dash-step{border-top:1px solid var(--border)}
  .dash-step-t{flex:1;display:grid;gap:2px;min-width:0}
  .dash-step-t b{font-weight:600}
  .dash-step-n{flex:none;display:grid;place-items:center;width:28px;height:28px;border-radius:var(--radius-full);border:1.5px solid var(--border-strong);font:600 var(--text-small)/1 var(--font-body);color:var(--text-2)}
  .dash-step.done .dash-step-n{border-color:transparent;background:var(--success-tint);color:var(--success)}
  .dash-step.done b{color:var(--text-2)}
  .dash-step-n svg{width:16px;height:16px}
  .dash-step-acts{display:flex;flex-wrap:wrap;gap:var(--space-2);margin-top:var(--space-2)}

  /* How the herd is doing: a list on a phone, three columns from 1024px. The figure says good or bad
     in words beside the number (.attn-st colour plus text), never colour alone. */
  .dash-figs{margin:0;padding:0;list-style:none}
  .dash-figs > li{display:block;padding:var(--space-4)}   /* stacked: title, number, description */
  .dash-figs > li + li{border-top:1px solid var(--border)}
  .dash-fig-t{display:grid;gap:var(--space-2);min-width:0}
  .dash-fig-t b{font-weight:600}
  .dash-fig-v{font:600 var(--text-figure)/1 var(--font-display);color:var(--text-1);font-variant-numeric:tabular-nums;white-space:nowrap}
  .dash-fig-v small{margin-left:4px;font:500 var(--text-small)/1 var(--font-body);color:var(--text-3)}
  /* "Show the 8 cows": a link at the end of the description line, not a block of its own. */
  .dash-fig-more{display:inline;padding:0;background:none;border:0;font:inherit;font-weight:600;color:var(--accent-strong);cursor:pointer;border-radius:var(--radius-sm)}
  .dash-fig-more:hover{text-decoration:underline;text-underline-offset:3px}
  .dash-fig-more:focus-visible{outline:2px solid var(--accent-strong);outline-offset:2px}
  @media (min-width:1024px){
    .dash-figs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
    .dash-figs > li + li{border-top:0;border-left:1px solid var(--border)}
  }

  /* Loading skeleton (Caleb, 26 Nov 2026, option B of design/mockups/dashboard-loading.html; the UI
     guide's "skeletons for first loads"). Static grey shapes in the layout of each panel sit in
     index.html until the first GET /api/dashboard lands; every render replaces them (replaceChildren),
     and a failed first load clears them (dashClearSkeleton) so a dead panel never looks busy.
     Calm on purpose: no shimmer (the guide's quick, functional motion), and the shapes only appear
     once the wait passes 200 ms, so a fast load goes straight from nothing to the data with no grey
     flash. Under reduced motion --duration-fast is 0ms: the delay still holds, the fade does not. */
  .dash-sk{opacity:0;animation:dash-sk-in var(--duration-fast) var(--ease-out) 200ms both}
  @keyframes dash-sk-in{from{opacity:0}to{opacity:1}}
  /* --border, not --surface-2: in light mode --surface-2 is near-white on the white panel and the shapes
     vanish; --border reads in both themes (it is also the peak colour of the guide's shimmer). */
  .dash-sk .sk{display:block;height:14px;border-radius:var(--radius-sm);background:var(--border)}
  .dash-sk-row{display:grid;grid-template-columns:40px minmax(0,1fr) 32px;gap:var(--space-3);align-items:center;padding:var(--space-3) var(--space-4)}
  .dash-sk-row + .dash-sk-row{border-top:1px solid var(--border)}
  .dash-sk-ic{height:40px !important;border-radius:var(--radius-md) !important}   /* the .attn-ic square */
  .dash-sk-n{height:22px !important}                                               /* the row count */
  .dash-sk-lines{display:grid;gap:6px}
  .dash-sk-fig{display:grid !important;gap:var(--space-2)}                          /* beats .dash-figs > li{display:block} */
  .dash-sk-big{height:34px !important;width:45%}                                   /* the big figure */
  .feed > li.dash-sk-feed{display:grid;gap:var(--space-3);padding:var(--space-2) var(--space-4) var(--space-4);border:0}   /* beats the feed's flex line */
  .dash-sk-h{display:inline-block !important;width:12ch;height:18px !important;vertical-align:middle}   /* Coming up's heading before its day count is known */
  .sk-w40{width:40%}.sk-w55{width:55%}.sk-w70{width:70%}.sk-w85{width:85%}
  /* A pinned note's paper: as tall as a real note (two lines of text on a laptop; the phone's taller
     65vw paper below 1024px), so nothing jumps when the notes land. */
  .dash-sk-note{flex:1 1 auto;width:100%;height:150px !important;border-radius:var(--radius-md) !important}   /* the strip's li is a flex box */
  @media (max-width:1023px){ .dash-sk-note{height:180px !important} }

  /* Recent activity: three lines on a phone, five from 1024px, Show more for the rest. */
  .dash-feed .feed > li:nth-child(n+4){display:none}
  @media (min-width:1024px){ .dash-feed .feed > li:nth-child(n+4){display:flex} .dash-feed .feed > li:nth-child(n+6){display:none} }
  .dash-feed.expanded .feed > li{display:flex !important}
  .dash-feed-quiet{margin:0;padding:var(--space-3) var(--space-4) 0}
  .dash-more{display:block;width:100%;padding:var(--space-3) var(--space-4);border:0;border-top:1px solid var(--border);background:none;font:inherit;font-weight:600;font-size:var(--text-small);color:var(--accent-strong);text-align:left;cursor:pointer}
  .dash-more[hidden]{display:none}
  .dash-notes-empty{margin:0;padding:var(--space-3) var(--space-4) 0}

  /* ---------- table ---------- */
  .toolbar{display:flex;align-items:center;gap:9px;margin-bottom:14px;flex-wrap:wrap}
  /* Filter pill (register type chips, contact groups, camp herds, report picker). An
     inline-flex box centred on both axes: the phone rules grow chips to a 40px tap
     target, and a plain block left the label stuck to the top of the taller pill. */
  /* Restyle slice 2 (UI guide, chips): a 44px touch target, 36px only with a mouse. Selected is
     the selected tint plus the 1px --selected-ring, never colour alone and never lime text. */
  .chip{font-size:var(--text-small);font-weight:600;min-height:var(--touch-min);padding:0 var(--space-3);border-radius:var(--radius-full);border:1.5px solid var(--border-strong);background:var(--surface);color:var(--text-1);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;text-align:center;font-family:inherit}
  .chip:hover{background:var(--hover-tint)}
  .chip.on{background:var(--accent-selected);border-color:transparent;box-shadow:var(--selected-ring);color:var(--text-1)}
  @media (hover:hover) and (pointer:fine){ .chip{min-height:var(--h-control-dense)} }
  table{width:100%;border-collapse:collapse}
  /* wraps a wide table that shares a panel with a header, so only the table
     scrolls sideways and the header/action button stay put */
  .tbl-scroll{overflow-x:auto}
  /* Column headings at the caption size, never under 13px (Kobus, 20 Nov 2026: 11.5px read "super
     tiny"; DESIGN.md: 13px is the smallest text), in --text-2 like the UI guide's .tbl th. */
  thead th{text-align:left;font-size:var(--text-caption);font-weight:600;letter-spacing:0;color:var(--text-2);padding:11px 16px;border-bottom:1px solid var(--line)}
  /* Click-to-sort column headers (register). A low-contrast ↕ hints sortability; the active
     column shows a solid ▲/▼ and tints its label. ::after carries the caret so it survives the
     [data-i18n] effect overwriting the header's textContent (e.g. the Quality column). */
  thead th.sortable{cursor:pointer;user-select:none;white-space:nowrap}
  thead th.sortable::after{content:'↕';margin-left:5px;font-size:10px;opacity:.35}
  thead th.sortable:hover{color:var(--ink)}
  thead th.sort-asc,thead th.sort-desc{color:var(--ink)}
  thead th.sort-asc::after{content:'▲';opacity:.9}
  thead th.sort-desc::after{content:'▼';opacity:.9}
  thead th.sortable:focus-visible{outline:2px solid var(--green);outline-offset:-2px}
  tbody td{padding:12px 16px;border-bottom:1px solid var(--line-soft);font-size:13px}
  tbody tr{cursor:pointer}
  tbody tr:hover{background:var(--surface-2)}
  .animal-cell{display:flex;align-items:center;gap:11px}
  .animal-cell .nm{font-weight:600}
  /* The register's empty state (app.js cellGap): a missing value is named quietly ("No breed", "Not
     weighed") in the helper-text colour at caption size, so a gap is never a blank cell that reads as
     a fault, yet the real values still stand out down the column (DESIGN.md, 26 Nov 2026). Regular
     weight even on the bold name line. Tokens only, so the dark theme follows. */
  .cell-gap{color:var(--text-3);font-size:var(--text-caption);font-weight:400}
  .animal-cell .br{font-size:11.5px;color:var(--faint)}
  /* Grade badge on the animal record (UI guide #grade, .grade-badge; DESIGN.md 28 Oct 2026): the
     plain-text grade (letter in the display font, score as a caption) inside a compact secondary button
     with a caret, because it opens the quality breakdown (app.js qualityBadge). 32px tall to sit beside
     the status pill; the transparent ::after keeps a 44px hit area on every pointer. Ink only: the
     letter carries the grade, so there are no per-grade colours, no lime (that means selected) and no
     traffic-light tints (a grade is not a warning). */
  .grade-badge{position:relative;display:inline-flex;align-items:center;gap:5px;height:32px;padding:0 6px 0 9px;background:var(--surface);border:1.5px solid var(--border-strong);border-radius:var(--radius-md);color:var(--text-1);font:inherit;cursor:pointer;white-space:nowrap;transition:background var(--duration-fast) var(--ease-out)}
  .grade-badge::after{content:"";position:absolute;left:0;right:0;top:50%;height:var(--touch-min);transform:translateY(-50%)}
  .grade-badge:hover{background:var(--hover-tint)}
  .gb-l{font:600 1.375rem/1 var(--font-display);letter-spacing:.02em;padding-top:2px}
  .gb-s{font-size:var(--text-caption);color:var(--text-3);font-variant-numeric:tabular-nums}
  /* The caret: the Phosphor caret-right as a mask (the --ic-caret-right token), so it follows the theme. */
  .gb-go{flex:none;width:var(--icon-sm);height:var(--icon-sm);background:var(--text-3);-webkit-mask:var(--ic-caret-right) center/contain no-repeat;mask:var(--ic-caret-right) center/contain no-repeat}
  /* Not graded: a quiet span, not a button (nothing to open), so no hover and no hit area. The same
     look marks the grade inside the open breakdown (.g-static), where it is no longer a control. */
  .g-na,.g-static{cursor:default}
  .g-na{padding-right:9px}
  .g-na:hover,.g-static:hover{background:var(--surface)}
  .g-na::after,.g-static::after{content:none}
  .g-static{padding-right:9px}
  .g-na .gb-l{color:var(--text-3)}
  /* Grade in register rows (UI guide .grade-t, app.js gradeText): plain text, no box. A grade in a list
     is a fact, not a control; the row opens the animal and the record's badge opens the breakdown. */
  .grade-t{display:inline-flex;align-items:center;gap:4px;white-space:nowrap;color:var(--text-1)}
  .grade-t .gl{font:600 1.125rem/1 var(--font-display);letter-spacing:.02em;padding-top:2px}
  .grade-t .gs{font-size:var(--text-caption);color:var(--text-3);font-variant-numeric:tabular-nums}
  /* An ungraded animal: "Not graded" as a quiet caption, so the cell is never empty (app.js gradeText). */
  .grade-t.g-none{font-size:var(--text-caption);color:var(--text-3)}
  /* coat swatch: the fill is the real hide colour (app.js COLOUR_KEYWORDS, same in both themes); the
     3:1 --border-strong edge keeps a black or white coat visible on a dark or light row (dark mode) */
  .swatch{width:14px;height:14px;border-radius:4px;border:1px solid var(--border-strong);flex:none}
  .herd{white-space:nowrap}
  .wt{font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap}
  .wt small{color:var(--faint);font-weight:400}
  /* animal register: chips grouped left, count + actions right; wraps cleanly */
  /* two stacked zones: the type pills wrap freely across as many rows as they need,
     then the count + Filter + Export sit together on their own row, aligned right.
     No horizontal scroll, consistent whichever pill is active */
  /* Tighten the space below the action row before the table (overrides .toolbar's 14px). */
  .an-toolbar{display:flex;flex-direction:column;gap:10px;align-items:stretch;margin-bottom:6px}
  .an-toolbar .chips{display:flex;flex-wrap:wrap;gap:8px}
  .an-toolbar .tb-actions{display:flex;align-items:center;gap:9px;justify-content:flex-end}
  .an-toolbar .tb-actions .muted{white-space:nowrap}
  /* Register empty state (#167): the sentence, then the Clear search button under it when a
     search or filter is what emptied the list. */
  .an-empty p{margin:0}
  .an-empty .btn{margin-top:10px}
  /* column-filter bar: a tidy 5-column grid, shown/hidden by the Filter button. Controls
     share the design's input look so the dropdowns match the rest. The three .an-filter-row
     wrappers collapse with display:contents so all their controls flow into ONE grid — giving
     a clean 5 × 3: identity+classification, lineage+origin+status, then the Sex + Pregnancy pair
     on the last row with Clear pinned to its right. (The ≤768px block overrides to 2 columns.) */
  .an-filters{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;align-items:center}
  .an-filters[hidden]{display:none}
  .an-filter-row{display:contents}
  /* each grid item (text input or the dropdown's mount span) fills its column; min-width:0 lets
     it shrink inside the track instead of forcing overflow */
  .an-filter-ctl,.an-filters .an-filter-sel{min-width:0}
  /* text inputs: same frame as the modal's .cb-inp / styled select button */
  input.an-filter-ctl{font-family:inherit;font-size:13px;color:var(--ink);background:var(--surface);border:1px solid var(--line);border-radius:6px;padding:7px 11px;outline:none}
  input.an-filter-ctl::placeholder{color:var(--faint)}
  input.an-filter-ctl:focus{border-color:var(--green)}
  /* styled dropdown (buildSelect) scoped into the filter bar — mirrors .setrow */
  .an-filters .an-filter-sel{display:block}
  .an-filters .cb-select{position:relative;width:100%}
  .an-filters .cb-select-btn{display:flex;align-items:center;gap:8px;width:100%;text-align:left;cursor:pointer;border:1px solid var(--line);background:var(--surface);border-radius:6px;padding:7px 11px;font-size:13px;font-weight:600;color:var(--ink);font-family:inherit}
  .an-filters .cb-select-btn .chev{width:13px;height:13px;flex:none;opacity:.6;margin-left:auto}
  .an-filters .cb-select-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .an-filters .cb-select-label.cb-ph{color:var(--faint);font-weight:400}
  .an-filters .cb-select-menu{position:fixed;z-index:30;display:flex;flex-direction:column;max-height:280px;min-width:160px;background:var(--surface);border:1px solid var(--line);border-radius:8px;box-shadow:var(--shadow-md);padding:5px}
  .an-filters .cb-select-menu[hidden]{display:none}
  .an-filters .cb-select-search{border:1px solid var(--line);border-radius:6px;padding:8px 10px;font-family:inherit;font-size:13px;color:var(--ink);outline:none;margin-bottom:5px}
  .an-filters .cb-select-search:focus{border-color:var(--green)}
  .an-filters .cb-select-list{overflow-y:auto}
  .an-filters .cb-select-opt{display:block;width:100%;text-align:left;border:none;background:none;font-family:inherit;font-size:13.5px;color:var(--ink);padding:8px 10px;border-radius:6px;cursor:pointer;white-space:nowrap}
  .an-filters .cb-select-opt:hover{background:var(--surface-2)}
  .an-filters .cb-select-opt.on{background:var(--green-tint);color:var(--accent-strong);font-weight:600}
  /* Clear sits on the last grid row, pinned to the far-right column so the Sex + Pregnancy
     pair keeps the left of that row (overridden to column 2 in the ≤768px block). */
  .an-filter-clear{grid-column:5;justify-self:end;align-self:center}
  /* Filter toggle: active/open tint so the collapsed bar's state is visible */
  .an-toolbar .tb-actions .btn.on{background:var(--green-tint);border-color:var(--green);color:var(--accent-strong)}
  /* Register action row: dedicated search on the left (~1/3), actions pushed right. */
  .an-actionbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
  .an-actionbar .tb-actions{margin-left:auto}                 /* count + Filter + Export stay right */
  /* search field: ~1/3 of the row (clamped), same rounded frame as the record-picker search box */
  .an-search{flex:0 0 clamp(240px,44%,480px);display:flex;align-items:center;gap:8px;background:var(--surface);border:1px solid var(--line);border-radius:12px;padding:10px 14px;color:var(--muted);box-shadow:var(--shadow)}
  .an-search svg{width:15px;height:15px;flex:none;opacity:.7}
  .an-search input{border:none;background:none;outline:none;font-family:inherit;font-size:14px;color:var(--ink);width:100%}
  .an-search input::placeholder{color:var(--muted)}
  @media (max-width:640px){ .an-search{flex-basis:100%} }     /* full width on phones */
  /* Register pager — "Showing X–Y of Z" · page-size dropdown · prev/next + numbered pages. */
  .an-pager{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:14px}
  .an-pager[hidden]{display:none}
  .an-pg-info{color:var(--muted);font-size:12.5px}
  .an-pg-size{display:flex;align-items:center;gap:8px;margin-left:auto;font-size:12.5px;color:var(--muted)}
  .an-pg-size .cb-select{position:relative;min-width:86px}
  .an-pg-nav{display:flex;align-items:center;gap:4px}
  .an-pg-btn{min-width:32px;height:32px;padding:0 9px;border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:6px;font-family:inherit;font-size:13px;font-weight:600;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
  .an-pg-btn:hover:not(:disabled){background:var(--surface-2)}
  /* --on-strong, not white: --green (--accent-strong) turns light lime in dark, so its text flips to ink */
  .an-pg-btn.on{background:var(--green);border-color:var(--green);color:var(--on-strong)}
  .an-pg-btn:disabled{opacity:.4;cursor:default}
  .an-pg-ellip{padding:0 2px;color:var(--muted)}
  /* styled page-size dropdown (buildSelect) scoped into the pager — mirrors the filter-bar select */
  .an-pg-size .cb-select-btn{display:flex;align-items:center;gap:8px;width:100%;text-align:left;cursor:pointer;border:1px solid var(--line);background:var(--surface);border-radius:6px;padding:7px 11px;font-size:13px;font-weight:600;color:var(--ink);font-family:inherit}
  .an-pg-size .cb-select-btn .chev{width:13px;height:13px;flex:none;opacity:.6;margin-left:auto}
  .an-pg-size .cb-select-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .an-pg-size .cb-select-menu{position:fixed;z-index:30;display:flex;flex-direction:column;max-height:280px;min-width:86px;background:var(--surface);border:1px solid var(--line);border-radius:8px;box-shadow:var(--shadow-md);padding:5px}
  .an-pg-size .cb-select-menu[hidden]{display:none}
  .an-pg-size .cb-select-list{overflow-y:auto}
  .an-pg-size .cb-select-opt{display:block;width:100%;text-align:left;border:none;background:none;font-family:inherit;font-size:13.5px;color:var(--ink);padding:8px 10px;border-radius:6px;cursor:pointer;white-space:nowrap}
  .an-pg-size .cb-select-opt:hover{background:var(--surface-2)}
  .an-pg-size .cb-select-opt.on{background:var(--green-tint);color:var(--accent-strong);font-weight:600}
  /* uniform-width ID tags so the Animal column lines up regardless of id length */
  #animals .animal-cell .tag{min-width:72px;justify-content:center}

  /* ---------- record ---------- */
  /* Full-image lightbox. The image is centred in ONE grid cell that is exactly the padded overlay
     (minmax(0,1fr) both ways), and is capped at 100% of THAT cell — not at 94vw/90vh. The old vw/vh
     caps ignored the overlay padding, so on a phone (375px: 94vw = 352px > 375 - 2×28 = 319px) the
     picture overflowed its cell and sat pushed to the right instead of centred. Equal top/bottom
     padding (clear of the × above and the date bar below) keeps it centred vertically too. */
  .cb-lightbox{position:fixed;inset:0;z-index:calc(var(--z-modal) + 20);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);place-items:center;padding:68px 16px;background:rgba(22,17,10,.84);opacity:0;transition:opacity .18s ease}
  @media (min-width:769px){.cb-lightbox{padding:68px 28px}}
  .cb-lightbox.on{opacity:1}
  .cb-lightbox[hidden]{display:none}
  .cb-lightbox-img{max-width:100%;max-height:100%;object-fit:contain;border-radius:10px;background:var(--surface);box-shadow:0 20px 60px rgba(0,0,0,.5)}
  .cb-lightbox-x{position:absolute;top:16px;right:18px;width:40px;height:40px;border-radius:50%;border:none;background:rgba(255,255,255,.15);color:#fff;font-size:24px;line-height:1;cursor:pointer;display:grid;place-items:center}
  .cb-lightbox-x:hover{background:rgba(255,255,255,.28)}
  /* Phase A: the photo's taken_on date, bottom-left of the full image, with an inline edit control
     (manager+ only — hidden for readonly by the generic [data-min-role] rule below). */
  .cb-lightbox-date{position:absolute;left:20px;bottom:18px;display:flex;align-items:center;gap:10px;z-index:2}
  .cb-lightbox-date-t{background:rgba(22,17,10,.72);color:#fff;font-size:13px;font-weight:600;padding:5px 11px;border-radius:7px}
  .cb-lightbox-date-edit{background:rgba(255,255,255,.15);color:#fff;border:none;font-size:12px;font-weight:600;padding:7px 12px;border-radius:7px;cursor:pointer;min-height:40px}
  .cb-lightbox-date-edit:hover{background:rgba(255,255,255,.28)}
  /* Overlay shell (.cb-quality / .cb-q-*). Named after the old quality breakdown, which now uses the
     restyled .cb-modal (see .qb-h below); the dashboard "Needs attention" drill-down still uses it. */
  /* One grid cell the size of the padded overlay; the card is capped at 100% of it (not 94vw, which
     ignored the 24px padding and pushed the card off-centre / past the edge on a 375px phone). The
     cell's minmax(0,…) row lets the card's max-height + overflow-y scroll inside the screen. */
  .cb-quality{position:fixed;inset:0;z-index:calc(var(--z-modal) + 30);display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);place-items:center;padding:24px 16px;background:rgba(22,17,10,.5);opacity:0;transition:opacity .18s ease}
  .cb-quality.on{opacity:1}
  .cb-quality[hidden]{display:none}
  .cb-q-card{position:relative;width:min(460px,100%);max-height:100%;overflow-y:auto;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow-lg);padding:22px}
  .cb-q-x{position:absolute;top:12px;right:14px;width:30px;height:30px;border-radius:50%;border:none;background:var(--surface-2);color:var(--muted);font-size:19px;line-height:1;cursor:pointer}
  .cb-q-x:hover{background:var(--line-soft);color:var(--ink)}
  .cb-q-title{font-family:var(--serif);font-size:var(--text-h2);font-weight:600}
  .cb-q-none{font-size:13px;color:var(--muted);margin:6px 0}
  /* Dashboard "Needs attention" drill-down (openAttention in app.js) — reuses the quality overlay
     shell (.cb-quality / .cb-q-card / .cb-q-x) and adds a list of tappable animals per section.
     The dashboard rows themselves are real <button>s (.attn-row, restyle slice 4c). */
  .cb-attn-card{width:min(520px,100%)}
  .cb-attn-title{margin:0 0 12px;padding-right:36px}
  .attn-sec+.attn-sec{margin-top:16px;padding-top:14px;border-top:1px solid var(--line)}
  .attn-sec-h{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:6px}
  .attn-count{font-weight:600;color:var(--muted)}
  .attn-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}
  .attn-item{width:100%;display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:10px;row-gap:2px;align-items:baseline;text-align:left;background:var(--surface-2);border:1px solid transparent;border-radius:8px;padding:10px 12px;min-height:44px;font-family:inherit;font-size:13.5px;color:var(--ink);cursor:pointer}
  .attn-item:hover{border-color:var(--line)}
  .attn-item:focus-visible{outline:2px solid var(--green);outline-offset:1px}
  .attn-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .attn-detail{grid-column:1 / -1;font-size:12px}
  /* "View all" on DESKTOP (tester feedback): use the screen width so the modal itself does not
     scroll. The card is as tall as the overlay allows (flex column, max-height:100%), the four lists
     sit side by side in one grid row, and only a list longer than the screen (e.g. 49 heifers)
     scrolls inside its own column. Below 1024px the normal single scrolling card is kept — on a phone
     one long scroll is the expected behaviour. */
  @media (min-width:1024px){
    .cb-attn-card.attn-all{width:min(1280px,100%);overflow:hidden;display:flex;flex-direction:column}
    .cb-attn-card.attn-all .cb-q-body{flex:1 1 auto;min-height:0;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:18px}
    .cb-attn-card.attn-all .attn-sec{display:flex;flex-direction:column;min-height:0;margin:0;padding:0;border:0}
    .cb-attn-card.attn-all .attn-sec+.attn-sec{padding-left:18px;border-left:1px solid var(--line)}
    .cb-attn-card.attn-all .attn-list{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-right:2px}
  }
  /* ── Quality breakdown (UI guide #grade; app.js openQualityBreakdown). It lives in the app's restyled
     modal (.cb-modal / .cb-modal-card / .cb-modal-h), so only the guide's body parts are styled here:
     the grade mark and caption (.qb-h), then the Trait / Value / Points table (.qb-t) with an ink-only
     bar per trait (.qbar). The bars are never grade or traffic-light colours (DESIGN.md: grades and
     quality in ink only). ── */
  .qb-h{display:flex;align-items:center;gap:var(--space-4);margin-bottom:var(--space-3)}
  .qb-h .caption{margin:0}
  .qb-none{margin:0;color:var(--text-2)}
  /* The table, after the guide's table.t: left-aligned cells on a hairline, quiet headings. The app's
     global tbody rules (row hover, pointer cursor, 16px padding) are for clickable lists; these rows
     open nothing, so they are reset here. */
  .qb-t{width:100%;border-collapse:collapse;font-size:var(--text-small)}
  .qb-t th,.qb-t td{text-align:left;padding:var(--space-2) var(--space-3);border-bottom:1px solid var(--border);vertical-align:middle;font-size:var(--text-small)}
  .qb-t th:first-child,.qb-t td:first-child{padding-left:0}
  .qb-t th:last-child,.qb-t td:last-child{padding-right:0;white-space:nowrap}
  .qb-t th{color:var(--text-3);font-weight:600}
  .qb-t .r{text-align:right}
  .qb-t tbody tr{cursor:default}
  .qb-t tbody tr:hover{background:none}
  .qb-t tr.muted td{color:var(--text-3)}
  /* The bar: the trait's earned share of its points (--q, 0 to 1, set per row by app.js). scaleX keeps
     it to one transform, so no layout work. A trait with no data, or not tracked, gets a dashed rule. */
  .qbar{display:inline-block;width:min(120px,22vw);height:6px;vertical-align:middle;margin-right:var(--space-3);background:var(--surface-2);box-shadow:inset 0 0 0 1px var(--border);border-radius:3px;overflow:hidden}
  .qbar-f{display:block;height:100%;width:100%;background:var(--text-1);transform-origin:0 0;transform:scaleX(var(--q))}
  .qbar-none{background:repeating-linear-gradient(90deg,var(--border-strong) 0 3px,transparent 3px 7px);box-shadow:none}
  .qpts{font-weight:600;color:var(--text-1);font-variant-numeric:tabular-nums}
  .qb-t tr.muted .qpts{font-weight:400;color:var(--text-3)}
  .qb-t tfoot td{border-top:1.5px solid var(--text-1);border-bottom:0;font-weight:600;color:var(--text-1)}
  /* Phones: three columns ran off a 375px screen (long AF values such as "Nog nie bygehou nie"). Under
     480px the Value column hides and its text moves under the trait name as a caption (.qb-sub, a copy
     app.js writes into every trait cell), and the bar shrinks, so the table fits without side scroll.
     The hidden cell stays in the DOM, so a screen reader still reads Trait, Value, Points. */
  .qb-sub{display:none}
  @media (max-width:479px){
    /* the phone rule table{min-width:560px} (wide lists scroll sideways) must not reach this table */
    .qb-t{min-width:0}
    .qb-t .qb-v{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;padding:0;border:0}
    .qb-sub{display:block;margin-top:2px;font-size:var(--text-caption);color:var(--text-3)}
    .qbar{width:56px;margin-right:var(--space-2)}
  }
  /* Record layout: fixed-width photo/identity column + the detail panel. The second
     track is minmax(0,1fr), NOT 1fr — a bare 1fr track has min-width:auto, so when the
     panel's content (the metrics grid, long notes) is wider than the space left over, the
     track refuses to shrink and the whole grid overflows its container, clipping the
     "General" panel off the right edge. minmax(0,…) lets the panel shrink and its content
     wrap instead of pushing past the viewport. Collapses to one column at <=1100px below. */
  /* ===== Animal record (restyle slice 7: Kobus's redesign 17 Nov 2026, UI guide #record). The
     animal first: a hero photo on the left; on the right her portrait tag beside her name, what and
     where she is, her status pill + grade, the one action (Add weighing) and the four key numbers.
     Then the tabs, pinned under the top bar while the record scrolls. ===== */
  .rec{display:grid;gap:var(--space-5)}
  @media (min-width:900px){ .rec{grid-template-columns:minmax(220px,300px) minmax(0,1fr)} }
  .rec-photo-col{min-width:0}
  /* Hero photo: a neutral surface, not the old brown placeholder. setHeroImage() sets the image. */
  .rec .photo{aspect-ratio:4/3;border-radius:var(--radius-lg);background:var(--surface-2);border:1px solid var(--border);position:relative;overflow:hidden;display:grid;place-items:center;color:var(--text-3);cursor:zoom-in}
  .rec .photo .ph{font-size:var(--text-small);opacity:.85}
  .rec .photo .tag{position:absolute;left:var(--space-2);top:var(--space-2)}
  /* Empty state (no photo): an invite, not a blank box. On phones it collapses to a 48px strip so
     the ear tag stays near the top of the record (proposal 17 Nov). loadAnimalPhotos toggles .is-empty. */
  .rec .photo.is-empty{cursor:pointer;border-style:dashed;border-color:var(--border-strong);color:var(--text-2)}
  /* Empty hero (mockup .rec-photo.is-empty): only the 64px cow glyph in the middle and the "+ Add a
     photo of <name>" invite in the corner. The photo system's .tag/.ph text hooks stay in the DOM
     (setHeroImage drives them once a photo exists) but are hidden here, so the empty box no longer
     repeats her tag and name, which the header already shows. */
  .rec .photo.is-empty > .tag,.rec .photo.is-empty > .ph{display:none}
  .rec .photo .rec-ph{display:none;width:64px;height:64px;color:var(--text-3)}
  .rec .photo.is-empty .rec-ph{display:block}
  .rec .photo .rec-add{position:absolute;left:var(--space-2);bottom:var(--space-2);display:inline-flex;align-items:center;gap:4px;padding:2px 8px;background:var(--surface);border-radius:var(--radius-sm);font-size:var(--text-caption);font-weight:600}
  .rec .photo .rec-add svg{width:var(--icon-sm);height:var(--icon-sm);flex:none}
  @media (max-width:899px){
    .rec .photo.is-empty{aspect-ratio:auto;min-height:48px;display:flex;justify-content:flex-start;align-items:center;padding:0 var(--space-3)}
    .rec .photo.is-empty .ph,.rec .photo.is-empty .rec-ph{display:none}
    .rec .photo.is-empty .rec-add{position:static;padding:0;background:none;font-size:var(--text-small)}
  }
  /* Right column: the identity header. */
  /* .rec-id is a size container (recid) so the four key numbers can go 2 per row by the space they
     really have, not the window width (see .rec-metrics). Its width always comes from the .rec grid
     column, never from its content, so inline-size containment is safe here. */
  .rec-id{min-width:0;container:recid / inline-size}
  .rec-head{display:flex;align-items:flex-start;gap:var(--space-4);flex-wrap:wrap}
  .rec-name{flex:1;min-width:180px}
  .rec-nm{font-size:var(--text-h1);line-height:1;margin:0}
  .rec-where{margin:var(--space-1) 0 var(--space-3);color:var(--text-2)}
  .rec-pills{display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap}
  /* Actions: Add weighing (primary) and Edit side by side; More opens the menu. Edit shows beside
     Add weighing from a laptop and moves into the More menu on a phone (rec-edit-wide/narrow). */
  .rec-acts{display:flex;gap:var(--space-2);align-items:center;flex-wrap:wrap}
  .rec-edit-narrow{display:none}
  @media (max-width:629px){ .rec-edit-wide{display:none} }
  /* Portrait ear tag: the anchor (punched hole, big number, year under it). Built on the tag tokens.
     Sized as the UI guide's .tag-portrait (96 x 108, a 30px band for the hole over the number): the
     earlier padded inline version shrank to the number and read as a small list tag beside the name. */
  .tag-portrait{width:96px;height:108px;flex:none;display:grid;grid-template-rows:30px 1fr;justify-items:center;background:var(--tag-yellow);border:2px solid var(--tag-yellow-edge);border-radius:var(--radius-tag-portrait);color:var(--tag-yellow-text);font-family:var(--font-display);font-weight:600;font-variant-numeric:tabular-nums}
  .tag-portrait .hole{align-self:end;width:14px;height:14px;border-radius:50%;background:var(--bg);border:2px solid var(--tag-yellow-edge)}
  .tag-portrait .nr{align-self:center;text-align:center;line-height:1;font:600 1.625rem/1 var(--font-display);letter-spacing:.03em;padding:0 4px;overflow-wrap:anywhere}
  .tag-portrait .sub{display:block;font:600 .75rem/1 var(--font-body);margin-top:4px;letter-spacing:0}
  /* A tappable sire/dam in the Overview facts: a bare button around the tag that opens that record. */
  .rec-parent{background:none;border:0;padding:0;cursor:pointer;font:inherit;display:inline-flex;align-items:center;min-height:32px}
  .rec-parent:hover .tag{filter:brightness(.97)}
  .rec-parent:focus-visible{outline:2px solid var(--accent-strong);outline-offset:2px;border-radius:var(--radius-sm)}
  /* The More menu on the action bar (guide dropdown look). */
  .rec-more{position:relative}
  .rec-more-btn{min-width:44px;padding:0;font-size:20px;line-height:1}
  .rec-more-menu{position:absolute;right:0;top:calc(100% + 4px);z-index:var(--z-dropdown);min-width:200px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:var(--space-1)}
  .rec-more-item{display:flex;width:100%;align-items:center;gap:var(--space-2);min-height:44px;padding:0 var(--space-3);background:none;border:0;border-radius:var(--radius-sm);color:var(--text-1);font:inherit;text-align:left;cursor:pointer}
  .rec-more-item svg{width:var(--icon-md);height:var(--icon-md);flex:none}
  /* The record's status pill at the guide's large size (.pill-lg), as in the mockup header. */
  .rec-pills .pill{font-size:var(--text-small);padding:7px 12px 7px 10px}
  /* The note's "Animal" label carries the cow glyph (mockup .snote-cat). */
  .rec-side .snote-cat svg{width:var(--icon-sm);height:var(--icon-sm);flex:none}
  .rec-more-item:hover{background:var(--hover-tint)}
  .rec-more-item.danger{color:var(--error)}
  @media (min-width:630px){ .rec-more-item.rec-edit-narrow{display:none} }
  /* ear tag at list size (guide .tag-sm), used in the facts and the pedigree nodes. */
  .tag-sm{font-size:.9375rem;padding:2px 6px 2px 5px}
  /* Photo strip (UI guide #record "Photo strip": .thumb / .thumb-tick / .thumb-add, restyle slice 7,
     24 Nov 2026). Four square tiles in a grid exactly as wide as the hero photo above it (Caleb: the
     small photos should fit under the large one, room for four). layoutPhotoStrip (app.js) decides
     what the four slots hold: the last one is the action tile. Up to 3 photos + the normal "+"; from
     the 4th photo, 3 photos + the stacked "+N" tile (which opens All photos, where "+" lives).
     A 1px border and the --radius-md corner; the hover border darkens. */
  .cb-gallery{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:var(--space-2);margin-top:var(--space-3)}
  /* #80: a thumb is a view-only tap target for everyone (pointer); the grab cursor and touch-action:none
     (so a touch drag does not scroll the page) apply only when the gallery can be dragged (.can-drag =
     manager+ in the manual order view). */
  .cb-thumb{position:relative;aspect-ratio:1;min-width:0;border-radius:var(--radius-md);background-color:var(--surface-2);background-size:cover;background-position:center;cursor:pointer;border:1px solid var(--border)}
  .cb-thumb:hover{border-color:var(--border-strong)}
  .cb-gallery.can-drag .cb-thumb{cursor:grab;touch-action:none}
  /* Two separate states (#80), drawn with the guide's two marks so both stay readable:
     .primary = the animal's main photo, always first in the stored order (the one the report prints):
       the guide's tick (.cb-thumb-tick), an --accent-strong square with a check;
     .shown   = the photo in the hero right now: the guide's selected ring (--selected-ring).
     Viewing the main photo shows both marks, exactly the guide's .thumb.is-primary; viewing any other
     photo moves only the ring, so a photo on screen is visibly not the main one (the #80 rule).
     The tick sits top-right, as the guide draws it (the tile itself opens the photo menu, so no
     corner button competes for it). */
  .cb-thumb.shown{box-shadow:var(--selected-ring);border-color:transparent}
  .cb-thumb:focus-visible{outline:2px solid var(--accent-strong);outline-offset:3px}
  .cb-thumb-tick{display:none;position:absolute;top:4px;right:4px;width:18px;height:18px;place-items:center;border-radius:var(--radius-sm);background:var(--accent-strong);color:var(--on-strong);pointer-events:none}
  .cb-thumb-tick svg{width:12px;height:12px}
  .cb-thumb.primary .cb-thumb-tick{display:grid}
  /* A photo taken offline, waiting to upload (offline field mode, slice 4): the thumb's size and frame, dimmed, with a
     "Waiting to upload" badge; its own class so the drag, delete and primary rules for saved photos never apply. */
  .cb-thumb-pending{position:relative;aspect-ratio:1;min-width:0;border-radius:var(--radius-md);background-size:cover;background-position:center;border:1.5px dashed var(--brass);opacity:.75}
  .cb-thumb-pending-badge{position:absolute;left:2px;right:2px;bottom:2px;background:var(--surface);color:var(--text-2);font-size:.625rem;line-height:1.1;padding:1px 2px;border-radius:3px;text-align:center;pointer-events:none}
  .cb-gallery .cb-thumb,.cb-gallery .cb-thumb-placeholder{transition:transform .18s ease}   /* siblings slide out of the way */
  /* The lifted photo (guide .thumb.is-dragging): --shadow-sm, as the guide's caption says. */
  .cb-thumb.dragging{opacity:.97;cursor:grabbing;z-index:50;box-shadow:var(--shadow-sm);transition:none}
  /* The gap a dragged photo leaves (sized from the thumb at drag start in enableThumbDrag). */
  .cb-thumb-placeholder{aspect-ratio:1;min-width:0;border-radius:var(--radius-md);border:1.5px dashed var(--border-strong);background:transparent;box-shadow:none;flex:none}
  /* The 4-slot rules (layoutPhotoStrip): in a collapsed strip (4+ photos) a photo past the third is
     hidden, the stack takes the last slot IN PLACE OF "+" (add from the All photos sheet or More),
     and the strip cannot be dragged (a click still opens each photo's menu). Grid order keeps the action tile last whatever the
     DOM order (an upload inserts its thumb before "+"). */
  .cb-gallery .is-overflow{display:none}
  .cb-gallery.has-more .cb-add-photo{display:none}
  .cb-gallery .cb-photo-stack,.cb-gallery .cb-add-photo{order:1}
  /* The stacked tile (a collapsed strip): the first hidden photo as the face, with two card edges peeking out
     above and to the right so it reads as a pile, and "+N" (the photos not shown) on a dark scrim.
     The face is inset 6px from the top and right so the edges fit inside the tile and the strip
     stays flush with the hero. A real button: "Show all N photos" opens the All photos sheet. */
  .cb-photo-stack{display:none;position:relative;aspect-ratio:1;min-width:0;padding:0;border:0;background:none;cursor:pointer;border-radius:var(--radius-md)}
  .cb-gallery.has-more .cb-photo-stack{display:block}
  .cb-photo-stack::before,.cb-photo-stack::after{content:"";position:absolute;border:1px solid var(--border-strong);border-radius:var(--radius-md);background:var(--surface-2)}
  .cb-photo-stack::before{inset:0 0 6px 6px}   /* back card: top-right */
  .cb-photo-stack::after{inset:3px 3px 3px 3px}  /* middle card */
  .cb-stack-face{position:absolute;inset:6px 6px 0 0;z-index:1;display:grid;place-items:center;overflow:hidden;border:1px solid var(--border);border-radius:var(--radius-md);background-color:var(--surface-2);background-size:cover;background-position:center}
  /* Fixed dark scrim with white text: it sits on a photo, so it must not follow the theme (the same
     reason the lightbox overlay is fixed). */
  .cb-stack-face::before{content:"";position:absolute;inset:0;background:rgb(20 22 18 / 0.55)}
  .cb-stack-more{position:relative;display:inline-flex;align-items:center;gap:2px;color:#fff;font:600 var(--text-h3)/1 var(--font-display);font-variant-numeric:tabular-nums}
  .cb-stack-more svg{width:var(--icon-sm);height:var(--icon-sm)}
  .cb-photo-stack:hover .cb-stack-face{border-color:var(--border-strong)}
  .cb-photo-stack:hover .cb-stack-face::before{background:rgb(20 22 18 / 0.45)}
  .cb-photo-stack:focus-visible{outline:2px solid var(--accent-strong);outline-offset:3px}
  /* The All photos sheet (openAllPhotos): the app modal holding the moved strip; every photo shows
     and "+" is always the last tile. Phones: the bottom sheet, three columns. From 600px: four.
     Desktop (900px+, where the modal is a centred dialog): a large dialog (Caleb: the photos are the
     point, so give them room), up to 1040px wide and filled with tiles of at least 180px. */
  .cb-photo-sheet .cb-modal-card{width:min(640px,100%)}
  .cb-photos.in-sheet .cb-gallery{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:0}
  @media (min-width:600px){ .cb-photos.in-sheet .cb-gallery{grid-template-columns:repeat(4,minmax(0,1fr))} }
  /* Wider margins around the photos (Caleb): more room between the tiles and between the grid and
     the sheet's edges than the form modals use. The header's negative side margins always equal the
     card's side padding, so its bottom rule still runs edge to edge. Phones: 20px sides, 12px gaps. */
  .cb-photo-sheet .cb-modal-card{padding:0 20px 24px}
  .cb-photo-sheet .cb-modal-h{margin:0 -20px 20px;padding-left:20px;padding-right:20px}
  .cb-photos.in-sheet .cb-gallery{gap:var(--space-3)}
  @media (min-width:900px){
    /* Desktop: 40px sides and bottom, 20px below the header, 16px between photos. */
    .cb-photo-sheet .cb-modal-card{width:min(1040px,calc(100vw - 96px));padding:0 var(--space-10) var(--space-10)}
    .cb-photo-sheet .cb-modal-h{margin:0 calc(var(--space-10) * -1) var(--space-5);padding-left:var(--space-10);padding-right:var(--space-10)}
    .cb-photos.in-sheet .cb-gallery{grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:var(--space-4)}
  }
  /* By date in the sheet's header, between the title and the x (moved there by openAllPhotos). */
  .cb-photo-sheet .cb-modal-h .cb-gallery-sort{flex:none}
  /* Under the grid only the By date direction hint is left. Its row keeps one caption line of height
     whether or not the hint shows, so toggling By date never makes the sheet grow and shrink (Caleb):
     the hint itself still hides (it is empty in the manual order), but the row's min-height holds
     the space. */
  .cb-photos.in-sheet .cb-gallery-bar{margin-top:var(--space-3);font-size:var(--text-caption);line-height:1.4;min-height:1.4em}
  .cb-gallery.reordering{cursor:grabbing}
  /* while dragging, nothing but the lifted thumb reacts to the pointer — no hover/active on the "+" tile or the other photos */
  .cb-gallery.reordering .cb-add-photo,.cb-gallery.reordering .cb-thumb:not(.dragging){pointer-events:none}
  /* a drag must not sweep a text selection across the page */
  body.cb-dragging{cursor:grabbing;user-select:none;-webkit-user-select:none}
  body.cb-dragging *{user-select:none !important;-webkit-user-select:none !important}
  /* The photo menu: the record's More menu look (.rec-more-menu / .rec-more-item), but fixed to the
     window next to its photo (top/left set by openPhotoMenu), above the All photos sheet (modal+10)
     and the full-size viewer (modal+20). */
  .rec-more-menu.cb-photo-menu{position:fixed;right:auto;z-index:calc(var(--z-modal) + 30)}
  /* The "+" tile (guide .thumb-add): dashed 1.5px --border-strong, --text-2, the plus glyph. */
  .cb-add-photo{aspect-ratio:1;min-width:0;border-radius:var(--radius-md);border:1.5px dashed var(--border-strong);background:var(--surface-2);color:var(--text-2);cursor:pointer;padding:0;display:grid;place-items:center}
  .cb-add-photo svg{width:var(--icon-md);height:var(--icon-md)}
  .cb-add-photo:hover{background:var(--hover-tint);color:var(--text-1)}
  .cb-add-photo:focus-visible{outline:2px solid var(--accent-strong);outline-offset:3px}
  /* No photos yet: hide the strip, so the lone "+" tile does not sit under the empty hero (Caleb,
     24 Nov 2026; not in Kobus's mockup). The empty hero's "Add a photo of <name>" invite is the one
     way in, and it still works: its click calls .click() on this hidden tile, which opens the file
     picker (loadAnimalPhotos). Driven by :has() on the thumbs, not a class, so the strip appears the
     moment the first photo is added incrementally (uploadPhoto inserts a thumb, no rebuild) and the
     "+" is back for adding more. A photo still waiting to upload counts as a photo. */
  .cb-gallery:not(:has(.cb-thumb,.cb-thumb-pending)){display:none}
  /* Date caption on the record hero (guide .rec-date): a --surface chip with caption text, bottom-left,
     following the theme (the old fixed dark box ignored it). pointer-events:none so it never blocks the
     hero's click-to-zoom. */
  .cb-photo-date{position:absolute;left:var(--space-2);bottom:var(--space-2);background:var(--surface);color:var(--text-2);font-size:var(--text-caption);line-height:1.4;padding:2px 8px;border-radius:var(--radius-sm);pointer-events:none;z-index:2}
  /* "Manual order / By date" toggle under the strip: the guide's ghost button (.btn.ghost) with a calendar
     glyph, built in ensureGalleryBar; pressed while the By date view is on. The hint is a caption. */
  .cb-gallery-bar{margin-top:var(--space-2);display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-3)}
  .cb-gallery-hint{font-size:var(--text-caption);color:var(--text-3)}
  .cb-gallery-hint[hidden]{display:none}
  .cb-gallery-bar[hidden]{display:none}
  .cb-gallery-sort.btn.ghost{padding:0 var(--space-3)}
  /* Pressed = the By date view is on. Written with .btn.ghost so it outweighs .btn.ghost's own
     transparent background, which otherwise hid the tint. */
  .cb-gallery-sort.btn.ghost[aria-pressed="true"]{background:var(--accent-selected);border-color:transparent}
  /* The hero's tag overlay (.photo > .tag) is hidden: the portrait ear tag beside the photo already shows
     it (guide: the hero carries only the date caption). The element stays: populateRecord fills it. */
  .rec .photo > .tag{display:none}
  /* Phase D: the "Calculate" row under the wizard's Growth-information fields. */
  .cb-wiz-calc{display:flex;align-items:center;gap:10px;margin-top:12px;flex-wrap:wrap}
  .cb-calc-hint{font-size:12px}
  /* gap:16px keeps a minimum channel between the label and the value so a long value
     (e.g. a long herd name) never butts up against the label; the value is right-aligned
     and wraps on word boundaries instead of overflowing/clipping at the panel's edge. */
  .kv{display:flex;justify-content:space-between;gap:16px;padding:9px 0;border-bottom:1px solid var(--line-soft);font-size:13px}
  .kv:last-child{border:none} .kv .k{color:var(--muted);flex:none} .kv .v{font-weight:600;text-align:right;min-width:0;word-break:break-word}
  /* .seg-tabs/.seg-tab mirror .tabs/.tab exactly, but carry their own class so the
     generic pane-switching tab logic (which resets every .tab inside a .panel) can
     never clear a nested segmented selector's active state — see the grading
     animal-type selector in app.js (renderGradingShell). */
  /* No side padding (Kobus, 20 Nov 2026): the first tab starts flush with the panel edge instead of
     6px in, which showed as a small gap beside the active tab's tint. */
  .tabs,.seg-tabs{display:flex;flex-wrap:wrap;gap:2px;border-bottom:1px solid var(--line);padding:0}
  /* Tabs (UI guide, navigation; restyle slice 2): 44px tall, body text, the active tab in ink and
     600 with a 3px ink underline (not lime: lime is never a thin line on white). */
  .tab,.seg-tab{min-height:var(--touch-min);padding:0 var(--space-4);font-size:var(--text-small);font-weight:400;color:var(--text-2);cursor:pointer;border:none;background:none;font-family:inherit;border-bottom:3px solid transparent;border-radius:var(--radius-md) var(--radius-md) 0 0;margin-bottom:-1px;flex:none;white-space:nowrap}
  .tab:hover,.seg-tab:hover{background:var(--hover-tint);color:var(--text-1)}
  .tab.on,.seg-tab.on{color:var(--text-1);font-weight:600;border-bottom-color:var(--text-1)}
  /* No "bounce" when a tab is picked (Andre, 20 Nov 2026): the active tab turns 600, which is wider
     than 400, so the picked tab grew and every tab after it shifted sideways. Each tab carries its own
     label in data-label (app.js reserveTabWidths(), run by the language effect and wherever a tab is
     built), and a hidden, zero-height bold copy of that label sits under the visible text. The column
     flex makes the button as wide as the wider of the two, so it is the same width at 400 and at 600.
     visibility:hidden keeps the copy out of the accessibility tree, so a screen reader never hears the
     label twice. */
  .tab,.seg-tab{display:inline-flex;flex-direction:column;align-items:center;justify-content:center}
  .tab::after,.seg-tab::after{content:attr(data-label);font-weight:600;height:0;overflow:hidden;visibility:hidden;pointer-events:none;user-select:none}
  .tabpane{display:none;padding:18px} .tabpane.on{display:block}
  /* Pedigree tree (restyle slice 7, guide #pedigree): nested lists drawn as a tree. Base = stacked
     (phones): generations indent down the page with the lines on the left. From 600px (container
     query on .ped-wrap) it becomes the classic left-to-right bracket, sire above and dam below at
     every level. Each known ancestor is a button that opens her own record; an unknown parent is a
     dashed node with an Add link. */
  .ped-wrap{container:ped / inline-size}
  .ptree,.ptree ul{list-style:none;margin:0;padding:0}
  .ptree ul{position:relative;margin-left:var(--space-5);padding-left:var(--space-5);border-left:1.5px solid var(--border-strong)}
  .ptree ul > li{position:relative;padding-top:var(--space-3)}
  .ptree ul > li::before{content:"";position:absolute;left:calc(var(--space-5) * -1);top:calc(var(--space-3) + 26px);width:var(--space-5);border-top:1.5px solid var(--border-strong)}
  .ptree ul > li:last-child::after{content:"";position:absolute;left:calc(var(--space-5) * -1 - 1.5px);top:calc(var(--space-3) + 27.5px);bottom:0;border-left:1.5px solid var(--surface)}
  .pnode{position:relative;display:grid;gap:2px;width:100%;max-width:260px;padding:var(--space-2) var(--space-3);background:var(--surface);border:1px solid var(--border-strong);border-radius:var(--radius-md);text-align:left;color:var(--text-1);font:inherit}
  button.pnode{cursor:pointer}
  button.pnode:hover{background:var(--hover-tint)}
  button.pnode:focus-visible{outline:2px solid var(--accent-strong);outline-offset:2px}
  .prole{font-size:.75rem;color:var(--text-3)}
  .prow{display:flex;align-items:center;gap:var(--space-2)}
  .pname{font-weight:600;font-size:var(--text-small);color:var(--text-1)}
  .sx{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;font:600 .6875rem/1 var(--font-body);border:1.5px solid var(--text-2);color:var(--text-2)}
  .pnode.is-focus{background:var(--accent-selected);box-shadow:var(--selected-ring);border-color:transparent}
  .pnode.is-unknown{border-style:dashed;background:transparent}
  .pnode.is-unknown .pname{color:var(--text-3);font-weight:400}
  .pnode .linkbtn{justify-self:start;min-height:32px;font-size:var(--text-small)}
  /* Link button (UI guide .linkbtn, design/ui-guide.html): an inline text action such as "Add it",
     "Add them", "Add sire". No box, accent-strong underlined text, 600. The guide writes the font as
     "font:600 inherit", which is not valid CSS, so browsers drop it and the button falls back to the
     system button font; this is the mockup's fix (font:inherit, then the weight). 44px tall by
     default (touch target); inside running text (a <p> or <dd>) it collapses to the line. */
  .linkbtn{background:none;border:0;padding:0;min-height:var(--touch-min);color:var(--accent-strong);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:3px;cursor:pointer;vertical-align:baseline}
  .linkbtn:hover{text-decoration-thickness:2px}
  .linkbtn:focus-visible{outline:2px solid var(--accent-strong);outline-offset:2px;border-radius:var(--radius-sm)}
  p .linkbtn,dd .linkbtn{min-height:0}
  @container ped (min-width:600px){
    .ptree li{display:flex;align-items:center}
    .ptree ul{display:flex;flex-direction:column;justify-content:center;margin-left:0;padding-left:var(--space-8);border-left:0}
    .ptree ul::before{content:"";position:absolute;left:0;top:50%;width:var(--space-8);border-top:1.5px solid var(--border-strong)}
    .ptree ul > li{padding:var(--space-2) 0 var(--space-2) var(--space-4)}
    .ptree ul > li::before{left:0;top:50%;width:var(--space-4)}
    .ptree ul > li::after,.ptree ul > li:last-child::after{content:"";position:absolute;left:0;top:0;bottom:0;border-left:1.5px solid var(--border-strong)}
    .ptree ul > li:first-child::after{top:50%}
    .ptree ul > li:last-child::after{bottom:50%}
    .ptree ul > li:only-child::after{display:none}
    .pnode{width:clamp(160px,26cqi,220px);flex:none}
  }
  .ped-note{margin-top:var(--space-4)}
  /* Breeding tab (restyle slice 7, proposal 17 Nov): a "where she stands now" line, then one line
     per calf as a card row that wraps on a phone (no sideways scroll), each calf once. */
  .rec-breeding-status{margin:0 0 var(--space-4);font-weight:600;color:var(--text-1)}
  .cb-calf-list{display:flex;flex-direction:column;gap:var(--space-2)}
  .cb-calf-row{display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap}
  .cb-calf-main{flex:1;min-width:0;display:flex;align-items:center;gap:var(--space-2);flex-wrap:wrap;min-height:44px;padding:var(--space-2) var(--space-3);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);color:var(--text-1);font:inherit;text-align:left;cursor:pointer}
  .cb-calf-main:hover{background:var(--hover-tint)}
  .cb-calf-main:focus-visible{outline:2px solid var(--accent-strong);outline-offset:2px}
  .cb-calf-name{font-weight:600}
  .cb-calf-meta{color:var(--text-3);font-size:var(--text-small)}
  /* Full service history, collapsed by default below the calf lines. */
  .cb-svc-history{margin-top:var(--space-4)}
  .cb-svc-history > summary{cursor:pointer;min-height:44px;display:flex;align-items:center;color:var(--text-2);font-weight:600;font-size:var(--text-small)}
  .cb-svc-history > summary:hover{color:var(--text-1)}
  .cb-svc-history .tbl-scroll{margin-top:var(--space-2)}
  /* Breeding tab extras (mockup): the "where she stands now" line as the guide's info notice, and the
     empty state (heart glyph, a heading and one sentence) when she has no services or calves. */
  .alert-info{background:var(--info-tint)}
  .alert-info > svg,.alert-info .alert-t{color:var(--info)}
  .alert > svg{flex:none;width:var(--icon-lg);height:var(--icon-lg)}
  .rec-breeding-status.alert{font-weight:400}
  .rec-empty{display:grid;justify-items:center;text-align:center;gap:var(--space-3);padding:var(--space-10) var(--space-4);color:var(--text-3)}
  .rec-empty svg{width:var(--icon-xl);height:var(--icon-xl)}
  .rec-empty h3{font-size:var(--text-h2);margin:0;color:var(--text-1)}
  .rec-empty p{max-width:44ch;margin:0;color:var(--text-2)}
  /* Growth tab (mockup .gr-sec): two sections, "Milestone weights" and "Weighing history", each with
     a display-font heading and its action on the right (.gr-h). The weights reuse the Overview's
     two-column facts (.rec-grid .kv-2 rules, via the .rec-grid class on the section body). The chart
     is the guide's bar chart (buildBarChart: .ch-plot), so each bar is at most 44px wide instead of
     stretching across the whole tab. */
  .gr-sec + .gr-sec{margin-top:var(--space-6)}
  .gr-h{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:var(--space-2) var(--space-4);margin-bottom:var(--space-3)}
  .gr-h h3{margin:0;font-size:var(--text-h3)}
  .gr-sec .rec-grid{display:block}
  .gr-gaps{margin:var(--space-3) 0 0;color:var(--text-2);font-size:var(--text-small)}
  .gr-gaps .gap-t{display:block}
  .gr-gaps .linkbtn{display:inline-block;margin-top:2px}
  .gr-note{margin:var(--space-4) 0 0}
  /* Four key numbers in the header (guide dl.metrics): un-boxed, 2 per row, 4 once .rec-id is 680px wide,
     with a hairline above the row. A present value is the big figure + unit; a missing one is a short
     body-text sentence (.is-gap) with its fix link, so the four slots stay in the same place. Scoped
     to .rec-metrics so it never touches the dashboard's dl.metrics-dash. */
  /* Written as .metrics.rec-metrics (two classes) so the phone rule `.metrics{grid-template-columns:1fr}`
     further down (meant for the dashboard tiles) cannot stack the record's numbers into one column. */
  /* gap (Caleb, 24 Nov 2026: "spaced apart a bit more"): 20px between columns and 8px more between
     rows. It used to be no gap and 12px right padding per slot, so the tiles nearly touched. */
  .metrics.rec-metrics{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-2) var(--space-5);margin:var(--space-5) 0 0;border-top:1px solid var(--border)}
  /* 4 per row only when each slot gets 170px or more (a container query on .rec-id, Caleb 24 Nov
     2026). It was a 600px WINDOW rule, so with the centred, narrower card at 1280 the four slots were
     about 105px (143px at 1440) and an empty tile's "No 205-day weight yet" wrapped onto three or four
     short lines; below 680px they now go 2 per row, where the reason and its action fit on one line each. */
  @container recid (min-width:680px){ .metrics.rec-metrics{grid-template-columns:repeat(4,minmax(0,1fr))} }
  .rec-metrics > div{padding:var(--space-3) 0;min-width:0}   /* sideways space comes from the grid gap */
  .rec-metrics dt{font-size:var(--text-caption);color:var(--text-3)}
  .rec-metrics dd{margin:0;font:600 var(--text-figure)/1 var(--font-display);color:var(--text-1);font-variant-numeric:tabular-nums}
  .rec-metrics dd span{font:400 var(--text-caption)/1 var(--font-body);color:var(--text-3);margin-left:4px}
  /* A missing key number is a tile in the figure's place (fillKeyNumber; option A of the empty-state
     mockups, Caleb 24 Nov 2026), in body text (600, small, --text-2), not the figure's display font.
     The span reset stops `.rec-metrics dd span` (the small "kg" after a figure) from shrinking,
     fading and indenting the tile's words. min-height keeps the row level with the figures. */
  .rec-metrics dd.is-gap{font:600 var(--text-small)/1.35 var(--font-body);color:var(--text-2);padding-top:var(--space-1)}
  .rec-metrics dd.is-gap span{margin-left:0;font:inherit;color:inherit}
  .rec-gap{display:flex;flex-direction:column;justify-content:center;align-items:flex-start;gap:var(--space-1);min-height:64px;padding:var(--space-2) var(--space-3);border-radius:var(--radius-md)}
  /* Every tile fills its cell's height, so a tile whose action wraps to two lines ("Add birth
     weight" in a narrow cell) does not leave its neighbours short: the row of tiles stays level. */
  .rec-metrics > div:has(> dd.is-gap){display:flex;flex-direction:column}
  .rec-metrics dd.is-gap{flex:1;display:flex}
  .rec-metrics dd.is-gap > .rec-gap{flex:1}
  /* INVITE: it can be filled. A dashed --border-strong frame (the empty photo invite's language) with
     the reason and a specific action ("Add birth weight", "Weigh her") as the guide's link button. */
  .rec-gap.is-invite{border:1.5px dashed var(--border-strong)}
  /* An action-only invite (Daily gain, Caleb 24 Nov 2026): managers and owners see just "+ Add 205-day
     weight", no reason line. A read-only user cannot see the action (data-min-role), so the reason
     stays for them; otherwise their tile would be an empty dashed box. */
  html[data-role="manager"] .rec-gap.is-action-only .gap-t,html[data-role="owner"] .rec-gap.is-action-only .gap-t{display:none}
  .rec-gap-act{position:relative;display:inline-flex;align-items:center;gap:4px;min-height:0;text-align:left}
  /* A larger tap area than the drawn link (DESIGN.md: 44px touch targets), without growing the tile. */
  .rec-gap-act::after{content:"";position:absolute;inset:-12px -8px}
  .rec-gap-act svg{width:var(--icon-sm);height:var(--icon-sm);flex:none}
  /* INFO: nothing to add (does not apply, fills itself later, or she is sold or dead). A solid,
     quiet frame with a minus mark, so it never reads as a gap waiting for the farmer. */
  .rec-gap.is-info{border:1px solid var(--border);background:var(--surface-2)}
  .rec-gap.is-info .gap-t{display:inline-flex;align-items:center;gap:6px;color:var(--text-3)}
  .rec-gap.is-info .gap-t svg{width:var(--icon-sm);height:var(--icon-sm);flex:none}
  .rec-audit{margin:var(--space-2) 0 0;color:var(--text-3);font-size:var(--text-caption)}
  /* One record card (mockup .panel.panel-body.rec-panel): the header, the four numbers, the tabs and
     the open tab all sit in ONE white panel. The tabs and their content are not boxed again (the old
     separate rounded .rec-body card is gone). The tabs pin under the 56px top bar while the record
     scrolls (proposal: the four tabs "stay in reach"); the sticky row carries the card's background
     so content never shows through behind it. */
  .rec-panel{padding-bottom:var(--space-5)}
  /* 200px narrower than the screen's content area and centred between the side menu and the screen
     edge (Caleb, 24 Nov 2026). Only from 1100px, where the record is two columns; below that (one
     column, tablets, phones) the card keeps the full width, since 200px off a narrow screen would
     cramp it. "Back to Animals" (.rec-back, outside the card in <main>) moves in by the same 100px so
     it still lines up with the card's left edge. */
  @media (min-width:1100px){
    .rec-panel{max-width:calc(100% - 200px);margin-inline:auto}
    .rec-back{margin-left:calc(var(--space-4) + 100px)}
  }
  .rec-tabs{margin-top:var(--space-6);position:sticky;top:var(--topbar-h);z-index:var(--z-sticky);background:var(--surface)}
  /* Phones (mockup .rec-tabs): the four tabs stay on ONE row that scrolls sideways, with the edges
     faded, instead of wrapping onto a second row (the proposal measured the wrapped row as a "before"
     problem). The tab row is its own scroll box; the sticky pin is on the row itself, so it still pins. */
  @media (max-width:599px){
    .rec-tabs{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-webkit-mask-image:linear-gradient(to right,transparent 0,#000 20px,#000 calc(100% - 20px),transparent 100%);mask-image:linear-gradient(to right,transparent 0,#000 20px,#000 calc(100% - 20px),transparent 100%)}
    .rec-tabs::-webkit-scrollbar{display:none}
  }
  .rec-body > .tabpane{padding:var(--space-5) 0 0}
  /* Overview tab: facts in two columns with the note beside them as a sticky note (guide .rec-grid). */
  .rec-grid{display:grid;gap:var(--space-5)}
  @media (min-width:900px){ .rec-grid{grid-template-columns:minmax(0,3fr) minmax(220px,2fr);align-items:start} }
  .rec-side .snote{max-width:320px}
  .rec-side .snote-cat{display:flex;align-items:center;gap:6px;margin:0 0 var(--space-2);font-size:.75rem;font-weight:600;color:var(--note-sky-label,var(--text-2))}
  /* Facts: a two-column fact list from 480px (guide .kv-2). The container is .rec-facts (the facts
     area), not the list itself — an element can't respond to its own container query. Scoped under
     .rec-grid so it beats the farm/sales dl.kv single-column rule without touching those cards. */
  .rec-facts{container:facts / inline-size}
  .rec-grid .kv-2{display:grid;grid-template-columns:minmax(0,1fr)}
  .rec-grid .kv-2 > div{display:grid;grid-template-columns:104px minmax(0,1fr);gap:var(--space-3);padding:var(--space-3) 0;border-top:1px solid var(--border);align-items:center}
  .rec-grid .kv-2 > div:first-child{border-top:0}
  .rec-grid .kv-2 dt{color:var(--text-3);font-size:var(--text-small)}
  .rec-grid .kv-2 dd{margin:0;color:var(--text-1);overflow-wrap:anywhere}
  .rec-grid .kv-2 dd.is-gap{color:var(--text-3)}
  @container facts (min-width:480px){
    .rec-grid .kv-2{grid-template-columns:1fr 1fr;column-gap:var(--space-6)}
    .rec-grid .kv-2 > div:nth-child(2){border-top:0}
  }

  /* ---------- service animals (restyle slice 6: UI guide #service, the service pickers) ----------
     Layout: the setup panel (date, method, herd) on top, then the bull and cow list panels, side by
     side from 900px, then the sticky record bar. Scrolling (Kobus, 6 Nov, after trying page scroll):
     on desktop and tablet each list scrolls in its own box, sized to fill the rest of the screen, so
     the picked bull and the setup fields stay in view while you work down a long cow list; on phones
     (768px and below) the page scrolls and the bar stays pinned, as the guide has it. */
  #service .svc-setup-panel{padding:var(--space-4);margin-bottom:var(--space-5)}
  /* date and method share a row even on phones (so the bull list starts higher); herd goes under */
  #service .svc-setup{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-3)}
  #service .svc-f-herd{grid-column:1 / -1}
  @media (min-width:600px){ #service .svc-setup{grid-template-columns:repeat(3,minmax(0,1fr))} #service .svc-f-herd{grid-column:auto} }
  #service .svc-setup .field{gap:var(--space-1);min-width:0}
  #service .svc-setup .field label{font-size:var(--text-small);font-weight:600;letter-spacing:0;color:var(--label-color)}
  /* the styled date picker and selects at the guide's full field size (44px, 1.5px input border) */
  #service .svc-setup .cb-select,#service .svc-setup .cb-date{position:relative;width:100%}
  #service .svc-setup .cb-select-btn,#service .svc-setup .cb-date-btn{display:flex;align-items:center;gap:var(--space-2);width:100%;min-height:var(--h-control);padding:0 var(--space-3);border:1.5px solid var(--input-border);border-radius:var(--radius-md);background:var(--surface);font:400 var(--text-body)/1.2 var(--font-body);color:var(--text-1);text-align:left;cursor:pointer}
  #service .svc-setup .cb-select-btn:focus-visible,#service .svc-setup .cb-date-btn:focus-visible{outline:none;border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  /* (no min-width on the menu: floatMenu() pins it to the viewport at the field's width, where a
     percentage min-width would mean the whole screen; see the .setrow note) */
  /* the .inp placeholders show for a moment before loadService() swaps in the controls */
  #service .svc-setup .inp{min-height:var(--h-control);box-sizing:border-box;border:1.5px solid var(--input-border);border-radius:var(--radius-md);background:var(--surface)}

  #service .svc{display:grid;gap:var(--space-5);align-items:start}
  @media (min-width:900px){ #service .svc{grid-template-columns:minmax(260px,1fr) minmax(0,2fr)} }
  #service .svc .panel-h h3{font-size:var(--text-h3)}
  #service .svc .panel-h .caption{margin-left:auto}

  /* search boxes (bull and cow): the guide's search input; the icon sits inside the frame */
  #service .svc-search{display:flex;align-items:center;gap:var(--space-2);min-height:var(--h-control-dense);box-sizing:border-box;padding:0 var(--space-3);background:var(--surface);border:1.5px solid var(--input-border);border-radius:var(--radius-md);color:var(--text-3)}
  #service .svc-search:focus-within{border-color:var(--accent-strong);box-shadow:var(--focus-ring)}
  #service .svc-search input{flex:1 1 auto;min-width:0;border:none;background:none;outline:none;font:400 var(--text-body)/1.2 var(--font-body);color:var(--text-1)}
  #service .bullsearch{margin:var(--space-3) var(--space-3) 0}
  /* the cow tools row: search grows, Select all stays its own size */
  #service .svc-tools{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2);padding:var(--space-3) var(--space-3) 0}
  #service .svc-tools .svc-search{flex:1 1 200px}
  #service .svc-empty{margin:0;padding:var(--space-3);font-size:var(--text-small);color:var(--text-3)}

  /* pick rows: the guide's .pick-row / .cow-row, bordered 56px rows with a gap between them */
  #service .bullscroll,#service .cb-cowlist{display:grid;align-content:start;gap:var(--space-1);padding:var(--space-3)}
  /* Desktop and tablet: each list is its own scroll box. The height leaves room for the top bar, page
     head, setup panel, panel head, search row and the record bar (about 480px in all), never below
     280px; dvh so a browser's own toolbars are not counted. overscroll-behavior stops a list at its
     end from scrolling the page underneath. Phones keep page scroll (no rule below 769px). */
  @media (min-width:769px){
    #service .bullscroll,#service .cb-cowlist{max-height:max(280px,calc(100dvh - 480px));overflow-y:auto;overscroll-behavior:contain}
  }
  #service .bullrow,#service .cowrow{display:flex;align-items:center;gap:var(--space-3);width:100%;min-height:56px;box-sizing:border-box;padding:var(--space-2) var(--space-3);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);text-align:left;color:var(--text-1);font:inherit;cursor:pointer}
  #service .bullrow:hover,#service .cowrow:hover{background:var(--hover-tint)}
  /* picked bull / ticked cow: the guide's selected state (lime tint and ring, never colour alone:
     the bull also shows a tick, the cow a filled check box) */
  #service .bullrow.on,#service .cowrow.sel{background:var(--accent-selected);box-shadow:var(--selected-ring);border-color:transparent}
  #service .bullrow:focus{outline:none}
  #service .bullrow:focus-visible,#service .cowrow:focus-visible{outline:none;box-shadow:var(--focus-ring)}
  #service .bullrow .pick-m,#service .cowrow .pick-m{display:grid;gap:2px;flex:1 1 auto;min-width:0}
  #service .pick-m b{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #service .pick-m .caption:empty{display:none}
  #service .pick-tick{flex:none;display:none;width:var(--icon-sm);height:var(--icon-sm);color:var(--accent-strong)}
  #service .pick-tick svg{display:block;width:100%;height:100%}
  #service .bullrow.on .pick-tick{display:block}
  /* the cow's check box (role="checkbox" row): 22px box, ink tick on lime when ticked */
  #service .check{width:22px;height:22px;box-sizing:border-box;border-radius:var(--radius-sm);border:1.5px solid var(--input-border);flex:none;display:grid;place-items:center;background:var(--surface)}
  #service .check svg{width:14px;height:14px;opacity:0}
  #service .cowrow.sel .check{background:var(--accent);border-color:var(--accent-strong);color:var(--on-accent)}
  #service .cowrow.sel .check svg{opacity:1}

  /* the record bar (guide .svc-bar.is-sticky): hidden until a cow is ticked, then pinned to the
     bottom of the screen above the lists. [hidden] needs its own rule because display:flex wins. */
  /* bottom: lifted above the sync panel while it shows (--sync-h, see body). On a phone the panel is
     full width at the very bottom and used to cover this bar, so the farmer could not record the next
     service offline. --sync-h already includes the safe-area inset, hence max() rather than adding both. */
  #service .svc-bar{position:sticky;bottom:calc(var(--space-3) + max(env(safe-area-inset-bottom, 0px), var(--sync-h, 0px)));z-index:var(--z-sticky);display:flex;align-items:center;gap:var(--space-3);margin-top:var(--space-4);padding:var(--space-3) var(--space-4);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-md)}
  #service .svc-bar[hidden]{display:none}
  #service .svc-sum{flex:1 1 auto;min-width:0;margin:0;display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-1) var(--space-2);font-size:var(--text-small);color:var(--text-1)}
  #service .svc-sum b{font-weight:600}
  #service .svc-by{white-space:nowrap}
  #service .svc-bull-tag{font-size:var(--text-small);padding:2px 6px 1px 5px}
  #service .svc-bull-tag[hidden]{display:none}
  #service .svc-bar .btn{flex:none}
  /* inbreeding warning (issue #78): the flag line on a cow row and the bar's own line, in the
     text-grade --warning colour. The bar wraps so the line gets a full row under the summary and
     the button; beside the button it was squeezed to ~170px and made the bar 173px tall on a phone.
     [hidden] needs its own rules because both elements are given a display here or by a parent. */
  #service .svc-bar{flex-wrap:wrap}
  /* basis 0: the summary shrinks beside the button instead of pushing it onto a new line now that
     the bar wraps; only the full-width warning line ever starts a second row */
  #service .svc-bar .svc-sum{flex-basis:0}
  #service .cowrow .svc-inb{color:var(--warning);font-weight:600;white-space:normal}
  #service .cowrow .svc-inb[hidden]{display:none}
  #service .svc-inb-warn{flex:1 1 100%;margin:0;font-size:var(--text-small);font-weight:600;color:var(--warning)}
  #service .svc-inb-warn[hidden]{display:none}
  .field{display:flex;flex-direction:column;gap:3px}
  .field label{font-size:10.5px;letter-spacing:.3px;color:var(--faint)}
  .field .inp{border:1px solid var(--line);background:var(--surface);border-radius:6px;padding:6px 10px;font-size:13px;font-weight:600;min-width:120px}

  /* sales & catalogue — stacked title-over-value fields (header meta + footer) */
  .cat-meta{display:flex;flex-wrap:wrap;gap:16px 34px;padding:14px 18px;border-bottom:1px solid var(--line-soft)}
  .cat-field{display:flex;flex-direction:column;gap:2px}
  .cat-field .k{font-size:11px;letter-spacing:.3px;color:var(--muted)}
  .cat-field .v{font-weight:600;font-size:14px}

  /* ---------- Mating work list (feature mating-work-list.md, slice 2; UI guide #worklist and #sheet) ----------
     The Mating cycle screen is a work list, not a board (decided with Caleb, 10 Nov 2026): one stage at a
     time behind four stage tabs, the most urgent cow first, every row the same height, and a tap opens
     the cow panel (.wl-sheet) with her one next step. Tokens only (no raw colours), so the dark theme
     needs nothing extra. Layout follows the space the list really has (a container, "wl"), not the
     viewport: a phone gets compact rows and four equal tabs, a laptop gets columns with a header row.
     Andre (10 Nov): headers must not scroll off, so the list head (.wl-stick) and the column headings
     pin under the top bar while the rows scroll with the page (one page scroll, no box inside a box). */
  #pipeline .wl-top{display:flex;flex-wrap:wrap;align-items:center;gap:0 var(--space-2);margin-bottom:var(--space-3)}
  #pipeline .wl-caption{margin:0;font-size:var(--text-small);color:var(--text-3)}
  /* Record services is navigation (to the Service animals screen), so it is a text link that continues
     the caption line: a muted middle dot in front, an arrow after. Both are CSS so the translated label
     stays exactly "Record services" / its AF row. */
  #pipeline .wl-services-link{display:inline-flex;align-items:center;gap:var(--space-2);font-size:var(--text-small);text-decoration:none}
  /* only the words are underlined, never the dot or the arrow */
  #pipeline .wl-services-link span{text-decoration:underline;text-underline-offset:3px}
  #pipeline .wl-services-link::before{content:"\00B7";color:var(--text-3);font-weight:400;text-decoration:none;display:inline-block}
  #pipeline .wl-services-link::after{content:"\2192";text-decoration:none;display:inline-block}
  /* phones: the caption and the link never fit on one line, so the link wraps to a line of its own and
     a leading dot there would look like a stray mark */
  @media (max-width:599px){ #pipeline .wl-services-link::before{display:none} }
  /* touch screens: the link keeps a 44px tall target without changing how the line reads */
  @media (pointer:coarse){ #pipeline .wl-services-link{min-height:var(--touch-min)} }
  /* overflow:clip (not hidden) keeps the rounded corners without making a scroll box: a scroll box
     would stop the head inside it from sticking to the page */
  .wl-panel{container:wl / inline-size;overflow:clip;padding:0}
  /* sticks under the top bar, and under the offline banner too when it shows (--offline-h) */
  .wl-stick{position:sticky;top:calc(var(--topbar-h) + env(safe-area-inset-top) + var(--offline-h, 0px));z-index:3;background:var(--surface);border-bottom:1px solid var(--border)}
  .wl-head{padding:var(--space-2) var(--space-3) 0}
  .wl-stage-row{display:flex;align-items:center;gap:var(--space-1)}
  .wl-tabs{flex:1;min-width:0;display:flex;gap:var(--space-1);padding-bottom:var(--space-2)}
  .wl-tab{display:inline-flex;align-items:center;gap:var(--space-2);min-height:var(--h-control-dense);padding:0 var(--space-3);border:0;border-radius:var(--radius-md);background:none;color:var(--text-2);font:600 var(--text-small)/1 var(--font-body);cursor:pointer;white-space:nowrap}
  .wl-tab:hover{background:var(--hover-tint)}
  .wl-tab[aria-selected="true"]{background:var(--accent-selected);box-shadow:var(--selected-ring);color:var(--text-1)}
  .wl-tab:focus-visible{outline:none;box-shadow:var(--focus-ring)}
  .wl-tab .count{display:inline-grid;place-items:center;min-width:22px;height:22px;padding:0 6px;border-radius:var(--radius-full);background:var(--text-1);color:var(--surface);font:600 .75rem/1 var(--font-body);font-variant-numeric:tabular-nums}
  .wl-tab .short{display:none}
  .wl-tools-btns{display:flex;flex:none;padding-bottom:var(--space-2)}
  .wl-tools-btns .icon-btn{min-width:var(--h-control-dense);min-height:var(--h-control-dense)}
  .wl-tools-btns .icon-btn[aria-pressed="true"]{background:var(--accent-selected)}
  .wl-tools{display:flex;flex-wrap:wrap;gap:var(--space-2);padding:0 0 var(--space-2)}
  .wl-tools[hidden]{display:none}
  .wl-q{flex:1 1 220px;min-height:var(--h-control-dense);padding:0 var(--space-3);border:1.5px solid var(--input-border);border-radius:var(--radius-md);background:var(--input-bg);color:var(--text-1);font:400 var(--text-body)/1 var(--font-body)}
  .wl-q:focus{outline:none;border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  .wl-hint-row{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2);padding:var(--space-2) var(--space-3);border-top:1px solid var(--border)}
  .wl-hint{margin:0 auto 0 0;font-size:var(--text-small);color:var(--text-3)}
  .wl-seasons{display:flex;flex-wrap:wrap;gap:var(--space-2)}
  .wl-seasons:empty{display:none}
  .wl-seasons .chip .count{display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 6px;margin-left:var(--space-2);border-radius:var(--radius-full);background:var(--text-1);color:var(--surface);font:600 .7rem/1 var(--font-body)}
  .wl-season-sel{display:none}
  /* the rows: one grid per row, the header row shares it so its labels line up with the cells */
  .wl-rows{list-style:none;margin:0;padding:0}
  .wl-row,.wl-hdr{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"tag cow status";align-items:center;gap:var(--space-1) var(--space-3);padding:var(--space-2) var(--space-3);border-bottom:1px solid var(--border)}
  .wl-row{width:100%;min-height:var(--touch-min);border-left:0;border-right:0;border-top:0;background:none;text-align:left;font:inherit;color:inherit;cursor:pointer}
  .wl-row:hover{background:var(--hover-tint)}
  .wl-row:focus-visible{outline:none;box-shadow:inset var(--focus-ring)}
  .wl-hdr{display:none;min-height:var(--h-control-dense);padding-top:0;padding-bottom:0;background:var(--surface-2);font-size:var(--text-small);font-weight:600;color:var(--text-2)}
  .wr-tag{grid-area:tag}
  .wr-cow{grid-area:cow;display:grid;min-width:0}
  .wr-name{font-weight:600;color:var(--text-1);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .wr-meta{font-size:var(--text-caption);color:var(--text-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .wr-dam{margin-top:2px}                                /* #89: "Dam: Dead" under the cow's name */
  .wr-status{grid-area:status;justify-self:end}
  .wr-camp,.wr-sire,.wr-date,.wr-open{display:none}
  .wr-date{text-align:right;font-variant-numeric:tabular-nums}
  .wr-open{justify-self:end;min-height:var(--h-control-dense);padding:0 var(--space-3);border:1.5px solid var(--border-strong);border-radius:var(--radius-md);font-weight:600;font-size:var(--text-small);display:none;align-items:center}
  .wl-foot{padding:var(--space-3);text-align:center}
  .wl-foot:empty{display:none}
  .wl-empty{padding:var(--space-6) var(--space-4);text-align:center;color:var(--text-3)}
  /* phone list: four equal tabs, the count as the big figure and a short name under it (the guide's
     tab strip hid two tabs off-screen on a phone, with nothing to say they were there) */
  @container wl (max-width:599px){
    .wl-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr))}
    .wl-tab{flex-direction:column;justify-content:center;gap:2px;min-height:calc(var(--touch-min) + 18px);padding:var(--space-1);white-space:normal;text-align:center}
    .wl-tab .full{display:none}
    .wl-tab .short{display:block;font-size:var(--text-caption);line-height:1.15}
    .wl-tab .count{min-width:0;height:auto;padding:0;background:none;color:var(--text-1);font:600 var(--text-h2)/1 var(--font-display)}
    .wl-stage-row > .wl-tools-btns{display:none}
    .wl-seasons{display:none}
    .wl-season-sel{display:block;width:100%}
    /* on a phone only the tabs stay pinned; the hint scrolls away so the small screen keeps the cows */
    .wl-stick{display:contents}
    /* + --offline-h: stays below the offline banner as well as the top bar (see .wl-stick) */
    .wl-head{position:sticky;top:calc(var(--topbar-h) + env(safe-area-inset-top) + var(--offline-h, 0px));z-index:3;background:var(--surface);border-bottom:1px solid var(--border)}
  }
  @container wl (min-width:600px){
    .wl-hint-row > .wl-tools-btns{display:none}
  }
  /* Below the 720px tier (phones, small tablets): the status pill moves to its own line under the
     name, so the cow's name and camp get the row's full width. Beside the name, the pill ("Overdue
     20 wk") and the Pregnancy test tick gutter left the name ~60px: "Rankvo…", "Suid · × R…"
     (Kobus's review, 26 Nov 2026). The tag spans both lines; the header row is hidden at this width. */
  @container wl (max-width:719px){
    .wl-row{grid-template-columns:auto minmax(0,1fr);grid-template-areas:"tag cow" "tag status"}
    .wr-tag{align-self:start}
    .wr-status{justify-self:start}
  }
  /* The column tiers are sized from measured content, not guessed: tag pill 66px, date 97px, the longest
     status pill ("Test from 26 Nov 2026") 180px, Open 61px. Every column except the names is fixed so
     each row (its own grid) and the header line up; only the name columns give, and they ellipsise.
     The Pregnancy test tab also loses 44px to the tick gutter, so each tier must still leave the cow
     column room at its lowest width WITH the ticks (17 Nov: the old 600px tier needed 740px and ran the
     Open button off the panel on tablets and small laptops).
     720 to 899: tag, cow (camp and sire stay on the meta line under the name), date, status, Open. */
  @container wl (min-width:720px){
    .wl-row,.wl-hdr{grid-template-columns:80px minmax(0,1fr) 100px 184px 72px;grid-template-areas:"tag cow date status open"}
    /* + --offline-h: stays below the offline banner as well as the top bar and the tabs strip */
    .wl-hdr{display:grid;position:sticky;top:calc(var(--topbar-h) + env(safe-area-inset-top) + var(--wl-stick-h, 0px) + var(--offline-h, 0px));z-index:2}
    .wr-date{grid-area:date;display:block}
    .wr-open{grid-area:open;display:inline-flex}
    .wr-status{justify-self:start}
  }
  /* 900 and up: camp and sire get columns of their own, so the meta line under the name goes */
  @container wl (min-width:900px){
    .wl-row,.wl-hdr{grid-template-columns:80px minmax(0,1.4fr) minmax(0,1fr) minmax(0,1fr) 100px 184px 72px;grid-template-areas:"tag cow camp sire date status open"}
    .wr-camp{grid-area:camp;display:block;color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
    .wr-sire{grid-area:sire;display:block;color:var(--text-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
    .wr-meta{display:none}
  }
  /* ticking rows on the Pregnancy test tab (slice 6): the tick is a 44px gutter beside the row button,
     the header row is pushed by the same 44px so its labels still sit over their cells */
  .wl-li{display:flex;align-items:stretch;border-bottom:1px solid var(--border)}
  .wl-li > .wl-row{flex:1;min-width:0;border-bottom:0;padding-left:0}   /* the tick gutter is the row's left padding */
  .wr-sel{flex:none;width:var(--touch-min);display:grid;place-items:center;cursor:pointer}
  .wr-sel input{width:20px;height:20px;accent-color:var(--accent-strong);cursor:pointer}
  .wl-rows.has-sel .wl-hdr{padding-left:var(--touch-min)}
  html:not([data-role="manager"]):not([data-role="owner"]) .wl-rows.has-sel .wl-hdr{padding-left:var(--space-3)}
  .wl-selbar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2);padding:var(--space-2) var(--space-3);background:var(--accent-selected);border-top:1px solid var(--border)}
  .wl-selbar[hidden]{display:none}
  .wl-selbar-n{margin-right:auto;font-weight:600;font-size:var(--text-small)}
  .wl-start[hidden]{display:none}
  /* the test session (slice 6, guide #testsession): its own full-screen layer for the crush. The answers
     are 100px tall with an ink edge, so they read in glare and take a gloved thumb; on a phone the
     answers are pinned to the bottom of the screen. */
  body.wl-ts-open{overflow:hidden}
  /* top inset is --offline-h, not 0: the offline banner sits above this layer, and at the crush the
     session is likely to be offline, so its header (and close button) must start below the banner. */
  .wl-ts{position:fixed;inset:var(--offline-h, 0px) 0 0 0;z-index:var(--z-modal);overflow-y:auto;overscroll-behavior:contain;background:var(--bg);padding:var(--space-4) var(--space-4) calc(var(--space-4) + 200px)}
  .wl-ts[hidden]{display:none}
  .wl-ts-card{max-width:560px;margin:0 auto;display:grid;gap:var(--space-3);padding:var(--space-5);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg)}
  .wl-ts-card h2{margin:0;font:600 var(--text-h2)/1.2 var(--font-display)}
  .wl-ts-intro,.wl-ts-card p{margin:0}
  .wl-ts-label{font-weight:600}
  .wl-ts-note{font-size:var(--text-small);color:var(--text-3)}
  .wl-ts-note:empty{display:none}
  .wl-ts-camps{display:flex;flex-wrap:wrap;gap:var(--space-2)}
  .wl-ts-actions{display:flex;flex-wrap:wrap;gap:var(--space-2);justify-content:flex-end}
  .wl-ts-actions .btn{min-height:var(--touch-min)}
  .wl-ts-top{position:sticky;top:calc(-1 * var(--space-4));z-index:1;display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);background:var(--surface);font-weight:600}
  .wl-ts-top .btn{min-height:var(--touch-min)}
  .wl-ts-prog{height:6px;border-radius:3px;background:var(--surface-2);overflow:hidden}
  .wl-ts-prog span{display:block;height:100%;background:var(--accent)}
  .wl-ts-hits{display:grid;gap:var(--space-2)}
  .wl-ts-hits:empty{display:none}
  .wl-ts-hit{justify-content:flex-start;gap:var(--space-3);min-height:var(--touch-min);width:100%;text-align:left}
  .wl-ts-hit .wl-ts-note{margin-left:auto}
  .wl-ts-cow{display:grid;justify-items:center;gap:var(--space-2);padding:var(--space-4) 0;text-align:center}
  .wl-ts-tag{font-size:2.25rem;padding:10px 18px 8px}
  .wl-ts-name{margin:0;font:600 var(--text-h1)/1.1 var(--font-display)}
  .wl-ts-meta{color:var(--text-2)}
  .wl-ts-cow .btn{min-height:var(--touch-min)}
  .wl-ts-dock{position:fixed;left:0;right:0;bottom:0;z-index:1;display:grid;gap:var(--space-2);padding:var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom));background:var(--surface);border-top:1px solid var(--border);box-shadow:var(--shadow-lg)}
  .wl-ts-dock > *{width:100%;max-width:560px;margin:0 auto}
  .wl-ts-last{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);font-size:var(--text-small);color:var(--text-2)}
  .wl-ts-answers{display:grid;grid-template-columns:1fr 1fr;gap:var(--space-3)}
  .wl-ts-btn{min-height:100px;border:2px solid var(--text-1);border-radius:var(--radius-md);background:var(--surface-2);color:var(--text-1);font:600 var(--text-h3)/1.2 var(--font-body);cursor:pointer}
  .wl-ts-btn:active{background:var(--accent-selected)}
  .wl-ts-btn:disabled{opacity:var(--disabled-opacity);cursor:not-allowed}
  .wl-ts-month-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:var(--space-2)}
  .wl-ts-month-grid .btn{min-height:64px;font-size:var(--text-h3)}
  /* the undo message (slice 3, guide #undo): the app's toast with the message, a Dismiss x and Undo
     under the message, so a long message never squeezes on a phone. It stacks above an ordinary toast. */
  .wl-undo{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;column-gap:var(--space-3)}
  .wl-undo[hidden]{display:none}
  .wl-undo::before{grid-row:1}
  .wl-undo-msg{grid-column:2;grid-row:1;margin:0}
  .wl-undo-x{grid-column:3;grid-row:1;width:var(--touch-min);height:var(--touch-min);border:0;border-radius:var(--radius-md);background:none;color:var(--toast-text);font-size:1.5rem;line-height:1;cursor:pointer}
  .wl-undo-btn{grid-column:2;grid-row:2;justify-self:start;min-height:var(--touch-min);margin-left:calc(-1 * var(--space-3));padding:0 var(--space-3);border:0;border-radius:var(--radius-md);background:none;color:var(--toast-ok);font:600 var(--text-small)/1 var(--font-body);cursor:pointer}
  .wl-undo-btn[hidden]{display:none}
  /* hover tint from the toast's own text token, so it follows the toast in either theme */
  .wl-undo-x:hover,.wl-undo-btn:hover{background:color-mix(in srgb, var(--toast-text) 10%, transparent)}
  /* above the message stack when one shows: --toast-stack-h is the stack's height plus a gap
     (showToast publishes it), so the undo message never covers a message, however many are stacked */
  .wl-undo.is-stacked{bottom:calc(var(--space-4) + var(--toast-stack-h, 72px) + env(safe-area-inset-bottom, 0px))}
  @media (min-width:600px){ .wl-undo.is-stacked{bottom:calc(var(--space-6) + var(--toast-stack-h, 72px))} }
  /* the cow panel: a bottom sheet on a phone, a drawer from the right from 900px (guide #sheet). It sits
     on <body>, outside the animated .screen, so position:fixed is relative to the window. */
  .wl-sheet-back{position:fixed;inset:0;z-index:var(--z-modal-backdrop);background:rgb(20 22 18 / 0.5)}
  .wl-sheet-back[hidden]{display:none}
  .wl-sheet{position:fixed;left:0;right:0;bottom:0;z-index:var(--z-modal);max-height:85vh;display:flex;flex-direction:column;overflow-y:auto;overscroll-behavior:contain;background:var(--surface);border-radius:var(--radius-lg) var(--radius-lg) 0 0;box-shadow:var(--shadow-lg);padding-bottom:env(safe-area-inset-bottom)}
  .wl-sheet[hidden]{display:none}
  .wl-sheet > *{flex-shrink:0}
  .wl-sheet-h{position:sticky;top:0;z-index:1;display:flex;align-items:center;gap:var(--space-2);padding:var(--space-4) var(--space-3) var(--space-3) var(--space-5);background:var(--surface);border-bottom:1px solid var(--border)}
  .wl-sheet-h h3{flex:1;min-width:0;margin:0;display:flex;align-items:center;gap:var(--space-2);font:600 var(--text-h2)/1.2 var(--font-display)}
  .wl-sheet-h .icon-btn{font-size:1.75rem;line-height:1;color:var(--text-2)}   /* the close × at icon size */
  .wl-kv{margin:0;padding:var(--space-2) var(--space-5)}
  .wl-kv > div{display:grid;grid-template-columns:minmax(96px,35%) 1fr;gap:var(--space-3);padding:var(--space-2) 0;border-top:1px solid var(--border)}
  .wl-kv > div:first-child{border-top:0}
  .wl-kv dt{color:var(--text-3);font-size:var(--text-small)}
  .wl-kv dd{margin:0;color:var(--text-1);display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2);font-variant-numeric:tabular-nums}
  .wl-next{display:grid;grid-template-columns:repeat(auto-fit,minmax(0,1fr));gap:var(--space-2);padding:var(--space-3) var(--space-5)}
  .wl-next:empty{display:none}
  .wl-next .btn{min-height:var(--touch-min)}
  .wl-more-l{margin:var(--space-2) var(--space-5) 0;font:600 var(--text-overline)/1.2 var(--font-display);letter-spacing:.06em;text-transform:uppercase;color:var(--text-3)}
  .wl-more{list-style:none;margin:0;padding:var(--space-1) var(--space-3) var(--space-4)}
  .wl-more button{display:flex;align-items:center;width:100%;min-height:var(--touch-min);padding:0 var(--space-2);border:0;border-radius:var(--radius-sm);background:none;color:var(--text-1);font:400 var(--text-body)/1.3 var(--font-body);text-align:left;cursor:pointer}
  .wl-more button:hover{background:var(--hover-tint)}
  .wl-more button.risk{color:var(--error)}
  .wl-linkbtn{padding:0;border:0;background:none;color:var(--accent-strong);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
  @media (min-width:900px){
    .wl-sheet{left:auto;top:0;bottom:0;width:420px;max-height:none;border-radius:0}
  }
  /* desktop with a mouse: the tab row is denser (36px controls, 8px above and below), like the guide's
     chips on a fine pointer; touch screens keep the 44px targets */
  @media (hover:none),(pointer:coarse){
    .wl-tab{min-height:var(--touch-min)}
    .wl-tools-btns .icon-btn{min-width:var(--touch-min);min-height:var(--touch-min)}
  }

  /* warning text on its own tint, edge from the text colour: follows the theme (dark mode sweep) */
  .note{margin:22px 26px 30px;padding:13px 16px;background:var(--brass-tint);border:1px solid color-mix(in srgb,currentColor 30%,transparent);border-radius:var(--radius);font-size:12.5px;color:var(--warning)}
  .note b{color:var(--warning)}

  /* ---------- herds & camps (camps restyle: UI guide #camps, design/mockups/herds.html) ----------
     renderCamps() draws one white panel per farm (.camp-farm, the shared .panel and .panel-h) with one
     row per camp (.camp). A row is the camp's name and its size caption, its herds as named chips with
     their head counts, and the animal total as a figure. Stacked below 720px of list width, three
     columns from there (a container query, so it follows the list's own width, not the window's). The
     whole row is one tap target: the name button's ::after stretches over it. The camp detail is the
     guide's drawer (.camp-drawer on the shared .wl-sheet, further down). */
  .camp-farms{display:grid;gap:var(--space-4);margin-top:var(--space-4)}
  .camp-farm{overflow:hidden;border-radius:var(--radius-lg);box-shadow:none;border-color:var(--border)}
  .camp-farm .panel-h{justify-content:space-between;flex-wrap:wrap}
  .camp-farm .panel-h h2{margin:0;font:600 var(--text-h2)/1.15 var(--font-display);color:var(--text-1)}
  .camp-farm .panel-h .caption{font-variant-numeric:tabular-nums}
  .camp-empty{margin:0;padding:var(--space-5) var(--space-4)}   /* "no camps yet" */
  .camp-hint{margin:var(--space-3) 2px 0}
  .camp-list{container:camps / inline-size}
  .camp{position:relative;display:grid;gap:var(--space-1) var(--space-4);padding:var(--space-4);border-top:1px solid var(--border);
    grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"name count" "herds herds"}
  .camp:first-child{border-top:0}
  .camp:hover{background:var(--hover-tint)}
  /* the open camp (its drawer is showing): the guide's selected state, lime tint and the accent-strong edge */
  .camp.sel{background:var(--accent-selected);box-shadow:var(--selected-ring)}
  .camp-n{grid-area:name;display:grid;min-width:0}
  .camp-n .caption{font-variant-numeric:tabular-nums}
  .camp-open{padding:0;background:none;border:0;font:600 var(--text-body-lg)/1.3 var(--font-body);color:var(--text-1);text-align:left;cursor:pointer;overflow-wrap:anywhere}
  /* stretch the name button over the whole row: one tap target, one tab stop */
  .camp-open::after{content:"";position:absolute;inset:0}
  .camp-open:focus-visible{outline:none;box-shadow:none}
  .camp-open:focus-visible::after{box-shadow:inset 0 0 0 2px var(--accent-strong)}
  .camp-count{grid-area:count;text-align:right}
  .camp-count b{display:block;font:600 var(--text-figure-sm)/1 var(--font-display);color:var(--text-1);font-variant-numeric:tabular-nums}
  .camp-herds{grid-area:herds;display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2);margin:var(--space-1) 0 0}
  /* herds on a camp row: labels, not links (the row opens the camp; the herd filter lives in the drawer) */
  .herd-chip{display:inline-flex;align-items:center;gap:var(--space-2);min-height:28px;padding:0 var(--space-2);border-radius:var(--radius-sm);background:var(--surface-2);color:var(--text-1);font-size:var(--text-small)}
  .herd-chip .num{color:var(--text-3);font-variant-numeric:tabular-nums}
  @container camps (min-width:720px){
    .camp{grid-template-columns:minmax(200px,1.2fr) minmax(0,2fr) 72px;grid-template-areas:"name herds count";align-items:center}
    .camp-herds{margin:0}
  }
  /* Loading skeleton (index.html, inside .camp-farms until the first load): the Dashboard's .dash-sk
     (200 ms delay, a calm fade, no shimmer) and its grey .sk bars, laid on the real .camp grid so each
     shape sits where its text will. These only size the shapes to the text they stand in for. */
  .camp-sk-row:hover{background:none}                                   /* not a row yet: no hover tint */
  .camp-sk-h{width:16ch;height:23px !important}                         /* the farm name (h2) */
  .camp-sk-cap{width:12ch}                                              /* "4 camps · 1 180 ha" */
  /* name, then its size caption: each bar sits inline in a line set in the real type (.camp-open's
     font for the name, the shared .caption for the size), so the lines take the real heights at every
     width (the phone's text is smaller) and a skeleton row is as tall as a real one: nothing jumps */
  .camp-sk-name{font:600 var(--text-body-lg)/1.3 var(--font-body)}
  /* each bar is a little shorter than its line so a middle-aligned bar never stretches the line box */
  .camp-sk-lines .sk{display:inline-block !important;vertical-align:middle;height:10px !important}
  .camp-sk-name .sk{height:14px !important}
  .camp-sk-chip{display:inline-block !important;width:11ch;height:28px !important}   /* a .herd-chip */
  /* the animal total and its unit ("animals"): each bar sits inline in the real .camp-count b and
     .caption lines, so the column takes the real figure's and caption's line heights in every layout */
  .camp-sk-count .sk{display:inline-block !important;vertical-align:middle}
  .camp-sk-fig{width:40px;height:16px !important}
  .camp-sk-unit{width:7ch;height:10px !important}
  /* the camp drawer (openCampDrawer): the shared .wl-sheet head, facts (.wl-kv) and More list (.wl-more);
     these add its herd filter, its animal rows and the Show all foot */
  .camp-drawer .wl-sheet-h .icon-btn{display:grid;place-items:center;min-width:var(--touch-min);min-height:var(--touch-min)}
  /* the Dominant bull fact's name (a .link-btn that opens his record): set in the facts' own type so it
     lines up with its label, and the touch-min tap area kept by an invisible ::after around the text */
  .camp-drawer .wl-kv .link-btn{position:relative;min-height:0;padding:0;font:inherit;font-weight:600;line-height:inherit}
  .camp-drawer .wl-kv .link-btn::after{content:"";position:absolute;left:0;right:0;top:50%;height:var(--touch-min);transform:translateY(-50%)}
  .camp-dchips{display:flex;flex-wrap:wrap;gap:var(--space-2);padding:var(--space-2) var(--space-5) var(--space-3)}
  .camp-dchips .chip .num{margin-left:var(--space-1);color:var(--text-2);font-variant-numeric:tabular-nums}
  .camp-dchips .chip.on .num{color:var(--text-1)}
  .camp-dnote{margin:0;padding:var(--space-2) var(--space-5)}   /* "no herds" / "no animals in this camp" */
  /* animal rows: the guide's list-row link (border between rows, not above the first; hover tint) */
  .camp-animals{list-style:none;margin:0;padding:0;border-top:1px solid var(--border);border-bottom:1px solid var(--border)}
  .camp-animals li + li .camp-arow{border-top:1px solid var(--border)}
  .camp-arow{display:flex;align-items:center;gap:var(--space-3);width:100%;min-height:var(--touch-min);padding:var(--space-3) var(--space-5);border:0;background:none;color:var(--text-1);font:inherit;text-align:left;cursor:pointer}
  .camp-arow:hover{background:var(--hover-tint)}
  .camp-arow .tag{min-width:72px;justify-content:center;flex:none}
  .camp-am{display:grid;flex:1;min-width:0}
  .camp-am b{font-weight:600;color:var(--text-1);overflow-wrap:anywhere}
  .camp-am .caption{overflow-wrap:anywhere}
  /* the caret: the Phosphor caret-right as a mask (--ic-caret-right), so it follows the theme */
  .camp-caret{flex:none;width:var(--icon-sm);height:var(--icon-sm);background:var(--text-3);-webkit-mask:var(--ic-caret-right) center/contain no-repeat;mask:var(--ic-caret-right) center/contain no-repeat}
  .camp-dfoot{padding:var(--space-2) var(--space-5)}
  .camp-dfoot .caption{font-variant-numeric:tabular-nums}
  /* The folded "Bull history" panel (campHistorySection, features/one-dominant-bull.md): a <details> card
     under the facts, closed by default, so the herd chips stay next to the list they filter. */
  .camp-hist{margin:var(--space-1) var(--space-5) var(--space-3);border:1px solid var(--border);border-radius:var(--radius-md);background:var(--surface-2)}
  .camp-hist-s{display:flex;align-items:center;gap:var(--space-2);min-height:var(--touch-min);padding:0 var(--space-3) 0 var(--space-4);cursor:pointer;list-style:none;border-radius:var(--radius-md)}
  .camp-hist-s::-webkit-details-marker{display:none}                       /* the caret below replaces it */
  .camp-hist-s:hover{background:var(--hover-tint)}
  .camp-hist-s:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--accent-strong)}
  .camp-hist-t{flex:1;font-weight:600;color:var(--text-1)}
  /* the number of periods, as a small count badge */
  .camp-hist-n{min-width:24px;padding:2px var(--space-2);border-radius:var(--radius-full);background:var(--surface);box-shadow:inset 0 0 0 1px var(--border);color:var(--text-2);font-size:var(--text-caption);text-align:center}
  /* the fold caret: the Phosphor caret-right, turned down when closed and up when open */
  .camp-hist-caret{flex:none;width:var(--icon-sm);height:var(--icon-sm);background:var(--text-2);transform:rotate(90deg);transition:transform var(--duration-fast) var(--ease-out);-webkit-mask:var(--ic-caret-right) center/contain no-repeat;mask:var(--ic-caret-right) center/contain no-repeat}
  .camp-hist[open] .camp-hist-caret{transform:rotate(-90deg)}
  .camp-hist[open] .camp-hist-s{border-bottom:1px solid var(--border);border-radius:var(--radius-md) var(--radius-md) 0 0}
  .camp-hist-none{margin:0;padding:var(--space-3) var(--space-4)}
  /* the timeline: a dot per bull on a thin line, newest at the top */
  .camp-tl{list-style:none;margin:0;padding:var(--space-3) var(--space-4) var(--space-2)}
  .camp-tl-i{position:relative;display:grid;grid-template-columns:20px minmax(0,1fr);gap:var(--space-2);padding-bottom:var(--space-3)}
  /* the line from this dot down to the next one (not after the last) */
  .camp-tl-i:not(:last-child)::before{content:"";position:absolute;left:6px;top:20px;bottom:-2px;width:2px;border-radius:1px;background:var(--border)}
  .camp-tl-dot{width:14px;height:14px;margin-top:6px;border-radius:50%;border:2px solid var(--text-3);background:var(--surface-2)}
  .camp-tl-i.now .camp-tl-dot{border-color:var(--accent-strong);background:var(--accent)}   /* the current bull: filled lime */
  .camp-tl-b{display:grid;gap:var(--space-1);min-width:0}
  .camp-tl-h{display:flex;align-items:center;flex-wrap:wrap;gap:var(--space-2)}
  /* the bull: his ear tag and name as one link to his record */
  .camp-tl-link{display:inline-flex;align-items:center;gap:var(--space-2);min-height:32px;padding:0;border:0;background:none;color:var(--text-1);font:inherit;text-align:left;cursor:pointer;border-radius:var(--radius-sm)}
  .camp-tl-link b{font-weight:600;overflow-wrap:anywhere}
  .camp-tl-link:hover b{text-decoration:underline;text-underline-offset:3px}
  .camp-tl-link:focus-visible{outline:none;box-shadow:0 0 0 2px var(--accent-strong)}
  .camp-tl-link .tag{min-width:64px;justify-content:center;flex:none}
  .camp-tl-w{font-variant-numeric:tabular-nums}

  /* ---------- reports directory (reports redesign S1, features/reports-redesign.md) ----------
     Built by app.js loadReports() from REPORT_GROUPS: search, Recently opened, five question groups in
     a grid and the full-width Forms strip under it. Mobile first: the base rules are the phone (one
     column, every group three reports); the layout follows the directory's OWN width (container rdx),
     not the window's, so the open sidebar never squeezes it into a broken grid. White panels on the
     1px border, rows split by hairlines (the guide's list rows), no shadows and no coloured edges. */
  #reports .rd-x{container:rdx / inline-size}
  .rd-search{margin:0 0 var(--space-5)}
  .rd-search .cb-inp{width:100%;box-sizing:border-box}
  /* while a search is typed the results panel stands in for the whole directory */
  .rd-x.is-searching .rd-recent,.rd-x.is-searching .rd-grid,.rd-x.is-searching .rd-strip{display:none}
  .rd-results,.rd-recent{margin-bottom:var(--space-5)}
  .rd-results[hidden],.rd-recent[hidden]{display:none}
  /* a panel heading: the display face at H2 size (Kobus, 13 Nov: group headings were too small) */
  .rd-h{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--space-1) var(--space-3);padding:var(--space-4) var(--space-4) var(--space-2)}
  .rd-h h2,.rd-h h3{margin:0;font:600 var(--text-h2)/1.2 var(--font-display);color:var(--text-1)}
  .rd-h .caption{color:var(--text-3)}
  /* group heading: its icon, its name and its report count, as the old category cards showed them */
  .rd-gh{align-items:center;flex-wrap:nowrap;gap:var(--space-2)}
  .rd-gh h3{min-width:0}
  .rd-gi{display:flex;flex:none;color:var(--text-2)}
  /* the count is a number, not a status: a neutral chip, never a warning tint */
  .rd-count{margin-left:auto;flex:none;font-size:var(--text-caption);font-weight:600;color:var(--text-2);background:var(--surface-2);box-shadow:inset 0 0 0 1px var(--border);padding:2px 9px;border-radius:var(--radius-full);font-variant-numeric:tabular-nums}
  .rd-list{list-style:none;margin:0;padding:0}
  .rd-list li{border-top:1px solid var(--border)}
  /* a report row: a full-width 44px button (a <button>, so the history router never takes it for a
     link); the name in 600, the question under it in small grey, the Graph marker on the right */
  .rl{display:flex;align-items:center;gap:var(--space-3);width:100%;min-height:var(--touch-min);padding:var(--space-2) var(--space-4);background:none;border:0;font:inherit;color:var(--text-1);text-align:left;cursor:pointer}
  .rl:hover{background:var(--hover-tint)}
  .rl:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--accent-strong)}
  .rl-t{display:grid;gap:2px;flex:1;min-width:0}
  .rl-n{font-weight:600}
  .rl-q{font-size:var(--text-small);color:var(--text-3)}
  .rl-ic{display:flex;flex:none;color:var(--text-3)}
  /* "Graph": a muted icon + word, so a graph report says what it is without a bare glyph (Kobus, 17 Nov) */
  .rr-kind{display:inline-flex;align-items:center;gap:var(--space-1);flex:none;font-size:var(--text-caption);font-weight:400;color:var(--text-3)}
  .rd-none{margin:0;padding:0 var(--space-4) var(--space-4)}
  /* groups: every panel stretches to its row, its Show all footer pinned to the bottom */
  .rd-grid{display:grid;gap:var(--space-5)}
  .rd-grp{display:flex;flex-direction:column;margin:0}
  .rd-foot{margin-top:auto;border-top:1px solid var(--border);padding:0 var(--space-4)}
  .rd-more{min-height:var(--touch-min);padding:0;background:none;border:0;font:inherit;font-weight:600;color:var(--accent-strong);cursor:pointer}
  .rd-more:hover{text-decoration:underline}
  .rd-more:focus-visible{outline:none;box-shadow:var(--focus-ring);border-radius:var(--radius-sm)}
  .rd-strip{margin-top:var(--space-5)}
  /* phone: every group three reports, so the tall Herd card hides its 4th and 5th rows; Recently
     opened shows its newest three */
  .rd-tall .rd-list li:nth-child(n+4),.rd-recent-list li:nth-child(n+4){display:none}
  /* herd composition on the Herd card: a title line like a report row, then a short bar chart */
  .rd-comp{margin:0;padding:var(--space-2) var(--space-4) var(--space-3);border-top:1px solid var(--border)}
  .rd-comp .rd-comp-h{display:flex;align-items:flex-start;gap:var(--space-3);margin-bottom:var(--space-2)}
  .rd-comp .rd-comp-h b{font-family:var(--font-body);font-size:var(--text-body)}
  .rd-comp .ch-plot{grid-template-rows:96px auto}
  .rd-comp .ch-bars{padding-top:var(--space-5)}
  /* the Show all drawer reuses the work list's sheet (.wl-sheet); these only add its body */
  .rd-drawer .wl-sheet-h h3 .caption{font:400 var(--text-small)/1.2 var(--font-body);color:var(--text-3)}
  .rd-drawer .wl-sheet-h .icon-btn{display:grid;place-items:center;min-width:var(--touch-min);min-height:var(--touch-min)}
  .rd-dbody{padding-bottom:var(--space-4)}
  .rd-sub h4{margin:var(--space-5) var(--space-4) var(--space-1);font:600 var(--text-small)/1.3 var(--font-body);color:var(--text-2)}
  .rd-sub:first-child h4{margin-top:var(--space-3)}
  .rd-sub-n{font-weight:400;color:var(--text-3)}
  .rd-sub .rd-list li:last-child{border-bottom:1px solid var(--border)}
  @container rdx (min-width:640px){
    .rd-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    /* the Herd card is two rows tall: the chart on top, then five reports */
    .rd-tall{grid-row:span 2}
    .rd-tall .rd-list li:nth-child(n+4){display:block}
    /* Forms: its three reports side by side, split by hairlines */
    .rd-strip .rd-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
    .rd-strip .rd-list li + li{border-left:1px solid var(--border)}
  }
  @container rdx (min-width:900px){
    .rd-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
    /* Recently opened: all five in one row, once a fifth of the width still fits a two-line name
       (between 640 and 900 px a fifth squeezed "Pregnant cows" onto two lines, so it stays a list) */
    .rd-recent-list{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));border-top:1px solid var(--border)}
    /* one hairline across the whole row (on the list, not per cell, so it stays full width with one report) */
    .rd-recent-list li{border-top:0}
    .rd-recent-list li:nth-child(n+4){display:block}
    .rd-recent-list li + li{border-left:1px solid var(--border)}
  }

  /* ---------- shared form controls (the auth screen's own rules follow the .cb-auth-err line) ----------
     Also moved out of a JS-injected <style>: a strict Content-Security-Policy blocks an
     injected <style>, which left form inputs/labels (reused by every modal) and the login
     screen unstyled. .cb-inp / .cb-lbl are the base frame for inputs and the custom select
     button, so when they were dropped the modal selects fell back to default browser buttons. */
  /* Fields (UI guide, Form elements; restyle slice 2). .cb-lbl is the guide's .field + .label
     (label text above, control below); .cb-inp is .input. Inputs are a fixed 16px so iOS never
     zooms on focus, 44px tall, white with the 3:1 --input-border so they are findable outdoors.
     Focus thickens the edge to --accent-strong (--focus-ring-input), with no white gap. */
  .cb-lbl{display:flex;flex-direction:column;gap:var(--space-1);font-size:var(--text-small);color:var(--label-color);font-weight:600}
  .cb-lbl:focus-within{color:var(--label-color-focused)}
  /* formModal's optional line under a dropdown (f.hint, e.g. "Saving moves Kaptein from Brahman-stoet to
     this herd."): plain caption text, not the label's bold colour, and gone while it has nothing to say */
  .cb-lbl .cb-field-hint{font-weight:400;color:var(--text-2)}
  .cb-lbl .cb-field-hint[hidden]{display:none}
  .cb-inp{border:1.5px solid var(--input-border);background:var(--input-bg);border-radius:var(--radius-md);min-height:var(--h-control);padding:0 var(--space-3);font-size:var(--text-body);font-weight:400;line-height:1.3;font-family:inherit;color:var(--text-1);transition:border-color var(--duration-fast) var(--ease-out),box-shadow var(--duration-fast) var(--ease-out)}
  .cb-inp::placeholder{color:var(--placeholder-color);opacity:1}
  .cb-inp:hover{border-color:var(--input-border-hover)}
  .cb-inp:focus,.cb-inp:focus-visible{outline:none;border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  .cb-inp:disabled{background:var(--input-bg-disabled);cursor:not-allowed}
  /* Required-field marker (formModal + the New-animal wizard): a red asterisk after the label text.
     aria-hidden in the markup — the control's aria-required="true" is what screen readers announce. */
  .cb-req{color:var(--error);margin-left:3px;font-weight:600}
  /* A field that failed client-side validation (set by focusInvalidField, cleared on the next
     edit/pick) gets the error edge so the user sees WHICH field the message is about; its label
     turns the error colour too (guide .field.has-error). */
  .cb-inp[aria-invalid="true"],.cb-inp[aria-invalid="true"]:focus{border-color:var(--input-border-error);box-shadow:0 0 0 1.5px var(--input-border-error)}
  .cb-lbl:has(.cb-inp[aria-invalid="true"]){color:var(--label-color-error)}
  /* Read-only parameter value (a single-choice "Order By" rendered as text, not a dropdown): the
     guide's .input-static, a field-shaped slot on the inset grey with no edge, so it lines up
     with editable fields but clearly is not one. */
  .cb-inp-static{cursor:default;color:var(--text-1);background:var(--surface-2);border-color:transparent;display:flex;align-items:center;min-height:var(--h-control)}
  .cb-inp-static:hover{border-color:transparent}
  /* .cb-auth-btn is the primary button of the sign-in card AND of every formModal / wizard footer
     (cb-m0), so it takes the guide's primary look here (restyle slice 2): lime fill, ink text, 44px. */
  .cb-auth-btn{margin-top:6px;background:var(--accent);color:var(--on-accent);border:1.5px solid transparent;border-radius:var(--radius-md);min-height:var(--h-control);padding:0 var(--space-5);font-size:var(--text-body);font-weight:600;font-family:inherit;cursor:pointer;transition:background var(--duration-fast) var(--ease-out)}
  .cb-auth-btn:hover{background:var(--accent-hover)} .cb-auth-btn:active{background:var(--accent-active)} .cb-auth-btn:disabled{opacity:var(--disabled-opacity);cursor:not-allowed}
  /* Inline error line (forms, wizard): the guide's bad alert ground, error text, no edge stripe. */
  .cb-auth-err{background:var(--error-tint);color:var(--error);border-radius:var(--radius-md);padding:var(--space-2) var(--space-3);font-size:var(--text-small);font-weight:600}
  /* Sign in and create account (UI guide #auth; restyle slice 4g): the plainest screen. One white
     panel with the colour logo, a title and the form, on the photo backdrop described below (added
     9 Nov; the guide's demos stay plain), and no shell. Mobile first: on phones the panel fills the width inside the 16px gutter and starts
     near the top, so the keyboard never covers the button; from 480px it centres at 400px. */
  /* Photo backdrop (Kobus, 9 Nov, replacing the plain page background the guide shows): cattle at the
     feed trough, /img/login-hero.webp (the cattlebase.co.za home-page hero, 1600x887; picked over a first
     photo that put the right-hand cow behind the panel), under a dark overlay in the frame colour so the white panel and
     the language toggle stand out and the photo never competes with the form. The overlay is the first
     layer (a flat gradient), the photo the second; --frame is the fallback while the photo loads.
     Its front cow is at the far right, so the photo is anchored at 85% across: on a wide screen that cow
     sits clear of the panel, and a phone's crop keeps it in view. */
  .auth-page{position:fixed;inset:0;z-index:100;overflow-y:auto;padding:var(--space-4);font-family:var(--font-body);
    background:linear-gradient(color-mix(in srgb, var(--frame) 62%, transparent) 0 0),
      var(--frame) url('/img/login-hero.webp') 85% 50% / cover no-repeat}
  .auth-bar{display:flex;justify-content:flex-end;gap:var(--space-2);margin-bottom:var(--space-4)}   /* gap: EN/AF and the theme toggle sit side by side (dark mode) */
  /* on the photo the panel lifts with the guide's floating shadow instead of relying on its border */
  .auth-card{display:grid;gap:var(--space-4);max-width:400px;margin:0 auto;padding:var(--space-5);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-md)}
  @media (min-width:480px){ .auth-page{display:flex;flex-direction:column} .auth-card{width:100%;margin:auto} }
  .auth-logo{display:block;height:36px;width:auto}
  .auth-head h1{margin:0;font:600 var(--text-h1)/1.1 var(--font-display);color:var(--text-1)}
  .auth-head .caption{margin:var(--space-1) 0 0}
  .auth-card .field{display:grid;gap:var(--space-1);min-width:0;align-content:start}
  .auth-card .label{margin:0;font-weight:600;font-size:var(--text-small);color:var(--label-color)}
  .auth-card .field:focus-within .label{color:var(--label-color-focused)}
  .auth-card .field:has([aria-invalid="true"]) .label{color:var(--label-color-error)}
  .auth-card .cb-inp{width:100%;box-sizing:border-box}
  /* EN | AF before anyone signs in (the persisted UI language) */
  .lang-toggle{flex:none;display:flex;border:1px solid var(--border);border-radius:var(--radius-md);overflow:hidden;background:var(--surface)}
  .lang-toggle button{min-width:var(--touch-min);height:var(--touch-min);padding:0 var(--space-2);background:transparent;border:0;color:var(--text-2);font:600 var(--text-small)/1 var(--font-body);cursor:pointer}
  .lang-toggle button + button{border-left:1px solid var(--border)}
  .lang-toggle button:hover{background:var(--accent-tint);color:var(--text-1)}
  .lang-toggle button[aria-pressed="true"]{background:var(--accent);color:var(--on-accent)}
  /* sign-in theme toggle (dark mode): the EN/AF toggle's look with three icon buttons, beside it */
  .lang-toggle.theme-toggle button{display:grid;place-items:center}
  .lang-toggle.theme-toggle svg{width:var(--icon-md);height:var(--icon-md)}
  /* password with its show button inside the field (an aria-pressed toggle that swaps the type) */
  .pw-wrap{position:relative}
  .pw-wrap .cb-inp{padding-right:calc(var(--touch-min) + var(--space-1))}
  .pw-eye{position:absolute;top:0;right:0;color:var(--text-2)}
  /* a field's error line under it: warning icon plus the words, never colour alone */
  .helper{display:flex;align-items:flex-start;gap:var(--space-1);margin:0;font-size:var(--text-caption);color:var(--helper-color)}
  .helper.is-error{color:var(--helper-color-error);font-weight:600}
  .helper.is-error::before{content:"";flex:none;width:var(--icon-sm);height:var(--icon-sm);margin-top:1px;background:currentColor;-webkit-mask:var(--ic-warning) center/contain no-repeat;mask:var(--ic-warning) center/contain no-repeat}
  .helper[hidden]{display:none}
  .helper-link{justify-self:start}
  .link-btn{min-height:var(--touch-min);padding:0 var(--space-1);background:none;border:0;color:var(--text-1);font:600 var(--text-small)/1 var(--font-body);text-decoration:underline;text-underline-offset:3px;cursor:pointer}
  .link-btn:hover{text-decoration-thickness:2px}
  /* the password rules tick off as they type: a --success tick when met, an empty circle until then */
  .pw-rules{display:grid;gap:var(--space-1);margin:var(--space-1) 0 0;padding:0;list-style:none;font-size:var(--text-caption);color:var(--text-2)}
  .pw-rules li{display:flex;align-items:center;gap:var(--space-2)}
  .pw-rules li i{flex:none;width:var(--icon-sm);height:var(--icon-sm);background:currentColor;-webkit-mask:var(--ic-circle) center/contain no-repeat;mask:var(--ic-circle) center/contain no-repeat}
  .pw-rules li.met{color:var(--text-1)}
  /* Met rule: a solid --success disc with a white tick (Kobus, 9 Nov: the outline tick was too faint to
     notice while typing). One deliberate exception to the outline-only icon style. The disc is the <i>
     itself (no mask, round); the tick is its ::after, masked in white on top. */
  .pw-rules li.met i{position:relative;background:var(--success);border-radius:50%;-webkit-mask:none;mask:none}
  .pw-rules li.met i::after{content:"";position:absolute;inset:3px;background:var(--surface);-webkit-mask:var(--ic-check) center/contain no-repeat;mask:var(--ic-check) center/contain no-repeat}
  /* one alert above the button (guide .alert-bad): icon, a bold title, one plain sentence */
  .alert{display:flex;align-items:flex-start;gap:var(--space-3);padding:var(--space-4);border-radius:var(--radius-md);color:var(--text-1)}
  .alert > i{flex:none;width:var(--icon-lg);height:var(--icon-lg);background:currentColor;-webkit-mask:var(--ic-warning) center/contain no-repeat;mask:var(--ic-warning) center/contain no-repeat}
  .alert > div{flex:1;min-width:0}
  .alert p{margin:0;font-size:var(--text-small)}
  .alert .alert-t{margin-bottom:2px;font-weight:600;font-size:var(--text-body)}
  .alert-bad{background:var(--error-tint)}
  .alert-bad > i,.alert-bad .alert-t{color:var(--error)}
  /* one primary button, full width, large; while busy it keeps its size, shows the spinner and says what is happening */
  .btn.btn-lg{min-height:52px;padding:0 var(--space-6);font-size:var(--text-body-lg)}
  .auth-card .auth-submit{width:100%}
  .btn .spin{display:none;width:18px;height:18px;border:2.5px solid currentColor;border-right-color:transparent;border-radius:50%;animation:cb-spin 700ms linear infinite}
  .btn.is-loading .spin{display:inline-block}
  .btn.is-loading{cursor:progress}
  /* Spinner-only loading (UI guide #buttons, States: "Loading keeps the button width, shows a spinner
     and sets aria-busy"): for a short label the spinner takes the label's place instead of sitting
     beside a longer busy word, so the button never changes size (Caleb, 26 Nov 2026: the grading Save
     grew from 81px to 155px as "Saving…"). The label stays in the layout, invisible, holding the
     width; the spinner is centred over it. The busy words reach screen readers through the button's
     aria-label (app.js gradingBusy). */
  .btn.btn-spin-only{position:relative}
  .btn.btn-spin-only.is-loading .lbl{visibility:hidden}
  .btn.btn-spin-only.is-loading .spin{position:absolute;inset:0;margin:auto}
  @keyframes cb-spin{ to{transform:rotate(360deg)} }
  @media (prefers-reduced-motion:reduce){ .btn .spin{animation-duration:2.4s} }
  .auth-switch{margin:0;text-align:center;color:var(--text-2);font-size:var(--text-small)}
  /* Error pages (404, 403, 500 from src/templates/errors/, and the SPA's #notfound screen): the sign-in
     pattern above reused as is (photo backdrop, one white panel, colour logo, Barlow heading), so these
     rules only add what the form does not have. The server pages carry .auth-page itself; the SPA screen
     uses .err-card alone inside the app shell. Mobile first: buttons stack full width at 44px+ (btn-lg
     is 52px); from 480px they sit side by side, the primary first. */
  .err-body{display:grid;gap:var(--space-4)}
  /* [hidden] must win over the display set by .err-body and .btn (inline-flex), or both languages and
     both main buttons would show. Scoped to the error panel so no other screen is affected. */
  .err-card [hidden]{display:none}
  .err-code{margin:0 0 var(--space-1);font-size:var(--text-caption);font-weight:600;color:var(--text-3)}
  .err-text{display:grid;gap:var(--space-2);color:var(--text-2)}
  .err-text p{margin:0;text-wrap:pretty}
  /* No orphans (Kobus, 10 Nov: "Ons kan nie daardie bladsy vind nie" left "nie" alone on line 2):
     the heading balances its lines and the body text avoids a lone last word. Both degrade to
     normal wrapping in a browser without text-wrap support. */
  .err-body .auth-head h1,.err-body .err-h{text-wrap:balance}
  .err-actions{display:grid;gap:var(--space-3)}
  /* the main actions are links (<a class="btn">), so drop the default link underline */
  .err-actions .btn{width:100%;text-decoration:none}
  @media (min-width:480px){
    .err-actions{display:flex;flex-wrap:wrap}
    .err-actions .btn{width:auto;flex:1 1 auto}
  }
  /* the 500's request id: small and selectable so a farmer can read it out or copy it to support */
  .err-ref{margin:0;font:var(--text-caption)/1.4 var(--font-mono);color:var(--text-3);user-select:all}
  /* The SPA's not-found screen sits in the content area, not over a photo: centred, the panel's own
     border instead of the floating shadow, and room above it so it does not hug the page header. */
  #notfound .err-card{max-width:440px;margin:var(--space-8) auto;box-shadow:none}
  /* In the shell the page header owns the h1, so the panel heading is an h2 styled like the sign-in h1. */
  .auth-head .err-h{margin:0;font:600 var(--text-h1)/1.1 var(--font-display);color:var(--text-1)}
  /* hidden visually, still read by screen readers (guide utility) */
  .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}
  /* Spacing modifiers for markup-rendered elements (tina4-js html`` templates) — a CSP-safe
     replacement for inline style="" attributes, which the strict CSP (default-src 'self') blocks. */
  .cb-auth-err.cb-mt12{margin-top:12px}                        /* wizard error line */
  .cb-auth-btn.cb-m0{margin:0}                                 /* wizard footer buttons (no top margin) */
  .cb-unit{font-size:12px;color:var(--faint)}                  /* record metric unit (kg/day, days) */
  /* a record metric with no value: a quiet caption in the tile instead of "Not recorded" in the big figure
     type (it wrapped to two heavy lines); never a dash (ui-quick-wins.md) */
  .cb-missing{display:block;font:400 var(--text-small)/1.4 var(--font-body);color:var(--text-3)}

  /* ---------- shared modal chrome (overlay, card, custom select + date, wizard) ----------
     These were previously injected at runtime from a JS <style> element. A strict
     Content-Security-Policy (default-src 'self', no 'unsafe-inline') blocks an injected
     <style>, which dropped ALL of this and left every modal (New animal, the report
     builder, the pickers) unstyled — rendered inline instead of as a centred overlay.
     Serving them from this external stylesheet keeps them under 'self', so CSP allows them. */
  /* Modal look (UI guide, Modal; restyle slice 2): ink backdrop at 50%, white card with the
     large radius and --shadow-lg (a floating layer, so it keeps its shadow), 44px close button.
     Below 900px the card docks to the bottom as a sheet (see the phone block further down). */
  /* Overlay layers (tokens.css --z-*): every full-screen overlay sits on the --z-modal layer, above the
     sticky top bar (--z-topbar) and the phone drawer (--z-drawer), so a scrim covers the whole screen and
     nothing it shows slides under the header. They used to be 75 to 210, below the restyled top bar
     (300). Their order among themselves is unchanged: report parameters (+0) < report preview (+5) <
     modal and confirm (+10) < photo viewer (+20) < photo quality check (+30). Toasts (--z-toast) stay on top. */
  .cb-modal{position:fixed;inset:0;background:rgb(20 22 18 / 0.5);display:grid;place-items:center;padding:24px;z-index:calc(var(--z-modal) + 10)}
  /* Fixed header and footer, only the body scrolls (Andre, 20 Nov 2026). The card stays the one scroll
     container, because every modal builder in app.js appends its fields straight into the card between
     the header and the action bar (no body wrapper to scroll on its own). Instead the header sticks to
     the top (.cb-modal-h below) and the action bar to the bottom (.cb-modal-actions, further down), so
     what moves is only the fields between them. The card has no top padding so the sticky header sits
     flush with its top edge; scroll-padding keeps a field that is scrolled into view (an inline error,
     the next empty field) clear of both bars. overscroll-behavior stops a scroll that reaches the end
     of the form from scrolling the page behind the backdrop. */
  .cb-modal-card{background:var(--surface);border:0;border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);padding:0 24px 20px;width:min(560px,100%);max-height:90vh;overflow:auto;overscroll-behavior:contain;scroll-padding:80px 0 88px;color:var(--text-2)}
  /* The header: one fixed height at every width and in every modal (the title, the 44px close button,
     12px above and below), so it never swells. A long title is cut with an ellipsis on one line rather
     than wrapping to two. The white fill and hairline let the fields scroll under it cleanly; the
     negative side margins pull it edge to edge over the card's side padding (16px on phones below). */
  .cb-modal-h{position:sticky;top:0;z-index:4;display:flex;align-items:center;gap:var(--space-3);min-height:68px;margin:0 -24px 16px;padding:12px 24px;background:var(--surface);border-bottom:1px solid var(--border)}
  .cb-modal-h h3{flex:1 1 auto;min-width:0;margin:0;font-family:var(--serif);font-size:var(--text-h2);font-weight:600;color:var(--text-1);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  /* Close button: the Phosphor X (the --ic-x mask above), not a "×" text glyph, so every modal's close
     matches the guide (staging click-through, 20 Nov 2026). font-size:0 hides any leftover glyph text;
     the builders give the button its name with aria-label (modal.close). flex:none keeps it 44px when
     a long title fills the header. */
  .cb-modal-x{flex:none;margin:-8px -10px -8px auto;width:var(--touch-min);height:var(--touch-min);display:grid;place-items:center;border:none;background:none;border-radius:var(--radius-md);font-size:0;color:var(--text-2);cursor:pointer;line-height:1}
  .cb-modal-x::before{content:"";width:20px;height:20px;background:currentColor;-webkit-mask:var(--ic-x) center/contain no-repeat;mask:var(--ic-x) center/contain no-repeat}
  .cb-modal-x:hover{background:var(--hover-tint);color:var(--text-1)}
  /* No up/down arrows on number fields anywhere (Caleb, 24 Nov 2026: "no one uses them"; weights are
     typed, and the arrows crowded the field). The field stays type=number, so phones still open the
     number keypad and min/step validation still runs. The older per-screen rules (.set-num, .val-inp,
     #s-grade) did the same for their own fields and are now covered by this one. */
  input[type=number]::-webkit-outer-spin-button,input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
  input[type=number]{-moz-appearance:textfield;appearance:textfield}
  .cb-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}
  .cb-grid .cb-lbl.wide{grid-column:1/-1}
  /* Form layout without empty columns (Kobus, 20 Nov 2026): .span2 is a long field that shares its row
     with a short one (formModal field span: 2), and .cb-grid-2 is a short form in two even columns
     (formModal columns: 2). Both fall back to one column on a phone (the max-width:768px block). */
  .cb-grid .cb-lbl.span2{grid-column:span 2}
  /* Label text at the top, control at the bottom: when one label in a row wraps to two lines (e.g.
     "Mother's weight at weaning (kg)"), every input in that row still lines up (tester feedback round 2). */
  .cb-grid > .cb-lbl{justify-content:space-between}
  /* ...but a checkbox label (.cb-check: row direction, box then text) must keep its text right next
     to the tick box. space-between above pushed "Register with studbook" to the far edge of a wide
     label, away from its box (tester feedback). Same specificity + later = this wins. */
  .cb-grid > .cb-check{justify-content:flex-start}
  /* formModal file field: preview of the picked image (Record calf photo). */
  .cb-file-preview{display:block;max-width:180px;max-height:140px;border-radius:8px;object-fit:cover;border:1px solid var(--line)}
  .cb-wizard{width:min(620px,100%)}
  .cb-steps{display:flex;gap:8px;margin:0 0 16px}
  .cb-step{flex:1;text-align:center;font-size:12px;font-weight:600;font-family:inherit;color:var(--faint);padding:7px 6px;border-radius:8px;background:var(--surface-2);border:1px solid var(--line-soft);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
  .cb-step:hover{border-color:var(--faint);color:var(--muted)}
  .cb-step.on{background:var(--green-tint);border-color:var(--green);color:var(--accent-strong)}
  .cb-step.on:hover{color:var(--accent-strong)}
  .cb-step.done{color:var(--green);border-color:var(--green-tint)}
  .cb-step.done:hover{border-color:var(--green)}
  .cb-step-pane[hidden]{display:none}
  .cb-sec{font-family:var(--serif);font-size:var(--text-h3);font-weight:600;color:var(--ink);margin:16px 0 8px;padding-bottom:5px;border-bottom:1px solid var(--line-soft)}
  .cb-sec:first-child{margin-top:4px}
  .cb-sec-note{color:var(--muted);font-size:12.5px;margin:0 0 6px}
  .cb-check{flex-direction:row;align-items:center;gap:9px;font-weight:600;color:var(--ink)}
  /* native checkbox in the accessible lime shade (restyle slice 2); the guide's custom 22px box is a markup change for later */
  .cb-check input{width:20px;height:20px;accent-color:var(--accent-strong)}
  /* Add/Edit-animal wizard footer: four equal buttons on every step (Save is offered on all of
     them). A grid — not the modal's default flex row — so every cell is the same width and, with
     align-items:stretch, the same height even when one label wraps. Desktop: one row
     Cancel · Back · Next · Save. The phone layout (2×2) is in the max-width:768px block below.
     Grid areas, not DOM order, place the buttons: Next must stay FIRST in the DOM because it is
     the form's default (Enter-key) button — see the footer markup in app.js. */
  .cb-modal-actions.cb-wiz-foot{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-template-areas:"cancel back next save";align-items:stretch;gap:10px}
  .cb-wiz-foot>button{width:100%;margin:0}
  .cb-wiz-cancel{grid-area:cancel} .cb-wiz-back{grid-area:back} .cb-wiz-next{grid-area:next} .cb-wiz-save{grid-area:save}
  /* Back on step 1 / Next on the last step are disabled (kept in place so nothing resizes). */
  .cb-wiz-foot .cb-btn-ghost:disabled{opacity:var(--disabled-opacity);cursor:not-allowed}
  /* textarea keeps the field look but pads all round and reads as body text (guide .textarea) */
  textarea.cb-inp{resize:vertical;min-height:88px;max-height:220px;padding:var(--space-3);font-family:inherit;line-height:1.5}
  textarea.cb-textarea{min-height:96px}
  .cb-drop{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;padding:26px 16px;border:2px dashed var(--line);border-radius:12px;background:var(--surface-2);color:var(--muted);cursor:pointer;transition:border-color .12s,background .12s}
  .cb-drop:hover,.cb-drop:focus-visible{border-color:var(--green);outline:none}
  .cb-drop.over{border-color:var(--green);background:var(--green-tint);color:var(--accent-strong)}
  .cb-drop svg{opacity:.7}
  .cb-drop-text{display:flex;flex-direction:column;gap:2px;font-size:13px}
  .cb-drop-text b{color:var(--ink);font-size:13.5px}
  .cb-drop-count{margin:8px 2px 0;font-size:12px}
  /* Staged photo cards, shared by New / Edit animal (Photos tab) and Record calf (buildPhotoDrop).
     Option A1 (Kobus, 24 Nov 2026): compact square cards, 6 to a row on a laptop (150px minimum)
     and 3 on a phone; the Primary / "Set as primary" tag top left and the Remove x top right sit ON the
     photo; under it a "Taken" caption and the date at 12px on one line. The picker is its own
     container, so the column count follows the host (the wizard or Record calf), not the screen. */
  .cb-photo-drop{container-type:inline-size;container-name:photodrop}
  .cb-drop-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:var(--space-3);margin-top:10px}   /* 6 to a row in the wizard and Record calf on a laptop */
  .cb-drop-cell{display:flex;flex-direction:column;gap:var(--space-1);min-width:0}
  .cb-drop-thumb{position:relative;aspect-ratio:1;border-radius:var(--radius-md);overflow:hidden;border:1px solid var(--line);background:var(--surface)}
  .cb-drop-cell.is-primary .cb-drop-thumb{outline:3px solid var(--accent);outline-offset:-1px}
  .cb-drop-thumb img{width:100%;height:100%;object-fit:cover;display:block}
  /* the top-left slot: filled when it is the primary photo, a faint outlined button on the others */
  .cb-drop-tag{position:absolute;top:6px;left:6px;max-width:calc(100% - 44px);padding:3px 8px;border-radius:var(--radius-full);font:600 11px/1.2 var(--font-body);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .cb-drop-tag.is-on{background:var(--accent-strong);color:var(--on-strong)}
  /* "Set as primary" did not fit beside the x at 8 to a row (117px cards: "Set as pri..."), so on the other
     photos it is a slim strip along the bottom of the photo, full width; Primary keeps the top-left tag. */
  button.cb-drop-main{top:auto;left:0;right:0;bottom:0;max-width:none;border-radius:0;border:0;padding:5px 6px;background:rgb(24 30 20 / .62);color:#fff;text-align:center;cursor:pointer}
  button.cb-drop-main:hover,button.cb-drop-main:focus-visible{background:var(--accent-strong);color:var(--on-strong);outline:none}
  /* With a mouse it only shows while the pointer is on the photo (or the button has keyboard focus), so it
     does not cover the photo; touch screens have no hover, so there it always shows (Kobus, 24 Nov 2026). */
  @media (hover:hover) and (pointer:fine){
    button.cb-drop-main{opacity:0}
    .cb-drop-thumb:hover button.cb-drop-main,button.cb-drop-main:focus-visible{opacity:1}
  }
  /* the Remove x on the photo: 28px, with a 44px invisible hit area so a thumb on a phone still lands it */
  .cb-drop-x{position:absolute;top:4px;right:4px;width:28px;height:28px;padding:0;border:none;border-radius:50%;background:rgb(24 30 20 / .72);color:#fff;display:grid;place-items:center;cursor:pointer}
  .cb-drop-x::after{content:"";position:absolute;inset:-8px}
  .cb-drop-x:hover,.cb-drop-x:focus-visible{background:rgb(24 30 20 / .92);outline:none}
  .cb-drop-x svg{width:16px;height:16px}
  /* under the photo: the "Taken" caption and the date on one line */
  .cb-drop-date{display:flex;flex-direction:column;gap:2px;min-width:0}
  .cb-drop-taken{font-size:11px;color:var(--muted);font-weight:600}
  .cb-drop-date .cb-date-btn{min-height:32px;padding:0 var(--space-2);font-size:12px;gap:6px}
  .cb-drop-date .cb-date-btn svg{width:14px;height:14px}
  .cb-drop-date .cb-select-label{white-space:nowrap;overflow:visible}
  /* phones (a narrow picker): 3 to a row; the calendar icon goes so the date keeps its one line */
  @container photodrop (max-width:420px){
    .cb-drop-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-2)}
    .cb-drop-date .cb-date-btn svg{display:none}
    .cb-drop-tag.is-on{padding:3px 6px;font-size:10px;max-width:calc(100% - 38px)}   /* "Primary" fits beside the x in a ~95px card */
  }
  .cb-inp-row{display:flex;gap:6px} .cb-inp-row .cb-inp{flex:1}
  /* show/hide toggle beside a masked password input (formModal type:'password'); min-width:0 on the
     input lets the pair fit a 375px modal without overflowing */
  .cb-inp-row{min-width:0} .cb-inp-row .cb-inp{min-width:0;width:100%}
  .cb-pw-toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:var(--touch-min);padding:0;color:var(--text-2)}
  .cb-pw-toggle[aria-pressed="true"]{color:var(--accent-strong)}
  .cb-pw-toggle svg{flex:none;width:18px;height:18px}   /* keep the eye from being squeezed by inherited svg sizing */
  /* "Suggest" next ID: a secondary button beside the ID field (restyle slice 2) */
  .cb-suggest{border:1.5px solid var(--border-strong);background:var(--surface);border-radius:var(--radius-md);min-height:var(--h-control);padding:0 var(--space-3);font-size:var(--text-small);font-weight:600;font-family:inherit;color:var(--text-1);cursor:pointer;white-space:nowrap}
  .cb-suggest:hover{background:var(--hover-tint);border-color:var(--text-3)}
  /* Issue #18: a short brass glow on the ID input when "Suggest" fills it, so the new number is noticed.
     suggestNumber -> flashIdField() adds .cb-flash for 900ms (keep the two durations in step). Users who
     ask for reduced motion get a static outline for the same moment instead of the animation. */
  .cb-inp.cb-flash{animation:cb-flash .9s ease-out}
  /* restyle slice 2: the glow is the selection tint plus the accessible lime edge (was brass) */
  @keyframes cb-flash{0%{background:var(--accent-selected);box-shadow:0 0 0 3px var(--accent-strong)}100%{box-shadow:0 0 0 0 transparent}}
  @media (prefers-reduced-motion:reduce){.cb-inp.cb-flash{animation:none;box-shadow:0 0 0 2px var(--accent-strong)}}
  .cb-modal-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:18px}
  /* confirmDialog: a small in-app confirm, above any open form modal (appended last; same z-index). */
  .cb-confirm .cb-modal-card{width:min(420px,100%)}
  /* A one-field form dialog (formModal narrowCard, e.g. "Date this photo was taken"): the confirm
     dialog's width. Two classes, so it outweighs the wider desktop .cb-modal-card rule; on phones
     the bottom sheet is narrower than 420px anyway, so min() keeps it full width. */
  .cb-modal-card.cb-modal-narrow{width:min(420px,100%)}
  /* pre-line: a warning list ("• one
• two", matingWarningText / pastServiceWarningText) breaks onto
     its own lines; ordinary one-line messages are unchanged. */
  .cb-confirm-msg{margin:0;font-size:14px;line-height:1.5;color:var(--ink);white-space:pre-line}
  /* destructive OK (remove / delete) and a risky form confirm (Record a loss, formModal submitDanger):
     the guide's one solid danger fill */
  .cb-confirm .cb-confirm-danger,.cb-modal-card .cb-confirm-danger{background:var(--error-fill);color:var(--on-danger)}
  .cb-confirm .cb-confirm-danger:hover,.cb-modal-card .cb-confirm-danger:hover{background:var(--error-fill-hover)}
  /* modal secondary button (Cancel, Back): the guide's secondary look, 44px (restyle slice 2) */
  .cb-btn-ghost{background:var(--surface);border:1.5px solid var(--border-strong);color:var(--text-1);border-radius:var(--radius-md);min-height:var(--h-control);padding:0 var(--space-4);font-size:var(--text-body);font-weight:600;font-family:inherit;cursor:pointer}
  .cb-btn-ghost:hover{background:var(--hover-tint);border-color:var(--text-3)}
  .cb-select{position:relative}
  .cb-select-btn{display:flex;align-items:center;gap:8px;width:100%;text-align:left;cursor:pointer}
  .cb-select-label{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .cb-select-btn .chev{width:var(--icon-md);height:var(--icon-md);flex:none;color:var(--text-2)}
  /* Dropdown panel (UI guide, menus and searchable select; restyle slice 2): a floating layer, so
     border + --shadow-md; 44px options; the selected option gets the selected tint, the 1px ring
     and a tick at the end (never colour alone). Keyboard and Esc behaviour are Caleb's (#43, #44). */
  .cb-select-menu{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:20;display:flex;flex-direction:column;max-height:300px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:var(--space-2)}
  .cb-select-menu[hidden]{display:none}
  .cb-select-search{border:1.5px solid var(--input-border);border-radius:var(--radius-md);min-height:var(--h-control);padding:0 var(--space-3);font-family:inherit;font-size:var(--text-body);color:var(--text-1);background:var(--input-bg);outline:none;margin:var(--space-1) var(--space-1) var(--space-2)}
  @media (hover:hover) and (pointer:fine){ .cb-select-search{min-height:var(--h-control-dense)} }
  .cb-select-search:focus{border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  .cb-select-list{overflow-y:auto}
  .cb-select-opt{position:relative;display:block;width:100%;min-height:var(--touch-min);text-align:left;border:none;background:none;font-family:inherit;font-size:var(--text-body);line-height:1.3;color:var(--text-1);padding:12px 36px 12px var(--space-3);border-radius:var(--radius-sm);cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  /* A group heading inside a dropdown list (buildSelect option with heading: true, e.g. Add weighing's
     "Your headings"): the guide's overline, not a pickable row. */
  .cb-select-group{padding:var(--space-3) var(--space-3) var(--space-1);font-family:var(--font-display);font-weight:600;font-size:var(--text-overline);letter-spacing:.06em;text-transform:uppercase;color:var(--text-3);border-top:1px solid var(--border);margin-top:var(--space-1)}
  .cb-select-opt:hover{background:var(--hover-tint)}
  .cb-select-opt:focus-visible{box-shadow:inset 0 0 0 2px var(--accent-strong)}
  .cb-select-opt.on{background:var(--accent-selected);box-shadow:var(--selected-ring);color:var(--text-1);font-weight:600}
  .cb-select-opt.on::after{content:"";position:absolute;right:var(--space-3);top:50%;width:var(--icon-sm);height:var(--icon-sm);transform:translateY(-50%);background:var(--accent-strong);-webkit-mask:var(--ic-check) center/contain no-repeat;mask:var(--ic-check) center/contain no-repeat}
  .cb-select-empty{padding:var(--space-2) var(--space-3);font-size:var(--text-small);color:var(--text-3)}
  .cb-select-label.cb-ph{color:var(--placeholder-color);font-weight:400}
  /* buildSuggestInput (report "Animal ID No."): a text input + chevron + its own floating menu. Same
     frame and menu chrome as .cb-select, but its own class names on purpose — closeOtherMenus and the
     global scroll handler target .cb-select-menu, and this menu must stay outside that machinery. (Not .cb-suggest: that
     name is already the Add Animal form's "Suggest" number button above.)
     The menu is position:fixed and placed by floatMenu so it escapes the modal's overflow clipping. */
  .cb-typeahead{position:relative}
  .cb-typeahead .cb-inp{width:100%;padding-right:62px}   /* room for the clear (×) + chevron */
  .cb-typeahead-clear{position:absolute;top:0;bottom:0;right:34px;width:28px;display:flex;align-items:center;justify-content:center;border:none;background:none;color:var(--muted);cursor:pointer;padding:0}
  .cb-typeahead-clear[hidden]{display:none}
  .cb-typeahead-clear svg{width:14px;height:14px}
  .cb-typeahead-clear:hover{color:var(--ink)}
  .cb-typeahead-chev{position:absolute;top:0;right:0;bottom:0;width:34px;display:flex;align-items:center;justify-content:center;border:none;background:none;color:var(--ink);cursor:pointer;padding:0}
  .cb-typeahead-chev .chev{width:14px;height:14px;opacity:.6}
  .cb-typeahead-menu{position:fixed;z-index:30;max-height:300px;overflow-y:auto;overscroll-behavior:contain;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md);padding:var(--space-1)}
  .cb-typeahead-menu[hidden]{display:none}
  .cb-typeahead-opt{display:flex;flex-direction:column;gap:1px;padding:8px 10px;border-radius:6px;cursor:pointer;min-height:40px;justify-content:center}   /* ≥40px rows: comfortable tap targets */
  .cb-typeahead-opt:hover{background:var(--hover-tint)}
  .cb-typeahead-opt.on{background:var(--accent-selected);box-shadow:var(--selected-ring)}
  .cb-typeahead-id{font-size:var(--text-body);font-weight:600;color:var(--text-1);font-variant-numeric:tabular-nums}
  .cb-typeahead-opt.on .cb-typeahead-id{color:var(--text-1)}
  .cb-typeahead-name{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .cb-typeahead-empty{padding:var(--space-2) var(--space-3);font-size:var(--text-small);color:var(--text-3)}
  /* Date picker (UI guide, Date picker; restyle slice 2): a floating panel (border + --shadow-md,
     large radius); month title in Barlow Condensed; 38px day cells; today ringed in ink; the
     chosen day a lime fill with ink text. Behaviour (keyboard, Esc) stays as it is (#43, #44). */
  .cb-date-btn .cal{width:var(--icon-md);height:var(--icon-md);flex:none;color:var(--text-2)}
  .cb-date-menu{position:absolute;top:calc(100% + 4px);left:0;z-index:20;width:336px;max-width:calc(100vw - 32px);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-md);padding:var(--space-3)}
  .cb-date-menu[hidden]{display:none}
  .cb-date-head{display:flex;align-items:center;gap:8px;margin-bottom:8px}
  .cb-date-title{flex:1;text-align:center;font-weight:600;font-family:var(--serif);font-size:1.25rem;letter-spacing:.03em;color:var(--text-1)}
  /* The title doubles as a button in the day/month views (click to step up to the
     month/year picker). It inherits .cb-date-title's serif look; this only resets
     the <button> chrome and adds a hover affordance so it reads as clickable. */
  .cb-date-title-btn{border:none;background:none;color:var(--text-1);min-height:var(--h-control-dense);padding:0 var(--space-2);border-radius:var(--radius-md);cursor:pointer}
  .cb-date-title-btn:hover{background:var(--hover-tint)}
  /* prev / next: borderless icon buttons, 36px with a mouse, 44px on touch (guide .btn-ghost.icon-only) */
  .cb-date-nav{width:var(--touch-min);height:var(--touch-min);flex:none;border:1.5px solid transparent;background:transparent;border-radius:var(--radius-md);font-size:18px;line-height:1;color:var(--text-1);cursor:pointer}
  .cb-date-nav:hover{background:var(--hover-tint);border-color:var(--border-strong)}
  @media (hover:hover) and (pointer:fine){ .cb-date-nav{width:var(--h-control-dense);height:var(--h-control-dense)} }
  /* Month/year quick-pick grids: a 3×4 layout reusing the day-cell colour tokens so
     the three panels read as one picker. '.other' dims the two edge years that fall
     just outside the shown decade. */
  .cb-date-mgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
  .cb-date-mcell{height:var(--touch-min);display:flex;align-items:center;justify-content:center;border:none;background:none;font-family:inherit;font-size:var(--text-small);color:var(--text-1);border-radius:var(--radius-md);cursor:pointer;font-variant-numeric:tabular-nums}
  .cb-date-mcell:hover{background:var(--hover-tint)}
  .cb-date-mcell.other{color:var(--text-3)}
  .cb-date-mcell.today{box-shadow:inset 0 0 0 1.5px var(--text-1)}
  .cb-date-mcell.on{background:var(--accent);color:var(--on-accent);font-weight:600}
  /* touch (the base): day cells are full 44px touch rows with no gap, the panel up to 336px; with a
     mouse they are square, at least 36px, in a 320px panel with a 2px gap (UI guide date picker) */
  .cb-date-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:0}
  .cb-date-wd{text-align:center;font-size:.75rem;color:var(--text-3);font-weight:600;padding:var(--space-1) 0}
  .cb-date-cell{height:var(--touch-min);display:flex;align-items:center;justify-content:center;border:none;background:none;font-family:inherit;font-size:var(--text-small);color:var(--text-1);border-radius:var(--radius-md);cursor:pointer;font-variant-numeric:tabular-nums}
  .cb-date-cell.other{color:var(--text-3)}
  @media (hover:hover) and (pointer:fine){
    .cb-date-menu{width:320px}
    .cb-date-grid{gap:2px}
    .cb-date-cell{height:auto;aspect-ratio:1;min-height:var(--h-control-dense)}
  }   /* days of the previous / next month (Monday-first grid) */
  .cb-date-cell:not(.empty):hover{background:var(--hover-tint)}
  .cb-date-cell.today{box-shadow:inset 0 0 0 1.5px var(--text-1)}
  .cb-date-cell.on{background:var(--accent);color:var(--on-accent);font-weight:600}
  .cb-date-foot{display:flex;justify-content:space-between;margin-top:var(--space-2);padding-top:var(--space-2);border-top:1px solid var(--border)}
  /* foot: Clear (ghost) and Today (secondary) as real buttons; dense 36px with a mouse */
  .cb-date-foot .btn{font-size:var(--text-small);padding:0 var(--space-3)}
  @media (hover:hover) and (pointer:fine){ .cb-date-foot .btn{min-height:var(--h-control-dense)} }
  /* A day after the picker's max (buildDate f.max, e.g. no future service or calving date, issue #38):
     still shown so the month reads normally, but muted, with no hover and the disabled cursor. The
     disabled opacity token keeps it in step with every other disabled control. */
  .cb-date-cell:disabled{opacity:var(--disabled-opacity);cursor:not-allowed}
  .cb-date-cell:disabled:hover{background:none}

  /* Bulk Service screen: "N cows were not serviced" (issue #38). The rows copy the Service screen's
     cow rows (slice 6, the guide's .cow-row): bordered rows at least 56px high with a small gap, the
     inline ear tag, then the name over the reason as a caption. The list scrolls inside the dialog when
     many cows were skipped, so the OK button stays in reach. Tokens only, so dark mode follows. */
  .cb-skip-sum{margin:0 0 var(--space-3)}
  .cb-skip-list{list-style:none;margin:0;padding:0;display:grid;gap:var(--space-1);max-height:min(50vh,360px);overflow-y:auto;overscroll-behavior:contain}
  .cb-skip-row{display:flex;align-items:center;gap:var(--space-3);min-height:56px;box-sizing:border-box;padding:var(--space-2) var(--space-3);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);color:var(--text-1)}
  .cb-skip-row .tag{flex:none}
  .cb-skip-m{display:grid;gap:2px;flex:1 1 auto;min-width:0}
  .cb-skip-m b{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

  /* Animal record > Mating tab, past services (issue #38): the toolbar with its caption and the
     "Add past service" button, and the "Entered later" pill beside a backfilled row's service date. */
  .pastsvc-bar{margin-bottom:var(--space-2)}
  .pastsvc-hint{margin:0 auto 0 0}
  .pastsvc-badge{margin-left:var(--space-2)}
  /* Record service modal: "She already has an open service" heads-up when the picked cow is still on
     the board (issue #38). Info tint with body text, so it reads as advice; the save still decides. */
  .cb-svc-open{margin-top:var(--space-3);padding:var(--space-2) var(--space-3);border-radius:var(--radius-md);background:var(--info-tint);color:var(--text-1);font-size:var(--text-small);line-height:1.45}
  .cb-svc-open[hidden]{display:none}
  @media (max-width:768px){
    /* phones: every modal docks to the bottom as a sheet (UI guide, Modal), full width, top
       corners rounded, so the actions sit under the thumb (restyle slice 2) */
    .cb-modal{padding:0;place-items:end stretch}
    .cb-modal-card,.cb-confirm .cb-modal-card{width:100%;max-height:92vh;padding:0 16px 18px;border-radius:var(--radius-lg) var(--radius-lg) 0 0}
    /* phones: the sticky header spans the card's 16px side padding instead of the 24px one */
    .cb-modal-h{margin:0 -16px 14px;padding:12px 16px}
    .cb-grid,.cb-grid.cb-grid-2{grid-template-columns:1fr}
    .cb-grid .cb-lbl.span2{grid-column:auto}
    .cb-modal-actions{flex-direction:column-reverse}
    .cb-modal-actions>*{width:100%}
  }

  /* ---------- desktop: fit modals to the viewport using horizontal space ----------
     On phones a modal is a tall single column that scrolls (see the max-width:768px
     block above), and that is correct there. On desktop a scrolling modal wastes the
     wide screen — especially the New-animal wizard's step 1, whose ~24 fields in a
     2-column grid run well past 90vh. Here we spend the horizontal room instead of
     scrolling: .cb-grid flows into as many ~230px columns as the card is wide (via
     auto-fit, which only creates as many tracks as there are fields, so a small
     breed/herd/contact form stays 2-up and never shows empty columns), and the
     New-animal wizard card is widened so its long form lays out ~4 columns deep and
     lands inside the viewport. The .cb-modal-card max-height:90vh + overflow:auto from
     the base rule is intentionally kept as a last-resort fallback: on a genuinely short
     screen where even this layout cannot fit, the content stays reachable rather than
     being clipped off-screen. In normal desktop use nothing scrolls. */
  @media (min-width:769px){
    /* Generic modals: a bit wider than the 560px base so a field-heavy form (e.g. Edit
       animal, ~18 fields) flows into ~3 columns and lands inside the viewport instead of
       scrolling. auto-fit only creates as many tracks as there are fields, so a small
       breed/herd/contact form collapses to 2-up (or 1 row) and never shows empty columns. */
    .cb-modal-card{width:min(760px,100%)}
    .cb-grid{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
    .cb-grid.cb-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
    /* Field-heavy modals — the New-animal wizard (24-field step 1) and the Edit-animal form
       (.cb-modal-wide, ~20 fields), the two tallest forms in the app — get a wide card and
       tighter (~6-up) columns. At ~4 field-rows deep the whole form fits the viewport height
       on any normal desktop without scrolling (the fields here are short — numbers and narrow
       selects — so ~165px columns stay perfectly legible). */
    .cb-wizard,.cb-modal-wide{width:min(1120px,100%)}
    .cb-wizard .cb-grid,.cb-modal-wide .cb-grid{grid-template-columns:repeat(auto-fit,minmax(165px,1fr))}
    /* Restyle slice 2: with 44px fields the tallest forms can now pass 90vh on a laptop, so the
       action bar sticks to the bottom of the card here too (the guide's modal footer: white, a
       hairline on top), exactly as the phone block does. The negative side margins pull it edge
       to edge over the card's 24px padding; it keeps its place in the flow, so it never covers
       the last field. */
    .cb-modal-card{padding-bottom:0}
    .cb-modal-actions{position:sticky;bottom:0;z-index:3;margin:18px -24px 0;padding:12px 24px;background:var(--surface);border-top:1px solid var(--border)}
    /* One fixed size per modal kind on a laptop (Andre, 20 Nov 2026): confirm 420px wide, standard
       760px, field-heavy 1120px (the widths above), each with the fixed 68px header and footer. The
       step-by-step New animal form also keeps ONE height across its steps, so the card no longer
       grows and shrinks (and the buttons no longer jump) as you step through it; its body (the
       .has-body layout at the end of this file) fills the height and scrolls. Only the card's size
       is set here; the form's fields and its Back / Next buttons are untouched. */
    .cb-wizard{height:min(760px,90vh)}
  }

  /* ---------- report page (reports redesign S2, features/reports-redesign.md) ----------
     /reports/<key>: back to the directory, the report's name and question, CSV and Generate PDF, then
     one panel with the row count and the filter chips on top and the document under them. Mobile
     first; the layout follows the page's own width (container rpx). The chips are today's form fields
     (buildParamField's .cb-lbl + .cb-inp) restyled as pills, so the selects, the typeahead and the
     cascade are the same tested controls; only their look changes here. */
  #reports .rp-x{container:rpx / inline-size}
  .rp-x[hidden],.rd-x[hidden]{display:none}
  .rp-head{display:grid;grid-template-columns:minmax(0,1fr);gap:var(--space-2) var(--space-4);margin-bottom:var(--space-4)}
  .rp-back{justify-self:start;display:inline-flex;align-items:center;gap:var(--space-1);min-height:var(--touch-min);padding:0;background:none;border:0;font:inherit;font-weight:600;color:var(--accent-strong);cursor:pointer}
  /* One header while a report is open (Kobus, 20 Nov 2026): the screen's own page header ("Reports /
     Herd and animals") is hidden, and the report's head takes its place: the back link as the small
     line above (in the caption's place), the report's name as the page's h1, at the page header's
     spacing. The back link keeps a 44px tap height; the negative margin stops that height from
     opening a gap above the title. */
  main:has(> #reports.on > .rp-x:not([hidden])) > .ph{display:none}
  #reports.on:has(> .rp-x:not([hidden])){padding-top:var(--space-4)}
  .rp-head{row-gap:0}
  .rp-back{min-height:var(--touch-min);margin:calc(var(--space-2) * -1) 0 calc(var(--space-1) * -1);font-size:var(--text-small)}
  /* the remove (x) on a chip that came from Add filter: a small round button at the chip's end, with a
     44px tap area on touch screens (::after), so the pill itself keeps its 36px height */
  .rp-chips .rp-chip-x{position:relative;flex:none;display:inline-grid;place-items:center;width:24px;height:24px;margin-left:2px;padding:0;border:0;border-radius:var(--radius-full);background:transparent;color:var(--text-3);cursor:pointer}
  .rp-chips .rp-chip-x::before{content:"";width:12px;height:12px;background:currentColor;-webkit-mask:var(--ic-x) center/contain no-repeat;mask:var(--ic-x) center/contain no-repeat}
  .rp-chips .rp-chip-x:hover{background:var(--hover-tint);color:var(--text-1)}
  .rp-chips .rp-chip-x:focus-visible{outline:none;box-shadow:var(--focus-ring)}
  @media (pointer:coarse){ .rp-chips .rp-chip-x::after{content:"";position:absolute;inset:-10px} }
  .rp-add[hidden]{display:none}
  .rp-back:hover{text-decoration:underline}
  .rp-back:focus-visible{outline:none;box-shadow:var(--focus-ring);border-radius:var(--radius-sm)}
  .rp-titles h1{margin:0;font:600 var(--text-h1)/1.15 var(--font-display);color:var(--text-1)}
  .rp-titles .caption{margin:var(--space-1) 0 0;color:var(--text-3)}
  .rp-acts{display:flex;flex-wrap:wrap;gap:var(--space-2)}
  .rp-acts .btn{min-height:var(--touch-min)}
  .rp-top{padding:var(--space-3) var(--space-4);border-bottom:1px solid var(--border)}
  .rp-count{margin:0 0 var(--space-2);color:var(--text-3)}
  .rp-count:empty{display:none}
  /* the chip row: one wrapping row of pills, each a field's label (muted) then its value (bold) */
  .rp-chips{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2)}
  .rp-chips .cb-lbl{flex-direction:row;align-items:center;gap:var(--space-1);min-height:var(--touch-min);margin:0;padding:0 var(--space-1) 0 var(--space-3);border:1px solid var(--border-strong);border-radius:var(--radius-full);background:var(--surface);font-size:var(--text-small);font-weight:400;color:var(--text-3)}
  .rp-chips .cb-lbl[hidden]{display:none}
  /* Compact chips (Kobus, 20 Nov 2026: too much padding): tighter sides, and 36px tall with a mouse, as
     DESIGN.md decided for dense chips (decision 3, 2 Nov); touch keeps the 44px target. */
  .rp-chips .cb-lbl{padding:0 var(--space-1) 0 var(--space-3);gap:2px}
  /* (the inside padding is set once for every state in the .rp-chips .cb-inp rule below: a separate
     rule here made a hovered chip 8px wider than a resting one, so it jumped under the pointer) */
  .rp-chips .cb-select-btn{gap:var(--space-1)}
  @media (pointer:fine){ .rp-chips .cb-lbl,.rp-chips .rp-add-btn{min-height:36px} .rp-chips .cb-inp,.rp-chips .cb-select-btn{min-height:34px} }
  .rp-chips .cb-lbl:focus-within{color:var(--text-2);border-color:var(--accent-strong);box-shadow:0 0 0 1px var(--accent-strong)}
  .rp-chips .cb-select{min-width:0}
  /* floatMenu sizes a select's menu to its button, which is only as wide as a chip's value ("All"), so
     the options were cut off ("Activ"); min-width wins over that inline width */
  .rp-chips .cb-select-menu{min-width:220px}
  .rp-chips .cb-inp,.rp-chips .cb-inp:hover,.rp-chips .cb-inp:focus,.rp-chips .cb-inp:focus-visible{min-height:36px;padding:0 var(--space-1);border:0;background:transparent;box-shadow:none;font-size:var(--text-small);font-weight:600;color:var(--text-1)}
  .rp-chips input.cb-inp[type="number"]{width:7ch}
  .rp-chips input.cb-inp[type="text"]{width:11ch}
  .rp-chips .cb-inp-static{display:flex;align-items:center}
  /* the yes/no option: the box first, then its words, all inside the pill */
  .rp-chips .cb-check{padding-right:var(--space-3);color:var(--text-1);font-weight:600}
  /* Add filter (past six fields): a dashed pill opening a small menu of the report's other fields */
  .rp-add{position:relative}
  .rp-add-btn{list-style:none;display:inline-flex;align-items:center;min-height:var(--touch-min);padding:0 var(--space-3);border:1px dashed var(--border-strong);border-radius:var(--radius-full);font-size:var(--text-small);font-weight:600;color:var(--text-2);cursor:pointer}
  .rp-add-btn::-webkit-details-marker{display:none}
  .rp-add-btn:focus-visible{outline:none;box-shadow:var(--focus-ring)}
  .rp-add-menu{position:absolute;z-index:var(--z-dropdown);top:calc(100% + var(--space-1));left:0;min-width:220px;padding:var(--space-2);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-lg)}
  .rp-add-menu .caption{margin:0 var(--space-2) var(--space-1);color:var(--text-3)}
  .rp-add-menu button{display:block;width:100%;min-height:var(--touch-min);padding:0 var(--space-2);background:none;border:0;border-radius:var(--radius-sm);font:inherit;color:var(--text-1);text-align:left;cursor:pointer}
  .rp-add-menu button:hover{background:var(--hover-tint)}
  /* the document: the A4 sheet on the inset grey, like paper on a desk (white in dark mode too) */
  .rp-doc[aria-busy="true"]{opacity:.55;transition:opacity var(--duration-fast) var(--ease-out)}
  .rp-bed{padding:var(--space-4);background:var(--surface-2);overflow-x:auto}
  .rp-bed .cb-rp-sheet{width:auto;max-width:1123px;margin:0 auto}
  /* phone: the same document as readable lines (tag, name, status; then the details) */
  .rp-doc.has-lines .rp-bed{display:none}
  .rp-lines{list-style:none;margin:0;padding:0}
  .rp-lines li{padding:var(--space-2) var(--space-4);border-top:1px solid var(--border)}
  .rp-lines li:first-child{border-top:0}
  .rp-line-1{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-2)}
  .rp-line-st{margin-left:auto;font-size:var(--text-small);color:var(--text-2)}
  /* Line 2 is ONE line (the approved two-line row, about 62px; click-through 20 Nov 2026 found 5 or 6
     line run-on rows): buildReportLines keeps three details, and a long one is cut with an ellipsis.
     The full row is on the PDF and the CSV. Line 1 stays on one line too, the name giving way first. */
  .rp-line-2{margin-top:2px;font-size:var(--text-small);color:var(--text-3);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .rp-line-1{flex-wrap:nowrap;min-width:0}
  .rp-line-1 b{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .rp-line-1 .tag,.rp-line-st{flex:none}
  /* Phones (under the 640px container break): the filter chips are ONE row that scrolls sideways, as
     approved (reports review G9), instead of wrapping onto four rows and pushing the first animal below
     the fold (click-through, 20 Nov 2026). An arrow on a fade sits over each end that has more chips past it (addScrollCues; Kobus, 20 Nov: a
     fixed fade alone read as cut off), so a farmer can see and tap to scroll. The
     chips' own menus are position:fixed (floatMenu), so the scrolling row never clips them; the Add
     filter menu opens as a bottom sheet here for the same reason. From 640px they wrap again (below). */
  .rp-chips{flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;padding-bottom:2px}
  .rp-chips::-webkit-scrollbar{display:none}
  .rp-chips>*{flex:none}
  .rp-add-menu{position:fixed;top:auto;left:0;right:0;bottom:0;border-radius:var(--radius-lg) var(--radius-lg) 0 0;padding-bottom:calc(var(--space-2) + env(safe-area-inset-bottom, 0px))}
  .rp-lines .rp-line-grp{font-weight:600;color:var(--text-1);background:var(--surface-2)}
  /* ---------- graph reports (reports redesign S3) ----------
     The chart or the table in the panel, with a Chart / Table switch (two .chip buttons) on top.
     Lying-down bars (.hb, per herd and per camp): the whole name on the left, wrapping instead of
     being cut, the bar in the middle (width from --w, set through CSSOM) and the value in ink. */
  .rp-graph{padding:var(--space-4)}
  .rp-gswitch{display:flex;gap:var(--space-2);margin-bottom:var(--space-4)}
  .rp-gtable{overflow-x:auto}
  .rp-gtable table{width:100%;border-collapse:collapse;font-size:var(--text-small)}
  .rp-gtable th,.rp-gtable td{padding:var(--space-2) var(--space-3);border-bottom:1px solid var(--border);text-align:left;white-space:nowrap}
  .rp-gtable th{color:var(--text-2);font-weight:600}
  .rp-gtable .cb-rp-num{text-align:right;font-variant-numeric:tabular-nums}
  .hb{list-style:none;margin:0;padding:0;display:grid;gap:var(--space-2)}
  .hb li{display:grid;grid-template-columns:minmax(0,38%) minmax(0,1fr) auto;align-items:center;gap:var(--space-3)}
  .hb-l{font-size:var(--text-small);color:var(--text-1);overflow-wrap:anywhere}
  .hb-t{display:block;height:18px}
  .hb-b{display:block;width:var(--w,0%);height:100%;min-width:2px;border-radius:0 4px 4px 0;background:var(--chart-1);-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .hb-v{font:600 var(--text-small)/1 var(--font-body);color:var(--text-1);font-variant-numeric:tabular-nums}
  /* the Herd card's chart title line is the button that opens Herd composition; the bars open it too */
  .rd-comp figcaption{margin:0}
  .rd-comp .rd-comp-h{width:100%;padding:var(--space-1) 0;background:none;border:0;font:inherit;color:var(--text-1);text-align:left;cursor:pointer;border-radius:var(--radius-sm)}
  .rd-comp .rd-comp-h:hover .rl-n{text-decoration:underline}
  .rd-comp .rd-comp-h:focus-visible{outline:none;box-shadow:var(--focus-ring)}
  .rd-comp .ch-host{cursor:pointer}
  @container rpx (min-width:640px){
    .rp-head{grid-template-columns:minmax(0,1fr) auto;align-items:end}
    .rp-back{grid-column:1 / -1}
    .rp-doc.has-lines .rp-bed{display:block}
    /* the A4 sheet scrolls inside its own box, sized to the window by fitReportSheet() (Kobus, 20 Nov
       2026), so the title, buttons and chips above it stay on screen; the page itself does not scroll */
    .rp-bed{max-height:var(--rp-bed-h,none);overflow:auto;overscroll-behavior:contain}
    .rp-lines{display:none}
    /* wide enough: the chips wrap onto a second line again, no fade, and Add filter drops down */
    .rp-chips{flex-wrap:wrap;overflow:visible}
    .rp-add-menu{position:absolute;top:calc(100% + var(--space-1));left:0;right:auto;bottom:auto;border-radius:var(--radius-md);padding-bottom:var(--space-2)}
  }
  /* ---------- charts (UI guide #charts; restyle slice 4b) ----------
     Bar and grouped bar, built by buildBarChart() in app.js. One grid: each group puts its bars in
     row 1 (above the baseline) and its label in row 2, so the baseline runs unbroken across the plot.
     Values sit on the bars in ink, never in the series colour (ochre is only 3.6:1). Series 1 steel
     blue, 2 ochre and always hatched (greyscale print), 3 plum; no lime and no status colours. */
  .chart{margin:0}
  .chart figcaption{display:grid;gap:2px;margin-bottom:var(--space-3)}
  .chart figcaption b{font-size:var(--text-h3);font-family:var(--font-display);font-weight:600;color:var(--text-1)}
  .ch-legend{display:flex;flex-wrap:wrap;gap:var(--space-2) var(--space-4);margin:0 0 var(--space-2);padding:0;list-style:none;font-size:var(--text-small);color:var(--text-2)}
  .ch-legend li{display:flex;align-items:center;gap:var(--space-2)}
  .ch-key{width:12px;height:12px;border-radius:2px;background:var(--chart-1);-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .ch-key.s2,.ch-bar.s2{background:var(--chart-hatch),var(--chart-2)}
  .ch-key.s3,.ch-bar.s3{background:var(--chart-3)}
  .ch-plot{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);grid-template-rows:180px auto}
  .ch-grp{display:contents}
  .ch-bars{grid-row:1;display:flex;align-items:flex-end;justify-content:center;gap:2px;padding:var(--space-6) var(--space-1) 0;border-bottom:1px solid var(--border-strong)}
  .ch-bar{position:relative;flex:0 1 44px;height:var(--v, 0%);min-height:2px;border-radius:4px 4px 0 0;background:var(--chart-1);-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .ch-val{position:absolute;bottom:100%;left:50%;transform:translateX(-50%);padding-bottom:4px;font:600 var(--text-caption)/1 var(--font-body);color:var(--text-1);white-space:nowrap;font-variant-numeric:tabular-nums}
  .ch-x{grid-row:2;padding:var(--space-2) var(--space-1) 0;text-align:center;font-size:var(--text-caption);color:var(--text-2);overflow-wrap:anywhere}
  .ch-plot.is-one{grid-auto-columns:minmax(0,160px)}
  .ch-empty{display:grid;place-items:center;gap:var(--space-3);min-height:180px;padding:var(--space-5);border:1px dashed var(--border-strong);border-radius:var(--radius-md);text-align:center;color:var(--text-2)}
  .ch-empty p{margin:0}

  /* ---------- studbook ---------- */
  .sbstat{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:20px}

  /* ---------- setup (UI guide #setup; restyle slice 4f) ---------- */
  /* The Setup panel is a size container, so a settings row folds by the PANEL's width: the label and
     helper on the left with the control on the right when there is room, the control under the text
     at full width when there is not. */
  #setup > .panel{container:set / inline-size}
  /* nine sections: one tab line that scrolls sideways when narrow, never three ragged rows */
  #setup .tabs{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}
  .setrow{display:grid;gap:var(--space-2);padding:var(--space-4) 0;border-top:1px solid var(--border)}
  .setrow:first-child{border-top:0}
  .setrow .info{min-width:0}
  .setrow .info .k{display:block;font-weight:600;color:var(--text-1)}
  .setrow .info .s{margin-top:2px;font-size:var(--text-small);color:var(--text-2)}
  @container set (min-width:560px){
    .setrow{grid-template-columns:minmax(0,1fr) 240px;column-gap:var(--space-5);align-items:center}
    .setrow > :not(.info){grid-column:2}
    .setrow > .toggle{justify-self:end}
  }
  /* the switch keeps its own size; in a narrow panel it sits under the text on the left */
  .setrow > .toggle{justify-self:start}
  /* number fields carry their unit in the field (guide .input-unit): the input, then the unit box */
  .setrow .set-inp-wrap{display:flex;align-items:stretch;width:100%}
  .setrow .inp,.setrow .set-inp-wrap .inp{flex:1;min-width:0;width:100%;min-height:var(--h-control);padding:0 var(--space-3);border:1.5px solid var(--input-border);border-radius:var(--radius-md);background:var(--surface);font:400 var(--text-body)/1.2 var(--font-body);color:var(--text-1);text-align:right;font-variant-numeric:tabular-nums}
  .setrow .set-inp-wrap .inp{border-top-right-radius:0;border-bottom-right-radius:0}
  .setrow .set-unit{display:grid;place-items:center;flex:none;padding:0 var(--space-3);border:1.5px solid var(--input-border);border-left:0;border-radius:0 var(--radius-md) var(--radius-md) 0;background:var(--surface-2);color:var(--text-2);font-weight:600;font-size:var(--text-small)}
  .setrow input.set-num:focus{outline:none;border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  .setrow input.set-num:disabled{background:var(--surface-2);color:var(--text-2)}
  /* clean text-field look: no native spinner arrows */
  .setrow input.set-num::-webkit-outer-spin-button,.setrow input.set-num::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
  .setrow input.set-num{-moz-appearance:textfield;appearance:textfield}
  /* the searchable select (buildSelect) in a settings row: the same field frame as the number inputs.
     Only the frame and width are set here; the menu, options and keyboard are the shared component's. */
  .setrow .cb-select{width:100%}
  .setrow .cb-select-btn{min-height:var(--h-control);padding:0 var(--space-3);border:1.5px solid var(--input-border);border-radius:var(--radius-md);background:var(--surface);font:400 var(--text-body)/1.2 var(--font-body);color:var(--text-1)}
  .setrow .cb-select-btn:focus-visible{outline:none;border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  /* No menu rule here: floatMenu() pins every open select menu to the viewport (position:fixed) and
     sets its left and width to the field's, so a min-width:100% here meant 100% of the SCREEN and the
     Setup menus ran the full window width (Caleb, 26 Nov 2026). The shared placement is enough. */
  /* Animal values: the currency sits in the field before the amount (the same unit box, on the left) */
  #s-val .val-wrap{display:flex;align-items:stretch;width:180px;max-width:100%}
  #s-val .val-cur{display:grid;place-items:center;flex:none;padding:0 var(--space-3);border:1.5px solid var(--input-border);border-right:0;border-radius:var(--radius-md) 0 0 var(--radius-md);background:var(--surface-2);color:var(--text-2);font-weight:600;font-size:var(--text-small)}
  #s-val .val-wrap input.val-inp{flex:1;min-width:0;min-height:var(--h-control);padding:0 var(--space-3);border:1.5px solid var(--input-border);border-radius:0 var(--radius-md) var(--radius-md) 0;background:var(--surface);font:400 var(--text-body)/1.2 var(--font-body);color:var(--text-1);text-align:right;font-variant-numeric:tabular-nums}
  #s-val .val-wrap input.val-inp:focus{outline:none;border-color:var(--input-border-focused);box-shadow:var(--focus-ring-input)}
  #s-val .val-wrap input.val-inp::-webkit-outer-spin-button,#s-val .val-wrap input.val-inp::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
  #s-val .val-wrap input.val-inp{-moz-appearance:textfield;appearance:textfield}

  /* Phones (below 768px, guide #setup): the sections are a list. Each row names the section with a
     one-line hint and opens it as its own page with a Back link, so nobody scrolls a strip of nine
     tabs. app.js builds .set-links from the tab buttons and sets #setup.is-section while one is open. */
  .set-links,.set-back{display:none}
  .set-links{list-style:none;margin:0;padding:0}
  .set-links > li + li{border-top:1px solid var(--border)}
  .set-link{display:flex;align-items:center;gap:var(--space-3);width:100%;min-height:var(--touch-min);padding:var(--space-3) var(--space-4);background:none;border:0;font:inherit;text-align:left;color:var(--text-1);cursor:pointer}
  .set-link:hover{background:var(--hover-tint)}
  .set-link:focus-visible{outline:2px solid var(--accent-strong);outline-offset:-2px}
  .set-link .pick-m{display:grid;gap:2px;flex:1;min-width:0}
  .set-link .pick-m b{font-weight:600}
  .set-link > svg{flex:none;width:var(--icon-sm);height:var(--icon-sm);color:var(--text-3)}
  .set-back{align-items:center;flex-wrap:wrap;gap:var(--space-1) var(--space-3);padding:var(--space-2) var(--space-4) 0}
  .crumb-back{display:inline-flex;align-items:center;gap:var(--space-1);min-height:var(--touch-min);padding:0 var(--space-2) 0 0;background:none;border:0;font:600 var(--text-small)/1 var(--font-body);color:var(--text-1);cursor:pointer;text-decoration:underline;text-underline-offset:3px}
  .crumb-back svg{width:var(--icon-sm);height:var(--icon-sm)}
  .set-back-t{flex:1 1 100%;margin:0;font:600 var(--text-h2)/1.2 var(--font-display);color:var(--text-1)}
  .set-back-t:focus{outline:none}   /* focused by app.js only to move a screen reader to the section; not a control */
  @media (max-width:767px){
    #setup .tabs{display:none}
    #setup:not(.is-section) .set-links{display:block}
    #setup:not(.is-section) .tabpane.on{display:none}
    #setup.is-section .set-back{display:flex}
  }
  #s-val input.val-inp::-webkit-outer-spin-button,#s-val input.val-inp::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
  #s-val input.val-inp{-moz-appearance:textfield;appearance:textfield}
  /* The value column: its heading and the "R <amount>" boxes both start on the column's left edge
     (Kobus, 20 Nov 2026: the heading sat at the far right while the boxes, a flex block that
     text-align cannot move, sat on the left, so the two did not line up). */
  #s-val th:last-child,#s-val td:last-child{text-align:left}
  /* Setup row actions (Breeds, Ease of birth, Team): the pencil / trash .dact icons
     from rowIconActionsCell() in app.js, side by side at the right of the row. */
  .row-icon-acts{display:flex;gap:4px;justify-content:flex-end}
  /* Grading type selector (Bulls / Cows / Oxen / Calves). app.js renders the strip
     with no side margin; dropping the shared .seg-tabs side padding and matching
     each tab's padding to the table cells (16px, 12px on phones below) puts the
     first label on the same line as the "Trait" column and the underline flush
     with the table edge. */
  #s-grade .seg-tabs{padding:0}
  #s-grade .seg-tab{padding-left:16px;padding-right:16px}
  /* Grading tab — numeric inputs matched to the rest of Setup.
     The trait table (renderGradingTable) emits bare number inputs (.inp.num.g-*),
     which otherwise render full-width and unstyled next to the compact bordered
     boxes every other Setup tab uses. Scope the shared Setup field look to the
     grading cells so weight/low/high read as one family with the page, and keep
     each box a fixed width so it sits inline instead of stretching the column. */
  #s-grade .inp{border:1px solid var(--line);background:var(--surface-2);border-radius:6px;padding:7px 11px;font-size:13px;font-weight:600;font-family:inherit;width:120px;text-align:right;outline:none}
  #s-grade .inp:focus{border-color:var(--green)}
  /* strip the native number spinners — the rest of Setup uses clean text-style fields */
  #s-grade .inp::-webkit-outer-spin-button,#s-grade .inp::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
  #s-grade .inp{-moz-appearance:textfield;appearance:textfield}
  /* Toggle drawn as the guide's switch track (restyle slice 2): on = lime track, ink knob on the
     right; off = light track with a 3:1 edge, grey knob on the left. Still the div role=switch
     from app.js; the real-checkbox switch (and aria-checked) is the a11y follow-up. */
  .toggle{width:44px;height:26px;flex:none;border-radius:var(--radius-full);background:var(--accent);border:1.5px solid var(--accent-strong);position:relative;cursor:pointer;transition:background var(--duration-base) var(--ease-out),border-color var(--duration-base) var(--ease-out)}
  .toggle::after{content:"";position:absolute;top:2px;right:2px;width:19px;height:19px;border-radius:50%;background:var(--on-accent);transition:background var(--duration-base) var(--ease-out)}
  .toggle.off{background:var(--surface-2);border-color:var(--input-border)} .toggle.off::after{right:auto;left:2px;background:var(--text-3)}

  /* ---------- contacts (UI guide #contacts and #azindex; restyle slice 4e) ---------- */
  /* group chips sit on their own row above the index; the New contact button lives in the list panel's header */
  .ct-chips{margin-bottom:var(--space-3)}
  /* A to Z index: 7 per row on phones keeps every letter a full 44px target, 13 from 600px, all 26
     from 1024px. Letters with no contact are disabled, not hidden, so the row never shifts. */
  .az{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;margin:0 0 var(--space-4)}
  @media (min-width:600px){ .az{grid-template-columns:repeat(13,minmax(0,1fr))} }
  @media (min-width:1024px){ .az{grid-template-columns:repeat(26,minmax(0,1fr))} }
  .az-l{min-height:var(--touch-min);padding:0;background:none;border:0;border-radius:var(--radius-sm);font:600 1.125rem/1 var(--font-display);color:var(--text-1);cursor:pointer}
  .az-l:hover{background:var(--hover-tint)}
  .az-l.is-on{background:var(--accent-selected);box-shadow:var(--selected-ring)}
  .az-l:disabled{color:var(--text-3);opacity:var(--disabled-opacity);cursor:default;background:none}
  /* header: title, then the count and New contact together on the right (as the dashboard's attention panel) */
  .ct-panel .panel-h .caption{margin-left:auto}
  .ct-panel .panel-h .btn{margin-left:0}
  /* avatar (guide .avatar.av-sm): 28px initials circle; the tint is picked per contact by app.js */
  .avatar{display:inline-grid;place-items:center;flex:none;border-radius:50%;overflow:hidden;font-weight:600;background:var(--surface-2);box-shadow:inset 0 0 0 1px var(--border);color:var(--text-1)}
  .av-sm{width:28px;height:28px;font-size:.6875rem}
  .av-c1{background:var(--info-tint);color:var(--info)} .av-c2{background:var(--success-tint);color:var(--success)}
  .av-c3{background:var(--warning-tint);color:var(--warning)} .av-c4{background:var(--accent-tint);color:var(--text-1)}
  /* 44px icon button (guide .icon-btn): call and email links on a contact row */
  .icon-btn{min-width:var(--touch-min);min-height:var(--touch-min);display:inline-grid;place-items:center;background:transparent;border:1px solid transparent;border-radius:var(--radius-md);color:var(--text-1);cursor:pointer;transition:background var(--duration-fast) var(--ease-out)}
  .icon-btn:hover{background:var(--hover-tint)}
  .icon-btn svg{width:var(--icon-md);height:var(--icon-md)}
  /* the list panel is a size container, so the row folds by the PANEL's width, not the window's */
  .ct-panel{container:ct / inline-size}
  .ct-list{list-style:none;margin:0;padding:0}
  .ct-list > li + li{border-top:1px solid var(--border)}
  .ct-row{display:flex;align-items:center;gap:var(--space-3);padding:var(--space-2) var(--space-2) var(--space-2) var(--space-4)}
  .ct-open{display:flex;align-items:center;gap:var(--space-3);flex:1;min-width:0;min-height:var(--touch-min);padding:0;background:none;border:0;border-radius:var(--radius-sm);font:inherit;text-align:left;color:var(--text-1);cursor:pointer}
  .ct-open:hover b{text-decoration:underline}
  .ct-open .pick-m{display:grid;flex:1;min-width:0}
  .ct-open .pick-m b{font-weight:600;overflow-wrap:anywhere}
  .ct-cat,.ct-tel{display:none;flex:none;font-size:var(--text-small);color:var(--text-2)}
  /* two icon slots always reserved, so the category and number columns line up when a contact has no email */
  .ct-acts{display:flex;flex:none;justify-content:flex-end;min-width:calc(var(--touch-min) * 2)}
  .ct-acts .icon-btn{color:var(--accent-strong)}
  @container ct (min-width:560px){
    .ct-cat{display:block;width:120px}
    .ct-tel{display:block;width:130px}
    .ct-sub-cat{display:none}
  }
  /* the opened contact: every stored field as a key-value list, then Delete and Edit */
  .ct-item.is-open{background:var(--surface-2)}
  .ct-detail{padding:0 var(--space-4) var(--space-4) calc(var(--space-4) + 28px + var(--space-3))}
  /* in a narrow panel the details use the full width (no avatar indent), so an email address still fits */
  @container ct (max-width:559px){ .ct-detail{padding-left:var(--space-4)} }
  .ct-detail dl.kv{max-width:640px}
  .ct-detail dl.kv dd{white-space:pre-wrap}
  .ct-detail .card-foot{max-width:640px}
  .ct-empty{list-style:none}

  /* ---------- diary (UI guide #diary and #notes; restyle slice 4e) ---------- */
  /* reminders beside the upcoming entries from 1024px, stacked below; the notes panel underneath */
  .diary-cols{display:grid;gap:var(--space-4);align-items:start}
  @media (min-width:1024px){ .diary-cols{grid-template-columns:1fr 1fr} }
  .diary-notes{margin-top:var(--space-4)}
  .diary-entries .panel-h .btn{margin-left:auto}
  /* a reminder with no drill-down list is a plain row: no hover, no pointer */
  .attn-row.is-static{cursor:default}
  .attn-row.is-static:hover{background:none}
  .de-list{list-style:none;margin:0;padding:0}
  .de-day{margin:0;padding:var(--space-4) var(--space-4) var(--space-1);font:600 var(--text-overline)/1 var(--font-display);text-transform:uppercase;letter-spacing:.06em;color:var(--text-3)}
  .de-list > li + li > .de-item,.de-list > li + li > .de-day,.de-list > li + .attn-quiet{border-top:1px solid var(--border)}
  .de-item{display:flex;align-items:center;padding-right:var(--space-2)}
  .de-row{align-items:flex-start;flex:1;min-width:0}
  .de-row .pick-m b{color:var(--text-1)}
  .de-note{white-space:pre-wrap;overflow-wrap:anywhere}
  .de-meta{display:flex;align-items:center;gap:var(--space-1);margin-top:var(--space-1)}
  .de-meta svg{width:var(--icon-xs);height:var(--icon-xs);flex:none}
  .de-del{flex:none}
  /* the guide's .btn-ghost-danger: a quiet Delete beside Edit that only opens the confirm (diary rows,
     an open contact, studbook rows). --error text, no edge, --error-tint on hover; the solid danger
     button stays in the confirm itself. */
  .btn.ghost.danger{border-color:transparent;color:var(--error)}
  .btn.ghost.danger:hover{color:var(--error);background:var(--error-tint);border-color:transparent}
  .btn.icon-only.de-del svg{width:var(--icon-md);height:var(--icon-md)}

  /* ---------- sticky notes (UI guide #notes; slice 4c papers, slice 4e structure) ----------
     Paper objects on a board, the deliberate exception to flat cards: they rest on --shadow-sm and
     lift 2px on hover or keyboard focus. Three palette papers cycled by app.js; no yellow (yellow is
     the ear tag) and no tilt; a tape strip at the top; text is always ink. On a phone the notes form
     a strip that snaps one note at a time; in a wider space (container query) they wrap into rows. */
  .notes-wrap{container:notes / inline-size}
  .panel > .notes-wrap{padding:0 var(--space-4) var(--space-4)}
  .notes-strip{display:flex;gap:var(--space-4);margin:0;padding:var(--space-4) var(--space-1) var(--space-2);list-style:none;overflow-x:auto;scroll-snap-type:x mandatory;scrollbar-width:thin}
  .notes-strip > li{flex:0 0 min(240px,82%);scroll-snap-align:start;display:flex}
  .notes-strip > li.notes-add{flex-basis:140px}   /* the add tile is narrower than a note */
  .notes-strip > li.notes-empty{flex:0 1 auto;align-self:center;color:var(--text-3)}
  @container notes (min-width:600px){
    .notes-strip{flex-wrap:wrap;overflow:visible;scroll-snap-type:none;row-gap:var(--space-6)}
    .notes-strip > li{flex:0 0 220px}
    .notes-strip > li.notes-add{flex-basis:140px}
  }
  .snote{--n-bg:var(--note-sage);--n-edge:var(--note-sage-edge);position:relative;display:flex;flex-direction:column;width:100%;padding:var(--space-5) var(--space-4) var(--space-2);background:var(--n-bg);border:1px solid var(--n-edge);border-radius:var(--radius-sm);color:var(--note-ink);box-shadow:var(--shadow-sm);transition:transform var(--duration-fast) var(--ease-out),box-shadow var(--duration-fast) var(--ease-out)}
  @media (hover:hover){ .snote:hover{transform:translateY(-2px);box-shadow:var(--shadow-md)} }
  .snote:focus-within{transform:translateY(-2px);box-shadow:var(--shadow-md)}
  @media (prefers-reduced-motion:reduce){ .snote:hover,.snote:focus-within{transform:none} }
  .note-clay{--n-bg:var(--note-clay);--n-edge:var(--note-clay-edge)}
  .note-sky{--n-bg:var(--note-sky);--n-edge:var(--note-sky-edge)}
  .snote-tape{position:absolute;top:-9px;left:50%;width:56px;height:18px;margin-left:-28px;background:var(--note-tape);border-radius:2px}
  .snote-open{display:grid;align-content:start;gap:var(--space-1);flex:1;padding:0;background:none;border:0;text-align:left;color:inherit;font:inherit;cursor:pointer;border-radius:var(--radius-sm)}
  .snote-open:focus-visible{box-shadow:var(--focus-ring);outline:none}
  .snote-t{font-weight:600;font-size:var(--text-body);overflow-wrap:anywhere}
  .snote-b{font-size:var(--text-small);line-height:1.45;color:var(--note-ink-2);white-space:pre-wrap;overflow-wrap:anywhere}
  .snote-foot{display:flex;align-items:center;justify-content:space-between;gap:var(--space-2);margin-top:var(--space-2)}
  .snote-foot .caption{color:var(--note-ink-3)}
  .btn.snote-more{color:var(--note-ink-2);margin-right:calc(var(--space-2) * -1)}
  .btn.snote-more:hover{background:rgb(30 33 28 / .06);color:var(--note-ink)}
  .snote-add{display:grid;place-items:center;align-content:center;gap:var(--space-2);width:100%;min-height:160px;padding:var(--space-4);background:none;border:1.5px dashed var(--border-strong);border-radius:var(--radius-sm);color:var(--text-2);font:600 var(--text-small)/1 var(--font-body);cursor:pointer}
  /* A square tile as tall as the notes (Andre, via Kobus 20 Nov 2026): the li stretches to the row's height
     (the tallest note) and the button fills that height, with aspect-ratio setting its width from it, so
     it is square at any note height. With no notes beside it, min-height keeps it 140px square. */
  .notes-strip > li.notes-add{flex:0 0 auto}
  .snote-add{aspect-ratio:1 / 1;width:auto;height:auto;min-height:140px;align-self:stretch;flex:none}
  .snote-add:hover{background:var(--hover-tint)}
  .snote-add svg{width:var(--icon-md);height:var(--icon-md)}
  /* dashboard sticky-notes panel: its spacing now comes from the .dash-side grid gap (dashboard redesign) */

  /* small action menu (a sticky note's "..."): the account menu's look, fixed to the viewport so a
     scrolling notes strip never clips it; app.js places it under its button */
  .cb-menu{position:fixed;z-index:var(--z-dropdown);min-width:180px;padding:var(--space-1);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md)}
  .cb-menu-item{display:flex;align-items:center;width:100%;min-height:var(--touch-min);padding:0 var(--space-3);background:none;border:0;border-radius:var(--radius-sm);color:var(--text-1);font:400 var(--text-body)/1 var(--font-body);text-align:left;cursor:pointer}
  @media (hover:hover) and (pointer:fine){ .cb-menu-item{min-height:var(--h-control-dense)} }
  .cb-menu-item:hover{background:var(--hover-tint)}
  .cb-menu-item:focus-visible{outline:none;box-shadow:inset 0 0 0 2px var(--accent-strong)}
  .cb-menu-item.is-danger{color:var(--error)}
  .cb-menu-item.is-danger:hover{background:var(--error-tint)}

  /* per-row edit/delete — hidden until the row is hovered/focused, keyboard-reachable */
  .dactions{margin-left:auto;display:flex;gap:4px;opacity:0;transition:opacity .12s}
  /* Row icon actions (edit / delete): the dense 36px size with a mouse; the phone block below
     raises them to the full 44px touch target (restyle slice 2). */
  .dact{display:inline-flex;align-items:center;justify-content:center;width:var(--h-control-dense);height:var(--h-control-dense);padding:0;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--surface);color:var(--text-2);cursor:pointer}
  .dact svg{width:var(--icon-sm);height:var(--icon-sm)}
  .dact:hover{color:var(--text-1);background:var(--hover-tint);border-color:var(--border-strong)}
  .dact-del:hover{color:var(--error);background:var(--error-tint);border-color:var(--error)}


  /* ---------- reports: "Run a report" panel ---------- */
  .cb-report-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 10px}
  .cb-report-export{margin-left:auto;padding:5px 12px;font-size:12px}
  /* cap the results height so a long report scrolls inside its own box instead of
     pushing the rest of the page down; header stays visible while scrolling */
  .cb-report-table{overflow:auto;max-height:min(58vh,460px);border:1px solid var(--line-soft);border-radius:8px}
  .cb-report-table thead th{position:sticky;top:0;background:var(--surface);z-index:1}
  /* keep each cell (ids, names, headers) on one line — the box scrolls if needed */
  .cb-report-table th,.cb-report-table td{white-space:nowrap}

  /* Tablet step (<=1100px): 4-up figure rows become 2-up, two-column layouts stack,
     and the 3-up grids drop to 2. (The mating board and camp list size by container query.) */
  @media (max-width:1100px){.sbstat{grid-template-columns:repeat(2,1fr)}.grid2,.rec{grid-template-columns:1fr}}

  /* ---------- mobile drawer + phone layout ---------- */
  /* hidden on desktop; shown at phone width */
  /* hamburger: the guide's 44px icon button with a hairline edge; hidden while the sidebar shows */
  .navtoggle{display:none;align-items:center;justify-content:center;flex:none;width:var(--touch-min);height:var(--touch-min);padding:0;border:1px solid transparent;background:transparent;border-radius:var(--radius-md);color:var(--text-1);cursor:pointer}   /* guide .icon-btn: borderless */
  .navtoggle:hover{background:var(--hover-tint)}
  .navtoggle svg{width:var(--icon-md);height:var(--icon-md)}
  .nav-scrim{position:fixed;inset:0;background:rgb(20 22 18 / 0.5);z-index:calc(var(--z-drawer) - 1);opacity:0;visibility:hidden;transition:opacity var(--duration-slow) var(--ease-out),visibility var(--duration-slow) var(--ease-out)}

  /* ---------- drawer: below 1024px (DESIGN.md --bp-lg; restyle slice 3) ----------
     The shell goes to one column and the sidebar becomes an off-canvas drawer (264px, at most 84%
     of the screen) on --z-drawer with the ink scrim behind it. Only shell rules live here; the
     phone content rules stay in the max-width:768px block below. */
  @media (max-width:1023px){
    /* minmax(0,1fr), not 1fr (Caleb, 24 Nov 2026): a bare 1fr column is at least as wide as its
       widest content, so at about 800px the top bar's row (menu, logo, farm name, 220px+ search, New
       animal, EN, avatar) stretched the whole page to 885px and it scrolled sideways. Capped at the
       window, the farm name gives way (ellipsis, or hidden below 880px: see .tb-farm) instead. */
    .app{grid-template-columns:minmax(0,1fr)}
    /* No box-shadow while closed: the drawer sits just off the left edge and a blur would bleed back
       onto the screen as a grey strip. The shadow only exists when open and fades with the slide. */
    .side{position:fixed;left:0;top:0;z-index:var(--z-drawer);width:280px;max-width:84vw;padding-bottom:var(--space-8);transform:translateX(-100%);transition:transform var(--duration-slow) var(--ease-out),box-shadow var(--duration-slow) var(--ease-out);box-shadow:none}
    .app.nav-open .side{transform:none;box-shadow:var(--shadow-lg)}
    /* 100dvh is the visible height on a phone browser (100vh stays as the fallback). With 44px rows
       the drawer needs about 790px; the footer stays pinned and the nav list scrolls on shorter
       phones (tester feedback asked for no scroll; 44px touch rows win over that, DESIGN.md). */
    /* The drawer starts below the offline banner when it shows (--offline-h, see body) and is that
       much shorter, so the farm picker at its top stays tappable and the footer stays on screen. */
    .side{top:var(--offline-h, 0px);height:calc(100vh - var(--offline-h, 0px));height:calc(100dvh - var(--offline-h, 0px));padding-top:calc(var(--space-4) + env(safe-area-inset-top, 0px))}
    .farmpick{margin-bottom:var(--space-2)}
    .navsec{padding:var(--space-5) var(--space-3) var(--space-2)}   /* guide drawer: 20px above, 8px below */
    .app.nav-open .nav-scrim{opacity:1;visibility:visible}
    .navtoggle{display:inline-flex}
    .top{padding:0 var(--space-4) 0 var(--space-2);gap:var(--space-2)}
  }

  @media (max-width:768px){
    /* top bar on a phone: menu, logo, then the language menu and avatar pushed right. Global search
       is hidden here (each list screen has its own search); the page header holds the title. */
    .search{display:none}
    .top .langwrap{margin-left:auto;flex:none}
    .top .langbtn > svg:first-child{display:none}   /* code and caret only: the phone top bar has no room for the globe */
    .ph{padding:var(--space-5) var(--space-4) 0}

    /* screens breathe less */
    .screen{padding:var(--space-4)}
    .sbstat,.metrics{grid-template-columns:1fr}

    /* wide data tables scroll inside their panel instead of stretching the page */
    .panel{overflow-x:auto}
    table{min-width:560px}
    /* the small Setup reference tables (Breeds, Animal values, Service codes) are
       narrow — let them fit the screen and wrap instead of clipping */
    #setup table{min-width:0}
    /* report results fill the box when narrow, and grow (scrolling inside
       .cb-report-table) only when the values are actually wider than the box */
    .cb-report-table table{min-width:100%;width:auto}
    thead th,tbody td{padding:10px 12px}
    .toolbar{gap:7px}
    /* report picker: even, full-width chips instead of a ragged wrap */
    .cb-report-run .toolbar{display:grid;grid-template-columns:1fr;gap:8px}
    .cb-report-run .toolbar .chip{text-align:center;padding:10px 12px}
    /* animal register: count on the left, Filter + Export grouped together on the
       right as a button pair (space-between strands Filter awkwardly in the middle) */
    /* The count gets its own line and Filter and Export share the row under it, each half the width.
       Count, Filter and "Voer CSV uit" in one row were 14px wider than a 375px phone in Afrikaans, so
       the whole page scrolled sideways (click-through, 20 Nov 2026); this fits any label length. */
    .an-toolbar .tb-actions{justify-content:flex-start;gap:8px;flex-wrap:wrap;width:100%;margin-left:0}
    .an-toolbar .tb-actions .num{flex:1 0 100%;margin-right:0}
    .an-toolbar .tb-actions .btn{flex:1 1 0;min-width:0}
    /* all 12 filter controls flow into ONE 2-column grid → a clean 6 rows × 2
       columns; the row wrappers collapse with display:contents so there's no
       lone/half-empty row, then Clear drops to its own spot below */
    .an-filters{display:grid;grid-template-columns:1fr 1fr;gap:7px;align-items:center}
    .an-filter-row{display:contents}
    .an-filters .an-filter-ctl,.an-filters .an-filter-sel{min-width:0;max-width:none}
    /* Clear: its own spot under the grid, bottom-right, same height as the buttons
       (two-class selector to beat .btn.ghost's smaller padding) */
    .an-filters .an-filter-clear{grid-column:2;justify-self:end;padding:8px 14px;font-size:13px}

    /* touch has no hover: keep the per-row edit/delete visible and bump the icon buttons to a
       thumb-friendly size */
    .dactions{opacity:1}
    .dact{width:var(--touch-min);height:var(--touch-min)}
  }

  /* ---------- phone fit pass (QA at 375px) ----------
     CSS-only fixes for the problems QA found walking every screen at phone width.
     Everything here lives inside max-width media queries, so the desktop layout
     (wider than 768px) is byte-for-byte unchanged. The rules use the theme tokens
     only, and no inline styles are added in markup. */
  @media (max-width:768px){
    /* Top-bar subtitle (e.g. "154 active animals · Kameeldrift: 44 · …") wrapped to
       three lines and pushed the title down. Keep it to one line with an ellipsis;
       min-width:0 lets the flex item shrink so the ellipsis can kick in. */
    .crumb{min-width:0;flex:1 1 auto}
    .crumb small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

    /* (1) New-animal wizard step tabs: four "N · Label" chips in one row left about
       70px each, so labels were clipped ("1 · Gene…"). A 2 × 2 grid gives each chip
       half the card width, so the full label fits, and the tap target grows to 40px. */
    .cb-steps{display:grid;grid-template-columns:1fr 1fr;gap:6px}
    .cb-step{min-height:40px;padding:8px 6px}

    /* (2) Sticky action bar for every modal (wizard Next/Back/Save, formModal Save).
       .cb-modal-card is the scroll container (max-height + overflow:auto), so a sticky
       footer pins to the bottom of the visible card while the fields scroll under it.
       The negative margins pull the bar edge-to-edge over the card's own padding, and
       the bar keeps its normal place in the flow, so the last field always scrolls into
       view above it (it never covers a field). Bottom padding respects the phone's home
       indicator through the safe-area inset. */
    .cb-modal-card{padding-bottom:0}
    .cb-modal-actions{position:sticky;bottom:0;z-index:3;margin:18px -16px 0;
      padding:12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
      background:var(--surface);border-top:1px solid var(--line-soft);
      /* one compact row instead of the stacked column: the bar is always on screen,
         so it must stay short. Each button shares the width equally. */
      flex-direction:row;gap:8px}
    .cb-modal-actions>*{width:auto;flex:1 1 0;min-height:44px}
    /* wizard footer on a phone: four buttons in one row would be ~80px each, too narrow for
       "Save changes", so it becomes a 2×2 of equal cells — [Back][Next] over [Cancel][Save] —
       keeping the primary Save under the thumb, bottom-right. */
    .cb-modal-actions.cb-wiz-foot{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-areas:"back next" "cancel save";gap:8px}

    /* (2) Service screen (restyle slice 6). Panels on phones scroll sideways (.panel overflow-x:auto),
       which would clip the setup panel's dropdown and date menus, so the service panels opt back to
       visible overflow (their rows already fit the width). The record bar is one line on a phone,
       as in the guide: count and bull, then the button; the method and date and the tag drop out. */
    #service .panel{overflow:visible}
    #service .svc-bar{padding:var(--space-2) var(--space-2) var(--space-2) var(--space-3);gap:var(--space-2)}
    #service .svc-when,#service .svc-bull-tag{display:none}
    /* "served by Rooi Baas" may wrap on a phone: kept on one line it ran under the button (AF is longer) */
    #service .svc-by{white-space:normal}
    #service .svc-bar .btn{min-height:var(--touch-min);padding:0 var(--space-3)}
    #service .svc-search{min-height:var(--touch-min)}


    /* (5) Other small tap targets found on the walk-through */
    .cb-lot-x{min-width:40px;min-height:40px}           /* catalogue lot remove × */
    #setup .btn{min-height:40px}                         /* Grading "Reset to defaults" etc. */
    /* the small Setup tables (Breeds, Team) must fit the screen without a sideways
       scroll: tighter cell padding, and long unbroken values (an email address) may
       break anywhere instead of forcing the column wider than the phone. Their row
       Edit / Remove are now compact .dact icons (rowIconButton in app.js), so the
       old rules that stacked and grew the text buttons are gone. */
    #setup thead th,#setup tbody td{padding:8px 6px}
    /* Team (Name, Email, Role, actions): four columns squeezed the email to ~44px.
       Each member becomes a small card instead — line 1 name + role + the edit /
       remove icons, line 2 the email (may break anywhere). Header hidden: the values
       are self-explanatory. Column order is fixed by renderTeam() in app.js. */
    #s-team table,#s-team tbody{display:block;width:100%}
    #s-team thead{display:none}
    #s-team tbody tr{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;padding:10px 6px;border-bottom:1px solid var(--line-soft)}
    #s-team tbody td{display:block;padding:0;border:none}
    #s-team tbody td:nth-child(1){flex:1 1 0;min-width:0;font-weight:600}
    #s-team tbody td:nth-child(2){order:3;flex:1 1 100%;overflow-wrap:anywhere;font-size:12.5px;color:var(--muted)}
    #s-team tbody td:nth-child(4){order:2;flex:none}
  }

  /* (3) Animal register on phones (<=640px): a real table that scrolls sideways
     inside its panel (.panel{overflow-x:auto} from the max-width:768px block).
     The earlier stacked-card layout squeezed the values and left the sort-header
     strip out of line with the data under it (QA review, phone fit pass 2), so
     every column — Colour included — keeps its own header cell again. No cell
     wraps, so a tag, name, breed or "235,7 kg" always reads on one line; the
     min-width is wide enough for all 8 columns at that size, and only the table
     scrolls, never the page. Desktop and tablet (above 640px) are unchanged. */
  @media (max-width:640px){
    #animals table{min-width:860px}
    #animals thead th,#animals tbody td{white-space:nowrap}
    /* the empty-state row is one long sentence: let it wrap in the visible width
       instead of running off along the 860px table */
    #animals tbody td[colspan]{white-space:normal}
    /* #167: wrapping alone was not enough, the cell is as wide as the 860px table, so the line
       still ran past the screen edge. The empty-state box pins to the left of the scrolling
       panel and is never wider than the screen, so the whole sentence and its button show. */
    #animals .an-empty{position:sticky;left:0;max-width:calc(100vw - 64px)}

    /* Animal record → Genealogy tree. Fixed 132/106px nodes need ~520px for the four
       grandparents, so the tree scrolled sideways. On phones every generation shares
       the full width instead: each ul spans its parent, each li takes an equal slice
       (1 → 2 → 4), and the node fills its slice. The connector lines are drawn from
       50%-wide pseudo-elements on each li, so they still meet at the slice centres. */
    .tree{overflow-x:visible}
    .tree > ul,.tree ul{width:100%}
    .tree li{flex:1 1 0;min-width:0;padding:20px 3px 0}
    .tnode,.tnode.sm{width:100%;max-width:132px}
    .tlabel{font-size:11px}
    .tnode.sm .tlabel{font-size:10px}
    .tnode.sm .tlabel span{font-size:9.5px}
    /* the ear-tag badge and sex dot shrink with the narrow grandparent photo */
    .tnode.sm .tphoto .tag{transform:scale(.6);left:4px;top:4px}
    .tnode.sm .tsex{width:14px;height:14px;font-size:9px;right:4px;top:4px}
  }

  /* ---------- phone fit pass 2 (QA review at 375px) ----------
     Second walk-through of every screen at phone width. Everything is inside a
     max-width media query, so desktop is unchanged; rules that also apply on
     desktop (button / chip centring, Animal values alignment, Grading tabs) live
     with their base styles. Some rules need !important only because app.js writes
     an inline margin on that element — each one says so. */
  @media (max-width:768px){
    /* (9, 10) Sales & catalogue and Logix submissions panel headers: the title and two or
       three buttons shared one row, so every label broke over two or three lines. The
       title takes its own line, and the buttons wrap below it, each label on one line.
       app.js / index.html give these buttons an inline margin-left (auto or 8px) for the
       desktop row, hence the !important to reset it here. */
    #sales .panel-h,#studbook .panel-h{flex-wrap:wrap;gap:8px}
    #sales .panel-h h3,#studbook .panel-h h3{flex:1 1 100%}
    #sales .panel-h .btn,#studbook .panel-h .btn{flex:1 1 auto;white-space:nowrap;min-height:40px;margin-left:0 !important}
    /* catalogue lots: keep "Beefmaster · 24 y 11 m" and "R 18 000" on one line — the
       table already scrolls inside its panel */
    #sales tbody td{white-space:nowrap}
    /* Logix submissions: same — "Birth notification", "Logix ref" and dates stay on one
       line and the table scrolls inside its .tbl-scroll box */
    #studbook thead th,#studbook tbody td{white-space:nowrap}
    #studbook tbody td[colspan]{white-space:normal}
    /* Logix: with no submissions the 560px table only holds the empty-state sentence,
       which ran off the edge. Drop the minimum width and the header row so the
       sentence wraps inside the screen; data rows bring the scroll table back. */
    #studbook table:has(td[colspan]){min-width:0}
    #studbook table:has(td[colspan]) thead{display:none}

    /* (11), (12) Contacts: the New contact button and the A to Z index moved to the guide's list
       panel and #azindex layout (restyle slice 4e), which handle phones themselves. */

    /* (13) The report parameter modal is gone (reports redesign S2: a report opens on its own page
       with its fields as chips, .rp-chips), so its phone rules went with it. */

    /* (14) Setup category tabs: below 768px the sections are a list into sub-pages (restyle slice 4f,
       the setup block above), so the old 3 x 3 grid of tab buttons is gone. */
    /* (15, 17) Setup code tables (Breeds, Ease of birth) with the pencil / trash icons:
       Code + Name + Description + two 38px icons came to ~335px, wider than the
       309px left inside the 18px pane padding, so the trash icon spilled past the
       panel edge. A slimmer pane padding and 34px icons (still an easy tap) make the
       row fit; long description words may break rather than widen the table. */
    #setup .tabpane{padding:14px 10px}
    #setup .dact{width:34px;height:34px}
    #setup tbody td.muted{overflow-wrap:anywhere}

    /* (17) Setup → Ease of birth: keep the Modified date on one line, and when no code
       has a description, hide the empty Description column (header + cells) so it
       stops taking width. :has() checks the live rows, so the column returns as soon
       as one code has a description. Row actions are compact icons (rowIconButton). */
    #s-ease td.num{white-space:nowrap}
    #s-ease table:not(:has(tbody td:nth-child(3):not(:empty))) :is(th,td):nth-child(3){display:none}

    /* (18) Setup → Grading: the five-column trait table ran off the screen (High cut
       off, trait names over three lines). It scrolls sideways inside #grade-body like
       the register, with one-line cells. Cell and tab padding are both 12px, so the
       Bulls / Cows tabs stay lined up with the "Trait" column. These beat the
       #setup table{min-width:0} and #setup th/td 8px 6px phone rules above (same
       specificity, later in the file). */
    #grade-body{overflow-x:auto;-webkit-overflow-scrolling:touch}
    #s-grade table{min-width:560px}
    #s-grade thead th,#s-grade tbody td{padding:10px 12px;white-space:nowrap}
    #s-grade .seg-tab{padding-left:12px;padding-right:12px}
  }

/* Catalogue lot remove (×) — a compact ghost button in the actions column, and a
   print rule so the actions column never appears on a printed catalogue. */
.cb-lot-x{border:0;background:transparent;color:var(--muted);cursor:pointer;
  font-size:18px;line-height:1;padding:4px 8px;border-radius:8px}
.cb-lot-x:hover{background:var(--error-tint);color:var(--error)}
.cb-lot-picker .cb-lotp-filters{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px;margin:4px 0 12px}
.cb-lot-picker .cb-lotp-search{margin-bottom:10px}
.cb-lot-picker .cb-lotp-list{max-height:46vh;overflow:auto;border:1px solid var(--line);border-radius:12px}
.cb-lot-picker .cb-lotp-row{display:flex;align-items:center;gap:10px;padding:9px 12px;border-bottom:1px solid var(--line)}
.cb-lot-picker .cb-lotp-row:last-child{border-bottom:0}
.cb-lot-picker .cb-lotp-row .nm{color:var(--muted)}
.cb-lot-picker .cb-lotp-row .btn{margin-left:auto}
.cb-lot-picker .cb-lotp-empty{padding:18px 14px;text-align:center}
@media (max-width:640px){.cb-lot-picker .cb-lotp-filters{grid-template-columns:1fr}}
/* ---------- report preview / print overlay ---------- */
/* Full-screen overlay (sibling of .app in <body>) that previews one report as a page-like
   "sheet" sized to A4 landscape, so what the user sees on screen matches the printout. */
.cb-report-preview{position:fixed;inset:0;z-index:calc(var(--z-modal) + 5);background:rgba(24,20,14,.55);
  display:flex;flex-direction:column;align-items:center;gap:16px;overflow:auto;padding:22px}
.cb-rp-toolbar{position:sticky;top:0;z-index:1;align-self:stretch;display:flex;align-items:center;gap:10px;
  padding:10px 14px;background:var(--surface);border:1px solid var(--line-soft);border-radius:10px}
.cb-rp-bartitle{font-weight:600}
.cb-rp-spacer{flex:1}
/* A4 landscape is 297mm ≈ 1123px at 96dpi — size the sheet to that so columns lay out as they print */
/* Report restyle (Caleb, 19 Nov): Kobus's print sheet (design/ui-guide.html #report, review questions
   6 a, 7 a and 9 a). Ink only so it prints true: white paper (--logo-ground), --tag-print text and
   rules, --print-rule between rows, no fills; a compact letterhead and the details in the footer. The
   server PDF (src/app/reports/pdf*.py) draws the same. */
.cb-rp-sheet{width:min(1123px,96vw);background:var(--logo-ground);color:var(--tag-print);
  border:1px solid var(--line-soft);border-radius:8px;box-shadow:var(--shadow-lg);
  /* 18 px sides ≈ the PDF's 5 mm side margin: narrow so wide tables shrink their text less. */
  padding:28px 18px;margin-bottom:22px}
/* Number columns (rpNumericCol) sit on the right edge so digits line up, as in the PDF. */
.cb-rp-sheet th.cb-rp-num,.cb-rp-sheet td.cb-rp-num{text-align:right}
/* The report's plain name in the display face (.sheet-t), then the line under it (.sheet-m). */
.cb-rp-title{margin:0;font:600 26px/1.15 var(--font-display);letter-spacing:.01em;color:var(--tag-print)}
.cb-rp-meta{margin:2px 0 14px;color:var(--tag-print);font-size:12px}
/* The compact letterhead (.sheet-lh-c): the logo left, the farm's name right, on one line. */
.cb-rp-lh{display:flex;align-items:center;justify-content:space-between;gap:var(--space-4)}
.cb-rp-logo{width:120px;height:auto;display:block}
.cb-rp-farm{font:600 18px/1.1 var(--font-display);letter-spacing:.02em;color:var(--tag-print);text-align:right}
/* The footer (.sheet-foot): the farm's contact and registration details, blank fields left out. */
.cb-rp-foot{margin:14px 0 0;font-size:11px;color:var(--tag-print)}
/* The animal's ear tag as an outline tag (.tag.print, tag-sm), scaled with a shrunk wide table, and a
   status as an icon and a word (.ink-st). */
.cb-rp-sheet .tag.print{color:var(--tag-print);background:transparent;border-color:var(--tag-print);
  font-size:calc(15px * var(--rp-scale,1));padding:calc(3px * var(--rp-scale,1)) calc(7px * var(--rp-scale,1)) calc(2px * var(--rp-scale,1)) calc(6px * var(--rp-scale,1))}
.cb-rp-sheet .ink-st{display:inline-flex;align-items:center;gap:4px;font-weight:600}
.cb-rp-sheet .ink-st svg{width:calc(14px * var(--rp-scale,1));height:calc(14px * var(--rp-scale,1));flex:none}
/* Branded report header (legacy CattleBase layout, current design tokens): mark + wordmark on the
   left, farm name + Contact Information / Registration Details columns on the right. */
.cb-rp-head{display:flex;gap:22px;align-items:flex-start;margin-bottom:12px}
.cb-rp-brand{display:flex;align-items:center;gap:10px;flex-shrink:0}
.cb-rp-mark{width:46px;height:46px;border-radius:9px;background:var(--logo-ground);display:grid;place-items:center;overflow:hidden;box-shadow:inset 0 0 0 1.5px var(--line-soft)}
.cb-rp-mark img{width:100%;height:100%;object-fit:contain;padding:5px;box-sizing:border-box}
.cb-rp-brand b{font-family:var(--serif,Georgia,serif);font-weight:600;font-size:17px;color:var(--green)}
.cb-rp-headmain{flex:1;min-width:0}
.cb-rp-farmname{margin:0;font-family:var(--serif,Georgia,serif);font-size:26px;line-height:1.1;color:var(--ink)}
.cb-rp-entity{color:var(--muted);font-size:13px;margin-top:3px}
.cb-rp-cols{display:flex;gap:48px;margin-top:12px;flex-wrap:wrap}
.cb-rp-col{min-width:190px}
.cb-rp-colh{font-weight:600;font-size:13px;margin-bottom:5px;color:var(--ink)}
.cb-rp-line{display:flex;gap:8px;font-size:12.5px;line-height:1.55}
.cb-rp-l{color:var(--muted);min-width:76px}
.cb-rp-v{color:var(--ink)}
/* The heavy ink rule under the letterhead (.sheet-rule, 3 px) + the TOTAL footer line under ink. No
   zebra rows: the print design is ink only (review question 6 a). */
.cb-rp-rule{border-top:3px solid var(--tag-print);margin:16px 0 12px}
.cb-rp-total{display:flex;align-items:baseline;gap:18px;margin-top:12px;border-top:1.5px solid var(--tag-print);
  padding-top:9px;font-weight:600;font-size:13px;color:var(--tag-print)}
/* Two-level report header (legacy parity — Growth report for bulls: "Bull Data" / "Calf Data" each
   spanning its columns), centred with a rule between the two groups. */
.cb-report-table tr.cb-rp-hgroup th,.cb-rp-sheet thead tr.cb-rp-hgroup th{text-align:center;border-bottom:1px solid var(--line)}
.cb-report-table tr.cb-rp-hgroup th+th,.cb-rp-sheet thead tr.cb-rp-hgroup th+th{border-left:2px solid var(--line)}
/* Animal information with picture (legacy parity, batch D) — one card per animal. Mobile-first: the
   field lists, notes and photo stack; from 720px they sit side by side (fields | fields | notes+photo)
   like the legacy card. Each card stays on one printed page where it fits. */
.cb-ac-list{display:flex;flex-direction:column;gap:16px}
.cb-ac-card{border:1px solid var(--line);border-radius:10px;padding:14px;background:var(--surface);break-inside:avoid;page-break-inside:avoid}
.cb-ac-grid{display:grid;grid-template-columns:1fr;gap:14px}
.cb-ac-kv{display:grid;grid-template-columns:minmax(120px,auto) 1fr;gap:4px 10px;margin:0;font-size:13px}
.cb-ac-kv dt{font-weight:600;color:var(--muted);text-transform:uppercase;font-size:11px;letter-spacing:.03em;align-self:center}
.cb-ac-kv dd{margin:0;border:1px solid var(--line-soft);border-radius:4px;padding:3px 8px;min-height:24px}
.cb-ac-side{display:flex;flex-direction:column;gap:10px}
.cb-ac-notes p{margin:4px 0 0;border:1px solid var(--line-soft);border-radius:4px;padding:6px 8px;min-height:48px;font-size:13px;white-space:pre-wrap}
.cb-ac-photo{border:1px solid var(--line);border-radius:6px;min-height:150px;display:grid;place-items:center;overflow:hidden;background:var(--surface-2)}
.cb-ac-photo img{display:block;width:100%;height:auto;object-fit:cover}
.cb-ac-calves{margin-top:12px}
@media (min-width:720px){.cb-ac-grid{grid-template-columns:1fr 1fr minmax(180px,240px)}}
@media print{.cb-ac-grid{grid-template-columns:1fr 1fr 200px}.cb-ac-photo{-webkit-print-color-adjust:exact;print-color-adjust:exact}}
/* Grouped reports (legacy parity — e.g. Animals per herd): a "Herd : <name>" section row before each
   group and a "TOTAL <n>" row after it, spanning the table. Both override the zebra stripe. */
.cb-report-table tr.cb-rp-group td{font-weight:600;background:var(--surface);border-top:2px solid var(--line);padding-top:10px}
.cb-report-table tr.cb-rp-grouptotal td{font-weight:600;background:var(--surface);border-top:1px solid var(--line)}
/* On the sheet (the guide's .grp-row): a bold group heading over an ink rule, with room above it. */
.cb-rp-sheet tbody tr.cb-rp-group td{font-weight:600;padding-top:12px;border-bottom:1.5px solid var(--tag-print)}
.cb-rp-sheet tbody tr.cb-rp-grouptotal td{font-weight:600}
/* Totals row (tfoot) — summed money/weight columns, bold with a strong top rule so it reads as the
   report footer, not another data row. The first cell holds the TOTAL label + row count. */
.cb-rp-sheet tfoot td{font-weight:600;border-top:1.5px solid var(--tag-print);border-bottom:0}
.cb-rp-sheet tfoot td.cb-rp-ft-label{white-space:nowrap}
/* Graphs-group reports render as an SVG bar chart (see buildReportChart). CSS vars resolve here
   because they are applied via the stylesheet, not inline attributes (which the pane CSP strips). */
.cb-rp-chartwrap{margin-top:6px}
.cb-rp-chart{display:block;width:100%;height:auto}
/* Graph-report SVG (buildReportChart; restyle slice 4b): chart tokens through classes, gridlines on the
   hairline border, the baseline on the 3:1 border, axis labels in --text-2, values in ink. Series 2
   fills with the chart's own hatch <pattern> (ochre tile plus a white stripe at 50%). */
.cb-rp-chart .cb-rp-grid{stroke:var(--border);stroke-width:1}
.cb-rp-chart .cb-rp-base{stroke:var(--border-strong);stroke-width:1.5}
/* 13px, the guide's caption minimum (click-through, 20 Nov 2026: 11px on a laptop). On the report page
   the chart is drawn at its real width (buildReportChart options.width), so this is the size on screen
   at every width; on the A4 sheet it scales with the sheet like the rest of the paper. */
.cb-rp-chart text.cb-rp-ax{fill:var(--text-2);font-size:13px}
.cb-rp-chart text.cb-rp-val{fill:var(--text-1);font-size:13px;font-weight:600}
.cb-rp-chart .cb-rp-bar.s1{fill:var(--chart-1)}
.cb-rp-chart .cb-rp-bar.s3{fill:var(--chart-3)}
.cb-rp-chart .cb-rp-hatch-bg{fill:var(--chart-2)}
.cb-rp-chart .cb-rp-hatch-line{fill:var(--surface);fill-opacity:.5}
.cb-rp-chart,.cb-rp-chart *{-webkit-print-color-adjust:exact;print-color-adjust:exact}
.cb-rp-legend{justify-content:center;margin:0 0 var(--space-2)}
/* Never squashed, never wrapped (features/report-pdf-export.md): every cell stays on ONE line and each
   column takes its natural width (table-layout:auto). A table narrower than the sheet fills it
   (width:100%); a wider one is scaled down as a whole by fitReportTables() in app.js so every column
   fits the landscape sheet width — the same rule the PDF uses. Capture forms (.cb-cap) opt out below. */
.cb-rp-sheet table{width:100%;border-collapse:collapse;table-layout:auto}
/* --rp-scale (set per table by fitReportTables, default 1) shrinks the text AND padding together, so a
   wide table re-lays out smaller instead of being zoomed — its measured width stays exact. */
/* Ink only (.sheet-tbl): a light rule under each row, no cell borders. */
.cb-rp-sheet th,.cb-rp-sheet td{border:0;border-bottom:1px solid var(--print-rule);text-align:left;vertical-align:middle;white-space:nowrap;
  padding:calc(6px * var(--rp-scale,1)) calc(8px * var(--rp-scale,1));font-size:calc(13px * var(--rp-scale,1))}
/* Capture forms are paper to write on: a ruled grid, fixed column widths, and long headers may stack
   (as legacy); they keep their bordered cells and tinted heading row. */
.cb-rp-sheet table.cb-cap{table-layout:fixed}
.cb-rp-sheet table.cb-cap th,.cb-rp-sheet table.cb-cap td{border:1px solid var(--line-soft);vertical-align:top}
.cb-rp-sheet table.cb-cap th{white-space:normal;overflow-wrap:anywhere;background:var(--surface-2,var(--surface))}
/* Bold headings over a 1.5 px ink rule, no fill. */
.cb-rp-sheet thead th{font-weight:600;font-size:calc(12px * var(--rp-scale,1));border-bottom:1.5px solid var(--tag-print)}
@media (max-width:640px){.cb-rp-sheet{padding:18px 14px}.cb-rp-sheet th,.cb-rp-sheet td{
  font-size:calc(12px * var(--rp-scale,1));padding:calc(5px * var(--rp-scale,1)) calc(6px * var(--rp-scale,1))}}

/* Printable data-capture forms (blank ruled field sheets). The table inherits .cb-rp-sheet table
   (fixed layout + bordered cells); here the body rows get extra height for handwriting, no zebra
   striping (it is a form to write on, not a data table), and a sign-off line under the grid. */
.cb-cap td,.cb-cap th{height:30px;vertical-align:middle}
.cb-cap tbody td{height:32px}
.cb-cap td.cap-filled{font-weight:600;white-space:nowrap}         /* pre-filled -ID No / No. */
.cb-cap tbody tr:nth-child(even){background:transparent}          /* a blank form must not be zebra-striped */
/* Fixed widths for the short/numeric columns (set via <col class="cap-c-<key>"> — CSP blocks inline
   style). Columns with no rule here share the remaining width under table-layout:fixed. */
.cb-cap col.cap-c-no{width:46px}
.cb-cap col.cap-c-yy{width:52px}
.cb-cap col.cap-c-id_no{width:92px}
.cb-cap col.cap-c-sex{width:60px}
.cb-cap col.cap-c-year{width:64px}
.cb-cap col.cap-c-photo_no{width:82px}
.cb-cap col.cap-c-ear_no{width:70px}
.cb-cap col.cap-c-date_birth{width:112px}
.cb-cap col.cap-c-birth_weight{width:78px}
.cb-cap col.cap-c-weaning_weight{width:88px}
.cb-cap col.cap-c-mother_birth_weight{width:96px}
.cb-cap col.cap-c-mother_weaning_weight{width:104px}
.cb-cap-foot{display:flex;flex-wrap:wrap;gap:30px;margin-top:26px;font-size:13px;color:var(--ink)}
.cb-cap-footitem{display:inline-flex;align-items:flex-end;gap:8px}
.cb-cap-footline{display:inline-block;border-bottom:1px solid var(--line);height:15px;min-width:210px}
.cb-cap-footline.sm{min-width:150px}

@media print{
  .cb-noprint{display:none !important}
  /* Force landscape so wide reports fit across the page; narrow 5 mm side margins (as the PDF) give
     wide tables more width so their text is shrunk less. */
  @page{size:A4 landscape;margin:12mm 5mm}
  /* When a preview is open, print ONLY its sheet — drop the whole SPA chrome and the backdrop. */
  body:has(.cb-report-preview) > *:not(.cb-report-preview){display:none !important}
  html,body{background:#fff !important}
  .cb-report-preview{position:static !important;inset:auto !important;display:block !important;
    padding:0 !important;background:#fff !important;overflow:visible !important}
  .cb-rp-sheet{width:100% !important;max-width:none !important;margin:0 !important;padding:0 !important;
    border:0 !important;border-radius:0 !important;box-shadow:none !important}
  /* Same no-wrap rule as on screen: cells stay on one line at their natural width and fitReportTables()
     (re-run on beforeprint for the printed page width) scales a wide table down to the page width.
     SEPARATE (not collapsed) borders: every cell paints its OWN right+bottom border and the header its
     top border, so NO border is dropped where a physical page splits — the grid stays fully closed on
     every page (top and bottom), instead of looking cut open at the page boundary. border-spacing:0
     keeps every line single (no doubling). This is what makes a multi-page report cut cleanly. */
  .cb-rp-sheet table{width:100% !important;table-layout:auto;border-collapse:separate;border-spacing:0;
    border-left:1px solid #bbb}
  .cb-rp-sheet table.cb-cap{table-layout:fixed}
  .cb-rp-sheet th,.cb-rp-sheet td{border-right:1px solid #bbb;border-bottom:1px solid #bbb;
    font-size:calc(9pt * var(--rp-scale,1));padding:calc(4px * var(--rp-scale,1)) calc(6px * var(--rp-scale,1));
    white-space:nowrap;break-inside:avoid;page-break-inside:avoid}   /* one line; a cell never splits a page */
  .cb-rp-sheet table.cb-cap th{white-space:normal}
  .cb-rp-sheet thead th{border-top:1px solid #bbb}     /* the table's top edge — repeats on EVERY page */
  .cb-rp-sheet thead{display:table-header-group}       /* repeat the column header on every printed page */
  .cb-rp-sheet tfoot{display:table-footer-group}       /* repeat the totals row at the foot of every page */
  .cb-rp-sheet tfoot td{-webkit-print-color-adjust:exact;print-color-adjust:exact;border-top:2px solid #777 !important;font-weight:600}
  /* Never split a row across a page; keep the title + meta WITH their table (no stranded heading at a
     page foot); keep the branded header block whole. Both the modern (break-*) and legacy
     (page-break-*) spellings are set so every print engine honours them. */
  .cb-rp-sheet tr{break-inside:avoid;page-break-inside:avoid}
  .cb-rp-title,.cb-rp-meta{break-inside:avoid;page-break-inside:avoid;break-after:avoid;page-break-after:avoid}
  .cb-rp-head{break-inside:avoid;page-break-inside:avoid}
  .cb-rp-sheet tbody tr:nth-child(even){-webkit-print-color-adjust:exact;print-color-adjust:exact;background:var(--surface-2) !important}
  .cb-rp-mark{-webkit-print-color-adjust:exact;print-color-adjust:exact}
  /* Force the chart bars/fills to print, and keep the whole chart on one page. */
  .cb-rp-chartwrap{-webkit-print-color-adjust:exact;print-color-adjust:exact;page-break-inside:avoid;break-inside:avoid}
  .cb-rp-chart{max-height:150mm}
  /* Capture forms print as a plain ruled grid: keep the row height for handwriting and turn OFF the
     shared zebra striping (a blank form must not be shaded). Header still repeats via table-header-group. */
  .cb-cap tbody td{height:9mm}
  .cb-cap tbody tr:nth-child(even){background:#fff !important}
  .cb-cap-foot{break-inside:avoid;page-break-inside:avoid}   /* sign-off line never splits across a page */
}

/* ===== ROLE GATING (UI mirror of the server's role checks) =====
   app.js writes the signed-in user's role onto <html data-role="owner|manager|readonly">
   (an effect on the `me` signal), and every write control carries data-min-role="manager", the
   MINIMUM role its API route enforces (forbid_readonly and has_min_role(payload, "manager") both
   need manager since #74 removed the field role, so there is one gate). Pure CSS means the rule also covers controls a
   screen re-renders later, and flips the moment `me` changes, with no per-screen re-gating code.
   Before /api/me resolves (no data-role yet) gated controls stay hidden, so a read-only user never
   sees a write button flash. This is presentation only: the API's 403 stays the real enforcement. */
html:not([data-role="manager"]):not([data-role="owner"]) [data-min-role="manager"]{display:none !important}


/* Setup -> My account inline form (#26). Each field is a .setrow like the rest of Setup: label +
   hint on the left, the input on the right, and Save at the right edge (under the inputs).
   Mobile-first: on a phone the row wraps so the input takes the full width under its label; from
   768px label and input share one line and the input is a fixed 280px on the right, lined up with
   the Role / Farm values above. Inputs reuse .cb-inp and are 44px tall for touch. */
/* The rows fold with the Setup panel's width (the .setrow container query, restyle slice 4f): the
   input sits in the right-hand column when there is room and under its label otherwise. */
.account-val{font-weight:600;overflow-wrap:anywhere}
@container set (min-width:560px){ .account-val{text-align:right} }
.account-inp{width:100%;min-height:44px;box-sizing:border-box;min-width:0}
/* the form's rows sit in their own wrapper, so its first row keeps the divider to Role / Farm above */
.account-grid > .setrow:first-child{border-top:1px solid var(--border)}
.account-err{margin-top:12px}
.account-actions{display:flex;justify-content:flex-end;padding-top:14px}
.account-actions .btn{min-height:44px}

/* ---------- modal body: the only part that scrolls (Andre, 20 Nov 2026) ----------
   wrapModalBody() in app.js moves everything between a modal's header and its action bar into one
   .cb-modal-body and marks the card .has-body. The card is then a column: the header and the action
   bar keep their size (flex:none) and the body takes the rest and scrolls, so the scrollbar runs
   between the header and the footer, inside the modal, instead of down the whole card. This replaces
   the sticky header / footer on these cards (they no longer need it: the card itself never scrolls).
   overscroll-behavior stops a scroll that reaches the end of the form from moving the page behind.
   Selectors start at .cb-modal so they win over the older card, header and action-bar rules above
   (including the phone and laptop blocks) without !important. */
.cb-modal .cb-modal-card.has-body{display:flex;flex-direction:column;overflow:hidden;padding:0}
.cb-modal .cb-modal-card.has-body > .cb-modal-h{position:static;flex:none;margin:0;padding:12px 24px}
.cb-modal .cb-modal-card.has-body > .cb-modal-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px 24px 20px;scroll-padding:16px 0}
.cb-modal .cb-modal-card.has-body > .cb-modal-actions{position:static;flex:none;margin:0;padding:12px 24px;background:var(--surface);border-top:1px solid var(--border)}
@media (max-width:768px){
  /* phones: the bottom sheet's side padding is 16px, and the bar clears the home indicator */
  .cb-modal .cb-modal-card.has-body > .cb-modal-h{padding:12px 16px}
  .cb-modal .cb-modal-card.has-body > .cb-modal-body{padding:14px 16px 18px}
  .cb-modal .cb-modal-card.has-body > .cb-modal-actions{padding:12px 16px calc(12px + env(safe-area-inset-bottom, 0px))}
}

/* ---------- more tabs this way: arrows and a fade on a sideways-scrolling tab strip ----------
   addScrollCues() in app.js (Setup's nine sections and the report chips on a phone; Kobus, 20 Nov 2026: a farmer could not tell
   the strip scrolls). Each arrow sits over an end of the strip that has more tabs past it, on a fade
   from the panel colour so the cut-off tab dissolves instead of stopping hard. 44px wide and as tall
   as the tabs (above the strip's bottom line), the caret is the Phosphor caret (the --ic-caret-right
   mask, mirrored for left). Hidden at an end with nothing more. */
.tab-cue-host{position:relative}
.tab-cue{position:absolute;z-index:2;width:44px;height:43px;padding:0;border:0;display:grid;place-items:center;color:var(--text-1);cursor:pointer}
.tab-cue[hidden]{display:none}
.tab-cue-l{left:0;justify-items:start;padding-left:var(--space-2);background:linear-gradient(to right,var(--surface) 55%,transparent)}
.tab-cue-r{right:0;justify-items:end;padding-right:var(--space-2);background:linear-gradient(to left,var(--surface) 55%,transparent)}
.tab-cue::before{content:"";width:16px;height:16px;background:currentColor;-webkit-mask:var(--ic-caret-right) center/contain no-repeat;mask:var(--ic-caret-right) center/contain no-repeat}
.tab-cue-l::before{transform:scaleX(-1)}
.tab-cue:hover{color:var(--accent-strong)}

/* ---------- list screens: one card, tools on top (Kobus, 20 Nov 2026; DESIGN.md, List screens) ----------
   Every list is ONE card (.panel.list-card): its tools row (.list-tools: type or group chips, search,
   count, secondary buttons such as Filter and Export CSV) along the top inside the card, a hairline,
   then the table or list. The screen's single lime action stays in the page header. Used by Animals
   and Contacts; the Mating cycle (.wl-panel), a report page (.rp-top), Sales, Studbook and Team already
   had this shape. The card never scrolls sideways itself (phones set .panel{overflow-x:auto}), so the
   tools stay put; a wide table scrolls inside its own .tbl-scroll box instead. */
.panel.list-card{overflow:visible}
/* The animal record card never scrolls sideways either: an overflow box would become the sticky
   container and stop .rec-tabs pinning under the top bar on a phone. Its wide service-history table
   already scrolls in its own .tbl-scroll box, and the More menu must be free to drop out of the card. */
.panel.rec-panel{overflow:visible}
.list-card > .list-tools{display:flex;flex-direction:column;flex-wrap:nowrap;gap:var(--space-3);margin:0;padding:var(--space-3) var(--space-4);border-bottom:1px solid var(--border)}
/* flex-wrap:nowrap on the column above matters: the shared .toolbar wraps, and a WRAPPING column makes
   Chrome size the search row as if it had wrapped onto two lines, so about 50px of empty space sat
   under it (Kobus, 20 Nov 2026). Same fix for the register's toolbar wherever it is a column. */
.an-toolbar{flex-wrap:nowrap}
/* the rows inside the tools keep no outer margins of their own; the tools row spaces them */
.list-tools .chips,.list-tools .ct-chips,.az-bar .az{margin:0}
/* inside a white card the search box needs its frame but not a floating shadow */
.list-tools .an-search{box-shadow:none;border-color:var(--input-border);border-radius:var(--radius-md)}
/* the search shrinks before the row wraps, so search, count and buttons share one line whenever they fit
   (it used to keep 44% and push the buttons onto a line of their own, leaving a gap beside the search) */
.list-tools .an-search{flex:1 1 220px;max-width:480px}
/* the table area: sideways scroll here, inside the card, never the page */
.list-card > .tbl-scroll{overflow-x:auto;border-radius:0 0 var(--radius-lg) var(--radius-lg)}
@media (max-width:768px){
  .list-card > .list-tools{padding:var(--space-3)}
}

/* ---------- list screens: tools and column headings stay in view (Andre's sticky headers) ----------
   fitListBoxes() in app.js sizes each list box (.fit-box: the register's table area, the contacts
   list) to end at the window's edge, so the page stops scrolling and only the rows move: the tools
   row above stays put, and the table heading sticks to the top of the box. Same idea as the report
   sheet (fitReportSheet) and the Mating cycle's sticky stage row. */
.list-card .fit-box{max-height:var(--fit-h,none);overflow:auto;overscroll-behavior:contain}
.list-card .tbl-scroll thead th{position:sticky;top:0;z-index:2;background:var(--surface);box-shadow:inset 0 -1px 0 var(--line)}

/* ---------- list tools on a phone (Kobus, 20 Nov 2026: option a) ----------
   Under 600px the tools row takes about 150px instead of 245px, so more of the list is on the first
   screen: the chips (and Contacts' groups and A to Z) are ONE row that scrolls sideways, with arrows
   and a fade where there is more (addScrollCues); search fills the next line with Filter and Export
   CSV beside it as 44px icon buttons (their words stay for a screen reader and as a tooltip; an
   active filter shows its count next to the funnel and the button keeps its tint); the count is a
   small caption under them. Laptops and tablets keep the full labels. */
@media (max-width:599px){
  .list-tools .chips,.list-tools .ct-chips{flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none}
  .list-tools .chips::-webkit-scrollbar,.list-tools .ct-chips::-webkit-scrollbar,.az-bar .az::-webkit-scrollbar{display:none}
  .list-tools .chips > *,.list-tools .ct-chips > *{flex:none}
  .az-bar .az{display:flex;flex-direction:row;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;gap:2px}
  .az-bar .az-l{flex:0 0 var(--touch-min);min-height:var(--touch-min)}
  #animals .an-actionbar{flex-wrap:wrap;gap:var(--space-2)}
  #animals .an-actionbar .tb-actions{display:contents}
  #animals .list-tools .an-search{order:1;flex:1 1 0;min-width:0;max-width:none}
  #animals .an-toolbar .tb-actions .btn{order:2;flex:none;min-width:var(--touch-min);width:auto;padding:0 var(--space-3);justify-content:center;gap:var(--space-1)}
  /* the words are hidden from sight but not from a screen reader (they name the button) */
  #animals .an-toolbar .tb-actions .btn span{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
  #animals .an-toolbar .tb-actions .num{order:3;flex:1 0 100%;margin:0;font-size:var(--text-caption)}
}

/* ---------- phones: give the screen back to the list (Kobus, 20 Nov 2026) ----------
   1. No fitted list box under 600px: a box of four or five rows with its own scrollbars inside the
      page is fiddly with a thumb, so on a phone the page scrolls as it always did. The sticky box is
      for tablets and laptops, where there is room for the tools, the heading and plenty of rows.
   2. The page header stays ONE line: the title (and its subtitle, cut with an ellipsis) beside the
      screen's one action, instead of the action dropping onto a row of its own (about 60px back). */
@media (max-width:599px){
  .list-card .fit-box{max-height:none;overflow-y:visible}
  .list-card .tbl-scroll.fit-box{overflow-x:auto}
  .ph{flex-wrap:nowrap;align-items:center}
  .ph .crumb{flex:1 1 0;min-width:0}
  .ph .crumb > *{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .ph-acts{flex:none;flex-wrap:nowrap}
  /* more than one header action: the buttons take their own row under the title, sharing it evenly */
  .ph.ph-multi{flex-wrap:wrap}
  .ph.ph-multi .ph-acts{flex:1 0 100%}
  .ph.ph-multi .ph-acts .btn{flex:1 1 0;justify-content:center}
}

/* ---------- Contacts A to Z: one row at every width (Kobus, 20 Nov 2026) ----------
   It used to be a 7-, 13- or 26-column grid by width, so between 600 and 1023px the letters spread
   over two wide rows with odd gaps (98px tall). Now it is always ONE row: on a wide card the 26 letters
   share the width; when they do not fit (every letter keeps at least 32px with a mouse, 44px to a
   finger) the row scrolls sideways with the arrows and fade from addScrollCues. */
.az-bar .az{display:flex;flex-direction:row;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;gap:2px;padding:0}
.az-bar .az::-webkit-scrollbar{display:none}
.az-bar .az-l{flex:1 0 32px;width:auto;min-height:36px}
@media (pointer:coarse){ .az-bar .az-l{flex-basis:var(--touch-min);min-height:var(--touch-min)} }

/* ---------- page header count tag (Kobus, 20 Nov 2026) ----------
   A screen's live count sits as a small tag after its subtitle ("Address book [6 contacts]") instead of
   a card heading row repeating the page title. The look is the Reports directory's soft counter
   (.rd-count): caption size, 600, --text-2 on --surface-2 with a hairline ring. setCrumbTag() in app.js. */
.crumb-tag{display:inline-block;margin-left:var(--space-2);padding:1px 8px;border-radius:var(--radius-full);background:var(--surface-2);box-shadow:inset 0 0 0 1px var(--border);font:600 var(--text-caption)/1.5 var(--font-body);color:var(--text-2);font-variant-numeric:tabular-nums;vertical-align:baseline}

/* ---------- New animal in the top bar (Kobus and Andre, 20 Nov 2026) ----------
   On every screen, always in the same place, beside the search. Outlined (the guide's secondary
   button) with the "+" in the accent, so each screen's own action stays the one lime button in the
   page header (DESIGN.md: one lime button per screen). Under 600px only the "+" shows, a 44px square;
   the words stay for a screen reader (visually hidden) and as the tooltip. */
.tb-new-animal{flex:none;gap:var(--space-2);white-space:nowrap}
.tb-new-animal svg{width:18px;height:18px;color:var(--accent-strong)}
/* the same height as the search box beside it (the dense 36px top-bar control, DESIGN.md decision 3), so
   the two read as one row (Kobus, 20 Nov 2026: a 44px button beside a 36px box looked like a mistake);
   on a touch screen both are 44px, the touch minimum */
.tb-new-animal{min-height:var(--h-control-dense);height:var(--h-control-dense)}
@media (pointer:coarse){ .tb-new-animal,.top .search{min-height:var(--touch-min);height:var(--touch-min)} }
@media (max-width:599px){
  /* margin-left:auto: the search box is hidden on a phone, so this pushes the + over to sit with EN and
     the avatar on the right instead of beside the logo */
  .tb-new-animal{width:var(--touch-min);min-width:var(--touch-min);height:var(--touch-min);padding:0;justify-content:center;margin-left:auto}
  .tb-new-animal span{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
  /* the + takes the auto margin, so the language switch sits right beside it, not halfway along */
  .tb-new-animal ~ .langwrap{margin-left:0}
}

/* ---------- Contacts A to Z bar ----------
   The letters sit in their own bar under the group chips (the tools row's hairline moves under the bar),
   so on a phone the bar can stick under the top bar while the page scrolls the contacts (Kobus, 20 Nov
   2026): a farmer scrolling a long address book can always jump to a letter. On wider screens the list
   scrolls in its fitted box anyway, so the bar simply stays above it. */
.ct-panel > .list-tools{border-bottom:0;padding-bottom:var(--space-2)}
.ct-panel > .az-bar{position:relative;padding:0 var(--space-4) var(--space-2);background:var(--surface);border-bottom:1px solid var(--border)}
@media (max-width:599px){
  .ct-panel > .az-bar{position:sticky;top:calc(var(--topbar-h) + env(safe-area-inset-top) + var(--offline-h, 0px));z-index:3;padding:var(--space-1) var(--space-3)}
}

/* ---------- top bar: every control one height (Kobus, 20 Nov 2026) ----------
   Search, New animal, the language switch and the avatar are all 36px tall (the dense top-bar size),
   44px on a touch screen. The language switch is outlined like the other buttons instead of a bare
   word, and the avatar's visible circle grows to the same 36px (it was a 28px circle in a 44px tap area;
   the tap area stays 44px), always a true circle. */
.top .langbtn{height:var(--h-control-dense);min-height:var(--h-control-dense);border-color:var(--border-strong)}
.top .langbtn:hover{border-color:var(--text-3)}
.top .tb-avatar{border-width:4px}   /* 44px box minus 2 x 4px transparent border = a 36px circle */
@media (pointer:coarse){
  .top .langbtn{height:var(--touch-min);min-height:var(--touch-min)}
  .top .tb-avatar{border-width:0}   /* the full 44px circle on touch, matching the 44px controls */
}

/* ===== New animal / Edit animal modal (Kobus's proposal, 20 Nov 2026) =====================================
   plan/phase-1-animal-register/features/add-animal-redesign.md. The wizard card (.cb-wizard.aa) keeps ONE
   fixed size so switching tabs never makes it jump (point 5); its title and tabs never scroll, only the
   fields do (wrapModalBody keeps .cb-modal-fixed out of the scrolling body). Fields sit in boxed groups
   (point 1) on a grid that follows the BODY's width through a container query, never narrower than about
   200px a field, so long names like "Kameeldrift-speenkalwers" show in full (point 4). Tokens only. */

/* The frame: a sheet 24px short of the screen on a phone; 1170 x min(720, screen - 64) from 900px (1100 until 24 Nov 2026: at 1170 the Pending camp of a
   multi-farm org, "Hangende . Rietvlei Boerdery", fits its field on one line; a longer farm name wraps, never cut off).
   overflow:clip, not hidden: a hidden box can still be scrolled by focus() / scrollIntoView, which would
   slide the title out of sight; clip never scrolls. */
.cb-modal .cb-modal-card.cb-wizard.aa{width:min(1170px,100%);height:calc(100dvh - 24px);max-height:none;overflow:clip}
@media (min-width:900px){ .cb-modal .cb-modal-card.cb-wizard.aa{height:min(720px, calc(100dvh - 64px))} }
.aa .aa-enter-guard{display:none}
.aa > .cb-modal-h{padding-bottom:var(--space-1)}

/* The tabs (seg-tabs look) sit under the title, outside the scrolling body. On a phone the four share
   the width, so there is no sideways scroll. */
.aa .aa-tabs{flex:none;flex-wrap:nowrap;margin:0 var(--space-5)}
@media (max-width:599px){
  .aa .aa-tabs{margin:0 var(--space-3);gap:0}
  .aa .aa-tabs .seg-tab{flex:1 1 auto;padding:0 var(--space-2)}
}

/* The body is the container the field grids measure. */
.cb-modal .cb-modal-card.aa.has-body > .cb-modal-body{container-type:inline-size;container-name:aabody;padding-top:var(--space-4)}

/* The boxed groups. The required box comes first and stands out (surface-2, stronger border). */
.aa .aa-box{position:relative;min-width:0;margin:0 0 var(--space-4);padding:var(--space-3) var(--space-4) var(--space-4);border:1px solid var(--border);border-radius:var(--radius-lg)}
.aa .aa-box > legend{padding:0 var(--space-2);margin-left:calc(-1 * var(--space-2));font-family:var(--serif);font-size:var(--text-h3);font-weight:600;color:var(--ink)}
.aa .aa-box.is-req{background:var(--surface-2);border-color:var(--border-strong)}
.aa .aa-box-note{margin:0 0 var(--space-3);font-size:var(--text-small);color:var(--muted)}
/* A box's one checkbox (Register with studbook) sits on the legend line, top right, so it never leaves a
   half-empty row. Narrow bodies drop it back into the flow above the fields.
   top:-26px centres the 20px box on the box's top border, level with the legend text (it sat 12px
   below it at -14px: the label is taller than its 28px min-height; design review of PR #121, 24 Nov). */
.aa .aa-box-side{position:absolute;top:-26px;right:var(--space-3);margin:0;padding:0 var(--space-2);background:var(--surface);min-height:28px;font-size:var(--text-small)}
@container aabody (max-width:499px){ .aa .aa-box-side{position:static;padding:0;margin:0 0 var(--space-2);background:none} }

/* The field grid: 1 column on a phone, 2 from a 500px body, 4 from 820px (.aa-c3: 3, for the six numbers
   and the weights). .aa-s2/.aa-s3/.aa-s4 span 2/3/4 columns; in 2 columns s3 and s4 take the whole row.
   fillWizardRows stretches the last field of a short row (fillRowGaps), so rows are filled edge to edge. */
.aa .aa-fg{display:grid;gap:var(--space-3) var(--space-4);grid-template-columns:minmax(0,1fr)}
.aa .aa-fg > .cb-lbl{min-width:0;grid-column:auto}
.aa .aa-fg > .cb-lbl[hidden]{display:none}
@container aabody (min-width:500px){
  .aa .aa-fg,.aa .aa-fg.aa-c3{grid-template-columns:repeat(2,minmax(0,1fr))}
  .aa .aa-fg > .aa-s3,.aa .aa-fg > .aa-s4{grid-column:1 / -1}
}
@container aabody (min-width:820px){
  .aa .aa-fg{grid-template-columns:repeat(4,minmax(0,1fr))}
  .aa .aa-fg.aa-c3{grid-template-columns:repeat(3,minmax(0,1fr))}
  .aa .aa-fg > .aa-s2{grid-column:span 2}
  .aa .aa-fg > .aa-s3{grid-column:span 3}
  .aa .aa-fg > .aa-s4{grid-column:1 / -1}
}
/* A value that is still too long wraps instead of being cut off (point 4). */
.aa .cb-select-label{white-space:normal;overflow-wrap:anywhere}

/* Sire / Dam: the search and a visible "+ New" side by side; the inline new-parent block under them. */
.aa .aa-par-row{display:flex;gap:var(--space-2);align-items:stretch}
.aa .aa-par-row > .cb-sel-mount{flex:1 1 auto;min-width:0}
.aa .aa-par-new{flex:none;display:inline-flex;align-items:center;gap:var(--space-1);margin:0;min-height:var(--touch-min);white-space:nowrap}
.aa .aa-par-new svg{width:16px;height:16px}
/* Icon-only "+" (Add weighing's New heading): always the square shape the narrow layout uses below. */
.aa .aa-par-new.is-icon{width:var(--touch-min);padding:0;justify-content:center}
@container aabody (max-width:499px){ .aa .aa-par-new{width:var(--touch-min);padding:0;justify-content:center} .aa .aa-par-new span{display:none} }
.aa .aa-par-done{display:flex;align-items:center;gap:var(--space-2);font-weight:400;color:var(--text-2)}
.aa .aa-par-done .aa-par-edit{margin:0;min-height:36px;padding:0 var(--space-2)}
.aa .aa-pill{background:var(--info-tint);color:var(--info);border-radius:var(--radius-full);padding:2px var(--space-2);font-size:var(--text-small);font-weight:600}
.aa .aa-newpar{display:grid;gap:var(--space-3);margin-top:var(--space-2);padding:var(--space-3) var(--space-4) var(--space-4);border-radius:var(--radius-md);background:var(--accent-tint);font-weight:400}
.aa .aa-newpar[hidden]{display:none}
.aa .aa-newpar-t{margin:0;font-weight:600;color:var(--ink)}
.aa .aa-newpar-g{display:grid;gap:var(--space-3);grid-template-columns:minmax(0,1fr)}
@container aabody (min-width:500px){ .aa .aa-newpar-g{grid-template-columns:repeat(2,minmax(0,1fr))} }
.aa .aa-newpar-help{margin:0;font-size:var(--text-small)}
.aa .aa-newpar-acts{display:flex;justify-content:flex-end;gap:var(--space-2)}
.aa .aa-newpar-acts .cb-btn-ghost{margin:0}

/* The footer: the required-fields note on the left, Cancel and the one lime Save on the right. */
.cb-modal .cb-modal-card.aa.has-body > .aa-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--space-2) var(--space-3)}
.aa .aa-foot > button{margin:0}
.aa .aa-req{flex:1 1 220px;margin:0 auto 0 0;font-size:var(--text-small);color:var(--muted)}
@media (max-width:599px){
  .aa .aa-req{flex-basis:100%}
  .aa .aa-foot > button{flex:1 1 0}
}

/* The message after Save (#aa-saved): the undo message's look, with Open record and Add another side by
   side on its second row. */
.aa-saved .aa-saved-acts{grid-column:2;grid-row:2;display:flex;flex-wrap:wrap;gap:var(--space-1);margin-left:calc(-1 * var(--space-3))}
.aa-saved .aa-saved-acts .wl-undo-btn{margin-left:0}
.aa-saved .aa-saved-acts .wl-undo-btn[hidden]{display:none}
