﻿/* Fonts are loaded by index.html (Fraunces / Manrope / JetBrains Mono with
   preconnect) — no @import here so we don't render-block on a second request. */

:root {
    /* ──────────────────────────────────────────────────────────────────────
       Editorial palette — "Bush Editorial". Cream paper, warm ink, eucalypt
       headings, terracotta accent, mint for confirmations, rust for danger.
       The old `--color-green-*` tokens are kept as aliases so existing CSS
       continues to work but receives the new editorial values.
       ────────────────────────────────────────────────────────────────────── */

    /* Editorial primitives — preferred names going forward. */
    --ed-paper:           #f5efe1;       /* cream */
    --ed-paper-deep:      #ebe3d1;       /* slightly darker cream for hover/shade */
    --ed-paper-warm:      #faf5e8;       /* lightest cream for surfaces */
    --ed-ink:             #1f1d18;       /* warm near-black */
    --ed-ink-soft:        #4a4639;       /* secondary text */
    /* Tertiary text. Darkened twice: once for AA on cream, then again on
       2026-07-19 because the first pass only checked cream — on the DEEPER
       surfaces this ink also lands on (--ed-paper-deep, and panels that tint it
       further to ~#e7ddcb) #6b6659 measured 4.25:1. Verify any future change
       against the darkest surface, not the lightest: 5.8:1 cream / 5.2:1
       paper-deep / 4.95:1 tinted panel. */
    --ed-mute:            #615c4e;
    --ed-eucalypt:        #1f3a2a;       /* deep green for headings */
    --ed-eucalypt-soft:   #3a5a45;       /* lighter eucalypt for hovers */
    /* Primary accent. Darkened from #c2641a on 2026-08-09, the same INK-first sweep
       --ed-mint got below. #c2641a failed AA in BOTH of its roles at once, which is
       why one value fixes both: as ink it read 3.57:1 on cream and 3.20:1 on
       paper-deep, and as a FILL under --ed-paper ink (pills, the export and mic
       buttons, the archive and backup hovers) that same 3.57:1 came back mirrored.
       A text-only companion token was the obvious alternative and would have fixed
       only the first half — the filled pairs need the FILL to move.
       Verify any future change in two directions, as with --ed-mint. Downwards,
       against the DARKEST surface it inks: 5.5:1 cream / 5.0:1 paper-deep / 4.7:1 on
       a panel that tints paper-deep further (~#e7ddcb). Upwards, against the darkest
       thing it is DRAWN ON — the radiograph under FilmMeasure's VHS ruler, where
       darkening LOSES contrast: 3.3:1 on black, floor 3:1. The band between those two
       is narrow; there is no room to round this value off casually.
       Zoolytic rebrand (2026-10-11): terracotta became the brand's chestnut. The token
       keeps its old name because hundreds of rules use it. #85553a was chosen inside
       that same band: 5.5:1 cream / 4.6:1 on the ~#e7ddcb panel / 3.4:1 on black.
       The brand sheet's #8b5a3c measured 4.3:1 on the panel and was darkened to fit. */
    --ed-terracotta:      #85553a;       /* warm primary accent (chestnut) */
    --ed-terracotta-soft: rgba(133, 85, 58, 0.13);
    --ed-terracotta-glow: rgba(133, 85, 58, 0.30);
    --ed-saffron:         #e8c84a;       /* "live recording" only */
    /* Confirmations, reviewed badges. INK first, decoration second: it sets `color`
       on the save toast, the live-consult saved check, Today's import result and
       done-row status line — none of which supply their own surface — so it answers
       to the 4.5:1 TEXT floor on the paper family, not the 3:1 floor its borders and
       FilmMeasure's ruler would be happy with. #3a7c5c shipped at 4.34:1 on cream
       (2026-08-06); the #2a6a35 it had replaced was 5.70:1, so the "frozen literal"
       cleanup cost contrast it did not have to cost.
       Verify any future change in two directions, not one. Downwards, against the
       DARKEST surface it lands on, not the lightest: 5.5:1 cream / 4.9:1 paper-deep /
       4.7:1 on a panel that tints paper-deep further (~#e7ddcb). Upwards, against the
       darkest thing it is DRAWN ON — the radiograph under FilmMeasure's ruler, where
       darkening LOSES contrast: 3.3:1 on black, floor 3:1. */
    --ed-mint:            #2f6b4e;
    --ed-rust:            #a23b2a;       /* destructive */
    --ed-hairline:        rgba(31, 29, 24, 0.14);
    --ed-hairline-strong: rgba(31, 29, 24, 0.28);
    --ed-grain:           rgba(122, 74, 28, 0.025);

    /* ── Zoolytic wordmark (Components/Wordmark.razor) ──
       The word takes the heading ink; the paw over the "i" and the heartbeat trace
       under the word take the accent. Chestnut on paper measures 5.1:1, so the mark
       clears the 3:1 graphics floor with room to spare. The on-dark pair is for the
       sidebar, which stays eucalypt in both themes: cream word, gold accent (5.3:1). */
    --zl-mark-ink:            var(--ed-eucalypt);
    --zl-mark-accent:         #8b5a3c;
    --zl-mark-ink-on-dark:    #efe4c8;
    --zl-mark-accent-on-dark: #c9a35b;
    /* The heartbeat's one pulse (micro-rewards, 2026-10-17): it runs along the trace when a
       consult is filed or the day closes. On paper it is the save family's mint, so the
       pulse reads as "filed", not as the accent; on the eucalypt sidebar a warm near-white
       that stands off the gold trace it travels over. Graphics only — 3:1 is its floor. */
    --zl-mark-pulse:          var(--ed-mint);
    --zl-mark-pulse-on-dark:  #fff3cf;

    /* ── Glass (Zoolytic, 2026-10-11) ──
       For chrome that floats over the work: the sign-in card, the phone tab bar, toasts,
       the update pill, the live-consult chip, the sidebar's current page. Never for the
       clinical record itself, which stays on solid paper. Any glass here that carries text
       is at least 70% opaque, so the ink keeps its contrast whatever scrolls behind it;
       the thinner floating glass below holds its ink up with a frost instead.
       Under prefers-reduced-transparency every one of these goes solid (below), and so
       does every one under data-glass="lite" or without backdrop-filter support. */
    --glass-light:        rgba(255, 253, 246, 0.72);
    --glass-light-strong: rgba(255, 253, 246, 0.88);
    --glass-dark:         rgba(20, 39, 26, 0.80);
    --glass-edge:         rgba(255, 255, 255, 0.65);
    --glass-edge-dark:    rgba(239, 228, 200, 0.25);
    --glass-highlight:    rgba(255, 255, 255, 0.85);
    --glass-shade:        rgba(20, 38, 28, 0.18);
    /* 16px is the ceiling (owner, 2026-10-17: the app must stay quick on a clinic PC).
       Never raise it, never animate it, and never stack two blurs over one region. */
    --glass-blur:         blur(16px) saturate(170%);

    /* ── Floating glass (2026-10-17, the approved "stronger glass") ──
       The floating bars and the layers that open over the work: masthead menus, dialogs,
       toasts. Thinner than the chrome above, so ink is held up by a FROST as well as the
       fill: a contrast-then-brightness step after the blur that squeezes whatever is
       behind into a band. --glass-frost (contrast 0.3, brightness 1.8: black comes out at
       63% grey, paper at white) is for panes that carry text on the glass itself — menus,
       dialogs, the phone's tab bar; --glass-frost-dark pulls into a dark band instead, for
       the dark toast and every floating pane in the dark theme. The masthead capsule
       carries no text on its bare glass — its words ride on chips (--glass-chip, set as
       --shell-chip by the floating bar) — so it takes the light --glass-frost-bar and a
       0.52 fill, and stays truly see-through; its bare glass only owes 3:1 to the icons.
       tests/js/css-hygiene "text on floating glass" measures every pairing at both ends of
       each band, both themes. Fill tokens: the masthead, its chips, the phone tab bar, a
       menu, a dialog, the dark toast, and the FLAT glass for a popover that can land over
       a bar, which therefore gets no blur at all. */
    --glass-bar:          rgba(255, 253, 246, 0.52);
    --glass-chip:         rgba(255, 253, 246, 0.72);
    --glass-tabbar:       rgba(255, 253, 246, 0.64);
    --glass-menu:         rgba(255, 253, 246, 0.66);
    --glass-dialog:       rgba(255, 253, 246, 0.70);
    --glass-toast:        rgba(20, 39, 26, 0.66);
    --glass-flat:         rgba(255, 253, 246, 0.96);
    --glass-float-edge:   rgba(255, 255, 255, 0.72);
    --glass-float-light:  rgba(255, 255, 255, 0.95);
    --glass-float-shade:  rgba(20, 38, 28, 0.16);
    --glass-toast-edge:   rgba(239, 228, 200, 0.28);
    --glass-toast-light:  rgba(255, 255, 255, 0.22);
    /* The toast's tick: a pale mint that reads on the dark glass in both themes. */
    --glass-toast-check:  #9fd3b4;
    --glass-frost:        contrast(0.3) brightness(1.8);
    --glass-frost-bar:    contrast(0.7) brightness(1.15);
    --glass-frost-dark:   contrast(0.3) brightness(0.3);
    /* The scrim behind a dialog: a plain colour, never a blur. */
    --glass-scrim:        rgba(20, 38, 28, 0.34);
    /* A floating pane's whole backdrop recipe: the blur, then the frost that holds its
       ink up. One token per family, so every solid fallback switches each off in one
       line (a bare "none contrast(...)" would be invalid, not off). */
    --glass-float-filter: var(--glass-blur) var(--glass-frost);
    --glass-bar-filter:   var(--glass-blur) var(--glass-frost-bar);
    --glass-toast-filter: var(--glass-blur) var(--glass-frost-dark);

    /* ── Type stack ── */
    --ed-display: "Fraunces", "Iowan Old Style", Georgia, serif;
    --ed-body:    "Fraunces", "Iowan Old Style", Georgia, serif;
    --ed-ui:      "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    --ed-mono:    "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

    /* ── Legacy aliases — old names map to the editorial palette so the
       hundreds of existing CSS rules pick up the new look automatically. ── */
    --color-accent:        var(--ed-terracotta);
    /* Deepened with the accent on 2026-08-09: #9e4a0e was darker than #c2641a but is
       LIGHTER than its replacement, which would have inverted the hover it exists to
       darken. Also inked (.btn-outline-accent:hover) — 7.4:1 on cream. */
    --color-accent-dark:   #6a4330;
    --color-accent-light:  #a97a58;
    --color-accent-soft:   var(--ed-terracotta-soft);
    --color-accent-glow:   var(--ed-terracotta-glow);
    --color-green-bg:      var(--ed-paper);
    --color-green-mid:     var(--ed-eucalypt);
    --color-green-border:  var(--ed-hairline-strong);
    --color-green-soft:    var(--ed-paper-deep);
    --color-green-accent:  var(--ed-mint);
    --color-sidebar-from:  #1f3a2a;
    --color-sidebar-to:    #14271a;
    --color-text-main:     var(--ed-ink);
    --color-text-muted:    var(--ed-mute);
    --color-text:          var(--ed-ink);
    --color-surface:       rgba(245, 239, 225, 0.78);
    --color-surface-solid: var(--ed-paper-warm);

    /* ── Radius (tightened — editorial is rectangular) ── */
    --radius-sm:   0.35rem;
    --radius-md:   0.5rem;
    --radius-lg:   0.75rem;
    --radius-xl:   1rem;
    --radius-full: 9999px;

    /* ── Shadow (lighter — hairlines do most of the elevation work) ── */
    --shadow-xs:  0 1px 2px rgba(31,29,24,0.06);
    --shadow-sm:  0 2px 6px rgba(31,29,24,0.07);
    --shadow-md:  0 4px 16px rgba(31,29,24,0.08);
    --shadow-lg:  0 8px 28px rgba(31,29,24,0.10);
    --shadow-accent: 0 4px 14px var(--ed-terracotta-glow);

    /* ── Sidebar ── */
    --sidebar-width:            250px;
    --sidebar-collapsed-width:  3.8rem;

    /* ── Floating shell geometry (2026-10-17) ──
       The masthead capsule: its inset from the top and sides, its height, and the
       clearance the scroller keeps above every page's first line (inset + bar + a gap).
       Phone mode re-binds them below (the bar is fixed there and clears the notch).
       --shell-sticky-top is where a sticky header stops: 0 inside the desktop article,
       whose padding already ends below the capsule; the clearance in phone mode, where
       the page itself scrolls under a fixed bar. --phone-bar-float is how far the phone's
       bottom capsule floats off the bottom edge (plus the home-indicator inset): every
       control parked above that bar adds it to the offset it already had. */
    --shell-bar-inset:   14px;
    --shell-bar-side:    16px;
    --shell-bar-h:       3.5rem;
    --shell-bar-clear:   calc(var(--shell-bar-inset) + var(--shell-bar-h) + 0.35rem);
    --shell-sticky-top:  0px;
    --phone-bar-float:   14px;
    /* The band a dialog's pane stays inside: below the masthead capsule, above the
       foot (phone mode raises the foot over the bottom capsule, phone/shell.css). */
    --shell-dialog-top:    var(--shell-bar-clear);
    --shell-dialog-bottom: 1rem;

    /* ── Transitions ── */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-overshoot: cubic-bezier(0.34, 1.2, 0.64, 1);

    /* ── Comfort micro-type floor ──
       Every font-size below 0.8rem is written max(<size>, var(--ed-fs-floor, 0rem)).
       Here the floor is 0rem, so max() is a no-op and normal view renders exactly
       as authored. Comfort view re-binds it (see the comfort section) and every
       badge, kicker, disclaimer and section label rises to a readable size at once.
       The css-hygiene suite enforces the pattern on every sub-0.8rem literal. */
    --ed-fs-floor: 0rem;

    /* ── Spacing scale ──
       Three tiers: this block (desktop), @media (max-width: 900px) (compact) and
       @media (max-width: 640.98px) (phone), all three defined just below.

       Custom properties rather than media overrides for the same hard reason
       --ed-fs-floor above is shaped this way: scoped CSS compiles .panel to
       .panel[b-xxxxx] and beats the same selector here, so a media block in this
       file cannot reach any of the 235 spacing declarations in the 25 scoped
       sheets. Inheritance is the only route through.

       To tune the phone, edit the phone tier — not 636 literals. */
    --ed-sp-gutter: 1.5rem;   /* article + top-row inline padding   */
    --ed-sp-pad-x:  1.75rem;  /* panel inline padding               */
    --ed-sp-pad-y:  1.5rem;   /* panel block padding                */
    --ed-sp-head-y: 1.1rem;   /* panel header block padding         */
    --ed-sp-gap:    0.7rem;   /* gap within a header or action row  */
}

/* Compact. Reproduces today's <=900px values exactly, and exists so the 641-900px
   band (iPad portrait) keeps them: without this tier, repointing the <=900px rules
   at tokens would silently hand a tablet the desktop values. */
@media (max-width: 900px) {
    :root {
        --ed-sp-pad-x:  1rem;
        --ed-sp-pad-y:  1rem;
        --ed-sp-head-y: 0.7rem;
        --ed-sp-gap:    0.6rem;
    }
}

/* Phone. --ed-sp-gutter is re-bound ONLY here: at 641px and above the article
   gutter is set by the !important rule in MainLayout.razor.css, which measurement
   confirms beats Bootstrap's px-4 (also !important — the scope attribute's
   (0,1,0) is what settles it). A compact value would be dead code.

   This tier also absorbs the old <=480px block. A fourth density tier is a knob
   nobody will tune; the cost is that 481-640px phones get slightly tighter than
   before, which is the intended direction. */
@media (max-width: 640.98px) {
    :root {
        --ed-sp-gutter: 0.6rem;
        --ed-sp-pad-x:  0.85rem;
        --ed-sp-pad-y:  0.9rem;
        --ed-sp-head-y: 0.65rem;
        --ed-sp-gap:    0.5rem;
    }
}

/* Dark mode — warm charcoal "ink paper" with lifted accents. */
[data-theme="dark"] {
    --ed-paper:           #1c1a16;
    --ed-paper-deep:      #14130f;
    --ed-paper-warm:      #221f19;
    --ed-ink:             #ede6d5;
    --ed-ink-soft:        #c9c1b1;
    --ed-mute:            #9c968a;       /* lifted for AA (~6:1) on dark charcoal */
    --ed-eucalypt:        #84b48e;
    --ed-eucalypt-soft:   #b5d6bd;
    --ed-terracotta:      #c9a35b;
    --ed-terracotta-soft: rgba(201, 163, 91, 0.16);
    --ed-terracotta-glow: rgba(201, 163, 91, 0.30);
    --ed-mint:            #6cc296;
    --ed-rust:            #d56a52;
    --ed-hairline:        rgba(237, 230, 213, 0.10);
    --ed-hairline-strong: rgba(237, 230, 213, 0.25);
    --ed-grain:           rgba(237, 230, 213, 0.02);
    --color-surface:      rgba(34, 31, 25, 0.85);
    /* On charcoal paper the mark takes the on-dark pair; the sidebar's pair is the
       same in both themes because the sidebar does not flip. */
    --zl-mark-accent:         #c9a35b;
    --zl-mark-ink-on-dark:    #efe4c8;
    --zl-mark-accent-on-dark: #c9a35b;
    --zl-mark-pulse-on-dark:  #fff3cf;
    /* Glass in the dark theme is charcoal, not white: a light pane on charcoal paper
       would glare and drop the cream ink below AA. */
    --glass-light:        rgba(34, 31, 25, 0.80);
    --glass-light-strong: rgba(34, 31, 25, 0.92);
    --glass-dark:         rgba(14, 26, 18, 0.84);
    --glass-edge:         rgba(237, 230, 213, 0.16);
    --glass-edge-dark:    rgba(239, 228, 200, 0.22);
    --glass-highlight:    rgba(237, 230, 213, 0.14);
    --glass-shade:        rgba(0, 0, 0, 0.40);
    /* Floating glass in the dark theme: charcoal panes over the dark frost, which pulls
       whatever is behind (cream ink, a mint button) down into a dark band so the cream,
       muted and rust inks keep AA. The bar, its chips and the menus share the paper-deep
       charcoal. Rust is near AA even on SOLID charcoal, and measured in linear light the
       frost lifts white further than in sRGB — which is why the dark menus, dialogs and
       tab bar went flat rather than ever thicker (below). */
    --glass-bar:          rgba(20, 19, 15, 0.58);
    --glass-chip:         rgba(20, 19, 15, 0.80);
    /* FLAT in the dark theme (2026-10-17 review): to keep rust and muted ink at AA the
       menus and dialogs needed 0.82/0.84 over a frost that leaves almost nothing showing,
       and the tab bar the same — near-solid panes still paying for a 16px blur. They take
       their solid equivalent (the paper-deep charcoal they were tinted with) and
       --glass-float-filter is none here. The masthead capsule (0.58 over a light frost)
       stays glass: it is visibly see-through. */
    --glass-tabbar:       var(--ed-paper-deep);
    --glass-menu:         var(--ed-paper-deep);
    --glass-dialog:       var(--ed-paper-deep);
    --glass-float-filter: none;
    --glass-toast:        rgba(14, 26, 18, 0.70);
    --glass-flat:         rgba(20, 19, 15, 0.97);
    --glass-float-edge:   rgba(237, 230, 213, 0.16);
    --glass-float-light:  rgba(237, 230, 213, 0.16);
    --glass-float-shade:  rgba(0, 0, 0, 0.42);
    --glass-toast-edge:   rgba(239, 228, 200, 0.22);
    --glass-toast-light:  rgba(237, 230, 213, 0.14);
    --glass-toast-check:  #9fd3b4;
    --glass-frost:        contrast(0.3) brightness(0.1);
    --glass-frost-bar:    contrast(0.7) brightness(0.6);
    --glass-frost-dark:   contrast(0.3) brightness(0.3);
    --glass-scrim:        rgba(0, 0, 0, 0.50);
}

/* Reduce transparency: every glass surface becomes its solid colour and loses the
   blur. Layout does not change. This is also the switch to reach for if the blur
   proves too slow on an older clinic PC. */
@media (prefers-reduced-transparency: reduce) {
    :root {
        --glass-light:        var(--ed-paper-warm);
        --glass-light-strong: var(--ed-paper-warm);
        --glass-dark:         var(--color-sidebar-to);
        --glass-blur:         none;
        --glass-bar:          var(--ed-paper-warm);
        --glass-chip:         var(--ed-paper-warm);
        --glass-tabbar:       var(--ed-paper-warm);
        --glass-menu:         var(--ed-paper-warm);
        --glass-dialog:       var(--ed-paper-warm);
        --glass-toast:        var(--color-sidebar-to);
        --glass-flat:         var(--ed-paper-warm);
        --glass-float-filter: none;
        --glass-bar-filter:   none;
        --glass-toast-filter: none;
    }
    /* The fills above already resolve per theme; the blur needs saying again here
       so the dark block's equal-specificity selector cannot bring it back. */
    [data-theme="dark"] {
        --glass-blur:         none;
        --glass-float-filter: none;
        --glass-bar-filter:   none;
        --glass-toast-filter: none;
    }
}

/* Solid fallbacks for the floating glass. Same layout, same tokens, opaque fills and
   no backdrop-filter at all:
   - a browser that cannot blur (the translucent fills were tuned on the assumption
     that the frost is there; without it the ink would sit on a bare 60% pane);
   - data-glass="lite", set before first paint by first-paint.js on a low-power device
     (4 cores or fewer, or 4 GB or less where the browser says) — the clinic PC case.
   (0,2,0) on the lite rule beats the dark theme's (0,1,0) wherever it sits. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    :root,
    [data-theme="dark"] {
        --glass-light:        var(--ed-paper-warm);
        --glass-light-strong: var(--ed-paper-warm);
        --glass-dark:         var(--color-sidebar-to);
        --glass-bar:          var(--ed-paper-warm);
        --glass-chip:         var(--ed-paper-warm);
        --glass-tabbar:       var(--ed-paper-warm);
        --glass-menu:         var(--ed-paper-warm);
        --glass-dialog:       var(--ed-paper-warm);
        --glass-toast:        var(--color-sidebar-to);
        --glass-flat:         var(--ed-paper-warm);
    }
}

:root[data-glass="lite"] {
    --glass-light:        var(--ed-paper-warm);
    --glass-light-strong: var(--ed-paper-warm);
    --glass-dark:         var(--color-sidebar-to);
    --glass-blur:         none;
    --glass-bar:          var(--ed-paper-warm);
    --glass-chip:         var(--ed-paper-warm);
    --glass-tabbar:       var(--ed-paper-warm);
    --glass-menu:         var(--ed-paper-warm);
    --glass-dialog:       var(--ed-paper-warm);
    --glass-toast:        var(--color-sidebar-to);
    --glass-flat:         var(--ed-paper-warm);
    --glass-float-filter: none;
    --glass-bar-filter:   none;
    --glass-toast-filter: none;
}

/* ── Sidebar width reflow ──────────────────────────────────────────────────── */
@media (min-width: 641px) {
    .nav-sidebar { width: var(--sidebar-width); }
    .nav-sidebar--collapsed { width: var(--sidebar-collapsed-width); }
}

/* ── Global keyframes ──────────────────────────────────────────────────────── */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}
@keyframes ripple-out {
    0%   { transform: scale(0); opacity: 0.5; }
    100% { transform: scale(4); opacity: 0; }
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
/* Root scale — lifts the whole rem-based type system ~6% (16px → 17px) so the
   default reads comfortably for older eyes. Single knob; set on html only (never
   on body too, or the percentage would compound). Tune here if it needs to grow. */
html { font-size: 106.25%; }

html, body {
    font-family: var(--ed-ui);
    background: var(--ed-paper);
    color: var(--ed-ink);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* The serif is reserved for content blocks (case data, legal docs, FAQ bodies,
   markdown render). UI chrome stays in Manrope so labels read crisply. */
.markdown-body,
.cv-entry-preview,
.cv-entry-expanded {
    font-family: var(--ed-body);
    /* Desktop markdown had no explicit leading — inherited ~1.2 (tight). This is
       the primary long-form reading surface (AI outputs, case entries), so give
       it comfortable leading for older eyes. */
    line-height: 1.6;
}

/* ────────────────────────────────────────────────────────────────────────────
   Editorial primitives — reusable typographic objects used across pages that
   need a magazine-spread treatment. CaseView has its own scoped versions; these
   are the global vocabulary every other page can pick up.
   ──────────────────────────────────────────────────────────────────────────── */

.ed-page {
    min-height: calc(100dvh - 3.5rem);
    background: var(--ed-paper);
    padding: 1.5rem 2rem 4rem;
    position: relative;
}

.ed-spread {
    max-width: 1180px;
    margin: 0 auto;
}

/* Tracked-small-caps stamp — kicker, status, signalment, "OPEN · 7 CASES". */
.ed-kicker {
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--ed-eucalypt);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ed-kicker-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ed-terracotta);
    flex-shrink: 0;
}

/* Italic display headline. clamp() makes one rule work from phone to desktop. */
.ed-headline {
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(2.2rem, 6vw, 4rem);
    font-variation-settings: "opsz" 144;
    line-height: 0.98;
    letter-spacing: -0.022em;
    color: var(--ed-ink);
    margin: 0 0 0.65rem;
    word-break: break-word;
}

.ed-headline--small {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
}

/* Section break — small-caps mono with a hairline under it. */
.ed-section-label {
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--ed-ink-soft);
    margin: 0 0 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ed-hairline);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.ed-section-label-meta {
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    color: var(--ed-mute);
    letter-spacing: 0.12em;
    font-weight: 400;
}

/* Manrope byline line for "Owner · Opened 15 Jun · Status · Active" style. */
.ed-byline {
    font-family: var(--ed-ui);
    font-size: 0.86rem;
    color: var(--ed-ink-soft);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.ed-byline-sep {
    color: var(--ed-mute);
    user-select: none;
}

/* Standfirst — serif intro paragraph with an italic terracotta drop-cap. */
.ed-standfirst {
    font-family: var(--ed-body);
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--ed-ink);
    margin: 0 0 1.75rem;
    max-width: 56ch;
    font-variation-settings: "opsz" 24;
}

.ed-dropcap {
    float: left;
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 600;
    font-size: 3.2rem;
    line-height: 0.85;
    padding: 0.18rem 0.5rem 0 0;
    color: var(--ed-terracotta);
    font-variation-settings: "opsz" 144;
}

/* Editorial pill button — the default ghost variant. */
.ed-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--ed-ui);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--ed-hairline-strong);
    background: transparent;
    color: var(--ed-ink-soft);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    line-height: 1.3;
    text-decoration: none;
    white-space: nowrap;
}

    .ed-pill:hover {
        border-color: var(--ed-ink);
        color: var(--ed-ink);
        text-decoration: none;
    }

    .ed-pill--small { font-size: max(0.74rem, var(--ed-fs-floor, 0rem)); padding: 0.25rem 0.7rem; }

    /* Selected state for a pill acting as a toggle (e.g. the Certificates doc-type picker).
       Same treatment as --primary: filled = "this one is selected", not a new visual language. */
    .ed-pill--active {
        background: var(--ed-eucalypt);
        color: var(--ed-paper);
        border-color: var(--ed-eucalypt);
    }

        .ed-pill--active:hover {
            background: var(--ed-ink);
            color: var(--ed-paper);
            border-color: var(--ed-ink);
        }

    .ed-pill--primary {
        background: var(--ed-eucalypt);
        color: var(--ed-paper);
        border-color: var(--ed-eucalypt);
    }

        .ed-pill--primary:hover {
            background: var(--ed-ink);
            color: var(--ed-paper);
            border-color: var(--ed-ink);
        }

    .ed-pill--terracotta {
        background: var(--ed-terracotta);
        color: var(--ed-paper);
        border-color: var(--ed-terracotta);
    }

        .ed-pill--terracotta:hover {
            background: var(--ed-eucalypt);
            border-color: var(--ed-eucalypt);
            color: var(--ed-paper);
        }

    .ed-pill--accent {
        color: var(--ed-mint);
        border-color: var(--ed-mint);
    }

        .ed-pill--accent:hover { background: var(--ed-mint); color: var(--ed-paper); }

    .ed-pill--danger {
        color: var(--ed-rust);
        /* The token at 35%, not the light rust frozen at 35%: that fell to about 1.4:1 on
           dark paper and the outline vanished (QoL 2026-10-04, phone#18). Same colour in light. */
        border-color: color-mix(in srgb, var(--ed-rust) 35%, transparent);
    }

        .ed-pill--danger:hover {
            background: var(--ed-rust);
            color: var(--ed-paper);
            border-color: var(--ed-rust);
        }

/* Inline editorial text-button — underlined Manrope, no chrome. */
.ed-text-btn {
    background: none;
    border: none;
    border-bottom: 1px solid var(--ed-hairline-strong);
    padding: 0 0 1px;
    font: inherit;
    font-family: var(--ed-ui);
    font-size: 0.86rem;
    color: var(--ed-eucalypt);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

    .ed-text-btn:hover {
        border-color: var(--ed-eucalypt);
        color: var(--ed-ink);
    }

/* A "?" that opens the rest of a shortened hint (QoL 2026-10-04 text trims): the short
   line says what the screen does, and the sentence it replaced is one tap away, word for
   word. The visible circle stays the height of the text it ends; a coarse pointer gets a
   44px target from an invisible ring around it rather than a 44px circle in a sentence. */
.ed-help-q {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    margin-left: 0.2rem;
    padding: 0;
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--ed-mute);
    font-family: var(--ed-ui);
    font-size: max(0.75rem, var(--ed-fs-floor, 0rem));
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

    .ed-help-q:hover,
    .ed-help-q[aria-expanded="true"] {
        border-color: var(--ed-eucalypt);
        color: var(--ed-eucalypt);
    }

@media (pointer: coarse) {
    .ed-help-q::after {
        content: "";
        position: absolute;
        inset: -0.75rem;
    }
}

/* "Active" pulse — shared keyframe + state pip. Used by CaseView's scoped
   .cv-active-pip and by .case-banner-dot. The .ed-* classes themselves
   aren't used in markup yet but the keyframe is so we keep it here. */
@keyframes ed-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(58, 124, 92, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(58, 124, 92, 0); }
}

/* ────────────────────────────────────────────────────────────────────────────
   Bootstrap override layer — re-skin the default .btn / .alert / .form-control
   surfaces so any page that uses Bootstrap classes still feels editorial.
   ──────────────────────────────────────────────────────────────────────────── */

.btn {
    font-family: var(--ed-ui);
    font-weight: 500;
    border-radius: var(--radius-md);
    letter-spacing: 0.01em;
    border-width: 1px;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn-primary {
    background: var(--ed-eucalypt);
    border-color: var(--ed-eucalypt);
    color: var(--ed-paper);
}

    .btn-primary:hover, .btn-primary:focus {
        background: var(--ed-ink);
        border-color: var(--ed-ink);
        color: var(--ed-paper);
    }

    .btn-primary:disabled {
        background: var(--ed-hairline-strong);
        border-color: var(--ed-hairline-strong);
        color: var(--ed-mute);
    }

.btn-outline-primary {
    color: var(--ed-eucalypt);
    border-color: var(--ed-eucalypt);
    background: transparent;
}

    .btn-outline-primary:hover, .btn-outline-primary:focus {
        background: var(--ed-eucalypt);
        color: var(--ed-paper);
        border-color: var(--ed-eucalypt);
    }

.btn-outline-secondary {
    color: var(--ed-ink-soft);
    border-color: var(--ed-hairline-strong);
    background: transparent;
}

    .btn-outline-secondary:hover, .btn-outline-secondary:focus {
        background: var(--ed-paper-deep);
        color: var(--ed-ink);
        border-color: var(--ed-ink);
    }

.btn-outline-success {
    color: var(--ed-mint);
    border-color: var(--ed-mint);
    background: transparent;
}

    .btn-outline-success:hover, .btn-outline-success:focus {
        background: var(--ed-mint);
        color: var(--ed-paper);
        border-color: var(--ed-mint);
    }

.btn-outline-danger {
    color: var(--ed-rust);
    /* The token at 40% (QoL 2026-10-04, phone#18): the light rust frozen at 40% was about
       1.4:1 on dark paper, so in dark mode Discard (the waiting screen's and Review's) lost
       its outline. Identical in light. */
    border-color: color-mix(in srgb, var(--ed-rust) 40%, transparent);
    background: transparent;
}

    .btn-outline-danger:hover, .btn-outline-danger:focus {
        background: var(--ed-rust);
        color: var(--ed-paper);
        border-color: var(--ed-rust);
    }

/* Alerts — hairline rectangles, not raised cards. Tone via the left rail. */
.alert {
    border-radius: var(--radius-sm);
    border: 1px solid var(--ed-hairline-strong);
    border-left-width: 3px;
    font-family: var(--ed-ui);
    font-size: 0.88rem;
    color: var(--ed-ink);
    /* --color-surface, not a literal cream: --ed-ink flips to cream in dark, so a
       hardcoded light background here means cream-on-cream. Latent rather than
       live today (every rendered alert carries an -info/-success/-warning/-danger
       modifier that supplies its own background), but the next bare .alert would
       be invisible in dark mode. --color-surface flips with the theme. */
    background: var(--color-surface);
}

.alert-success { border-left-color: var(--ed-mint); color: var(--ed-ink); background: rgba(58, 124, 92, 0.06); }
.alert-info    { border-left-color: var(--ed-eucalypt); color: var(--ed-ink); background: rgba(31, 58, 42, 0.05); }
.alert-warning { border-left-color: var(--ed-terracotta); color: var(--ed-ink); background: rgba(133, 85, 58, 0.06); }
.alert-danger  { border-left-color: var(--ed-rust); color: var(--ed-ink); background: rgba(162, 59, 42, 0.07); }

/* Form controls — hairline-rectangle, no raised inset. */
.form-control, .form-select {
    font-family: var(--ed-ui);
    background: var(--ed-paper-warm);
    border: 1px solid var(--ed-hairline-strong);
    border-radius: var(--radius-sm);
    color: var(--ed-ink);
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--ed-eucalypt);
        box-shadow: 0 0 0 3px rgba(31, 58, 42, 0.08);
        background: var(--ed-paper-warm);
    }

    .form-control::placeholder { color: var(--ed-mute); }

.form-label {
    font-family: var(--ed-ui);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ed-ink-soft);
    letter-spacing: 0.01em;
    margin-bottom: 0.35rem;
}

.form-check-label {
    font-family: var(--ed-ui);
    font-size: 0.88rem;
    color: var(--ed-ink);
}

.form-check-input:checked {
    background-color: var(--ed-eucalypt);
    border-color: var(--ed-eucalypt);
}

/* ── Custom scrollbar ──────────────────────────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-green-border) transparent;
}
*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--color-green-border);
    border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover { background: var(--color-accent); }

/* ── Chat page layout ──────────────────────────────────────────────────────── */
.chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 3.5rem);
    position: relative;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(133,85,58,0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(45,106,45,0.09) 0%, transparent 55%),
        var(--color-green-bg);
}

.chat-header {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    padding: 1.1rem 1.5rem 0.9rem;
    background: transparent;
    border-bottom: 1px solid var(--ed-hairline-strong);
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.5rem;
    font-variation-settings: "opsz" 48;
    color: var(--ed-ink);
    letter-spacing: -0.01em;
}

.chat-header-icon {
    font-size: 1.3rem;
    font-style: normal;
    align-self: center;
    animation: fadeIn 0.4s ease;
}

/* ── Message history ───────────────────────────────────────────────────────── */
.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.25rem 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    /* No smooth scroll: the streaming loop sets scrollTop directly on a cadence,
       and animating each jump fights the auto-follow. */
}

/* ── Bubble rows ───────────────────────────────────────────────────────────── */
.bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 100%;
}

.bubble-row--user {
    flex-direction: row-reverse;
    align-self: flex-end;
    max-width: 78%;
}

.bubble-row--assistant {
    align-self: flex-start;
    max-width: 82%;
}

.bubble-avatar {
    font-size: 1.1rem;
    flex-shrink: 0;
    line-height: 1;
    margin-bottom: 2px;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-full);
    background: var(--color-green-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xs);
}

/* Assistant identity: a paw badge on the brand green. The warm accent gradient is
   the user's colour (see .bubble--user), so the assistant stays green to keep the
   two voices visually distinct. */
.bubble-avatar--assistant {
    background:
        radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.28), transparent 60%),
        var(--color-green-mid);
}

.paw-icon {
    width: 1.15rem;
    height: 1.15rem;
    fill: #ffffff;
    display: block;
}

/* ── Bubbles ───────────────────────────────────────────────────────────────── */
.bubble {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    line-height: 1.55;
    font-size: 0.94rem;
    word-break: break-word;
    box-shadow: none;
    animation: fadeSlideUp 0.2s var(--ease-smooth);
    font-family: var(--ed-body);
    font-variation-settings: "opsz" 14;
}

.bubble--user {
    background: var(--ed-eucalypt);
    color: var(--ed-paper);
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.bubble--assistant {
    background: var(--ed-paper-warm);
    color: var(--ed-ink);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--ed-hairline);
}

/* Assistant avatar gets the eucalypt; we keep the paw mark white on green. */
.bubble-avatar { background: var(--ed-eucalypt); }
.bubble-avatar--assistant {
    background:
        radial-gradient(circle at 35% 28%, rgba(255,255,255,0.18), transparent 60%),
        var(--ed-eucalypt);
}

/* ── Thinking animation ────────────────────────────────────────────────────── */
.thinking-animation {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.1rem 0;
}

.thinking-label {
    font-size: 0.85rem;
    /* Token, not the template's #6b7280: the cool grey measured 4.22:1 on the
       cream tool pages — under the 4.5:1 floor — and only dark mode had been
       retokened (2026-09-03 sweep). The token flips itself, so the dark
       override below became redundant and was removed. */
    color: var(--color-text-muted);
    font-style: italic;
}

.thinking-dots {
    display: inline-flex;
    gap: 7px;
    align-items: center;
}

/* Each "dot" is a paw print; staggered delays make them step left-to-right like a
   small animal trotting — the thinking state for a veterinary assistant. */
.thinking-dots span {
    width: 14px;
    height: 14px;
    display: inline-block;
    background-color: var(--color-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cellipse%20cx='12'%20cy='16'%20rx='5.2'%20ry='4.3'/%3E%3Cellipse%20cx='5.6'%20cy='10.6'%20rx='2'%20ry='2.6'/%3E%3Cellipse%20cx='9.8'%20cy='7.5'%20rx='2.05'%20ry='2.85'/%3E%3Cellipse%20cx='14.2'%20cy='7.5'%20rx='2.05'%20ry='2.85'/%3E%3Cellipse%20cx='18.4'%20cy='10.6'%20rx='2'%20ry='2.6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3E%3Cellipse%20cx='12'%20cy='16'%20rx='5.2'%20ry='4.3'/%3E%3Cellipse%20cx='5.6'%20cy='10.6'%20rx='2'%20ry='2.6'/%3E%3Cellipse%20cx='9.8'%20cy='7.5'%20rx='2.05'%20ry='2.85'/%3E%3Cellipse%20cx='14.2'%20cy='7.5'%20rx='2.05'%20ry='2.85'/%3E%3Cellipse%20cx='18.4'%20cy='10.6'%20rx='2'%20ry='2.6'/%3E%3C/svg%3E") center / contain no-repeat;
    animation: paw-step 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.22s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.44s; }

@keyframes paw-step {
    0%, 70%, 100% { opacity: 0.2;  transform: translateY(2px) scale(0.82) rotate(-6deg); }
    35%           { opacity: 0.95; transform: translateY(-2px) scale(1.05) rotate(-6deg); }
}

@media (prefers-reduced-motion: reduce) {
    .thinking-dots span { animation-duration: 2.4s; }
}

/* ── Input bar ─────────────────────────────────────────────────────────────── */
.chat-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: calc(100% - 2.5rem);
    max-width: 850px;
    margin: 0 auto 1rem auto;
}

.chat-input {
    flex: 1;
    border: 1.5px solid var(--color-green-border);
    border-radius: var(--radius-xl);
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.45;
    outline: none;
    background: rgba(255,255,255,0.7);
    resize: none;
    max-height: 160px;
    overflow-y: auto;
    transition: border-color 0.2s var(--ease-smooth),
                box-shadow  0.2s var(--ease-smooth),
                background  0.2s;
}

.chat-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px var(--color-accent-soft);
    background: #ffffff;
}

.chat-input:disabled {
    background: var(--color-green-bg);
    color: var(--color-text-muted);
}

/* ── Empty state ───────────────────────────────────────────────────────────── */
.chat-empty {
    margin: auto;
    max-width: 520px;
    text-align: center;
    padding: 2rem 1rem;
    color: var(--color-text-muted);
}
.chat-empty-icon { font-size: 2.4rem; }
.chat-empty-title {
    margin-top: 0.6rem;
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.8rem;
    font-variation-settings: "opsz" 48;
    color: var(--ed-ink);
    letter-spacing: -0.01em;
}
.chat-empty-text {
    margin: 0.6rem auto 1.5rem;
    font-family: var(--ed-body);
    font-size: 1rem;
    line-height: 1.55;
    color: var(--ed-ink-soft);
    font-variation-settings: "opsz" 14;
    max-width: 36ch;
}

/* New-chat button: icon + label on tablet+, icon-only on phone. */
.chat-newchat-btn { display: inline-flex; align-items: center; gap: 0.3rem; }
.chat-newchat-icon { font-weight: 700; font-size: 1.05rem; line-height: 1; }
.chat-header-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Regenerate + copy ─────────────────────────────────────────────────────── */
.chat-regenerate { display: flex; justify-content: center; margin-top: 0.25rem; }
.bubble-action {
    margin-top: 0.4rem;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    cursor: pointer;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.bubble-action:hover { color: var(--color-text-main); background: var(--color-green-bg); }

.chat-stop-btn { background: var(--color-accent); }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.app-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(0.5rem);
    /* Dark eucalypt glass (2026-10-17), the save toast's sibling: frosted dark, cream
       words. Solid sidebar green in every solid fallback. */
    background: var(--glass-toast);
    border: 1px solid var(--glass-toast-edge);
    box-shadow: inset 0 1px 0 var(--glass-toast-light), 0 18px 44px var(--glass-float-shade);
    color: var(--zl-mark-ink-on-dark);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    /* One line by construction (2026-10-17 review): the foot stack gives it one row
       (--foot-app), so a long message elides rather than growing into the save toast's.
       max-content, or left: 50% would cap it at half the screen and wrap it. */
    width: max-content;
    max-width: calc(100vw - 2rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 1000;
    pointer-events: none;
}
.app-toast--visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Legal pages ───────────────────────────────────────────────────────────── */
.legal-page { display: flex; justify-content: center; padding: 1.5rem 1rem 3rem; }
.legal-page-inner { width: 100%; max-width: 820px; }
.legal-back { border: none; background: transparent; color: var(--color-accent); cursor: pointer; font: inherit; font-size: 0.9rem; padding: 0.25rem 0; margin-bottom: 0.5rem; }
.legal-back:hover { text-decoration: underline; }
.legal-body { line-height: 1.65; color: var(--color-text-main); }
.legal-body h2 { font-size: 1.2rem; margin-top: 1.6rem; }
.legal-body table { border-collapse: collapse; width: 100%; margin: 0.75rem 0; }
.legal-body th, .legal-body td { border: 1px solid var(--color-green-border); padding: 0.4rem 0.6rem; text-align: left; font-size: 0.88rem; }
.legal-body blockquote { border-left: 3px solid var(--color-accent); margin: 1rem 0; padding: 0.5rem 1rem; background: var(--color-green-bg); }
.legal-foot { margin-top: 2rem; font-size: 0.8rem; color: var(--color-text-muted); font-style: italic; }

/* ── App footer + nav legal links ──────────────────────────────────────────── */
.app-footer { display: flex; gap: 0.5rem; justify-content: center; align-items: center; padding: 0.7rem 1rem; font-size: 0.8rem; color: var(--color-text-muted); border-top: 1px solid var(--color-green-border); }
.app-footer a { color: var(--color-text-muted); text-decoration: none; }
.app-footer a:hover { color: var(--color-accent); text-decoration: underline; }
.nav-legal { display: flex; flex-wrap: wrap; gap: 0.4rem 0.75rem; padding-top: 0.75rem; margin-top: 0.5rem; border-top: 1px solid var(--color-green-border); }
/* These sit INSIDE the dark-green sidebar gradient, so they need sidebar ink —
   not --color-text-muted, which is tuned for cream paper and measured 2.16:1
   here (on every page). Matches the .nav-link-text treatment above.

   Parent selector is load-bearing, not decorative: `[data-theme="dark"] a`
   (0,1,1) further down out-ranks a bare `.nav-legal-link` (0,1,0) and repainted
   these terracotta in dark — the same trap already recorded above .btn-primary.
   `.nav-legal .nav-legal-link` is (0,2,0), so one rule now holds in both themes.
   The sidebar gradient does not change between themes, so the ink should not either. */
.nav-legal .nav-legal-link { font-size: max(0.78rem, var(--ed-fs-floor, 0rem)); color: rgba(255, 255, 255, 0.72); text-decoration: none; }
.nav-legal .nav-legal-link:hover { color: #ffffff; text-decoration: underline; }

/* ── AI output notice ──────────────────────────────────────────────────────── */
.ai-output-notice { display: flex; align-items: center; gap: 0.45rem; font-size: max(0.78rem, var(--ed-fs-floor, 0rem)); color: var(--color-text-muted); padding: 0.4rem 0.6rem; margin: 0.4rem 0; border: 1px dashed var(--color-green-border); border-radius: var(--radius-md, 8px); background: var(--color-green-bg); }
.ai-output-notice a { color: var(--color-accent); }
.ai-output-notice-icon { font-size: 0.9rem; }

/* ── Terms acceptance gate ─────────────────────────────────────────────────── */
.terms-gate { display: flex; justify-content: center; align-items: flex-start; min-height: 60vh; padding: 1.5rem 1rem; }
.terms-gate-card { width: 100%; max-width: 640px; background: var(--color-surface); border: 1px solid var(--color-green-border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: 1.5rem 1.75rem; }
.terms-gate-title { font-size: 1.3rem; margin-bottom: 0.5rem; color: var(--color-text-main); }
.terms-gate-intro { font-size: 0.92rem; color: var(--color-text-main); }
.terms-gate-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1rem 0; }
.terms-gate-links a { color: var(--color-accent); font-size: 0.9rem; font-weight: 500; text-decoration: none; }
.terms-gate-links a:hover { text-decoration: underline; }
.terms-gate-points { font-size: 0.85rem; color: var(--color-text-main); line-height: 1.5; padding-left: 1.1rem; }
.terms-gate-points li { margin-bottom: 0.4rem; }
.terms-gate-agree { display: flex; gap: 0.5rem; align-items: flex-start; margin: 1rem 0; font-size: 0.88rem; color: var(--color-text-main); }
.terms-gate-accept { margin-top: 0.25rem; }

/* ── Mobile chat layout ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .chat-input-bar {
        width: 100%;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 0.55rem 0.6rem calc(0.55rem + env(safe-area-inset-bottom));
        gap: 0.4rem;
    }

    .chat-history {
        padding: 0.85rem 0.6rem 0.6rem;
        gap: 0.7rem;
    }


    .chat-header {
        padding: 0.6rem 0.85rem;
        font-size: 1rem;
        gap: 0.45rem;
    }

    /* Icon-only New-chat on phone to free the title row. */
    .chat-newchat-btn .chat-newchat-label { display: none; }
    .chat-newchat-btn {
        width: 2.25rem;
        height: 2.25rem;
        padding: 0;
        justify-content: center;
        flex-shrink: 0;
    }

    /* Bubbles use more horizontal room on phone — narrow screens make 78/82%
       feel cramped, especially with the avatar and gap eating the line. */
    .bubble-row--user { max-width: 90%; }
    .bubble-row--assistant { max-width: 94%; }

    .bubble {
        padding: 0.6rem 0.85rem;
        font-size: 0.92rem;
        line-height: 1.5;
    }

    /* Smaller avatar so it doesn't dominate the row on a 380 px viewport. */
    .bubble-avatar { width: 1.7rem; height: 1.7rem; }
    .paw-icon { width: 1rem; height: 1rem; }

    /* 44 px touch target for the action buttons inside the composer. */
    .chat-mic-btn, .chat-send-btn { width: 2.75rem; height: 2.75rem; }

    /* 16 px input font stops iOS Safari from zooming when the textarea is focused. */
    .chat-input {
        font-size: 16px;
        padding: 0.55rem 1rem;
    }

    /* Save Q+A / Regenerate row wraps cleanly when both buttons are present. */
    .chat-regenerate { flex-wrap: wrap; gap: 0.4rem; padding: 0 0.3rem; }

    .chat-empty { padding: 1.25rem 0.85rem; }
    .chat-empty-text { font-size: 0.9rem; }
}

/* ── Send button with ripple ───────────────────────────────────────────────── */
.chat-send-btn {
    position: relative;
    overflow: hidden;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--radius-full);
    border: none;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: var(--shadow-accent);
    transition: transform 0.15s var(--ease-spring),
                box-shadow 0.2s,
                filter 0.2s;
}

.chat-send-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.35);
    transform: scale(0);
    opacity: 0;
}

.chat-send-btn:active:not(:disabled)::after {
    animation: ripple-out 0.4s ease-out forwards;
}

.chat-send-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px var(--color-accent-glow);
    filter: brightness(1.08);
}

.chat-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.chat-send-btn:disabled {
    background: var(--color-green-border);
    box-shadow: none;
    cursor: not-allowed;
}

/* ── Microphone / recording button ──────────────────────────────────────────── */
.chat-mic-btn {
    position: relative;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--color-green-border);
    background: transparent;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s var(--ease-spring),
                box-shadow 0.2s,
                border-color 0.2s,
                color 0.2s,
                background 0.2s;
}

.chat-mic-btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.chat-mic-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.chat-mic-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.chat-mic-btn--recording {
    color: #dc2626;
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.08);
    animation: mic-pulse 2.4s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
    50%       { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.08); }
}

/* "Set up voice (~83 MB)" affordance — replaces the mic until the speech
   model is cached. Terracotta accent reads as "tap me to start a process",
   distinct from the eucalypt-on-press recording state. */
.chat-mic-btn--setup {
    color: var(--ed-terracotta);
    border-color: var(--ed-terracotta);
}

    .chat-mic-btn--setup:hover:not(:disabled) {
        background: var(--ed-terracotta);
        color: var(--ed-paper);
        transform: none;
    }

/* Last attempt failed — a blocked, missing, or busy microphone. Borrows the
   terracotta attention accent rather than inventing an error colour, and stays
   ENABLED: every one of these is fixable and then tappable again. Cleared the
   moment a new attempt starts. */
.chat-mic-btn--error {
    color: var(--ed-terracotta);
    border-color: var(--ed-terracotta);
}

/* Transcribing: disabled, but not dead. At the plain :disabled 0.35 it read as a broken
   button for the 2–15 s a take is out (QoL 2026-10-04, speed #6), so it breathes in the
   accent instead; the words beside it are .dictate-status. */
.chat-mic-btn--transcribing:disabled {
    opacity: 0.75;
    border-color: var(--color-accent);
    color: var(--color-accent);
    animation: mic-transcribing 1.6s ease-in-out infinite;
}

@keyframes mic-transcribing {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 0.9; }
}

/* The mic and its own status line (QoL 2026-10-04, errors #4 / speed #6). One flex item
   wherever the button sits — beside a field label, under the SOAP summary, in the chat bar —
   so the line never becomes a third item a space-between row would spread apart.

   The line goes UNDER the mic, on its own line (review of QoL batch 2, finding 1). Beside it,
   in a label row that anchors the mic on its right, the line arriving with a press moved the
   mic up to 18 px left and 28 px down under a still mouse: the label and the line fought for
   the row, and the row re-aligned on the line's baseline. Stacked, the mic stays the first
   item — so it is still the baseline the row aligns on — and flex-end keeps it at the row's
   right-hand end however wide the line is. The line wraps rather than take more than half the
   row from the label. min-width stays auto — the mic, since the line can break anywhere — so
   a long label squeezes itself, never the mic: at min-width 0 the mic overflowed the row (past
   its right edge before this change, and onto the label's words after it). .dictate--beside
   (StatusAfter) keeps the line beside a mic its row anchors on the LEFT (SOAP's summary),
   where growing rightwards moves nothing. */
.dictate {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.2rem;
    max-width: 50%;
}

.dictate--beside {
    flex-direction: row;
    align-items: center;
    gap: 0.45rem;
    max-width: none;
}

.dictate-status {
    min-width: 0;
    max-width: 100%;
    font-family: var(--ed-ui);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    line-height: 1.35;
    color: var(--ed-mute);
    overflow-wrap: anywhere;
    text-align: right;
}

.dictate--beside .dictate-status {
    text-align: left;
}

.dictate-status--error {
    color: var(--ed-terracotta);
}

[data-theme="dark"] .chat-mic-btn {
    border-color: var(--color-green-border);
    color: var(--color-text-muted);
}

[data-theme="dark"] .chat-mic-btn:hover:not(:disabled) {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

[data-theme="dark"] .chat-mic-btn--recording {
    color: #f87171;
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* Markdown rendered responses */
.markdown-body ul, .markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.markdown-body li {
    margin-bottom: 0.25rem;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    margin-top: 1rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.markdown-body h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ed-ink-soft);
    border-bottom: 1px solid var(--ed-hairline);
    padding-bottom: 0.2rem;
}

.markdown-body p {
    margin-bottom: 0.5rem;
}

.markdown-body code {
    background: var(--ed-paper-deep);
    color: var(--ed-terracotta);
    border-radius: 3px;
    padding: 0.1em 0.35em;
    font-size: 0.9em;
    font-family: var(--ed-mono);
}

.markdown-body pre {
    background: var(--ed-paper-deep);
    color: var(--ed-ink);
    border-radius: 4px;
    padding: 0.75rem;
    overflow-x: auto;
    font-family: var(--ed-mono);
}

.markdown-body strong {
    font-weight: 700;
}

/* ── Markdown tables ───────────────────────────────────────────────────────── */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.6rem 0 0.75rem;
    font-size: 0.88rem;
}

/* Green header, contrasting ink. --color-green-mid could NOT be used here: it
   is a legacy alias whose meaning diverged between themes (light → --ed-eucalypt,
   a heading COLOUR; dark → --ed-paper-warm, a surface), so any single text colour
   paired with it fails one theme — light measured 1.36:1, near-black on deep
   green. --ed-eucalypt/--ed-paper is a pair that flips together: 10.8:1 light,
   7.4:1 dark. Reaches every markdown table, including the lab panel's own
   hardcoded header and the owner discharge medication table. */
.markdown-body th {
    background: var(--ed-eucalypt);
    color: var(--ed-paper);
    font-weight: 600;
    text-align: left;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--color-green-border);
}

.markdown-body td {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--ed-hairline);
    vertical-align: top;
}

.markdown-body tr:nth-child(even) td {
    background: var(--ed-paper-deep);
}


h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--color-accent);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: transform 0.15s var(--ease-spring),
                box-shadow  0.2s,
                filter      0.15s;
    position: relative;
    overflow: hidden;
    /* The overflow:hidden above (needed to clip the ::after ripple) has a side effect
       that is easy to miss: a flex item's automatic minimum size — min-width: auto —
       only applies while overflow is `visible`. With it hidden the minimum collapses
       to 0, so any .btn in a tight flex row gets squashed and silently CLIPS its own
       label: "Delete" rendered as "Delet" on the users table at every width, and
       "Cancel" / "Request persistent storage" lost their tails on narrow screens.
       Restoring the content minimum explicitly is what stops that. */
    min-width: fit-content;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255,255,255,0.3);
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.btn:active:not(:disabled)::after {
    animation: ripple-out 0.4s ease-out forwards;
}

/* .btn hover/active transforms live in the paper-lift grammar (Motion & Feel
   section at the end of this file) — one dialect for the whole app. */

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
    border: none;
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover:not(:disabled), .btn-primary:focus {
    background: linear-gradient(135deg, var(--color-accent-dark) 0%, var(--color-accent) 100%);
    box-shadow: 0 6px 20px var(--color-accent-glow);
    color: #fff;
}

.btn-outline-primary {
    color: var(--color-accent);
    border: 1.5px solid var(--color-accent);
    background: transparent;
}

.btn-outline-primary:hover:not(:disabled) {
    background: var(--color-accent-soft);
    color: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
    box-shadow: var(--shadow-sm);
}

.btn-outline-secondary {
    border-radius: var(--radius-md);
    border: 1.5px solid var(--color-green-border);
    color: var(--color-text-muted);
}

/* Hover deliberately NOT redefined here. This block used to set
   `background: var(--color-green-mid); color: var(--color-text-main)` which, at
   (0,3,0), out-specified the editorial `.btn-outline-secondary:hover, :focus`
   rule above and rendered near-black on deep green — 1.36:1, the label vanished
   on hover. The editorial rule already covers both themes (13.2:1 / 14.9:1), so
   the fix is to let it win rather than to restate it. */

/* Disabled outline buttons keep their own hue (sweep 2026-10-15, runtime#3).
   Bootstrap's `.btn:disabled` (0,2,0) paints color/border-color from
   --bs-btn-disabled-*, which every .btn-outline-* variant sets to its STOCK colour —
   and it out-ranks the single-class re-skins above. So a disabled Print on
   Certificates went Bootstrap blue (#0d6efd) and a disabled "Save to <patient>"
   Bootstrap green (#198754), then changed hue when it came alive. Re-pointing the
   variables at each variant's own tokens keeps Bootstrap's model — the enabled
   colours at its 0.65 disabled opacity — and flips with the theme for free. */
.btn-outline-primary {
    --bs-btn-disabled-color: var(--color-accent);
    --bs-btn-disabled-border-color: var(--color-accent);
}

.btn-outline-secondary {
    --bs-btn-disabled-color: var(--color-text-muted);
    --bs-btn-disabled-border-color: var(--color-green-border);
}

.btn-outline-success {
    --bs-btn-disabled-color: var(--ed-mint);
    --bs-btn-disabled-border-color: var(--ed-mint);
}

.btn-outline-danger {
    --bs-btn-disabled-color: var(--ed-rust);
    --bs-btn-disabled-border-color: color-mix(in srgb, var(--ed-rust) 40%, transparent);
}

/* ── Focus ring ──────────────────────────────────────────────────────────────
   Keyboard is the primary input for our users, so EVERY focusable control gets
   a bold, obvious ring — not just an allow-list of a few components. The old
   `:where(...)` list had zero specificity and covered only a handful of widgets,
   leaving links, the Mine/All toggle, consult steps, and the search/chat inputs
   with no visible focus at all once the global reset below stripped the default.

   :focus-visible keeps mouse clicks ring-free. 3px terracotta reads on both cream
   paper and warm charcoal. The trick for "obvious": a 2px gap (outline-offset)
   backed by a matching paper-coloured box-shadow, so the ring stays visible even
   on the terracotta buttons themselves — where ring and fill are the same hue,
   the paper gap separates them. The class selectors (0,2,0) out-rank each
   control's own :focus glow (equal specificity, but this rule comes later), so
   keyboard focus shows the strong ring while mouse :focus keeps the soft glow. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible,
.cases-search-input:focus-visible,
.chat-input:focus-visible {
    outline: 3px solid var(--ed-terracotta);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--ed-paper);
}

/* Drop the default browser focus ring (mouse :focus). Kept lower-specificity
   than the rule above so keyboard :focus-visible still wins. */
:focus { outline: none; }

.content {
    padding-top: 1.1rem;
}

/* Retokened from the Blazor template's raw `red`/`#26b050` (2026-09-03 sweep):
   pure red measured 3.49:1 on the cream auth card and 4.34:1 on dark charcoal —
   both under the 4.5:1 floor — on the messages that tell a vet why sign-in
   refused. --ed-rust and --ed-mint are theme-tuned by the contrast register. */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--ed-mint);
}

.invalid {
    outline: 1px solid var(--ed-rust);
}

.validation-message {
    color: var(--ed-rust);
}

/* On the sign-in card each message carries its own small solid backing (sweep
   2026-10-15, shell-brand-pwa#4). Since the rebrand the card is 72-80% glass over the
   collie photo, and rust is a mid-tone: it measured 3.4-3.8:1 at its worst there (the
   dog's fur in light, the scrimmed sky in dark), under the floor the 2026-09-03 sweep
   set for exactly these lines. Thicker glass cannot rescue dark (rust on SOLID
   charcoal is only 4.70:1), so the backing is --ed-paper-warm: 6.04:1 light, 4.70:1
   dark, whatever the photo does. fit-content keeps it a label, not a full-width bar. */
.auth-card .validation-message {
    width: fit-content;
    max-width: 100%;
    margin-top: 0.25rem;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-sm);
    background: var(--ed-paper-warm);
    color: var(--ed-rust);
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    /* Explicit ink, scoped to the strip: the banner sits directly under body
       and INHERITED dark-mode cream — cream on lightyellow is ~1.2:1, so a
       dark-theme crash showed a blank yellow bar (2026-09-03 sweep). Literals
       on purpose, matching this rule's deliberate light-only posture: the one
       surface that must be readable at crash time depends on no token. */
    color: #1f1d18;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui a {
        color: #7a3b12;
    }

    #blazor-error-ui .dismiss {
        color: #1f1d18;
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: var(--color-accent);
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

/* Bare <code> takes the same inline-code role token .markdown-body code uses —
   the template's frozen #c02d76 magenta sat off-palette in light mode and
   needed its own dark override to stay legible (sweep, 2026-08-27). */
code {
    color: var(--ed-terracotta);
}


/* ── Auth pages (Login / Register) ────────────────────────────────────────── */
/* Sign-in sits on the brand photo: a Border Collie in red-dirt outback among
   banksias (2026-10-15; it replaced the golden-field photo of 2026-10-11). The
   card is glass over it. The photo is decoration, so it is a CSS background with
   no alt text, and phones get the 800px cut. Dark theme adds a scrim so the cream
   card does not glare.
   Three cuts of the one photo (2026-11-22, sharper renders supplied by the owner; the
   original was 1264px and looked soft on a large monitor): 1920px for ordinary desktop
   screens, 2528px only where a screen can show it (wider than 1920px, or a
   high-density screen that is desktop-sized), and the 800px cut for phones. One rule
   per size so a browser fetches exactly one file; the dark theme repeats all three
   below, because its selector outranks these. */
.auth-page {
    min-height: calc(100vh - 3.5rem);
    background: var(--color-green-mid) url("../images/signin-outback-1920.webp") 20% 40% / cover no-repeat;
    padding: 2rem 1rem;
}

@media (min-width: 1921px), (min-resolution: 1.5dppx) and (min-width: 1281px) {
    .auth-page { background-image: url("../images/signin-outback-2528.webp"); }
}

@media (max-width: 640px) {
    .auth-page { background-image: url("../images/signin-outback-800.jpg"); }
}

/* From the lg breakpoint the card moves right (justify-content-lg-end in Login.razor).
   This photo has the dog left of centre and open bush to the right, so the one
   position above already puts the card over the bush, not the dog's face, at every
   desktop width (checked at 1024x768 to 1920x1080). On phones and portrait tablets
   the card covers most of the screen whatever the position, as it did before. */
@media (min-width: 992px) {
    .auth-page {
        padding-right: 7%;
    }
}

/* Register (the super-admin's Create user form) shares .auth-page but not the photo
   (2026-10-15 sweep): it renders inside the app shell with its card centred, which put
   the card over the dog's face. Two classes (plus the dark twin) out-rank the dark
   theme's photo rule and the phone cut whichever comes later in the sheet. */
.auth-page.auth-page--plain,
[data-theme="dark"] .auth-page.auth-page--plain {
    background: none;
}

@media (min-width: 992px) {
    .auth-page.auth-page--plain { padding-right: 1rem; }
}

.auth-card {
    border: 1px solid var(--glass-edge);
    border-radius: 22px;
    background: var(--glass-light);
    box-shadow: inset 0 1px 0 var(--glass-highlight), 0 10px 30px var(--glass-shade);
    animation: fadeSlideUp 0.35s var(--ease-smooth);
}

.auth-card h1 {
    color: var(--color-text-main);
    letter-spacing: -0.3px;
}

/* The Zoolytic wordmark above the sign-in heading. 2.6rem is well over the 24px
   line, so the heartbeat trace shows; the top margin is room for the paw. */
.auth-brand {
    font-size: 2.6rem;
    margin: 0.4rem 0 1.1rem;
}

/* ── Sign-up (2026-11-11) ─────────────────────────────────────────────────────
   The public form and its two follow-on pages. They reuse the plain auth page and
   the glass card; only the width and the form's own groupings are new. The card is
   tall, so it starts at the top of the page rather than centring. */
.signup-card {
    width: 100%;
    max-width: 640px;
}

.signup-card--narrow {
    max-width: 460px;
}

/* Two fields side by side where there is room; one column on a phone. */
.signup-pair {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 1rem;
}

@media (min-width: 576px) {
    .signup-pair { grid-template-columns: 1fr 1fr; }
}

.signup-password-hint {
    margin-top: -0.5rem;
}

.signup-plans,
.signup-interval {
    min-width: 0;
    border: 0;
    padding: 0;
}

.signup-plans legend,
.signup-interval legend {
    float: none;
    font-size: inherit;
    margin-bottom: 0.5rem;
}

/* One row per plan: the whole row is the radio's label, so it is a thumb-sized target on
   a phone. The chosen one is marked by its border and wash as well as by the radio. */
.signup-plan-option {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 12px;
    color: var(--color-text-main);
    cursor: pointer;
}

.signup-plan-option--chosen {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
}

.signup-plan-option input {
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.15rem;
}

.signup-plan-text {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 1rem;
    row-gap: 0.1rem;
    flex: 1;
    min-width: 0;
}

.signup-plan-name {
    font-weight: 600;
}

.signup-plan-devices {
    grid-column: 1;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.signup-plan-price {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    text-align: right;
    font-size: 0.9rem;
}

.signup-plan-trial {
    grid-column: 1 / -1;
    margin-top: 0.3rem;
    font-size: 0.85rem;
}

@media (max-width: 575.98px) {
    .signup-plan-text { grid-template-columns: 1fr; }
    .signup-plan-price { grid-column: 1; grid-row: auto; text-align: left; }
}

.signup-choice {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.4rem;
    margin-right: 1.25rem;
    color: var(--color-text-main);
    cursor: pointer;
}

.signup-legal {
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 14px;
    padding: 1rem;
    margin-top: 0.5rem;
    color: var(--color-text-main);
}

.signup-accept {
    margin: 0.6rem 0 0;
}

.signup-accept input {
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.1rem;
}

/* A phone spends three nested paddings on this card (page, card, legal box), which left
   the statements a column of four-word lines. Give the words the width back. */
@media (max-width: 575.98px) {
    .auth-page.signup-page { padding: 1rem 0.5rem; }
    .signup-card.p-4 { padding: 1.1rem !important; }
    .signup-legal { padding: 0.75rem; }
}

.signup-accept a {
    color: var(--color-accent);
}

.signup-field-error {
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.signup-state,
.signup-done-message {
    color: var(--color-text-main);
}

.signup-state {
    text-align: center;
}

/* ── Billing section on Practice details (2026-11-12) ───────────────────────── */
.billing-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 1.25rem;
    row-gap: 0.35rem;
    margin: 0 0 1rem;
    color: var(--color-text-main);
}

.billing-facts dt {
    font-weight: 500;
    color: var(--color-text-muted);
}

.billing-facts dd {
    margin: 0;
}

.billing-manage {
    margin-top: 1rem;
}

.billing-explain {
    margin-top: 0.5rem;
}

@media (max-width: 575.98px) {
    .billing-facts { grid-template-columns: 1fr; row-gap: 0; }
    .billing-facts dd { margin-bottom: 0.5rem; }
}

.subscription-banner-link {
    margin-left: 0.4rem;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    white-space: nowrap;
}

/* ── User management table ─────────────────────────────────────────────────── */
.avatar-placeholder {
    flex-shrink: 0;
}

/* ── Shared tool page layout — editorial treatment ────────────────────────── */
.tool-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 3.5rem);
    background:
        radial-gradient(ellipse at 18% 0%, rgba(133, 85, 58,0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 82% 100%, rgba(31,58,42,0.05) 0%, transparent 55%),
        var(--ed-paper);
    color: var(--ed-ink);
}

/* Tool header reads as a kicker + italic display title rather than a stuffed
   toolbar. Icon emoji stays for now — easy to swap later for an SVG mark. */
.tool-header {
    display: flex;
    align-items: baseline;
    /* Wrap is the base behaviour, not a breakpoint special case: pages now carry
       up to four header actions, and at any width where title + actions don't
       fit (a narrow window, comfort view's 118% scale) the actions drop to
       their own line instead of clipping off the panel's left edge. */
    flex-wrap: wrap;
    gap: 0.5rem 0.7rem;
    padding: 1.1rem 1.75rem 0.85rem;
    background: transparent;
    border-bottom: 1px solid var(--ed-hairline-strong);
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.6rem;
    font-variation-settings: "opsz" 48;
    color: var(--ed-ink);
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.tool-header-icon {
    /* The icon is an inline <svg> sized in em, so font-size is still the size knob.
       Terracotta makes it read as a deliberate mark beside the Fraunces title rather
       than a stray glyph — which is how the platform emoji it replaced read. */
    font-size: 1.4rem;
    color: var(--ed-terracotta);
    align-self: center;
    flex-shrink: 0;
}

/* The tool's own action — run it, and clear it — sits beside the title rather than
   at the foot of the form. .tool-page is a fixed-height flex column and this header
   is flex-shrink: 0, so the header is the only part of a tool page that never
   scrolls; .tool-form-panel is overflow-y: auto. A CTA at the panel's foot is
   off-screen for as long as the form is taller than the panel, which on Image
   Description with films attached is most of the time. ToolHeaderActionsTests pins
   the convention across all eight pages that follow it. */
.tool-header-actions {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    /* The header lays out on the BASELINE of a 1.6rem italic display title; a button
       has no baseline worth sharing with that and hangs low against it. */
    align-self: center;
    align-items: center;
    /* The buttons wrap among themselves before anything clips. min-width: 0 lets
       the row actually take less than its one-line content width, and flex-end
       keeps partial rows ragged-left against the panel's right edge. */
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 0.4rem;
    min-width: 0;
}

/* .btn resolves font-family to `inherit` (the second .btn block below), which in
   here is Fraunces italic at 1.6rem — so the face and the type scale both have to
   be restated or the actions render as display text. */
.tool-header-actions .btn {
    font-family: var(--ed-ui);
    font-style: normal;
    font-size: 0.88rem;
    padding: 0.4rem 0.95rem;
    white-space: nowrap;
}

/* Narrow: the actions take the full row below the title. (Wrap itself is base
   behaviour above — this only forces the full-width row sooner so the title
   never shares a cramped line with a lone orphaned button.) */
@media (max-width: 820px) {
    .tool-header-actions { width: 100%; }
}

.tool-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

.tool-form-panel {
    width: 38%;
    min-width: 300px;
    flex-shrink: 0;
    background: transparent;
    border-right: 1px solid var(--ed-hairline-strong);
    padding: 1.5rem 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Single-panel variant, for tools whose output leaves the app instead of landing
   in a result pane (Certificates prints/PDFs, Practice details just saves). The
   two-panel scaffold reserved 62% of the page for a result panel these pages
   never render — a big blank pane with a divider that read as broken, not as
   design. The form becomes one centred document-width column: full area used,
   whitespace symmetric, and 58rem keeps inputs at a readable measure instead of
   stretching them across 1100px. */
.tool-body--single {
    justify-content: center;
}

.tool-body--single .tool-form-panel {
    width: 100%;
    max-width: 58rem;
    border-right: none;
    border-bottom: none; /* the stacked-layout divider is also pointless with one panel */
}

.tool-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    /* .save-toast used to pin to this corner, which is why this is here. It is fixed to
       the viewport now (it was covering this panel's own action bar), but the panel keeps
       a positioning context for its other absolutely-placed children. */
    position: relative;
}

/* Editable textarea for the result panel — used by SOAP, Discharge, and any
   other tool that adds an inline "✎ Edit" affordance on the generated output. */
.tool-result-edit {
    width: 100%;
    min-height: 24rem;
    font-family: var(--ed-mono, ui-monospace, "JetBrains Mono", monospace);
    font-size: 0.92rem;
    line-height: 1.55;
    resize: vertical;
}

/* Save-success toast — pinned to the result panel's top-right corner. Enters
   with one gentle overshoot frame (a note tucked under the panel's corner) and
   a self-drawing check; exits absorbed into the panel edge (scaleY, origin
   top) rather than dismissed. Lifecycle owned by Components/SaveToast.razor.
   animation-fill-mode is backwards (not both) so the finished entry animation
   releases control back to the rule values and the leaving transition can run. */
/* A receipt, not a control. It used to be absolutely positioned at the result panel's
   top-right — which is precisely where that panel's action bar lives, so for the ~3s it
   was up it COVERED "Save to case", "Open a case", "start a new one" and "Copy", and
   with pointer-events at their default it swallowed clicks aimed at them too. Measured
   2026-07-26: a click at the toast's centre landed on the toast.

   Now it behaves like .app-toast, this stylesheet's other toast, which had it right all
   along: fixed to a corner nothing else uses, and transparent to the pointer. Bottom
   RIGHT rather than bottom centre because .app-toast and .update-pill are both centred,
   and a save can land while either is up. */
.save-toast {
    position: fixed;
    top: auto;
    bottom: 1.5rem;
    right: 1.5rem;
    /* Same band as the app's other transient chrome, below the modal backdrops (1100+)
       so it can never sit over a dialog the vet has to answer. */
    z-index: 1090;
    /* THE fix. It is role="status" — there is nothing on it to click, so a click meant
       for whatever is underneath must reach it. */
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.95rem;
    /* The reclaimed-time line runs to ~470px; unbounded, it spanned a phone twice over. */
    max-width: min(28rem, calc(100vw - 3rem));
    /* Dark eucalypt glass since 2026-10-17 (the approved "stronger glass"): cream words,
       a pale mint tick. It was mint ink on light glass; on the frosted dark pane the
       confirmation colour moves to the tick (--glass-toast-check, a glyph: 3:1) and the
       words take the on-dark cream. Both are measured by css-hygiene "text on floating
       glass" at both ends of the frost's band, in both themes. */
    background: var(--glass-toast);
    border: 1px solid var(--glass-toast-edge);
    border-radius: 999px;
    color: var(--zl-mark-ink-on-dark);
    font-size: 0.88rem;
    font-weight: 500;
    box-shadow: inset 0 1px 0 var(--glass-toast-light), 0 18px 44px var(--glass-float-shade);
    transform-origin: bottom;
    animation: save-toast-in 0.26s var(--ease-overshoot) backwards;
    transition: opacity 0.2s ease-in, transform 0.2s ease-in;
}

.save-toast--leaving {
    opacity: 0;
    transform: scaleY(0.94);
}

/* Its one action, "Cleared · Undo" (QoL 2026-10-04, text #16). The toast stays transparent
   to the pointer — the fix above — and only this takes the pointer back, so the rest of
   the pill still lets a click through to whatever it covers. The toast's own ink. */
.save-toast-action {
    pointer-events: auto;
    background: none;
    border: none;
    padding: 0 0.15rem;
    font: inherit;
    font-weight: 700;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.save-toast-check {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    fill: none;
    stroke: var(--glass-toast-check);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 18;
    stroke-dashoffset: 18;
    animation: save-check-draw 0.2s ease-out 0.18s forwards;
}

/* On a phone this pill is nearly the full width, so "bottom right" stops meaning
   anything: it spans the width. Its height above .app-toast and .update-pill comes from
   the foot stack (below, 2026-10-17), which puts it above both at every width — it was a
   fixed 4.75rem here, which the app toast lifted over the pill then landed on. */
@media (max-width: 640px) {
    .save-toast {
        left: 1rem;
        right: 1rem;
        justify-content: center;
        text-align: center;
    }
}

/* Rises from below now that it is anchored to the bottom — it used to drop from above,
   which is the wrong direction for a corner it is no longer in. */
@keyframes save-toast-in {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

@keyframes save-check-draw {
    to { stroke-dashoffset: 0; }
}

.tool-result-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Wrap rather than clip, at every width. The panel around this bar is
       overflow:hidden, so a bar that outgrows it loses its right-hand buttons
       silently — "Copy" was simply absent at some widths, with nothing to
       indicate it existed. Wrapping costs nothing when it fits. */
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.7rem 1.25rem;
    border-bottom: 1px solid var(--ed-hairline);
    background: transparent;
    flex-shrink: 0;
}

.tool-result-bar .tool-panel-title { margin: 0; padding: 0; border: none; }

/* The result bar's Stop exists for stacked layouts only (the 900px block below shows it):
   side by side, the header's Stop is in view beside it (QoL 2026-10-04, phone #2). */
.tool-result-stop { display: none; }

.btn-export-pdf {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--ed-terracotta);
    background: transparent;
    color: var(--ed-terracotta);
    font-family: var(--ed-ui);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

    .btn-export-pdf:hover:not(:disabled) {
        background: var(--ed-terracotta);
        color: var(--ed-paper);
    }

    .btn-export-pdf:disabled { opacity: 0.35; cursor: not-allowed; }

/* Copy-to-PMS pill — sits next to the PDF export button on every tool result.
   Eucalypt-outlined to read as a "send-to-system" action distinct from the
   terracotta export. Switches to a mint-filled "✓ Copied" state for ~1.8 s. */
.btn-copy-plain {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--ed-eucalypt);
    background: transparent;
    color: var(--ed-eucalypt);
    font-family: var(--ed-ui);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

    .btn-copy-plain:hover:not(:disabled) {
        background: var(--ed-eucalypt);
        color: var(--ed-paper);
    }

    .btn-copy-plain:disabled { opacity: 0.35; cursor: not-allowed; }

    /* Brief affirmation state — mint to read as "good, done". */
    .btn-copy-plain.is-copied {
        border-color: var(--ed-mint);
        color: var(--ed-mint);
    }

        .btn-copy-plain.is-copied:hover {
            background: var(--ed-mint);
            color: var(--ed-paper);
        }

    /* The clipboard refused (QoL 2026-10-04, errors #7). Rust, the "this did not
       happen" colour; the line beside it says what to do and stays until the next try
       or a change to the text — a toast that timed out would be gone before the vet
       looked back from the PMS. */
    .btn-copy-plain.is-copy-failed {
        border-color: var(--ed-rust);
        color: var(--ed-rust);
    }

        .btn-copy-plain.is-copy-failed:hover:not(:disabled) {
            background: var(--ed-rust);
            color: var(--ed-paper);
        }

.copy-plain-failed {
    font-family: var(--ed-ui);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    color: var(--ed-rust);
}

/* ── Review & sign overlay (Certificates) ───────────────────────────────────
   position:fixed is a requirement, not a preference: since the app-shell change
   article.content is the only scroller, and an absolutely-positioned overlay
   would be clipped inside it. Same rule the date picker follows. */
.sign-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    /* No backdrop blur (2026-10-17): a dialog never blurs the screen behind it. */
    background: rgba(20, 32, 20, 0.55);
}

.sign-overlay-panel {
    display: flex;
    flex-direction: column;
    width: min(880px, 100%);
    max-height: 100%;
    background: var(--color-surface-solid);
    border-radius: var(--radius-md);
    box-shadow: 0 18px 60px rgba(20, 32, 20, 0.35);
    overflow: hidden;
}

.sign-overlay-panel--narrow { width: min(560px, 100%); }

.sign-overlay-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-green-border);
    flex-shrink: 0;
}

.sign-overlay-title {
    font-family: var(--ed-display, var(--ed-ui));
    font-size: 1.05rem;
    color: var(--color-text-main);
}

.sign-overlay-sub {
    font-family: var(--ed-ui);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.15rem;
}

/* The document itself — the one part that scrolls. The owner reads here. */
.sign-overlay-doc {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 1.25rem;
    background: #fff;
}

/* ── The document's own styling, inside the overlay ──────────────────────────
   DocumentHtml emits .doc-* markup, and until now those classes were defined in
   exactly ONE place: the inline <style> of the print popup (exportDocumentPdf in
   app.js). Every other consumer hands the HTML to that popup; this overlay is
   the only one that renders it in the app's own DOM — so the owner was reading
   a borderless, unpadded dump with NO VISIBLE SIGNATURE LINE, which is the one
   thing a document being signed has to have.

   Deliberately a copy rather than a shared sheet: the popup is a detached window
   that cannot reach this stylesheet, and giving it a <link> would make printing
   depend on a second network fetch. Kept scoped under .sign-overlay-doc so the
   generic class names cannot leak into the rest of the app, and pinned in the
   fixed light palette because it is paper — it must look the same in dark mode
   as the sheet that comes out of the printer. Change these together with the
   popup's copy in app.js. */
.sign-overlay-doc {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 11pt;
    color: #111;
}

    .sign-overlay-doc .doc-letterhead { border-bottom: 2px solid #333; padding-bottom: 10px; margin-bottom: 18px; }
    .sign-overlay-doc .doc-clinic { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.2px; }
    .sign-overlay-doc .doc-clinic-meta { font-size: 0.8rem; color: #444; line-height: 1.5; margin-top: 4px; }
    .sign-overlay-doc .doc-title { font-size: 1.05rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin: 18px 0 12px; }
    .sign-overlay-doc .doc-section { margin-bottom: 14px; }
    .sign-overlay-doc .doc-label { font-weight: 700; }
    .sign-overlay-doc table.doc-fields { width: 100%; border-collapse: collapse; margin: 8px 0 14px; }
    .sign-overlay-doc table.doc-fields th { text-align: left; width: 34%; padding: 5px 8px; border: 1px solid #ccc; background: #f4f4f4; font-size: 0.85rem; }
    .sign-overlay-doc table.doc-fields td { padding: 5px 8px; border: 1px solid #ccc; font-size: 0.9rem; }
    .sign-overlay-doc p { line-height: 1.6; margin-bottom: 0.5rem; }
    .sign-overlay-doc ul { padding-left: 1.3rem; margin-bottom: 0.6rem; }
    .sign-overlay-doc li { margin-bottom: 0.25rem; line-height: 1.5; }
    .sign-overlay-doc .doc-signatures { margin-top: 26px; }
    .sign-overlay-doc .doc-sign-row { display: flex; gap: 32px; margin-top: 24px; }
    .sign-overlay-doc .doc-sign-cell { flex: 1; }
    .sign-overlay-doc .doc-sign-line { border-bottom: 1px solid #333; height: 26px; }
    /* Printed paper — fixed type in both view modes, like its frozen colours. */
    .sign-overlay-doc .doc-sign-label { font-size: 0.75rem; color: #444; margin-top: 4px; }
    .sign-overlay-doc .doc-sign-cell .doc-sign-img + .doc-sign-line { height: 0; }
    .sign-overlay-doc .doc-sign-img { display: block; max-height: 56px; max-width: 100%; margin-bottom: 2px; }

.sign-overlay-sign {
    flex-shrink: 0;
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--color-green-border);
    background: var(--color-surface-solid);
}

/* Two pads at their standalone height leave the document a letterbox, and the
   document is the thing being consented to. Shorter here — still ample for a
   signature, which is a stroke or two — and side by side once there is width.
   THREE classes deliberately: SignaturePad's own scoped rule compiles to
   `.sigpad-canvas[b-xxx]` (0,2,0) and would otherwise win or lose on load order
   alone. This is (0,3,0) and beats it outright. */
.sign-overlay .sign-overlay-pads .sigpad-canvas {
    height: 84px;
}

@media (min-width: 720px) {
    .sign-overlay-pads {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.85rem;
    }
}

.sign-overlay-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.sign-overlay-done {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1.25rem;
}

/* Phone / narrow: the document needs the height more than the chrome does. */
@media (max-width: 640.98px) {
    .sign-overlay { padding: 0; }
    .sign-overlay-panel { border-radius: 0; height: 100%; }
}

/* ── "Fill in automatically" (New case; Brad's mock-up, round 10, 2026-11-12) ──
   One card over the form: three equal tiles (Take photo, Choose image, Dictate), one line
   of status, what happens to the photo, then a ruled "or type the details". It replaces the
   two dashed boxes (dictated intake, 2026-08-02; PMS screenshot, round 8) that sat here.

   GLOBAL on purpose. Two of the tiles are drawn by PasteToRead and the third by the page;
   a scoped sheet would style one and miss the other. Tokens only: the filled tile is
   eucalypt under paper, which holds in both themes (deep green under cream; pale green
   under charcoal). */
.fill-card {
    margin-bottom: 1rem;
    padding: 1.1rem 1.15rem 1.15rem;
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 14px;
    background: var(--ed-paper-warm);
    font-family: var(--ed-ui);
}

.fill-card-title {
    margin: 0 0 0.2rem;
    font-family: var(--ed-ui);
    font-style: normal;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0;
    color: var(--ed-eucalypt);
}

.fill-card-sub {
    margin: 0 0 0.85rem;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--ed-ink-soft);
}

/* Equal columns for however many tiles are showing: three on a phone, two on a desktop,
   where the camera tile is off. */
.fill-tiles {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0.6rem;
}

.fill-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 5.25rem;
    margin: 0;
    padding: 0.7rem 0.2rem;
    border: 1.5px solid var(--ed-eucalypt);
    border-radius: 12px;
    background: transparent;
    color: var(--ed-eucalypt);
    font-family: var(--ed-ui);
    font-weight: 700;
    font-size: 0.86rem;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.fill-tile:hover:not(:disabled) { background: var(--ed-paper-deep); }

.fill-tile--primary,
.fill-tile--recording {
    background: var(--ed-eucalypt);
    color: var(--ed-paper);
}

.fill-tile--primary:hover:not(:disabled),
.fill-tile--recording:hover:not(:disabled) { background: var(--ed-eucalypt-soft); }

.fill-tile:disabled {
    opacity: 0.55;
    cursor: default;
}

/* The file input inside a label tile is visually hidden, not display:none, so it stays
   focusable; the tile shows the focus. */
.fill-tile input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.fill-tile:focus-within,
.fill-tile:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.fill-tile .fill-tile-icon {
    width: 1.6rem;
    height: 1.6rem;
}

/* The camera tile: off on a desktop — a webcam pointed at the vet is not how a patient page
   gets in — and on wherever a touch screen or phone mode says a camera is the way in. The
   same rule "Take a photo" has had since round 8. */
.fill-tile--camera { display: none; }

@media (pointer: coarse) {
    .fill-tile--camera { display: flex; }
}

[data-phone="on"] .fill-tile--camera { display: flex; }

/* The desktop's paste route. Where the camera tile shows, there is no Ctrl+V to speak of. */
.fill-paste-hint {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--ed-ink-soft);
}

@media (pointer: coarse) {
    .fill-paste-hint { display: none; }
}

[data-phone="on"] .fill-paste-hint { display: none; }

.fill-paste-hint kbd {
    font-family: var(--ed-mono);
    font-size: max(0.76rem, var(--ed-fs-floor, 0rem));
    padding: 0.05rem 0.3rem;
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 4px;
    background: var(--ed-paper);
    color: var(--ed-ink);
}

.fill-read-local,
.fill-card-status {
    margin-top: 0.75rem;
    font-size: 0.84rem;
    line-height: 1.45;
    color: var(--ed-ink-soft);
}

    .fill-card-status strong { color: var(--ed-ink); }

/* What happens to the photo: always on screen before one is taken. */
.fill-card-info {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-top: 0.85rem;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    background: var(--ed-paper-deep);
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--ed-ink-soft);
}

    .fill-card-info strong { color: var(--ed-ink); }

    .fill-card-info .fill-card-info-icon {
        flex: 0 0 auto;
        width: 1.2rem;
        height: 1.2rem;
        margin-top: 0.1rem;
        color: var(--ed-ink);
    }

.fill-card .newcase-read-ai,
.fill-card .newcase-read-progress,
.fill-card .newcase-read-error,
.fill-card .newcase-read-note { margin-top: 0.75rem; margin-bottom: 0; }

/* "or type the details": a rule either side of the words. */
.fill-or {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1.1rem 0 0.9rem;
    font-family: var(--ed-ui);
    font-weight: 600;
    font-size: 0.84rem;
    color: var(--ed-mute);
}

    .fill-or::before,
    .fill-or::after {
        content: "";
        flex: 1 1 0;
        border-top: 1px solid var(--ed-hairline-strong);
    }

/* The lines under the tiles: the AI read's choice (while the on-device reader is offered),
   its progress and error, and what a read filled. Every field a read filled is highlighted
   until the vet changes it: the form is the review step. Tokens only — the accent wash is
   the one the app already uses for "look here". */
.newcase-read-ai {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.newcase-read-help,
.newcase-read-note,
.newcase-read-progress {
    font-family: var(--ed-ui);
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--color-text-muted);
}

    .newcase-read-help strong { color: var(--color-text-main); }

.newcase-read-error {
    font-family: var(--ed-ui);
    font-size: 0.82rem;
    color: var(--color-accent-dark);
    margin-bottom: 0.35rem;
}

.form-control.newcase-read,
.form-select.newcase-read {
    background-color: var(--color-accent-soft);
    border-color: var(--color-accent);
}

/* ── Vaccination rows (Certificates) ────────────────────────────────────────
   One row per vaccine given at the visit — a C5 and a rabies together is routine.
   Stacked on narrow panels, three across when there is room. */
.vax-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.vax-row--extra {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--color-green-border);
}

.vax-row-fields {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

@media (min-width: 1200px) {
    .vax-row-fields { grid-template-columns: 1.2fr 1fr 1.1fr; }
}

/* Aligns with the inputs rather than the labels above them. */
.vax-row-remove {
    margin-top: 1.6rem;
    flex-shrink: 0;
    line-height: 1;
}

.form-label--sm {
    font-size: max(0.75rem, var(--ed-fs-floor, 0rem));
    margin-bottom: 0.15rem;
    color: var(--color-text-muted);
}

/* Sitting in a row of btn-link controls (the Live Consult summary header), the pill
   treatment is too loud and its padding pushes the row out of line. This variant keeps
   the copy behaviour and borrows the link look of its neighbours. */
.btn-copy-plain--inline {
    padding: 0;
    border: none;
    background: none;
    font-size: 0.875rem;
    color: var(--ed-eucalypt);
}

    .btn-copy-plain--inline:hover:not(:disabled) {
        background: none;
        color: var(--color-accent);
        text-decoration: underline;
    }

/* Panel titles are small-caps mono labels — the editorial section break. */
.tool-panel-title {
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--ed-ink-soft);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ed-hairline);
}

/* Lab panel summary — collapsed by default so the interpretation stays above the
   fold. The whole header row is the toggle, so the counts are part of the click
   target rather than dead text sitting next to one. */
.lab-panel-toggle {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    width: 100%;
    padding: 0 0 0.5rem 0;
    margin-bottom: 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--ed-hairline);
    text-align: left;
    cursor: pointer;
}

.lab-panel-caret {
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    line-height: 1;
    color: var(--ed-ink-soft);
}

.lab-panel-heading {
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--ed-ink-soft);
}

.lab-panel-det {
    text-transform: none;
    letter-spacing: 0.06em;
    opacity: 0.75;
}

.lab-panel-counts {
    margin-left: auto;
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    font-family: var(--ed-ui);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    color: var(--ed-ink-soft);
}

/* Abnormal is the one count that must survive a glance at a collapsed panel. */
.lab-panel-count-abnormal {
    color: var(--ed-terracotta);
    font-weight: 600;
}

.lab-panel-count-flag {
    font-style: italic;
}

.lab-panel-toggle:hover .lab-panel-heading,
.lab-panel-toggle:focus-visible .lab-panel-heading {
    text-decoration: underline;
    text-underline-offset: 0.25em;
}

.tool-required-legend {
    font-family: var(--ed-ui);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    color: var(--ed-mute);
    margin-bottom: 0.9rem;
}

.tool-result-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem 1.75rem 2rem;
    animation: fadeIn 0.25s ease;
    font-family: var(--ed-body);
    color: var(--ed-ink);
}

    .tool-result-content .markdown-body { font-family: var(--ed-body); }

.tool-placeholder {
    font-family: var(--ed-display);
    font-style: italic;
    color: var(--ed-mute);
    font-size: 1.1rem;
    margin-top: 3rem;
    text-align: center;
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
    font-variation-settings: "opsz" 24;
    line-height: 1.45;
}

/* ── Case Switcher (top-bar active case + recent picker) ───────────────── */
.case-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    /* Shrinkable: flex min-width defaults to `auto`, which pins the chip at its
       content width — at narrow widths it then overflowed its slot and, being
       position:relative, PAINTED OVER the theme toggles beside it. The whole
       chain (root → trigger → name/meta spans) opts into shrinking so the
       signalment truncates with an ellipsis instead. */
    min-width: 0;
    max-width: 100%;
}

.case-switcher-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem;
    background: var(--color-surface-solid);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.86rem;
    color: var(--color-text);
    cursor: pointer;
    max-width: min(360px, 100%);
    min-width: 0;
}

.case-switcher-trigger:hover { background: rgba(0,0,0,0.03); }

.case-switcher-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-green-accent, #2d6a4f);
    flex-shrink: 0;
}

.case-switcher-dot--off { background: #b0b0b0; }

/* The NAME holds and the signalment gives way, but a name too long on its own now
   elides too (sweep 2026-10-15, shell-brand-pwa#11). It was flex-shrink:0, so its box
   was always as wide as its text and its own ellipsis could never fire: below 640px
   the trigger clipped "Charlie Richa" hard and pushed the ▾ out of sight, and in
   phone mode a long name ran over the vet disc and took its taps. Priority now comes
   from the signalment's flex-basis of 0: it adds nothing when room is shared out, so
   the name is the only thing that shrinks, and only once it alone does not fit; the
   signalment then grows into whatever room is left, never past its own text
   (max-width: max-content), and elides there. A shrink-weighted split instead (meta
   flex-shrink 100) still took a fraction of a pixel off the name, which is enough
   to elide it.

   0%, not 0 (review of the same sweep). Above 640px the trigger is width:auto, so its
   width is the sum of its children's intrinsic contributions, and Gecko is believed
   to use a length flex-basis in place of width there: a basis of 0 would contribute
   nothing, the trigger would size to dot + name + ▾ and Firefox would show "Bella ▾"
   with no signalment. A percentage of the not-yet-sized trigger counts as content for
   that sum in every engine (the cyclic-percentage rule) and still resolves to 0 once
   the trigger has a width. Chromium lays the two out identically (measured at 500,
   700, 1000 and 1280px); Firefox itself was not to hand to check. */
.case-switcher-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 0 1 auto;
}

.case-switcher-meta {
    color: var(--color-text-muted);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 0%;
    max-width: max-content;
}

/* The menu's affordance: it never shrinks, so it is never pushed past a clip. */
.case-switcher-chev {
    color: var(--color-text-muted);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    margin-left: 0.25rem;
    flex-shrink: 0;
    transition: transform 0.2s var(--ease-spring);
}

.case-switcher-open .case-switcher-chev { transform: rotate(180deg); }

.case-switcher-menu {
    position: absolute;
    top: calc(100% + 0.3rem);
    left: 0;
    min-width: 320px;
    max-width: 440px;
    /* Light glass (2026-10-17). It opens below the masthead's bottom edge, never over
       it, so its blur is the only one where it lies. It holds no fixed box (the switch
       and detach dialogs render outside it), so its filter captures nothing. */
    background: var(--glass-menu);
    border: 1px solid var(--glass-float-edge);
    border-radius: 18px;
    box-shadow: inset 0 1px 0 var(--glass-float-light), 0 24px 60px var(--glass-float-shade);
    -webkit-backdrop-filter: var(--glass-float-filter);
    backdrop-filter: var(--glass-float-filter);
    padding: 0.4rem 0;
    z-index: 1000;
    animation: switcher-open 0.16s var(--ease-smooth) backwards;
    transform-origin: top left;
}

.case-switcher-section-title {
    padding: 0.3rem 0.85rem 0.2rem;
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.case-switcher-item, .case-switcher-action {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.45rem 0.85rem;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 0.88rem;
    color: var(--color-text);
    cursor: pointer;
}

.case-switcher-item { flex-direction: column; align-items: flex-start; gap: 0.1rem; }

.case-switcher-item:hover, .case-switcher-action:hover {
    background: var(--color-green-bg);
}

.case-switcher-item--active { background: var(--color-green-bg); }

.case-switcher-item-name { font-weight: 600; }

.case-switcher-item-meta {
    color: var(--color-text-muted);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
}

.case-switcher-empty {
    padding: 0.5rem 0.85rem;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.case-switcher-divider {
    height: 1px;
    background: var(--color-green-border);
    margin: 0.35rem 0;
}

.case-switcher-action--detach {
    /* Token, not a literal: #842029 was frozen across themes and fell to 1.84:1 on the
       dark dropdown panel. --ed-rust is the destructive ink and flips with the theme. */
    color: var(--ed-rust);
}

/* Mobile: shrink the trigger, drop meta, anchor dropdown to viewport edge.
   The case switcher lives in the top-row which has limited width on phones —
   the patient name is the only thing the vet actually needs to see at a glance. */
@media (max-width: 640.98px) {
    .case-switcher {
        flex: 1 1 auto;
        min-width: 0;
    }

    .case-switcher-trigger {
        min-height: 44px;
        max-width: 100%;
        width: 100%;
        justify-content: flex-start;
    }

    .case-switcher-meta { display: none; }

    .case-switcher-menu {
        left: 0;
        right: auto;
        min-width: 0;
        width: min(calc(100vw - 1.5rem), 360px);
    }

    .case-switcher-item, .case-switcher-action {
        min-height: 44px;
    }
}

/* ── Cases list + detail pages ──────────────────────────────────────────── */
.cases-page {
    min-height: calc(100vh - 3.5rem);
    background: var(--color-green-bg);
    padding: 1.5rem;
}

.cases-page-container {
    max-width: 1080px;
    margin: 0 auto;
}

/* ── Active-case banner ───────────────────────────────────────────────────
   Surfaces at the top of Cases (now the landing page) when the vet has a
   case selected from a prior session — fastest way to rejoin context without
   scanning the grid. Mirrors the today-active-case banner. */

.cases-active-case {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.55rem 0.95rem;
    margin-bottom: 1rem;
    background: var(--ed-paper, #fffdf6);
    border: 1px solid var(--color-green-border, #cfe1c2);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.92rem;
}

.cases-active-case-label {
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ed-ink-soft);
}

.cases-active-case-name {
    color: var(--ed-ink);
}

.cases-active-case-link {
    margin-left: auto;
    color: var(--ed-ink);
    text-decoration: none;
    font-weight: 500;
}

    .cases-active-case-link:hover {
        text-decoration: underline;
        color: var(--ed-ink);
    }

.cases-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* Editorial page title — italic display serif at moderate scale. */
.cases-page-title {
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-variation-settings: "opsz" 144;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--ed-ink);
    margin: 0;
}

/* Filter tabs — plain mono caps with an underline on the active item.
   No pill background; reads as editorial section navigation. */
.cases-filter-tabs {
    display: inline-flex;
    gap: 1.25rem;
    background: transparent;
    border: none;
    padding: 0.1rem 0 0;
    border-bottom: 1px solid var(--ed-hairline);
}

.cases-filter-tab {
    padding: 0.35rem 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ed-mute);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px;
}

    .cases-filter-tab:hover { color: var(--ed-ink-soft); }

    .cases-filter-tab.active {
        background: transparent;
        color: var(--ed-ink);
        border-bottom-color: var(--ed-terracotta);
        font-weight: 500;
    }

/* Small numeric badge inside the "Recheck" tab when there's anything due. */
.cases-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.4rem;
    margin-left: 0.4rem;
    border-radius: 999px;
    background: var(--ed-rust);
    color: var(--ed-paper);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
    vertical-align: 1px;
}

/* Search bar — single-line input + clear affordance. The clear button only
   renders when the query is non-empty (page-side logic). */
.cases-search-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 0.75rem 0 1rem;
}

.cases-search-input {
    flex: 1 1 auto;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--ed-hairline-strong);
    padding: 0.45rem 0.2rem;
    font-family: var(--ed-body);
    font-size: 1.05rem;
    color: var(--ed-ink);
    outline: none;
    transition: border-color 0.15s;
}

    .cases-search-input::placeholder {
        color: var(--ed-ink-soft);
        font-style: italic;
        opacity: 0.7;
    }

    .cases-search-input:focus {
        border-bottom-color: var(--ed-terracotta);
    }

/* Recheck-on-card. Subtle by default, rust-flagged when overdue. */
.case-card-recheck {
    margin-top: 0.45rem;
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ed-eucalypt);
}

.case-card-recheck--overdue { color: var(--ed-rust); }

/* "Consult saved 15 Oct — clear this recheck?" (sweep 2026-10-15, today-cases#20): a
   hint, never a clear — the card keeps its overdue colour. A sibling of the anchor,
   raised above its stretched overlay like the footer's controls, so Clear is a tap
   on Clear and not on the card. */
.case-card-recheck-hint {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    color: var(--color-text-muted);
}

.case-card-recheck-clear {
    padding: 0.1rem 0.45rem;
    background: transparent;
    border: 1px solid var(--ed-hairline);
    border-radius: var(--radius-sm, 6px);
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ed-ink);
    cursor: pointer;
}

    .case-card-recheck-clear:hover {
        border-color: var(--ed-terracotta);
        color: var(--ed-terracotta);
    }

.case-card--overdue:hover { border-left-color: var(--ed-rust); }

.cases-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0;
}

/* The wrapper carries the card's own chrome — the hairline, the left accent, the
   padding, the hover. The anchor inside it holds only the content, because the
   archive control is a <button> and interactive content cannot legally nest inside
   an <a href>; keeping the box out here lets that button live in the footer while
   the anchor still covers the whole card (see .case-card::after). */
.case-card-wrap {
    position: relative;
    background: transparent;
    border-bottom: 1px solid var(--ed-hairline);
    border-left: 2px solid transparent;
    padding: 1rem 1rem 1rem 1.25rem;
    transition: background 0.15s, border-left-color 0.18s;
}

    .case-card-wrap:hover {
        background: var(--ed-paper-deep);
        border-left-color: var(--ed-terracotta);
    }

/* Always visible rather than hover-revealed: the whole point of this control is
   that finishing with a patient should be one tap, and a control you have to
   discover by hovering is not that. Touch devices have no hover at all.

   Shaped like .case-card-status below, because it acts on exactly that: the pair
   reads as "this case is OPEN — file it". It replaced a full-height strip down the
   card's right edge, which was a far bigger target; the text label rather than a
   bare icon is what keeps this one tappable, and the gap in
   .case-card-footer-left is what keeps it from being tapped by accident. */
.case-card-archive {
    /* Above the anchor's stretched overlay, or the card would swallow the click
       and archiving would silently open the case instead. */
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.34em;
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    line-height: 1.5;
    padding: 0.14rem 0.6rem;
    border-radius: 999px;
    background: transparent;
    border: 1px solid var(--ed-hairline-strong);
    color: var(--ed-mute);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

    .case-card-archive .ic {
        width: 0.9rem;
        height: 0.9rem;
    }

    .case-card-archive:hover,
    .case-card-archive:focus-visible {
        color: var(--ed-terracotta);
        border-color: var(--ed-terracotta);
        background: var(--ed-paper-warm);
    }

/* Undo strip after archiving. Archiving removes the case from this list AND from
   the CaseSwitcher recents in one action, so the reversal has to be right there —
   a confirm dialog before every archive would defeat the speed this exists for.
   Since 2026-10-04 the same strip (Components/UndoStrip) follows the case page's Close
   and Archive, Today's row delete and register clear, and a medication row's ✗. */
.cases-undo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--ed-hairline-strong);
    border-left: 3px solid var(--ed-eucalypt);
    border-radius: var(--radius-md, 8px);
    background: var(--color-green-soft);
    font-size: 0.88rem;
    color: var(--ed-ink);
}

.cases-undo-action {
    font: inherit;
    font-weight: 600;
    background: none;
    border: none;
    padding: 0.1rem 0.2rem;
    color: var(--color-accent);
    text-decoration: underline;
    cursor: pointer;
}

.cases-undo-dismiss {
    font: inherit;
    margin-left: auto;
    background: none;
    border: none;
    padding: 0.1rem 0.3rem;
    color: var(--ed-ink-soft);
    cursor: pointer;
}

/* A thumb's floor where the strip now sits on a phone's rows (2026-10-04): Undo is the
   one tap that brings a deleted row back. */
@media (max-width: 1024px), (pointer: coarse) {
    .cases-undo-action,
    .cases-undo-dismiss {
        min-height: 44px;
        min-width: 44px;
    }
}

/* The save toast's one action - "Cleared · Undo" - is the only way back from a mis-tapped Clear,
   offered for five seconds; on a touch screen in the desktop layout it measured 43x22
   (pre-push sweep, 2026-10-04). Own block so the base rule stays the only top-level one. */
@media (max-width: 1024px), (pointer: coarse) {
    .save-toast-action {
        min-height: 44px;
        padding-inline: 0.6rem;
    }
}

/* Case cards — hairline editorial entries. No raised box; hover lifts the
   left border to terracotta (both now on .case-card-wrap, which is the box).
   This is just the content block. */
.case-card {
    display: block;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    cursor: pointer;
    box-shadow: none;
    /* The browser's own anchor underline, which nothing in this file ever asked
       for, was being drawn across the whole card — name, signalment, owner. It
       only became visible as an inconsistency when the footer moved out of the
       anchor and stopped getting it. */
    text-decoration: none;
}

/* Stretches the link over the entire wrapper so the footer, and the status pill
   in it, still open the case — the pill is what a vet reaches for. Anything in
   the footer that must stay clickable in its own right raises itself above this
   (see .case-card-archive). */
.case-card::after {
    content: "";
    position: absolute;
    inset: 0;
}

.case-card-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

/* Status + archive on the left, last-updated on the right, one baseline at the
   foot of the card. Outside the anchor, so its <button> child is legal. */
.case-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.35rem;
}

/* The gap is the mis-tap guard. The status pill is what a vet reaches for to open
   the case, and until 2026-07-26 archive was kept at the far edge of the card
   precisely because reaching for the pill and hitting archive was a reported
   error. Sitting them side by side is deliberate now — they are a status and the
   action on it — so what stops the error is the space between them. Do not close
   it up to save a few pixels. */
.case-card-footer-left {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.case-card-name {
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.4rem;
    color: var(--ed-ink);
    font-variation-settings: "opsz" 24;
    letter-spacing: -0.01em;
    line-height: 1.1;
}

.case-card-status {
    display: inline-flex;
    align-items: center;
    gap: 0.34em;
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    padding: 0.14rem 0.6rem;
    border-radius: 999px;
    background: transparent;
    border: 1px solid var(--ed-hairline-strong);
    color: var(--ed-ink-soft);
}

/* The glyph is slightly larger than the caps so its silhouette carries. */
.case-card-status-icon {
    font-size: 0.95em;
    line-height: 1;
    letter-spacing: 0;
}

/* Each status differs by ICON (above) + COLOUR + BORDER, never colour alone —
   so it stays legible for older eyes with reduced blue–yellow discrimination.
   Archived also switches to a dashed border: a shape cue that survives even in
   full greyscale / total colour-blindness. */
.case-card-status--open {
    color: var(--ed-eucalypt);
    border-color: var(--ed-eucalypt);
}

.case-card-status--recheck {
    color: var(--ed-rust);
    border-color: var(--ed-rust);
}

.case-card-status--closed {
    color: var(--ed-ink-soft);
    border-color: var(--ed-hairline-strong);
}

.case-card-status--archived {
    color: var(--ed-mute);
    border-color: var(--ed-mute);
    border-style: dashed;
}

.case-card-meta {
    font-family: var(--ed-ui);
    color: var(--ed-ink-soft);
    font-size: 0.85rem;
    line-height: 1.45;
}

.case-card-times {
    margin-top: 0.45rem;
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ed-mute);
}

/* Shown on case cards only when "All" scope is active — surfaces the creator
   so the vet can tell whose work they're looking at on a shared device. */
.case-card-creator {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: var(--ed-ink-soft, var(--ed-mute));
    font-style: italic;
}

/* ── Mine/All scope toggle ───────────────────────────────────────────────
   Sits in the cases header next to the status tabs + New case button.
   Pill-style binary toggle: highlights the active scope, deemphasizes the
   inactive. Smaller than the status tabs because it's a secondary filter. */

.cases-scope-toggle {
    display: inline-flex;
    border: 1px solid var(--ed-hairline-strong, #b6b0a5);
    border-radius: 999px;
    overflow: hidden;
    flex-shrink: 0;
}

.cases-scope-btn {
    padding: 0.32rem 0.85rem;
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: transparent;
    border: 0;
    color: var(--ed-ink-soft, var(--ed-mute));
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

    .cases-scope-btn:hover { color: var(--ed-ink); }

    .cases-scope-btn.active {
        background: var(--ed-ink);
        color: var(--ed-paper);
    }

[data-theme="dark"] .cases-scope-btn.active {
    background: var(--ed-paper);
    color: var(--ed-ink);
}

@media (max-width: 640.98px) {
    /* Cases list: shrink page padding and let the grid use the full width. */
    .cases-page {
        padding: 0.85rem;
    }
    .cases-page-title { font-size: 1.2rem; }
    .cases-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    .cases-page-header {
        gap: 0.6rem;
    }
    .cases-filter-tab {
        min-height: 36px;
        padding: 0.35rem 0.7rem;
    }
    .case-detail-main {
        padding: 0.85rem;
    }
}

/* NewCase's form card — the one survivor of the old two-column case-detail
   layout (the -page/-container/-side/-section-title halves matched nothing
   and were removed in the 2026-08-27 sweep, with the old .timeline family;
   CaseView's timeline speaks cv-timeline/cv-entry). */
.case-detail-main {
    background: var(--color-surface-solid);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-xs);
}

/* ── Cases empty state + backup pill ───────────────────────────────────── */
.cases-backup-pill-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.cases-backup-pill {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-full, 999px);
    background: var(--color-green-bg);
    border: 1px solid var(--color-green-border);
    color: var(--color-text-muted);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    text-decoration: none;
}

    .cases-backup-pill:hover {
        background: var(--color-green-soft);
        color: var(--color-accent);
    }

.cases-backup-pill--warning {
    background: transparent;
    border-color: var(--ed-terracotta);
    color: var(--ed-terracotta);
}

    .cases-backup-pill--warning:hover {
        background: var(--ed-terracotta);
        color: var(--ed-paper);
    }

.cases-empty {
    text-align: center;
    padding: 3.5rem 1rem 3rem;
    background: transparent;
    border: none;
    border-top: 1px solid var(--ed-hairline);
    border-bottom: 1px solid var(--ed-hairline);
    border-radius: 0;
    margin-top: 1rem;
}

.cases-empty-icon {
    font-size: 2.6rem;
    margin-bottom: 0.6rem;
    opacity: 0.7;
}

.cases-empty-title {
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: 2rem;
    font-variation-settings: "opsz" 96;
    color: var(--ed-ink);
    margin-bottom: 0.6rem;
    letter-spacing: -0.015em;
}

.cases-empty-copy {
    font-family: var(--ed-body);
    color: var(--ed-ink-soft);
    max-width: 36rem;
    margin: 0 auto 1.5rem;
    font-size: 1rem;
    line-height: 1.55;
    font-variation-settings: "opsz" 14;
}

/* ── Live Consult top-bar indicator (the can't-forget-to-stop chip) ─────── */
.live-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--ed-rust);
    /* The tint is an image over a base colour (2026-10-17): the base is the floating
       capsule's chip fill (--shell-chip), so the words sit on a chip and not on the bare
       see-through glass; outside the capsule it is transparent, as the tint always was. */
    background-color: var(--shell-chip, transparent);
    background-image: linear-gradient(rgba(162, 59, 42, 0.10), rgba(162, 59, 42, 0.10));
    color: var(--ed-rust);
    font-family: var(--ed-ui);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s var(--ease-spring);
    flex-shrink: 0;
    max-width: 100%;
    min-height: 36px;
}

.live-chip:hover { background-image: linear-gradient(rgba(162, 59, 42, 0.18), rgba(162, 59, 42, 0.18)); transform: translateY(-1px); }

.live-chip--recording { border-color: var(--ed-rust); }
.live-chip--paused    {
    border-color: var(--ed-saffron);
    background-image: linear-gradient(rgba(232, 200, 74, 0.18), rgba(232, 200, 74, 0.18));
    color: #6b5500;
}

/* Review state — recording is finished but the vet hasn't saved yet. Quieter
   than recording/paused (no pulsing dot, no time-sensitive urgency) but still
   present so the vet can navigate back to finish the summary. */
.live-chip--review {
    border-color: var(--ed-hairline-strong, #b6b0a5);
    background: var(--ed-paper);
    color: var(--ed-ink);
    font-weight: 500;
}

    .live-chip--review:hover {
        background-image: linear-gradient(rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.04));
    }

/* Unfinished state — an interrupted transcript is sitting on disk unclaimed.
   Warmer than Review because this one carries a risk of loss: the vet may not
   know the work survived at all. */
.live-chip--unfinished {
    border-color: var(--ed-saffron);
    background-image: linear-gradient(rgba(232, 200, 74, 0.18), rgba(232, 200, 74, 0.18));
    color: #6b5500;
    font-weight: 500;
}

[data-theme="dark"] .live-chip--unfinished { color: var(--ed-saffron); }

.live-chip-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.live-chip-label {
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.85;
}

[data-theme="dark"] .live-chip--paused { color: var(--ed-saffron); }

.live-chip-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--ed-rust);
    position: relative;
    animation: calm-breath 2.4s ease-in-out infinite;
    flex-shrink: 0;
}

.live-chip-dot::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(162, 59, 42, 0.25);
    animation: calm-ring 2.4s ease-in-out infinite;
}

.live-chip--paused .live-chip-dot {
    background: var(--ed-saffron);
    border-radius: 2px;
    animation: none;
    box-shadow: none;
}

.live-chip--paused .live-chip-dot::after { animation: none; opacity: 0; }

/* The microphone has stopped (shell-brand-pwa#2): a still rust dot, as on the capsule. */
.live-chip--failed .live-chip-dot {
    background: var(--ed-rust);
    border-radius: 50%;
    animation: none;
}

.live-chip--failed .live-chip-dot::after { animation: none; opacity: 0; }

.live-chip-time {
    font-family: var(--ed-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.live-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 14ch;
}

@media (max-width: 640.98px) {
    /* On phone, the chip shares the top-bar with the case switcher. Keep just the
       dot + timer; the patient name is already in the case switcher to the left. */
    .live-chip-name { display: none; }
    .live-chip { padding: 0.25rem 0.55rem; min-height: 40px; flex-shrink: 0; }

    /* Cases page header — the filter strip + new-case button overflow narrow
       phones without these. */
    .cases-page-header > div { flex-wrap: wrap; row-gap: 0.5rem; }
    .cases-filter-tabs { flex-wrap: wrap; gap: 0.6rem 0.9rem; }
    .cases-filter-tab { letter-spacing: 0.12em; }

    /* Dose Calculator tab labels — drop the tracking on phone so the long
       "CONCENTRATION → VOLUME" label doesn't claim a row to itself. */
    .dose-calc-tab { letter-spacing: 0.1em; font-size: max(0.7rem, var(--ed-fs-floor, 0rem)); }

    /* Live Consult patient line — italic display at 1.6rem on a 568px viewport
       pushes the bigbutton below the fold. */
    .live-consult-patient-line { font-size: 1.2rem; margin-bottom: 1rem; }
    .live-consult-timer { font-size: 3rem; margin: 1.25rem 0; }
}

/* ── Live Consult page (three states share the wrapper) ─────────────────── */
.live-consult-page {
    min-height: calc(100dvh - 3.5rem);
    background: var(--color-green-bg);
    /* Trimmed 2026-07-30: at 720p the old 1.5rem top pad + 1rem card margin +
       generous stage spacing pushed the consent gate's primary button below the
       fold — the vet had to scroll to reach "start recording". */
    padding: 0.75rem 1rem 1.25rem;
    display: flex;
    justify-content: center;
}

.live-consult-empty,
.live-consult-consent,
.live-consult-record,
.live-consult-review {
    width: 100%;
    /* 920, not 640: the old column left a third of a 1280 screen empty while the
       consent script wrapped to four lines and the buttons fell below the fold. */
    max-width: 920px;
    background: var(--color-surface-solid);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.4rem;
    box-shadow: var(--shadow-xs);
    margin-top: 0.5rem;
}

.live-consult-empty {
    text-align: center;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
}

.live-consult-empty-icon {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
}

/* Editorial stage label — small-caps mono with terracotta accent. */
.live-consult-stage-title {
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--ed-eucalypt);
    margin-bottom: 0.55rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ed-hairline);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.live-consult-patient-line {
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.35rem;
    font-variation-settings: "opsz" 48;
    line-height: 1.15;
    color: var(--ed-ink);
    margin-bottom: 0.9rem;
    letter-spacing: -0.01em;
}

.live-consult-patient-line strong {
    font-weight: 500;
}

/* Consent script reads as the actual transcribed scrip — Fraunces Roman,
   slightly oversized, on a soft cream card with a left rail. */
.live-consult-consent-card {
    background: var(--ed-paper-warm);
    border: none;
    border-left: 3px solid var(--ed-terracotta);
    border-radius: 0;
    padding: 0.85rem 1.1rem 0.95rem;
    margin-bottom: 1.25rem;
}

.live-consult-consent-label {
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ed-terracotta);
    font-weight: 500;
    margin-bottom: 0.55rem;
}

.live-consult-consent-script {
    font-family: var(--ed-body);
    font-size: 1.1rem;
    line-height: 1.55;
    margin-bottom: 0.6rem;
    color: var(--ed-ink);
    font-variation-settings: "opsz" 24;
}

.live-consult-consent-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* The Upload / Type shortcuts, below the consent gate. Deliberately quiet: they are
   the other two ways a consult reaches the timeline, not competition for the primary
   action. Separated by a rule so the gate above reads as finished — the vet's eye
   should reach "start recording" before it reaches these. */
.live-consult-consent-alt {
    margin-top: 1.5rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--ed-hairline);
}

/* Its own line. Inline with the buttons, the three items measured 590px against a
   587px row and wrapped to leave the second shortcut orphaned below the first. */
.live-consult-consent-alt-label {
    display: block;
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ed-mute);
    margin-bottom: 0.6rem;
}

.live-consult-consent-alt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.live-consult-consent-alt .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.86rem;
}

/* Recording stage. The timer and the big Pause/Resume button are the focal points
   — large enough that the owner across the exam table can see them too. */
.live-consult-rec-pip,
.live-consult-pause-pip {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    margin-right: 0.2rem;
}
.live-consult-rec-pip {
    background: var(--ed-rust);
    position: relative;
    animation: calm-breath 2.4s ease-in-out infinite;
}
.live-consult-rec-pip::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(162, 59, 42, 0.25);
    animation: calm-ring 2.4s ease-in-out infinite;
}
/* Paused: saffron SQUARE — the shape change carries the state without motion. */
.live-consult-pause-pip { background: var(--ed-saffron); border-radius: 2px; }

/* Recording timer as a magazine display numeral — italic Fraunces at scale. */
.live-consult-timer {
    /* Was --ed-display (Fraunces) + tabular-nums, which is a silent no-op: Fraunces
       has no tnum, so a 5rem timer's digits changed width every tick and the whole
       thing shuffled once a second. Mono matches .live-chip-time, the other timer in
       this feature, and is what the tabular-nums here was always asking for. */
    font-family: var(--ed-mono);
    font-variant-numeric: tabular-nums;
    font-size: 4.4rem;
    font-weight: 500;
    text-align: center;
    color: var(--ed-ink);
    letter-spacing: -0.045em;
    line-height: 1;
    margin: 1.75rem 0;
}

/* The batch state as one quiet line under the big button, in both modes (QoL
   2026-10-04, text#1 + speed#3): "Transcribing the latest section…" while one is on
   its way, "Transcribing the last section… N s" at Stop, so a frozen clock reads as
   "working on it" rather than "stuck". It replaced the "Processing…" line that sat
   under the clock. No display here: the caught-up line is .phone-mode-only, and that
   utility is what hides it on desktop. The phone sheet adds its own spacing. */
.live-consult-batch-state {
    font-family: var(--ed-ui);
    font-size: max(0.9rem, var(--ed-fs-floor, 0rem));
    color: var(--ed-mute);
    text-align: center;
    margin-top: 0.85rem;
}

.live-consult-bigbutton {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    min-height: 4.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s var(--ease-spring), filter 0.15s, box-shadow 0.2s;
}

.live-consult-bigbutton--recording {
    background: linear-gradient(135deg, #dc3545 0%, #b02a37 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(220, 53, 69, 0.35);
}
.live-consult-bigbutton--paused {
    background: linear-gradient(135deg, #2d6a2d 0%, #1e4a1e 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(45, 106, 45, 0.35);
}
.live-consult-bigbutton:hover { filter: brightness(1.05); transform: translateY(-2px); }
.live-consult-bigbutton:active { transform: scale(0.97); }
.live-consult-bigbutton-icon { font-size: 1.6rem; }

/* Live amplitude meter — replaces the previous live-transcript toggle. Sits
   below the big Pause/Resume button during Recording and Paused states. The
   canvas itself is positioned absolutely so its height stretches without
   leaking layout reflow into Razor's render path. */
.live-consult-amplitude-wrapper {
    margin-top: 0.85rem;
    padding: 0.85rem 0.9rem 0.65rem;
    background: var(--color-green-bg);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-sm, 6px);
}

.live-consult-amplitude {
    display: block;
    width: 100%;
    height: 64px;
    background: transparent;
}

.live-consult-amplitude-hint {
    margin-top: 0.4rem;
    text-align: center;
}

/* Summary panel on Review — sits above the editable raw transcript. Marked
   visually as the primary surface ("this is what gets saved") so the vet
   focuses on cleaning it up rather than wrangling sentence-level redactions
   on the raw text. */
.live-consult-summary-panel {
    padding: 0.85rem 0.9rem;
    background: var(--ed-paper-warm);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-sm, 6px);
}

.live-consult-summary-content {
    font-size: 0.95rem;
    line-height: 1.55;
    min-height: 3rem;
}

.live-consult-summary-edit {
    font-family: var(--font-mono, ui-monospace, "JetBrains Mono", monospace);
    font-size: 0.92rem;
    line-height: 1.5;
    min-height: 240px;
}

.live-consult-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ── Post-save picker — replaces the review actions once save completes ──── */

/* The screen's one heading (text#4, QoL 2026-10-04): the stage title and
   "✓ Saved to Bella's case" merged. Read at the size the confirmation had inside
   the picker, not as the other states' small-caps label — it is the answer to
   "did that save, and to whom?". */
.live-consult-saved-title {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    color: var(--ed-ink);
    gap: 0.5rem;
}

/* Recorded length and Copy on one row, under the heading. Wraps rather than
   squeezes; Copy keeps to the right when there is no length to show (a typed,
   dictated or uploaded note). */
.live-consult-saved-headline {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.live-consult-saved-headline .btn-copy-plain {
    margin-left: auto;
}

.live-consult-saved-length {
    color: var(--ed-mute);
    font-size: 0.9rem;
}

.live-consult-saved-picker {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: var(--ed-paper-warm);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-sm, 6px);
    margin-top: 0.5rem;
}

.live-consult-saved-check {
    /* --ed-mint is the confirmation ink. A 1.2rem glyph is NOT large text (that starts
       at 1.5rem unbolded), so the check answers to the same 4.5:1 floor as the words
       beside it — on --ed-paper-warm, the surface the saved screen's card sets
       (--color-surface-solid) and .live-consult-saved-picker repeats. */
    color: var(--ed-mint);
    font-size: 1.2rem;
    line-height: 1;
}

/* "For Bella:" — the patient once, directly above the buttons that act for her
   (text#4). Tucked against them: the picker's 0.85rem gap is for separate blocks. */
.live-consult-saved-lead {
    color: var(--ed-mute);
    font-size: 0.9rem;
    margin-bottom: -0.45rem;
}

/* The saved summary's phone copy, one line until opened (taps#2). Hidden outside
   phone mode, where .live-consult-saved-full shows the summary open; the phone
   sheet (css/phone/consult.css) swaps the two. */
.live-consult-saved-fold {
    display: none;
}

/* "Saved summary" with its Edit beside it (round 9, 2026-11-10). */
.live-consult-saved-summary-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.live-consult-saved-edited {
    color: var(--ed-mint);
    margin-bottom: 0.35rem;
}

.live-consult-saved-fold > summary {
    cursor: pointer;
    color: var(--ed-mute);
    font-size: 0.9rem;
    font-weight: 600;
}

.live-consult-next-cta {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.1rem;
    text-align: left;
}

.live-consult-next-label {
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.85;
}

.live-consult-next-patient {
    font-size: 1.05rem;
    font-weight: 500;
}

.live-consult-next-time {
    font-family: var(--ed-mono);
    font-size: 0.9rem;
    opacity: 0.85;
    margin-right: 0.4rem;
}

.live-consult-next-reason {
    font-weight: 400;
    opacity: 0.92;
}

.live-consult-next-arrow {
    font-size: 0.95rem;
    white-space: nowrap;
}

.live-consult-saved-secondary {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

    .live-consult-saved-secondary .btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 9rem;
    }

@media (max-width: 640.98px) {
    .live-consult-page { padding: 0.85rem; }
    .live-consult-empty,
    .live-consult-consent,
    .live-consult-record,
    .live-consult-review {
        padding: 1rem 1rem;
    }
    .live-consult-timer { font-size: 3.5rem; margin: 1rem 0; }
    .live-consult-bigbutton { min-height: 4rem; font-size: 1.2rem; }
    .live-consult-consent-script { font-size: 1rem; }
    .live-consult-review-actions .btn { flex: 1 1 100%; }
}

/* ── Backup / Restore page ──────────────────────────────────────────────── */
.backup-page {
    min-height: calc(100dvh - 3.5rem);
    background: var(--color-green-bg);
    padding: 1.5rem 1rem;
}

.backup-container {
    max-width: 720px;
    margin: 0 auto;
}

.backup-title {
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(2rem, 4.5vw, 2.8rem);
    font-variation-settings: "opsz" 144;
    letter-spacing: -0.022em;
    line-height: 1;
    color: var(--ed-ink);
    margin-bottom: 0.5rem;
}

.backup-section {
    background: transparent;
    border: none;
    border-top: 1px solid var(--ed-hairline);
    border-radius: 0;
    padding: 1.4rem 0 0.75rem;
    margin-top: 1.25rem;
    box-shadow: none;
}

.backup-section-title {
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--ed-ink-soft);
    font-weight: 500;
    margin-bottom: 0.85rem;
}

.backup-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    /* Description on the left, action button on the right. Now that .btn keeps its
       label at full width, the button has to be allowed to drop to its own line on
       narrow screens instead of forcing the row wider than the viewport. */
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

@media (max-width: 640.98px) {
    .backup-page { padding: 0.85rem; }
    .backup-section { padding: 0.85rem; }
    .backup-row { flex-direction: column; gap: 0.5rem; }
}

/* ── Image Description scope banner ─────────────────────────────────────── */
.image-desc-scope-banner {
    padding: 0.6rem 0.8rem;
    margin-bottom: 1rem;
    background: var(--ed-terracotta-soft);
    border: 1px solid rgba(133, 85, 58, 0.35);
    border-radius: var(--radius-sm, 6px);
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--color-text);
}

[data-theme="dark"] .image-desc-scope-banner {
    background: var(--ed-terracotta-soft);
    border-color: rgba(201, 163, 91, 0.4);
}

/* ── Dose Calculator ─────────────────────────────────────────────────────── */
/* Embedded inside Medications' .meds-body scroller since 2026-07-26, so no
   viewport floor here — a "100vh minus top row" budget overflows the slot by
   the tool header + tab strip (+ stepper) and re-creates the phantom scroll
   band the 2026-07-30 app-shell migration removed. Phones keep their
   document-flow budget in the <=640.98px block below. */
.dose-calc {
    display: flex;
    flex-direction: column;
    background: var(--color-green-bg);
}

.dose-calc-tabs {
    display: flex;
    /* Wrapping belongs in the BASE rule, not just the phone breakpoint. The tabs are
       white-space: nowrap and need ~896px; between 641px and 900px the sidebar is
       still expanded, so on an iPad in portrait they blew straight past the viewport
       and scrolled the whole PAGE sideways (+138px at 768). Desktop is unaffected —
       they fit on one line there, so the wrap never triggers. */
    flex-wrap: wrap;
    gap: 0.35rem 1.5rem;
    padding: 0.5rem 1.75rem 0;
    background: transparent;
    border-bottom: 1px solid var(--ed-hairline-strong);
}

.dose-calc-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 0;
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ed-mute);
    cursor: pointer;
    border-radius: 0;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    /* Mono small-caps should never break mid-label — wrap entire labels instead. */
    white-space: nowrap;
}

.dose-calc-tab:hover {
    color: var(--ed-ink-soft);
    background: transparent;
}

.dose-calc-tab.active {
    color: var(--ed-ink);
    background: transparent;
    border-color: var(--ed-terracotta);
    font-weight: 500;
}

/* Emergency tab — rust accent finds the eye in a crash without breaking the
   editorial restraint. */
.dose-calc-tab--emergency {
    color: var(--ed-rust);
    font-weight: 500;
}

    .dose-calc-tab--emergency:hover { color: var(--ed-rust); }

    .dose-calc-tab--emergency.active {
        color: var(--ed-rust);
        border-color: var(--ed-rust);
    }

.dose-calc-body {
    display: flex;
    flex: 1;
    justify-content: center;
    padding: 1.5rem;
    align-items: flex-start;
}

.dose-calc-panel {
    flex: 1 1 auto;
    max-width: 760px;
    background: var(--color-surface-solid);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-xs);
}

.dose-calc-section {
    margin-bottom: 1rem;
}

.dose-calc-section + .dose-calc-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed var(--color-green-border);
}

.dose-calc-section-title {
    font-family: var(--ed-mono);
    font-size: max(0.7rem, var(--ed-fs-floor, 0rem));
    color: var(--ed-ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    margin-bottom: 0.65rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--ed-hairline);
    font-weight: 500;
}

.dose-calc-row {
    margin-bottom: 0.75rem;
}

.dose-calc-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.dose-calc-num-unit {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.5rem;
    align-items: end;
}

.dose-calc-alert {
    margin-top: 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm, 6px);
    font-size: 0.85rem;
}

.dose-calc-alert-danger {
    background: rgba(162, 59, 42, 0.07);
    border: 1px solid var(--ed-rust);
    color: var(--ed-rust);
}

/* ── Emergency drug panel (Mode C) ──────────────────────────────────────── */
.emergency-drug-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.emergency-drug {
    border: 1px solid var(--ed-hairline-strong);
    border-radius: var(--radius-sm, 6px);
    background: var(--ed-paper-warm);
    padding: 0.65rem 0.8rem;
}

.emergency-drug-excluded {
    border-color: var(--ed-rust);
    background: rgba(162, 59, 42, 0.07);
}

.emergency-drug-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.emergency-drug-exclusion {
    padding: 0.5rem 0.6rem;
    background: rgba(162, 59, 42, 0.07);
    border: 1px solid var(--ed-rust);
    border-radius: var(--radius-sm, 6px);
    color: var(--ed-rust);
    font-size: 0.86rem;
    line-height: 1.45;
}

.emergency-indications {
    list-style: none;
    padding: 0;
    margin: 0;
}

.emergency-indication {
    padding: 0.45rem 0;
    border-top: 1px dashed var(--color-green-border);
}

.emergency-indication:first-child {
    border-top: none;
    padding-top: 0;
}

.emergency-indication-label {
    font-weight: 500;
    font-size: 0.87rem;
}

.emergency-indication-line {
    font-size: 0.92rem;
    margin: 0.15rem 0 0.1rem;
}

.emergency-dose {
    font-weight: 600;
}

.emergency-indication-caveat {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.45;
    margin-top: 0.15rem;
}

.emergency-drug-note {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--color-green-border);
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-style: italic;
    line-height: 1.45;
}

/* ── Calculator result card (shared by Volume + CRI modes) ──────────────── */
.result-card {
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    background: var(--color-green-bg);
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-md);
}

.result-card-title {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.result-card-lines {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.55;
}

.result-card-lines li + li {
    margin-top: 0.2rem;
}

.result-card-warning {
    margin-top: 0.6rem;
    font-size: 0.82rem;
    color: var(--color-text-muted);
    font-style: italic;
}

@media (max-width: 900px) {
    .dose-calc-panel {
        max-width: none;
    }
}

@media (max-width: 640.98px) {
    /* Dose Calculator on phones: page-level scrolling, tabs that wrap,
       and form fields that stack instead of compete for width. */
    .dose-calc {
        min-height: calc(100dvh - 3.5rem);
    }
    .dose-calc-tabs {
        padding: 0.4rem 0.85rem 0;
        flex-wrap: wrap;
        gap: 0.2rem;
    }
    .dose-calc-tab {
        flex: 1 1 auto;
        padding: 0.55rem 0.7rem;
        font-size: 0.85rem;
        min-height: 44px;
    }
    .dose-calc-body {
        padding: 0.85rem;
    }
    .dose-calc-panel {
        padding: 0.9rem 1rem;
    }
    .dose-calc-row-2 {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    .dose-calc-num-unit {
        grid-template-columns: 1.6fr 1fr;
    }

    /* Emergency cards get tight on phone — let the citation link drop under
       the drug name instead of fighting it for the same row. */
    .emergency-drug { padding: 0.55rem 0.65rem; }
    .emergency-drug-header { flex-direction: column; align-items: flex-start; gap: 0.15rem; }
    .emergency-indication-line { font-size: 0.9rem; }
    .emergency-indication-caveat { font-size: 0.8rem; }
    .emergency-drug-note { font-size: 0.8rem; }
}

/* 900px, not 768px. The arithmetic decides this: the sidebar is 250px and the
   form panel is a fixed 300px, so a 768px cut-off left the RESULT panel — where
   every generated note, interpretation and handout renders — just 201px wide on
   an iPad in portrait (820x1180), with its own Save/Copy bar overflowing and
   clipped by 65px. 900px keeps two columns only while the results can still hold
   ~350px, and hands iPad portrait the single-column layout it needs.
   iPad Pro 12.9 portrait (1024) still gets two columns. */
@media (max-width: 900px) {
    /* Below that, switch the tool page from a desktop-style fixed-height
       two-column shell to a phone-friendly scroll-the-whole-thing layout.
       50vh max-height on the form was painful for long inputs (SOAP dictation,
       17-row lab paste) — drop it and let the page scroll naturally. */
    .tool-page {
        height: auto;
        min-height: calc(100dvh - 3.5rem);
    }
    .tool-body {
        flex-direction: column;
        overflow: visible;
    }
    /* Padding below this line reads from the spacing scale (:root, near the top of
       this file). The literals it replaced were 1rem / 0.85rem / 0.7rem 1rem /
       0.6rem 0.85rem — five values chosen per-rule, which is why "tighten the
       phone" used to mean hunting them. The panels' old asymmetric 1.25rem bottom
       becomes symmetric; the deleted <=480px tier had already gone symmetric, so
       this follows precedent rather than setting one. */
    .tool-form-panel {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--color-green-border);
        padding: var(--ed-sp-pad-y) var(--ed-sp-pad-x);
        overflow-y: visible;
        max-height: none;
    }
    .tool-result-panel {
        overflow: visible;
    }
    /* Stays literal, and deliberately so. This is an action strip, not a titled
       panel header, and it was already tighter than .tool-header at the same
       width — 0.6/0.85 against 0.7/1. Pointing it at the header tokens made it
       LOOSER at every width below 900px (gap 6.8→10.2px, padding 10.2/14.45→
       11.9/17px at 768), which is backwards for a density change. Measured, not
       reasoned about. If this ever wants to join the scale it needs its own pair
       of tokens, and one bar does not justify two. */
    .tool-result-bar {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.6rem 0.85rem;
    }
    /* Stacked, the result scrolls with the page, and Save, Copy and Share scrolled away
       with it — a whole handout above the vet's thumb by the time he had read it (QoL
       2026-10-04, phone #2). The bar rides at the top while its panel is in view. Opaque,
       or the text reads through it; three classes so it also outranks the dark theme's
       translucent [data-theme="dark"] .tool-result-bar, which comes later in this file.
       z 5: over the result's own content, far under the chrome (40). */
    .tool-page .tool-result-panel > .tool-result-bar {
        position: sticky;
        top: var(--shell-sticky-top);   /* under the fixed phone masthead (2026-10-17) */
        z-index: 5;
        background: var(--ed-paper);
    }
    /* The result bar's own Stop, for the moment revealToolResult (app.js) has scrolled
       the header's Stop off screen. Side by side, the header's is in view and this one
       stays hidden by its base rule beside .tool-result-bar's. */
    .tool-result-stop {
        display: inline-flex;
    }
    .tool-result-content {
        padding: var(--ed-sp-pad-y) var(--ed-sp-pad-x);
        overflow-y: visible;
    }
    .tool-header {
        padding: var(--ed-sp-head-y) var(--ed-sp-pad-x);
        font-size: 1rem;
    }
    .tool-header-icon { font-size: 1.2rem; }
}

/* ── Global mobile pass: touch targets + form sizing + iOS zoom-on-focus ──
   These rules apply across every page. The 16px input font-size is the
   iOS Safari trigger threshold — anything smaller and Safari zooms the
   viewport when an input gains focus, breaking the layout. 44px is the
   iOS Human Interface Guideline minimum touch target. */
@media (max-width: 640.98px) {
    /* Rehomed from a <=480px tier that the spacing scale absorbed. It sat there
       beside two panel-padding rules the scale now owns, but it is a button's own
       type and padding rather than scale work — so it moves rather than dies. */
    .btn-export-pdf {
        padding: 0.4rem 0.7rem;
        font-size: max(0.75rem, var(--ed-fs-floor, 0rem));
    }

    .form-control, .form-select, textarea.form-control {
        font-size: 16px;
        min-height: 44px;
    }
    textarea.form-control {
        /* min-height on textarea is the height of one row; rows attr drives the rest */
        min-height: 0;
    }
    .btn:not(.btn-sm):not(.btn-link) {
        min-height: 44px;
    }
    .btn-sm {
        min-height: 38px;
    }
    /* Result panel markdown text is denser than the form inputs; give it
       just a touch more line height on phone for readability. */
    .markdown-body { font-size: 0.95rem; line-height: 1.6; }
    .markdown-body table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ── FAQ page ─────────────────────────────────────────────────────────── */
.faq-page {
    min-height: calc(100vh - 3.5rem);
    background:
        radial-gradient(ellipse at 15% 10%, rgba(133,85,58,0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 90%, rgba(45,106,45,0.09) 0%, transparent 50%),
        var(--color-green-bg);
    padding: 2rem 1rem;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
    animation: fadeSlideUp 0.35s var(--ease-smooth);
}

.faq-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text-main);
    letter-spacing: -0.5px;
    margin-bottom: 0.3rem;
}

.faq-header-icon {
    font-size: 1.6rem;
}

.faq-subtitle {
    font-family: var(--ed-body);
    color: var(--ed-ink-soft);
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 2rem;
    font-variation-settings: "opsz" 18;
    max-width: 48ch;
}

/* Accordion as editorial Q&A — no raised cards, just hairline-ruled entries. */
.faq-page .accordion-item {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--ed-hairline);
    border-radius: 0;
    margin-bottom: 0;
    box-shadow: none;
    overflow: hidden;
}

.faq-page .accordion-button {
    background: transparent;
    color: var(--ed-ink);
    font-family: var(--ed-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.25rem;
    font-variation-settings: "opsz" 24;
    padding: 1.1rem 0.5rem;
    border: none;
    box-shadow: none;
    letter-spacing: -0.005em;
}

.faq-page .accordion-button:not(.collapsed) {
    background: transparent;
    color: var(--ed-ink);
}

.faq-page .accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.faq-page .accordion-button::after { background-size: 0.95rem; filter: none; opacity: 0.55; }

.faq-page .accordion-body {
    padding: 0.2rem 0.5rem 1.25rem;
    font-family: var(--ed-body);
    font-size: 1rem;
    color: var(--ed-ink-soft);
    line-height: 1.6;
    border-top: none;
    font-variation-settings: "opsz" 14;
    max-width: 56ch;
}

.faq-page .accordion-body strong { color: var(--ed-ink); font-weight: 600; }
.faq-page .accordion-body code { background: var(--ed-paper-deep); color: var(--ed-terracotta); padding: 0.05rem 0.3rem; border-radius: 3px; font-family: var(--ed-mono); font-size: 0.88em; }

/* Bootstrap's .btn-close glyph is a hardcoded BLACK SVG data-URI at 50% opacity, and
   Bootstrap only inverts it under [data-bs-theme="dark"] — an attribute this app never sets,
   because it themes with [data-theme]. So in dark mode the dismiss control is a black X on
   near-black paper: present, focusable, and invisible. Invert it ourselves. */
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Same failure class, same fix (2026-09-03 sweep): the accordion chevron is a
   hardcoded near-black stroke in --bs-accordion-btn-icon, so dark-mode FAQ rows
   showed no expand/collapse affordance at all. The [data-theme] prefix
   out-cascades the light rule's filter:none above. */
[data-theme="dark"] .faq-page .accordion-button::after {
    filter: invert(1) grayscale(100%) brightness(200%);
}

[data-theme="dark"] .faq-page {
    background:
        radial-gradient(ellipse at 15% 10%, rgba(201,163,91,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 90%, rgba(26,58,26,0.10) 0%, transparent 50%),
        var(--color-green-bg);
}

[data-theme="dark"] .faq-page .accordion-item {
    background: var(--color-surface);
    border-color: var(--color-green-border);
}

[data-theme="dark"] .faq-page .accordion-button {
    color: var(--color-text-main);
}

[data-theme="dark"] .faq-page .accordion-button:not(.collapsed) {
    background: var(--color-accent-soft);
}

[data-theme="dark"] .faq-page .accordion-body {
    color: var(--color-text-muted);
    border-color: var(--color-green-border);
}

[data-theme="dark"] .faq-page .accordion-body strong {
    color: var(--color-text-main);
}

/* ════════════════════════════════════════════════════════════════════════════
   DARK MODE LEGACY ALIASES — the editorial dark inversion lives in :root above
   (the [data-theme="dark"] block right after :root). This block keeps the
   `--color-*` legacy aliases pointed at editorial dark tokens so any rule that
   still consumes `--color-green-bg`, `--color-text-main`, etc. inherits the
   warm-charcoal dark mode instead of falling back to the old forest-green.
   ════════════════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    /* Editorial dark accents already live at :root. These just re-bind the
       legacy alias names so the ~40 rules across the app that still consume
       them flip together with the editorial primitives. */
    --color-accent:        var(--ed-terracotta);
    --color-accent-dark:   #a8853f;
    --color-accent-light:  #dcc08a;
    --color-accent-soft:   var(--ed-terracotta-soft);
    --color-accent-glow:   var(--ed-terracotta-glow);

    --color-green-bg:      var(--ed-paper);
    --color-green-mid:     var(--ed-paper-warm);
    --color-green-border:  var(--ed-hairline-strong);
    --color-green-soft:    var(--ed-paper-deep);
    --color-green-accent:  var(--ed-mint);

    --color-sidebar-from:  #1f3a2a;
    --color-sidebar-to:    #14271a;

    --color-text-main:     var(--ed-ink);
    --color-text-muted:    var(--ed-mute);
    --color-text:          var(--ed-ink);

    --color-surface:       rgba(34, 31, 25, 0.85);
    --color-surface-solid: var(--ed-paper-warm);

    /* Shadows are quieter — editorial uses hairlines for elevation. */
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.25);
    --shadow-sm:  0 2px 6px rgba(0,0,0,0.30);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg:  0 8px 28px rgba(0,0,0,0.40);

    /* Bootstrap's OWN tokens. Everything above re-binds our --color-* aliases,
       but Bootstrap components that read --bs-* directly never flipped: .form-text
       resolves --bs-secondary-color from --bs-body-color-rgb, which stayed at
       Bootstrap's light near-black (33,37,41) and rendered at 1.04:1 on charcoal —
       invisible. Re-binding the rgb triple fixes --bs-secondary-color and the other
       derived tokens together; --bs-secondary-color is also set explicitly so the
       result does not depend on Bootstrap's internal derivation surviving upgrades. */
    --bs-body-color:       var(--ed-ink);
    --bs-body-color-rgb:   237, 230, 213;
    --bs-body-bg:          var(--ed-paper);
    --bs-secondary-color:  rgba(237, 230, 213, 0.75);
    --bs-border-color:     var(--ed-hairline-strong);
    --bs-emphasis-color:   var(--ed-ink);
    /* .is-invalid's border and .invalid-feedback's text (QoL 2026-10-04, phone#18): left
       at Bootstrap's light #dc3545 they measured about 3.8:1 on dark paper — the Discharge
       email's error. The app's destructive ink clears AA there (the contrast sweep holds
       --ed-rust to it on every paper surface, in both themes). */
    --bs-form-invalid-color:        var(--ed-rust);
    --bs-form-invalid-border-color: var(--ed-rust);
}

/* Bootstrap sets these on .table itself, so re-binding at :root cannot reach them —
   this needs the (0,2,0) selector to win. Without it every .table kept
   --bs-table-bg: #fff and --bs-table-color: near-black, so the Users admin table
   rendered as a white slab on a charcoal page, and the controls inside it (styled
   for a dark backdrop) fell to 2.1–3.5:1. */
[data-theme="dark"] .table {
    --bs-table-bg:            transparent;
    --bs-table-color:         var(--ed-ink);
    --bs-table-border-color:  var(--ed-hairline-strong);
    --bs-table-striped-bg:    var(--ed-paper-warm);
    --bs-table-striped-color: var(--ed-ink);
    --bs-table-hover-bg:      var(--ed-paper-warm);
    --bs-table-hover-color:   var(--ed-ink);
    --bs-table-active-bg:     var(--ed-paper-deep);
    --bs-table-active-color:  var(--ed-ink);
}

/* ── Base ── */
[data-theme="dark"] html,
[data-theme="dark"] body,
html[data-theme="dark"],
html[data-theme="dark"] body {
    background: var(--color-green-bg);
    color: var(--color-text-main);
    color-scheme: dark;
}

/* ── Page chrome ── */
[data-theme="dark"] .page,
[data-theme="dark"] main {
    background: var(--color-green-bg);
}

/* Not the masthead (main > .top-row): its own sheet sets it from tokens that flip with
   the theme, glass when it floats, and an !important here flattened the dark capsule. */
[data-theme="dark"] .top-row:not(main > .top-row) {
    background: var(--color-surface) !important;
    border-bottom: 1px solid var(--color-green-border);
}

[data-theme="dark"] .top-row .text-muted {
    color: var(--color-text-muted) !important;
}

/* ── Chat page ── */
[data-theme="dark"] .chat-page {
    background:
        radial-gradient(ellipse at 20% 0%, rgba(201,163,91,0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 100%, rgba(26,58,26,0.12) 0%, transparent 55%),
        var(--color-green-bg);
}

[data-theme="dark"] .chat-header,
[data-theme="dark"] .chat-input-bar {
    background: var(--color-surface);
    border-color: var(--color-green-border);
}

[data-theme="dark"] .bubble--assistant {
    background: rgba(26, 40, 26, 0.92);
    border-color: var(--color-green-border);
    color: var(--color-text-main);
}

[data-theme="dark"] .bubble-avatar {
    background: var(--color-green-mid);
}

[data-theme="dark"] .chat-input {
    background: rgba(20, 35, 20, 0.7);
    border-color: var(--color-green-border);
    color: var(--color-text-main);
}

[data-theme="dark"] .chat-input:focus {
    background: #1a2e1a;
    border-color: var(--color-accent);
}

[data-theme="dark"] .chat-input:disabled {
    background: var(--color-green-mid);
    color: var(--color-text-muted);
}

/* ── Tool pages ── */
[data-theme="dark"] .tool-page {
    background:
        radial-gradient(ellipse at 90% 0%, rgba(201,163,91,0.05) 0%, transparent 50%),
        var(--color-green-bg);
}

[data-theme="dark"] .tool-header {
    background: var(--color-surface);
    border-color: var(--color-green-border);
    color: var(--color-text-main);
}

[data-theme="dark"] .tool-form-panel {
    background: var(--color-surface-solid);
    border-color: var(--color-green-border);
}

[data-theme="dark"] .tool-result-panel {
    background: var(--color-green-bg);
}

[data-theme="dark"] .tool-result-bar {
    background: rgba(20, 35, 20, 0.7);
    border-color: var(--color-green-border);
}

[data-theme="dark"] .tool-panel-title {
    color: var(--color-text-muted);
    border-color: var(--color-green-border);
}

[data-theme="dark"] .lab-panel-toggle {
    border-color: var(--color-green-border);
}

[data-theme="dark"] .lab-panel-heading,
[data-theme="dark"] .lab-panel-caret,
[data-theme="dark"] .lab-panel-counts {
    color: var(--color-text-muted);
}

[data-theme="dark"] .tool-placeholder {
    color: var(--color-text-muted);
}

/* ── Forms ── */
/* ── Input-group suffix chips ("y", "mo" on the age fields) ────────────────
   Bootstrap ships .input-group-text with a hardcoded #f8f9fa background and
   #212529 text, and nothing in this file ever overrode it. In light mode that
   passes on its own numbers but sits off-palette (Bootstrap grey beside the
   app's cream). In dark mode it broke outright: the theme's light form colour
   cascaded into the chip while the near-white background stayed put, leaving
   the age suffixes at 1.18:1 — cream on near-white, effectively invisible.

   Both rules live together because they are a pair; splitting them across the
   light and dark sections is how the override came to be missing in the first
   place. Chips take the same surface as the input they are attached to, with
   muted ink so they read as an affix rather than a second value. */
.input-group-text {
    background: var(--color-green-soft);
    border-color: var(--color-green-border);
    color: var(--color-text-muted);
}

[data-theme="dark"] .input-group-text {
    background: rgba(20, 35, 20, 0.7);
    border-color: var(--color-green-border);
    color: var(--color-text-muted);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: rgba(20, 35, 20, 0.7);
    border-color: var(--color-green-border);
    color: var(--color-text-main);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: #1a2e1a;
    border-color: var(--color-accent);
    color: var(--color-text-main);
}

[data-theme="dark"] .form-control:disabled,
[data-theme="dark"] .form-select:disabled {
    background: var(--color-green-mid);
    color: var(--color-text-muted);
}

[data-theme="dark"] .form-label {
    color: var(--color-text-main);
}

[data-theme="dark"] .form-control::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

/* Bootstrap's .text-danger (#dc3545) measures 3.63:1 on the dark page — below
   AA, and it carries the required-field asterisks plus most inline save/validation
   errors. Lifted to a red that clears AA on every dark surface it lands on.
   Deliberately NOT moved toward the palette's terracotta: an error colour that
   reads as the accent colour stops signalling anything. Dark mode only — the
   light-mode value already passes. */
[data-theme="dark"] .text-danger {
    color: #e57373 !important;
}

/* Bootstrap's .text-warning (#ffc107) measures 1.42:1 on the light paper: the
   Backup page's "Best-effort" storage status — the headline of the record's one
   durability risk — was near-invisible (2026-10-15 sweep, runtime#5). Re-tokened
   to --ed-rust, the warning ink the app already uses for its cautions (the Drug
   Book's warn hint), which css-hygiene measures on every paper surface in both
   themes. Not the accent, for the reason .text-danger gives above. !important
   because Bootstrap's own rule is. */
.text-warning {
    color: var(--ed-rust) !important;
}

/* ── Buttons ── */
/* Dark-mode primary button. Its fill is a lifted peach; white text on it only
   reaches ~2.7:1, and — because the button is often an <a> — the generic
   `[data-theme="dark"] a` rule (specificity 0,1,1) out-ranked `.btn-primary`
   (0,1,0) and tinted the label terracotta-on-terracotta: invisible until hover
   (0,2,0) swapped it back to white. Fix: dark ink on the peach (~6.3:1, AA) and
   brighten — not darken — on hover so the label stays legible. `:not(:disabled)`
   leaves the muted disabled styling intact.
   Since the Zoolytic rebrand the fill is gold, not peach; the hover's end stop was
   still the frozen peach #f2bb95, so every hover faded gold into salmon. It is a
   lighter gold now (#e2cc97, ~11:1 under the #1c1a16 ink) — 2026-10-15 sweep. */
[data-theme="dark"] .btn-primary:not(:disabled),
[data-theme="dark"] a.btn-primary {
    color: #1c1a16;
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
}

[data-theme="dark"] .btn-primary:hover:not(:disabled),
[data-theme="dark"] .btn-primary:focus:not(:disabled) {
    color: #1c1a16;
    background: linear-gradient(135deg, var(--color-accent-light) 0%, #e2cc97 100%);
}

[data-theme="dark"] .btn-outline-secondary {
    border-color: var(--color-green-border);
    color: var(--color-text-muted);
}

/* Dark hover intentionally omitted — see the light-mode note beside
   `.btn-outline-secondary:hover, :focus`. That editorial rule uses tokens that
   already flip with the theme, so restating it here only risks the two drifting
   apart again. */

/* ── Markdown body ── */
[data-theme="dark"] .markdown-body h2 {
    color: var(--color-text-muted);
    border-color: var(--color-green-border);
}

[data-theme="dark"] .markdown-body code,
[data-theme="dark"] .markdown-body pre {
    background: #1a2e1a;
    color: var(--color-text-main);
}

/* No dark `th` override: the base rule now uses --ed-eucalypt/--ed-paper, a pair
   that flips with the theme on its own, so the header stays green in both. This
   block previously restated the --color-green-mid pair and only ESCAPED the
   1.36:1 light-mode bug because that alias happens to mean a surface in dark. */

[data-theme="dark"] .markdown-body td {
    border-color: var(--color-green-border);
    color: var(--color-text-main);
}

[data-theme="dark"] .markdown-body tr:nth-child(even) td {
    background: rgba(26, 46, 26, 0.6);
}

/* ── Auth card ── */
[data-theme="dark"] .auth-page {
    background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url("../images/signin-outback-1920.webp");
}

@media (min-width: 1921px), (min-resolution: 1.5dppx) and (min-width: 1281px) {
    [data-theme="dark"] .auth-page {
        background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url("../images/signin-outback-2528.webp");
    }
}

@media (max-width: 640px) {
    [data-theme="dark"] .auth-page {
        background-image: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url("../images/signin-outback-800.jpg");
    }
}

[data-theme="dark"] .auth-card {
    background: var(--glass-light);
    border-color: var(--glass-edge);
}

[data-theme="dark"] .auth-card h1 {
    color: var(--color-text-main);
}

/* ── Scrollbar ── */
[data-theme="dark"] * {
    scrollbar-color: var(--color-green-border) transparent;
}

/* ── Bootstrap overrides ── */
[data-theme="dark"] .text-muted { color: var(--color-text-muted) !important; }
[data-theme="dark"] a { color: var(--color-accent); }

/* ── Logout backup prompt (modal overlay) ─────────────────────────────────
   Triggered by clicking Sign out. Backdrop is the standard semi-transparent
   black; the card is centered, on cream/paper background, with three
   actions (Cancel / Skip / Download & sign out). Mobile collapses the
   action row to vertically stacked full-width buttons. */

.logout-prompt-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1100;
    /* A plain translucent scrim, never a blur (2026-10-17): blurring the whole screen
       behind a dialog is the most expensive thing glass can do, and the dialog's own
       pane is the one surface that needs it. */
    background: var(--glass-scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Top and bottom clear the floating bars, and the pane's max-height keeps it inside
       that band, so the pane's blur never lies over a bar's (no glass on glass). */
    padding: var(--shell-dialog-top) 1rem var(--shell-dialog-bottom);
    /* The scrim fades its COLOUR, never its opacity (2026-10-17 review): an ancestor at
       opacity < 1 becomes the pane's Backdrop Root, so the pane's blur would see nothing
       until the fade ended and snap in ~180ms late. Colour on the scrim, opacity and
       transform on the pane: the blur is right from the first frame. */
    animation: glass-scrim-in 0.18s ease-out;
}

.logout-prompt {
    /* Light glass (2026-10-17, the approved "stronger glass"): the thickest of the
       floating panes, since it carries a question the vet must read. Solid paper in
       every fallback. The dark theme's pane comes from the same tokens. */
    background: var(--glass-dialog);
    border: 1px solid var(--glass-float-edge);
    -webkit-backdrop-filter: var(--glass-float-filter);
    backdrop-filter: var(--glass-float-filter);
    color: var(--ed-ink);
    border-radius: 22px;
    box-shadow: inset 0 1px 0 var(--glass-float-light), 0 30px 80px var(--glass-float-shade);
    padding: 1.5rem 1.5rem 1.25rem;
    width: 100%;
    max-width: 30rem;
    max-height: 100%;
    overflow-y: auto;
    animation: logout-prompt-rise 0.22s ease-out;
}

[data-theme="dark"] .logout-prompt {
    /* --color-bg-card was defined nowhere, so the old cool green-slate #1f2724
       fallback always won — an off-palette card on five dark dialogs (sign-out,
       session-expired, unsaved-work, patient-switch, offline-hold) that no
       retune could ever reach (2026-09-03 sweep). The pane is the dark glass
       token now (2026-10-17), which falls back to --ed-paper-warm, the dark
       palette's card surface everywhere else. */
    background: var(--glass-dialog);
    color: var(--color-text);
}

.logout-prompt-title {
    font-family: var(--ed-display, var(--font-display, serif));
    font-size: 1.35rem;
    margin: 0 0 0.6rem;
}

.logout-prompt-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 1rem;
}

@media (max-width: 575.98px) {
    .logout-prompt-actions {
        flex-direction: column-reverse;
    }

    .logout-prompt-actions .btn { width: 100%; }
}

/* Archived-tab date range. Sits under the search row and only exists on that
   tab — the archive is the one list read by date rather than by patient. */
.cases-date-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0 0 0.75rem;
}

.cases-date-label {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    margin: 0;
}

.cases-date-input {
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--ed-hairline-strong);
    border-radius: var(--radius-sm, 6px);
    background: var(--color-surface-solid);
    color: var(--color-text);
    font-size: 0.85rem;
    font-family: var(--ed-mono);
}

/* Spinner arrows off on the clinical number fields. They eat horizontal room
   inside the box, and the vet runs the app in a split-screen half-window with a
   practice system beside it to copy patient details across — at that width the
   arrows were covering the digits. type=number is kept for the numeric keypad
   on tablets and for the browser's own validation. */
.ed-no-spinner { -moz-appearance: textfield; appearance: textfield; }

.ed-no-spinner::-webkit-outer-spin-button,
.ed-no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Held consult audio. Deliberately not subtle: this is audio kept on the device
   as an exception to what a client was told, so it is stated plainly wherever
   the vet is until it is sent or discarded. */
.held-audio-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.75rem 1rem 0;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--ed-saffron);
    border-radius: var(--radius-sm, 6px);
    background: rgba(232, 200, 74, 0.14);
    color: var(--color-text);
    font-size: 0.88rem;
}

.held-audio-icon {
    color: var(--ed-rust);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.held-audio-text { flex: 1 1 18rem; min-width: 0; }

.held-audio-error {
    margin: 0.35rem 1rem 0;
    color: var(--ed-rust);
}

/* Session-expired re-auth prompt. Shares the logout prompt's card so the two
   read as the same family, but sits above it (and above every other overlay):
   requests are blocked awaiting an answer, so nothing may cover it. No
   click-to-dismiss handler is wired in the markup — that is deliberate. */
.session-expired-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    /* The logout backdrop's scrim and band (2026-10-17): no blur behind the pane. */
    background: var(--glass-scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--shell-dialog-top) 1rem var(--shell-dialog-bottom);
    animation: glass-scrim-in 0.18s ease-out;   /* colour, not opacity: see .logout-prompt-backdrop */
}

/* The scrim arrives as colour from clear to its own --glass-scrim (the "to" is the rule's
   value). No opacity on the scrim: see .logout-prompt-backdrop. */
@keyframes glass-scrim-in {
    from { background-color: transparent; }
}

@keyframes logout-prompt-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ────────────────────────────────────────────────────────────────────────────
   Motion & Feel system — Phase 1 (spec: 2026-07-02-motion-feel-system-design)
   Held press, deposit trace, timeline settle,
   anchored chat answers, condensation sweep. All transform/opacity only.
   ──────────────────────────────────────────────────────────────────────────── */

/* Held press — Save-to-case buttons. :active depresses; .is-saving (set while
   the save round-trip runs) HOLDS the press; removal springs back with one
   overshoot frame timed to land with the save toast. Failure paths remove
   .is-saving with no toast — the spring-back is the only feedback. */
.save-hold {
    transition: transform 0.18s var(--ease-overshoot);
}
.save-hold:active,
.save-hold.is-saving {
    transform: translateY(1px);
    transition: transform 0.08s ease-in;
}

/* Anchored answer — a saved Q+A keeps a permanent margin hairline: filed
   exchanges look anchored, unsaved ones float. The draw-in plays only during
   the save interaction (--fresh); reloaded threads render it statically. */
.bubble--anchored {
    position: relative;
}

.bubble--anchored::before {
    content: "";
    position: absolute;
    left: -0.65rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: var(--ed-eucalypt);
    opacity: 0.55;
    border-radius: 0;
    transform-origin: top;
}

.bubble--anchored-fresh::before {
    animation: anchor-draw 0.18s var(--ease-smooth) both;
}

@keyframes anchor-draw {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

/* Timeline settle — the just-saved artifact's left border draws in mint and
   the entry's tint cools to neutral: the archive visibly grew. One-shot,
   keyed to the saved artifact id via MotionCueService (take-once). */
.cv-entry--settle {
    position: relative;
    animation: cv-entry-tint 0.9s ease-out 0.3s backwards;
}

.cv-entry--settle::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--ed-mint);
    border-radius: 0;
    transform-origin: top;
    animation:
        cv-entry-border 0.3s var(--ease-smooth) backwards,
        cv-entry-border-fade 0.9s ease-out 0.3s forwards;
}

@keyframes cv-entry-tint {
    from { background-color: rgba(58, 124, 92, 0.06); }
    to   { background-color: transparent; }
}

@keyframes cv-entry-border {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

@keyframes cv-entry-border-fade {
    to { opacity: 0; }
}

/* Condensation — when the consult summary lands (text rendered, no error), a
   one-time eucalypt sweep runs along the summary panel's top border: twenty
   minutes of consult visibly condensed into an artifact. Ends translated past
   the clipped edge, so nothing persists on screen. */
.live-consult-summary-panel--captured {
    position: relative;
    overflow: hidden;
}

.live-consult-summary-panel--captured::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 2px;
    width: 40%;
    background: linear-gradient(90deg, transparent, var(--ed-eucalypt), transparent);
    opacity: 0;
    animation: capture-sweep 0.5s ease-in-out 0.05s both;
}

@keyframes capture-sweep {
    0%   { transform: translateX(-100%); opacity: 1; }
    100% { transform: translateX(350%); opacity: 1; }
}

/* Calm breath — recording indicators breathe at resting-heart cadence (2.4 s)
   instead of the old 1.4 s alarm pulse. The expanding ring is a ::after
   pseudo-element animated on transform/opacity (compositor-only), replacing
   the old box-shadow pulse. Paused pips are square: shape carries the state. */
@keyframes calm-breath {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}

@keyframes calm-ring {
    0%   { transform: scale(1);   opacity: 0.25; }
    70%  { transform: scale(1.8); opacity: 0; }
    100% { transform: scale(1.8); opacity: 0; }
}

@keyframes calm-glow {
    0%, 100% { opacity: 0.55; }
    50%      { opacity: 1; }
}

/* Paper lift — ONE press/hover dialect for the whole app, three intensities.
   Buttons lift 1px and press faster than they lift (paper resists, then
   yields); cards never move (editorial stillness) — color/border only, which
   .case-card and .today-row already do; exits are ~40% faster than entries
   (the transition on the base rule governs the exit, the hover rule the
   entry). Excluded: .save-hold (owned by held-press), .chat-send-btn and
   .chat-mic-btn (bespoke spring identity), disabled controls. */
.ed-pill, .btn:not(.save-hold), .cv-pill, .cv-text-btn, .ed-text-btn,
.btn-export-pdf, .btn-copy-plain, .cv-quicklink, .cv-add-med-btn {
    transition-property: background, background-color, border-color, color, box-shadow, transform;
    transition-duration: 0.09s;
    transition-timing-function: ease-out;
}

.ed-pill:hover, .btn:not(.save-hold):not(:disabled):hover, .cv-pill:hover,
.cv-text-btn:hover, .ed-text-btn:hover, .btn-export-pdf:hover,
.btn-copy-plain:hover, .cv-quicklink:hover, .cv-add-med-btn:hover {
    transition-duration: 0.15s;
    transform: translateY(-1px);
}

.ed-pill:active, .btn:not(.save-hold):not(:disabled):active, .cv-pill:active,
.cv-text-btn:active, .ed-text-btn:active, .btn-export-pdf:active,
.btn-copy-plain:active, .cv-quicklink:active, .cv-add-med-btn:active {
    transition-duration: 0.08s;
    transition-timing-function: ease-in;
    transform: translateY(0) scale(0.985);
}

/* Staggered page rise — pages assemble top-to-bottom like sheets squared on a
   desk: 240ms rise per section, 30ms stagger, done in <350ms. Case cards:
   first 8 only at 20ms so long lists never feel slow. No exit animations on
   route leave (Blazor swaps instantly — fighting that adds latency).
   .chain-arrival (set by pages arriving via a chain handoff) suppresses the
   rise entirely so the patient banner never blinks between chain stages. */
.tool-header,
.tool-form-panel,
.tool-result-panel,
.meds-body > *,
.cases-page-container > *,
.cv-spread > *,
.today-container > * {
    animation: fadeSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.tool-form-panel,
.cases-page-container > :nth-child(2),
.cv-spread > :nth-child(2),
.today-container > :nth-child(2),
.meds-body > :nth-child(2) { animation-delay: 30ms; }

.tool-result-panel,
.cases-page-container > :nth-child(3),
.cv-spread > :nth-child(3),
.today-container > :nth-child(3),
.meds-body > :nth-child(3) { animation-delay: 60ms; }

.cases-page-container > :nth-child(n+4),
.cv-spread > :nth-child(n+4),
.today-container > :nth-child(n+4),
.meds-body > :nth-child(n+4) { animation-delay: 90ms; }

/* On .case-card-wrap, not .case-card: the wrapper is the grid child, so it is what
   :nth-child can stagger — on the anchor every one of these would match
   :nth-child(1), one card per wrapper, and the whole list would enter on the same
   frame. It is also the whole card now, footer included; animating the anchor alone
   would fade the content in over a footer that was already there. */
.case-card-wrap { animation: fadeSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.case-card-wrap:nth-child(1) { animation-delay: 0ms; }
.case-card-wrap:nth-child(2) { animation-delay: 20ms; }
.case-card-wrap:nth-child(3) { animation-delay: 40ms; }
.case-card-wrap:nth-child(4) { animation-delay: 60ms; }
.case-card-wrap:nth-child(5) { animation-delay: 80ms; }
.case-card-wrap:nth-child(6) { animation-delay: 100ms; }
.case-card-wrap:nth-child(7) { animation-delay: 120ms; }
.case-card-wrap:nth-child(8) { animation-delay: 140ms; }
.case-card-wrap:nth-child(n+9) { animation-delay: 140ms; }

.chain-arrival .tool-header,
.chain-arrival .tool-form-panel,
.chain-arrival .tool-result-panel,
.chain-arrival .meds-body > * { animation: none; }

/* CaseSwitcher drawer — weighty open (scale+rise from the trigger corner,
   first five rows stagger in), instant close (Blazor unmounts the menu —
   faster than any exit animation, which is the point at 40x/day). */
@keyframes switcher-open {
    from { opacity: 0; transform: translateY(-4px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

.case-switcher-menu > * { animation: fadeIn 0.12s ease-out backwards; }
.case-switcher-menu > :nth-child(1) { animation-delay: 0ms; }
.case-switcher-menu > :nth-child(2) { animation-delay: 15ms; }
.case-switcher-menu > :nth-child(3) { animation-delay: 30ms; }
.case-switcher-menu > :nth-child(4) { animation-delay: 45ms; }
.case-switcher-menu > :nth-child(5) { animation-delay: 60ms; }
.case-switcher-menu > :nth-child(n+6) { animation-delay: 60ms; }

.case-switcher-item, .case-switcher-action { position: relative; }
.case-switcher-item::before, .case-switcher-action::before {
    content: "";
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 2px;
    background: var(--ed-terracotta);
    border-radius: 0;
    transform: scaleY(0);
    transform-origin: center;
    transition: transform 0.12s ease-out;
}
.case-switcher-item:hover::before, .case-switcher-action:hover::before {
    transform: scaleY(1);
}

/* Chain carry-glow — 'your selections arrived here' said with light, not
   labels. One-shot mint wash on carried-over data when a page is entered via
   a chain handoff; the page rise is suppressed (see .chain-arrival above) so
   the patient banner stays optically fixed while only the tooling changes. */
.carry-glow {
    animation: carry-glow-fade 0.6s ease-out backwards;
}

/* The glow must survive the chain-arrival rise suppression — both rules can
   target the same direct children of .meds-body, and the suppressor's
   `animation: none` would otherwise win on specificity. Same specificity,
   later in the file: the glow wins. */
.chain-arrival .carry-glow {
    animation: carry-glow-fade 0.6s ease-out backwards;
}

@keyframes carry-glow-fade {
    from { background-color: rgba(58, 124, 92, 0.08); }
    to   { background-color: transparent; }
}

/* Ghost scaffold — see Components/GhostScaffold.razor. Headers reuse the
   small-caps panel-title voice at 30% presence; lines shimmer at 2.4s and
   very low contrast (anticipation, not noise). */
.ghost-scaffold {
    padding: 0.5rem 0;
    animation: fadeIn 0.2s ease-out backwards;
}

.ghost-scaffold-section { margin-bottom: 1.4rem; }

.ghost-scaffold-title {
    font-family: var(--ed-mono);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ed-ink);
    opacity: 0.3;
    margin-bottom: 0.5rem;
}

.ghost-scaffold-line {
    height: 0.55rem;
    border-radius: 4px;
    margin-bottom: 0.45rem;
    background: linear-gradient(90deg,
        var(--ed-paper-deep) 25%, var(--ed-paper-warm) 50%, var(--ed-paper-deep) 75%);
    background-size: 200% 100%;
    animation: shimmer 2.4s linear infinite;
    opacity: 0.6;
}

/* Chat follow pill — cream, hairline, no unread count. The chat history's
   parent (.chat-page) is the positioning context. */
.chat-page { position: relative; }

.chat-followpill {
    position: absolute;
    left: 50%;
    bottom: 5.5rem;
    transform: translateX(-50%) translateY(4px);
    z-index: 10;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    border: 1px solid var(--ed-hairline-strong);
    background: var(--ed-paper-warm);
    color: var(--ed-ink);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.chat-followpill--on {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Provenance pulse — a small tone-on-tone ripple on pressing timeline pills
   and quicklinks; navigation is never delayed (pure ::after decoration). */
.cv-pill, .cv-quicklink { position: relative; overflow: hidden; }
.cv-pill::after, .cv-quicklink::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: rgba(31, 58, 42, 0.18);
    opacity: 0;
    pointer-events: none;
}
.cv-pill:active::after, .cv-quicklink:active::after { animation: ripple-out 0.35s ease-out; }

/* Paws depart — the arriving answer body fades in over 300ms; the dots and
   the first chunk swap in the same render, so there is no dead frame. */
#chat-live-bubble, .tool-result-content .markdown-body { animation: fadeIn 0.3s ease-out backwards; }

/* Density-aware timeline settle — entries unfold top-down, capped at 10.
   The just-saved entry's .cv-entry--settle (higher specificity) still wins. */
.cv-entry { animation: fadeSlideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.cv-entry:nth-child(2)  { animation-delay: 25ms; }
.cv-entry:nth-child(3)  { animation-delay: 50ms; }
.cv-entry:nth-child(4)  { animation-delay: 75ms; }
.cv-entry:nth-child(5)  { animation-delay: 100ms; }
.cv-entry:nth-child(6)  { animation-delay: 125ms; }
.cv-entry:nth-child(7)  { animation-delay: 150ms; }
.cv-entry:nth-child(8)  { animation-delay: 175ms; }
.cv-entry:nth-child(9)  { animation-delay: 200ms; }
.cv-entry:nth-child(n+10) { animation-delay: 200ms; }

/* Quiet empty states — a slow text breath: awaiting you, not performing. */
.tool-placeholder, .chat-empty-text, .meds-empty, .cv-empty, .case-switcher-empty {
    animation: empty-breath 4s ease-in-out infinite;
}
@keyframes empty-breath {
    0%, 100% { opacity: 0.72; }
    50%      { opacity: 1; }
}

/* First-open sprig — the record wakes: masthead botanical draws itself once
   per session per case (session gate in faunaSprigDraw, app.js). */
.cv-botanical--draw path {
    stroke-dasharray: 140;
    stroke-dashoffset: 140;
    animation: sprig-draw 1.2s ease-out forwards;
}
.cv-botanical--draw path:nth-child(2) { animation-delay: 80ms; }
.cv-botanical--draw path:nth-child(3) { animation-delay: 160ms; }
.cv-botanical--draw path:nth-child(4) { animation-delay: 240ms; }
.cv-botanical--draw path:nth-child(5) { animation-delay: 320ms; }
.cv-botanical--draw path:nth-child(6) { animation-delay: 400ms; }
.cv-botanical--draw path:nth-child(7) { animation-delay: 480ms; }
.cv-botanical--draw path:nth-child(8) { animation-delay: 560ms; }
@keyframes sprig-draw { to { stroke-dashoffset: 0; } }

/* Dusk crossfade — see setTheme (app.js): colors ease over 300ms only while
   .theme-dusk is present; the class is hard-removed after 350ms. */
.theme-dusk, .theme-dusk *, .theme-dusk *::before, .theme-dusk *::after {
    transition: background-color 0.3s ease, color 0.3s ease,
                border-color 0.3s ease, fill 0.3s ease, stroke 0.3s ease !important;
}

/* Ink-line focus — one drawn underline on focused writing surfaces (scoped;
   never global Bootstrap). background-size trick: no pseudo-element needed. */
.tool-form-panel .form-control, .chat-input {
    background-image: linear-gradient(var(--ed-terracotta), var(--ed-terracotta));
    background-repeat: no-repeat;
    background-position: left bottom;
    background-size: 0% 2px;
    transition-property: background-size, border-color, box-shadow, background, color;
    transition-duration: 0.18s;
    transition-timing-function: ease-out;
}
.tool-form-panel .form-control:focus, .chat-input:focus { background-size: 100% 2px; }

/* ═══════════════════════════════════════════════════════════════════════════
   Motion & Feel system — Wave 2 (spec: 2026-07-03-motion-feel-wave2-design)
   ═══════════════════════════════════════════════════════════════════════════ */

/* A1 · Hand-delivered note — bad news arrives slower and softer than good
   news: plain easing (never overshoot), then a rust bar draws down the left
   edge. Once landed the note is fully static — it never pulses. The leaving
   beat runs only on in-place clears; navigation unmounts with no exit. */
.error-note {
    position: relative;
    /* The drawn bar below IS the rail — the alert base's static 3px
       border-left (app.css .alert/.alert-danger) goes transparent so the
       rail doesn't double up and the draw isn't pre-empted. */
    border-left-color: transparent;
    animation: error-note-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.error-note::before {
    content: "";
    position: absolute;
    left: -3px;
    top: -1px;
    bottom: -1px;
    width: 3px;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: var(--ed-rust);
    transform: scaleY(0);
    transform-origin: top;
    animation: error-note-bar 0.22s ease-out 0.08s forwards;
}

.error-note--leaving {
    opacity: 0;
    transition: opacity 0.12s ease-in;
}

@keyframes error-note-in {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: none; }
}

@keyframes error-note-bar { to { transform: scaleY(1); } }

/* Save-failure rescue affordance (Wave 1, 2026-07-05). Appears directly under
   the ErrorNote when a save failed with rescuable content — a copy-to-clipboard
   button that lets the vet lift the LLM output off-device before it's lost.
   Deliberately quiet: this is the safety net, not the primary action. Fades in
   150ms after the ErrorNote settles so the eye reaches the alert first. */
.save-failure-rescue {
    display: flex;
    justify-content: flex-end;
    padding-top: 0.35rem;
    opacity: 0;
    animation: save-failure-rescue-in 0.24s ease-out 0.15s forwards;
}
.save-failure-rescue .btn { font-size: 0.85rem; }
@keyframes save-failure-rescue-in { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .save-failure-rescue { animation: none; opacity: 1; }
}

/* Update-available pill (Wave 2, 2026-07-05). Same motion vocabulary as
   SaveToast — enters bottom-up with soft ease, exits by fade. Pinned bottom-
   center of the viewport; does not compete with the app chrome. */
.update-pill {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    z-index: 1080;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem 0.55rem 1rem;
    background: var(--ed-paper-warm);
    border: 1px solid var(--ed-hairline-strong);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    color: var(--ed-ink);
    font-family: var(--ed-ui);
    font-size: 0.9rem;
    animation: update-pill-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.update-pill-text { font-weight: 500; }
.update-pill-btn {
    background: var(--ed-eucalypt);
    color: var(--ed-paper-warm);
    border: 0;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-family: var(--ed-ui);
    cursor: pointer;
    transition: background 0.15s ease-out;
}
.update-pill-btn:hover:not(:disabled) { background: var(--ed-eucalypt-soft); }
.update-pill-btn:disabled { opacity: 0.7; cursor: default; }
.update-pill-dismiss {
    background: transparent;
    border: 0;
    color: var(--ed-mute);
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.1rem 0.25rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.update-pill-dismiss:hover { color: var(--ed-ink); background: var(--ed-paper-deep); }
.update-pill--leaving {
    opacity: 0;
    transform: translateX(-50%) translateY(4px);
    transition: opacity 0.16s ease-in, transform 0.16s ease-in;
}
@keyframes update-pill-in {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
    .update-pill { animation: none; }
    .update-pill--leaving { transition: opacity 0.05s linear; transform: translateX(-50%); }
}

/* Stale-store banner (errors#17, 2026-10-04). Raised by app.js when fauna_db reports that
   this tab can no longer reach the record store — another window opened a newer Fauna, or
   an older one will not let go — and kept until the reload. Same look as the update pill,
   since both say "reload to carry on", but pinned top-centre: the bottom edge is the pill's
   and the toasts', and after a deploy the two can be up together. Under the modal band
   (1100+), so it never covers a dialog the vet has to answer. */
.fauna-stale-banner {
    position: fixed;
    top: calc(0.75rem + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1085;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    width: max-content;
    max-width: calc(100vw - 2rem);
    padding: 0.55rem 0.85rem 0.55rem 1rem;
    background: var(--ed-paper-warm);
    border: 1px solid var(--ed-hairline-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    color: var(--ed-ink);
    font-family: var(--ed-ui);
    font-size: 0.9rem;
}
.fauna-stale-banner-text { font-weight: 500; }
.fauna-stale-banner-btn {
    background: var(--ed-eucalypt);
    color: var(--ed-paper-warm);
    border: 0;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-family: var(--ed-ui);
    cursor: pointer;
    transition: background 0.15s ease-out;
}
.fauna-stale-banner-btn:hover { background: var(--ed-eucalypt-soft); }

/* Offline banner (Wave 2, 2026-07-05). Soft entrance in the failure dialect —
   opacity + translateY, no overshoot. Uses ed-mute rather than rust so the
   vet reads "informational" not "alarm". */
.offline-tool-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.75rem 0 1rem;
    padding: 0.65rem 0.85rem;
    background: rgba(31, 29, 24, 0.04);
    border: 1px solid var(--ed-hairline);
    border-radius: var(--radius-md);
    color: var(--ed-ink-soft);
    font-family: var(--ed-ui);
    font-size: 0.9rem;
    animation: offline-tool-banner-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.offline-tool-banner-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--ed-mute);
    box-shadow: 0 0 0 3px rgba(138, 133, 121, 0.16);
    flex-shrink: 0;
}
.offline-tool-banner-text { flex: 1; }
.offline-tool-banner--leaving {
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity 0.14s ease-in, transform 0.14s ease-in;
}
@keyframes offline-tool-banner-in {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .offline-tool-banner { animation: none; }
    .offline-tool-banner--leaving { transition: opacity 0.05s linear; transform: none; }
}

/* Page recovery view — rendered by the global ErrorBoundary in MainLayout.
   Deliberately quiet: an apology, cause context, and a Resume affordance
   rather than a red alarm. */
.page-recovery-note {
    max-width: 640px;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--ed-paper-warm);
    border: 1px solid var(--ed-hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.page-recovery-note-title {
    font-family: var(--ed-display);
    font-size: 1.5rem;
    color: var(--ed-eucalypt);
    margin: 0 0 0.75rem;
}
.page-recovery-note-lede {
    color: var(--ed-ink-soft);
    font-size: 1rem;
    line-height: 1.55;
    margin: 0 0 0.9rem;
}
/* Details: the raw exception message, shown only on request (errors#10, 2026-10-04) —
   quieter than both actions, and under them. */
.page-recovery-note-toggle {
    display: inline-flex;
    align-items: center;
    margin-top: 0.75rem;
    padding-inline: 0;
}
.page-recovery-note-detail {
    margin: 0.4rem 0 0;
    font-family: var(--ed-mono);
    font-size: 0.82rem;
    padding: 0.5rem 0.75rem;
    background: rgba(31, 29, 24, 0.04);
    border-radius: var(--radius-sm);
    color: var(--ed-mute);
    word-break: break-word;
}
.page-recovery-note-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
    flex-wrap: wrap;
}

/* Skeleton loaders (Wave 2, 2026-07-05). Editorial ink-wash — a slow
   left-to-right sheen across a soft ink block. Colors picked from the
   editorial palette so skeletons look like the page they're standing in
   for. Motion is reduced-motion-safe. */
:root {
    --skel-block: rgba(31, 29, 24, 0.06);
    --skel-sheen: rgba(31, 29, 24, 0.10);
}
[data-theme="dark"] :root,
[data-theme="dark"] {
    --skel-block: rgba(245, 239, 225, 0.06);
    --skel-sheen: rgba(245, 239, 225, 0.11);
}
.cases-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.cases-skeleton-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--ed-paper-warm);
    border: 1px solid var(--ed-hairline);
    border-radius: var(--radius-md);
}
.cases-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--skel-block);
    animation: skel-sheen 1.6s ease-in-out infinite;
}
.cases-skeleton-body { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.cases-skeleton-line {
    height: 10px;
    background: var(--skel-block);
    border-radius: var(--radius-sm);
    animation: skel-sheen 1.6s ease-in-out infinite;
    animation-delay: 0.15s;
}
.cases-skeleton-line--title { width: 45%; height: 12px; }
.cases-skeleton-line--sub   { width: 65%; }
.cases-skeleton-pill {
    width: 72px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--skel-block);
    animation: skel-sheen 1.6s ease-in-out infinite;
    animation-delay: 0.3s;
}
.case-timeline-skeleton {
    max-width: 720px;
    margin: 1.5rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}
.case-timeline-skeleton-masthead {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--ed-hairline);
}
.case-timeline-skeleton-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.1rem;
    background: var(--ed-paper-warm);
    border: 1px solid var(--ed-hairline);
    border-radius: var(--radius-md);
}
.case-timeline-skeleton-line {
    height: 10px;
    background: var(--skel-block);
    border-radius: var(--radius-sm);
    width: 100%;
    animation: skel-sheen 1.6s ease-in-out infinite;
}
.case-timeline-skeleton-line--wide  { width: 55%; height: 20px; }
.case-timeline-skeleton-line--sub   { width: 30%; }
.case-timeline-skeleton-line--head  { width: 40%; height: 12px; margin-bottom: 0.2rem; }
.case-timeline-skeleton-line--short { width: 65%; }

@keyframes skel-sheen {
    0%, 100% { background: var(--skel-block); }
    50%      { background: var(--skel-sheen); }
}
@media (prefers-reduced-motion: reduce) {
    .cases-skeleton-avatar,
    .cases-skeleton-line,
    .cases-skeleton-pill,
    .case-timeline-skeleton-line {
        animation: none;
    }
}

/* A2 · Pen handed back — after a stream ends the composer visibly returns
   to hand: the input regains contrast over 200ms and the send button
   re-enters with a small settle. The reverse swap (send→stop) is instant:
   entering the machine's turn is cheap; getting your pen back is the event.
   The same entrance plays once on initial mount — it composes with the page
   rise and reads as the bar assembling. */
.chat-send-btn:not(.chat-stop-btn) { animation: pen-return 0.16s ease-out backwards; }

@keyframes pen-return {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: none; }
}

/* The disabled look exits smoothly but enters instantly — the transition
   lives on the enabled state only (the ink-line focus rule carries the
   property list; background/color were added there for this item). */
.chat-input:disabled { transition: none; }

/* A3 · Late-settling emptiness — "no matches" waits one composed 120ms beat
   while typing narrows the list, then settles; a returning match swaps in
   with no animation (results are never delayed). The child selector matches
   the page-rise nth-child delay rules' specificity so the 120ms beat is not
   overridden down to the rise stagger's 90ms. */
.cases-empty--settle,
.cases-page-container > .cases-empty--settle { animation: empty-settle 0.22s ease-out 0.12s backwards; }

@keyframes empty-settle {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: none; }
}

/* B1 · Inscription — a just-created record composes itself top-down like a
   fresh page being inscribed: the first deposit is an act of authorship.
   Overrides the standard page-rise timings for this arrival only; every
   other arrival (including revisits) uses the standard rise. */
.cv-spread--inscribe > * { animation: fadeSlideUp 0.3s var(--ease-smooth) backwards; }
.cv-spread--inscribe > :nth-child(1) { animation-delay: 0ms; }
.cv-spread--inscribe > :nth-child(2) { animation-delay: 90ms; }
.cv-spread--inscribe > :nth-child(n+3) { animation-delay: 180ms; }

/* B2 · Rule under the name — closing a case draws the deposit underline
   MIRRORED: right-to-left, held ~600ms, gone. The same grammar bookends the
   case's life (the save underline draws left-to-right). Confirmed close
   only; nothing persists and revisits render static. */
.cv-headline { position: relative; }

.cv-headline--closing::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -0.08em;
    height: 2px;
    background: var(--cv-eucalypt, #1f3a2a);
    transform: scaleX(0);
    transform-origin: right;
    animation: close-rule 1.42s var(--ease-smooth) both;
    pointer-events: none;
}

@keyframes close-rule {
    0%    { transform: scaleX(0); opacity: 1; }
    22.5% { transform: scaleX(1); opacity: 1; }  /* 320ms draw */
    65%   { transform: scaleX(1); opacity: 1; }  /* +600ms hold */
    100%  { transform: scaleX(1); opacity: 0; }  /* 500ms fade */
}

@keyframes close-rule-reduced {
    0%   { opacity: 0; }
    21%  { opacity: 1; }
    65%  { opacity: 1; }
    100% { opacity: 0; }
}

/* B3 · Ink stamp settle — sign-off lands like a rubber stamp: scale 1.12→1,
   pure deceleration into the paper, nothing bounces up. The 60ms delay is
   the outgoing badge's departure beat (chip-to-row precedent). Undo and
   Reopen swap instantly — bookkeeping, not ceremony. */
.cv-badge--stamp {
    display: inline-flex; /* the inline badge needs a box for transform */
    animation: stamp-settle 0.24s ease-out 60ms backwards;
}

@keyframes stamp-settle {
    from { opacity: 0; transform: scale(1.12); }
    to   { opacity: 1; transform: none; }
}

/* B4 · Note slid across the desk — the sent message rises from the composer
   it was written in (honest physics: it comes from below). Assistant bubbles
   keep their quiet fadeIn — paws-depart owns that moment. */
.bubble-row--sent { animation: bubble-sent 0.24s var(--ease-smooth) backwards; }

/* The row carries the entrance — suppress the base .bubble fadeSlideUp so
   the two rises don't compound into a ~20px double fade. */
.bubble-row--sent .bubble { animation: none; }

@keyframes bubble-sent {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

/* C1 · Ink Strata — the record reads as sediment: today's marginalia in
   crisp ink, last month's settled, older faded (0.6 floor keeps AA
   contrast); visit boundaries carry a stronger rule, like growth rings.
   Static material treatment — never counted, never announced. Selector
   depth beats the scoped .cv-entry[b-*] border shorthand. */
.cv-timeline .cv-entry--ink-recent  .cv-marg-day { opacity: 0.75; }
.cv-timeline .cv-entry--ink-settled .cv-marg-day { opacity: 0.6; }

.cv-timeline .cv-entry.cv-entry--day-boundary {
    border-bottom-color: var(--cv-hairline-strong, rgba(31, 29, 24, 0.28));
}

/* First-open draw — faunaSprigDraw adds the class (sharing the sprig's
   session gate and its reduced-motion early-return). The static strong
   border yields to a scaleX overlay for the draw window, then returns:
   same geometry, same color, seamless swap. Each overlay inherits its
   entry's page-rise stagger delay. */
.cv-timeline--strata-draw .cv-entry.cv-entry--day-boundary { border-bottom-color: transparent; }

.cv-timeline--strata-draw .cv-entry--day-boundary::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: var(--cv-hairline-strong, rgba(31, 29, 24, 0.28));
    transform-origin: left;
    animation: strata-draw 0.24s var(--ease-smooth) backwards;
    animation-delay: inherit;
}

@keyframes strata-draw {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* D2 · Folio unfold — the sheet gets bigger instantly (honest paper; no
   height tween), but the newly revealed ink settles briefly. 150ms so the
   500th expand never reads as a legibility tax. Replays by design —
   direct-manipulation feedback like the CaseSwitcher drawer, not a
   celebration; no keying needed. scroll-margin keeps the collapse
   scroll-return from parking the title under the sticky top bar. */
.cv-entry { scroll-margin-top: 4.5rem; }

.cv-entry-expanded { animation: folio-unfold 0.15s var(--ease-smooth) backwards; }

@keyframes folio-unfold {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* D1 · Traveling ink line — the active-tab underline is one continuous drawn
   line that travels between tabs (faunaInkLine, app.js). The per-button
   underline remains as the no-JS/measurement-failure fallback, suppressed
   only while the shared line exists. Terracotta on Cases (chrome, not a
   clinical-record surface); the consult row keeps its own accent and weight.
   Reduced motion snaps in JS — no CSS fallback needed. */
.cases-filter-tabs, .consult-intake-tabs { position: relative; }

.fauna-ink-line {
    position: absolute;
    left: 0;
    top: 0;
    width: 1px;
    height: 2px;
    background: var(--ed-terracotta);
    transform-origin: left;
    pointer-events: none;
}

/* Height only. The background here used to be a hardcoded #2a64d6 — the single
   occurrence of that blue in the whole codebase, off-palette and frozen across both
   themes. Dropping it lets the base .fauna-ink-line terracotta show through. */
.consult-intake-tabs .fauna-ink-line { height: 3px; }

.cases-filter-tabs:has(.fauna-ink-line) .cases-filter-tab.active { border-bottom-color: transparent; }
.consult-intake-tabs:has(.fauna-ink-line) .consult-tab.active { border-bottom-color: transparent; }

/* Reduced-motion fallbacks for the Motion & Feel system — every cue degrades
   to a simple fade or a static state (spec invariant 7). */
@media (prefers-reduced-motion: reduce) {
    .save-toast { animation: fadeIn 0.15s ease-out backwards; }
    .save-toast--leaving { transform: none; }
    .save-toast-check { animation: none; stroke-dashoffset: 0; }
    .save-hold:active,
    .save-hold.is-saving { transform: none; }
    .cv-entry--settle { animation: fadeIn 0.15s ease-out backwards; }
    .cv-entry--settle::before { animation: none; opacity: 0; }
    .bubble--anchored-fresh::before { animation: none; }
    .live-consult-summary-panel--captured::before { animation: none; }
    .live-consult-rec-pip,
    .live-chip-dot { animation: calm-glow 2.4s ease-in-out infinite; }
    .live-consult-rec-pip::after,
    .live-chip-dot::after { animation: none; opacity: 0; }
    .chat-mic-btn--recording { animation: none; }
    .chat-mic-btn--transcribing:disabled { animation: none; }
    .ed-pill:hover, .btn:hover, .cv-pill:hover, .cv-text-btn:hover,
    .ed-text-btn:hover, .btn-export-pdf:hover, .btn-copy-plain:hover,
    .cv-quicklink:hover, .cv-add-med-btn:hover,
    .ed-pill:active, .btn:active, .cv-pill:active { transform: none; }
    .tool-header, .tool-form-panel, .tool-result-panel, .meds-body > *,
    .cases-page-container > *, .cv-spread > *, .today-container > *,
    .case-card { animation: fadeIn 0.15s ease-out backwards; animation-delay: 0ms; }
    .case-switcher-menu { animation: fadeIn 0.12s ease-out backwards; }
    .case-switcher-menu > * { animation: none; }
    .case-switcher-chev { transition: none; }
    .case-switcher-item::before, .case-switcher-action::before { transition: none; }
    .carry-glow { animation: none; }
    .ghost-scaffold-line { animation: none; }
    .cv-pill:active::after, .cv-quicklink:active::after { animation: none; }
    #chat-live-bubble, .tool-result-content .markdown-body { animation: none; }
    .cv-entry { animation: fadeIn 0.15s ease-out backwards; animation-delay: 0ms; }
    .tool-placeholder, .chat-empty-text, .meds-empty, .cv-empty,
    .case-switcher-empty { animation: none; }
    .tool-form-panel .form-control, .chat-input { transition: none; }
    .cv-botanical--draw path { animation: none; stroke-dashoffset: 0; }

    /* ── Wave 2 fallbacks ── */
    .error-note { animation: fadeIn 0.15s ease-out backwards; }
    .error-note::before { animation: none; transform: scaleY(1); }
    .error-note--leaving { transition: none; }
    .chat-send-btn:not(.chat-stop-btn) { animation: none; }
    .cases-empty--settle,
    .cases-page-container > .cases-empty--settle { animation: fadeIn 0.15s ease-out 0.12s backwards; }
    .cv-spread--inscribe > *,
    .cv-spread--inscribe > :nth-child(n) { animation: fadeIn 0.15s ease-out backwards; animation-delay: 0ms; }
    .cv-headline--closing::after { animation: close-rule-reduced 1.42s ease both; transform: scaleX(1); height: 1px; }
    .cv-badge--stamp { animation: none; }
    .bubble-row--sent { animation: fadeIn 0.15s ease-out backwards; }
    .cv-entry-expanded { animation: fadeIn 0.1s ease-out backwards; }
}
/* ════════════════════════════════════════════════════════════════════════════
   TABULAR FIGURES + THE SEASONAL DATELINE  (2026-07-25)
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Tabular figures ────────────────────────────────────────────────────────
   Measured 2026-07-25, because this silently does nothing if you get it wrong:

     Fraunces  (--ed-display / --ed-body)  NO tabular figures at all. Neither
               font-variant-numeric NOR font-feature-settings:"tnum" moves it —
               "1111" is 69.6px and "0000" is 102.5px either way. Google Fonts'
               Fraunces has no tnum feature to switch on.
     Manrope   (--ed-ui, and therefore body, .markdown-body and .form-control)
               works.
     JetBrains Mono (--ed-mono)  monospaced already; the property is a no-op
               but harmless.

   Two traps: `font-variant-numeric: tabular-nums lining` is INVALID (the keyword
   is `lining-nums`) and an invalid value drops the whole declaration, and asking
   Fraunces for tabular figures is a silent no-op — which is how .live-consult-timer
   below ended up with digits that jitter as they count.

   The rule this implies: PROSE is Fraunces, DATA is Manrope or mono. */

/* Opt-in for numeric data that would otherwise inherit Fraunces. Switches the
   face as well as the feature, because the feature alone cannot save it. */
.ed-figures {
    font-family: var(--ed-ui);
    font-variant-numeric: tabular-nums;
}

/* Rendered markdown tables are where most clinical numbers live — lab panels and
   their reference intervals, dose tables, medication lists.

   The FACE has to change here, not just the feature: .markdown-body is --ed-body
   (Fraunces) at app.css:153, so tabular-nums alone would be another silent no-op.
   This is the prose/data split made concrete — the surrounding note stays serif,
   the table it contains becomes sans so its columns line up on the decimal. */
.markdown-body th,
.markdown-body td {
    font-family: var(--ed-ui);
    font-variant-numeric: tabular-nums;
    font-size: 0.94em;
}

/* Weights, doses, volumes and rates are typed into these. */
.form-control,
.form-select {
    font-variant-numeric: tabular-nums;
}

/* ════════════════════════════════════════════════════════════════════════════
   TOUCH TARGETS  (2026-07-25)

   Measured across 390 / 768 / 1024px: several controls sat at 20–32px tall,
   well under the 44px in WCAG 2.5.5 and the Apple/Material guidance. That
   matters here specifically because the consult-room device is an iPad and the
   vet is often tapping one-handed with a patient in the other.

   Width-based AND pointer-based: a narrow desktop window gets the roomier
   targets (harmless), and so does a large touchscreen, which width alone misses.
   Desktop-with-a-mouse density is untouched.
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px), (pointer: coarse) {

    /* Cases list controls. */
    .cases-scope-btn {
        min-height: 44px;
        padding-inline: 0.9rem;
    }

    .cases-backup-pill {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Legal links — sidebar footer and page footer. Both were 20px tall. These
       are the links to the app's own terms and disclaimers, so a missed tap is
       a real annoyance rather than a cosmetic one. */
    .nav-legal .nav-legal-link,
    .app-footer a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding-inline: 0.15rem;
    }

    /* The footer wraps to two lines on a phone once its links are taller. */
    .app-footer {
        flex-wrap: wrap;
        row-gap: 0;
    }

    /* Buttons. Most already clear 44px; .btn-sm in the users table did not. */
    .btn {
        min-height: 44px;
    }

    /* Checkboxes and radios render at 17x17 — a third of the guidance. Growing the
       control helps, but the real win is the LABEL: clicking it toggles the input,
       so giving it a 44px band makes the whole row the target. */
    .form-check-input {
        width: 1.3rem;
        height: 1.3rem;
        margin-top: 0.1rem;
    }

    .form-check-label {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding-left: 0.15rem;
    }

    /* ── Second pass (2026-07-25) ─────────────────────────────────────────────
       The first pass raised .btn and missed everything else, because this app's
       buttons are mostly NOT .btn — they are .ed-pill, .consult-step,
       .cases-filter-tab and friends. A viewport-wide re-measure found 14 more
       controls between 22px and 43px. Grouped by what they are, not by page,
       so a new use of .ed-pill is covered the day it is written.

       min-height rather than a ::after hit-expander for all of these: several sit
       in wrapping rows, and 44px bands around 27px chips overlap the row above
       and below, which trades a small target for an ambiguous one. */

    /* The house button. Covers --small, --primary, --active and plain. */
    .ed-pill {
        min-height: 44px;
    }

    /* Short labels need the width too: the vaccine quick-picks are "C3", "F3",
       "F4" — two characters, and 39px wide once the height was fixed. */
    .ed-pill--small {
        min-width: 44px;
        justify-content: center;
    }

    /* Copy-to-PMS and Export PDF (QoL 2026-10-04, phone#4): measured 32px and 35px, the
       smallest targets on the screens they end — Copy on every note and timeline entry,
       Export PDF and Share / email on every discharge. Global classes, inline-flex and
       centred already, so there is no scoped rule to fight. */
    .btn-copy-plain,
    .btn-export-pdf {
        min-height: 44px;
    }

    /* .consult-step is NOT here: it lives in a scoped stylesheet, so a global
       rule loses to .consult-step[b-xxxxx] on specificity. Its touch size is set
       in ConsultStepper.razor.css alongside the chip it has to match. */

    .cases-filter-tab,
    .account-menu-trigger,
    .cases-search-input,
    .today-date-input {
        min-height: 44px;
    }

    /* Square controls need the width too — these were 36x36. */
    .btn-theme-toggle,
    .today-date-arrow {
        min-width: 44px;
        min-height: 44px;
    }

    /* "Open case →" — the one control that resumes work, at 23px tall. */
    .cases-active-case-link,
    .today-active-case-link {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
    }

    /* NOT adjusted, deliberately: links inside a sentence ("Verify independently",
       "Practice details"). WCAG 2.5.5 exempts inline targets, and padding them to
       44px would overlap the lines above and below and break the paragraph. */
}

/* The two controls in the update toast were 35px and 22px tall side by side — a
   13px step between neighbours in a pill 40px tall. Equal height at every size,
   and a full target where the pointer is coarse. */
.update-pill-btn,
.update-pill-dismiss,
.fauna-stale-banner-btn {
    min-height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 1024px), (pointer: coarse) {
    .update-pill-btn,
    .update-pill-dismiss,
    .fauna-stale-banner-btn {
        min-height: 44px;
    }

    .update-pill-dismiss {
        min-width: 44px;
    }
}

/* Seasonal hazard marks. Sized in em like every other icon, and tinted so the
   hazard reads as a marginal note rather than competing with the talk-track. */
.today-hazard-icon {
    font-size: 1.05rem;
    color: var(--ed-eucalypt);
    flex-shrink: 0;
    margin-top: 0.15rem;
}

/* Save-time attach prompt. Replaces the "No case open" banner that used to head
   every tool page — the consequence is now stated next to the control it affects,
   once there is something to save. The links matter on a tablet, where the disabled
   button's title tooltip never appears. */
.save-attach {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.save-attach-hint {
    font-size: 0.8rem;
    color: var(--ed-mute);
}

@media (max-width: 640.98px) {
    /* On a phone the hint goes under the button rather than beside it. */
    .save-attach { align-items: flex-start; flex-direction: column; gap: 0.35rem; }
}

/* Wait-state clock. Appears a few seconds in, so most calls never show it — the
   point is to distinguish "working" from "stuck" on the long tail, not to put a
   stopwatch on the vet. --ed-ui because Fraunces has no tabular figures, so a
   ticking count set in it would jitter (see the tabular-figures note above). */
.thinking-elapsed {
    margin-left: 0.5rem;
    font-family: var(--ed-ui);
    font-variant-numeric: tabular-nums;
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    color: var(--ed-mute);
}

.thinking-reassure {
    margin: 0.4rem 0 0;
    max-width: 46ch;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--ed-mute);
}

/* ── End-of-day recharting rows ─────────────────────────────────────────────
   The 7pm job: a dozen patients copied into the PMS one at a time, under time
   pressure, often interrupted. The tick is what lets a vet find their place
   again — done rows recede rather than disappear, so the list never reflows
   under the cursor mid-task. */
.eod-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--ed-hairline);
    flex-wrap: wrap;
    transition: opacity 0.15s;
}

.eod-row--done {
    opacity: 0.55;
}

.eod-tick {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--ed-hairline-strong);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--ed-mute);
    font-family: var(--ed-ui);
    font-size: max(0.76rem, var(--ed-fs-floor, 0rem));
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.eod-tick:hover {
    background: var(--ed-paper-deep);
    color: var(--ed-ink-soft);
}

.eod-tick--done {
    border-color: var(--ed-mint);
    color: var(--ed-mint);
}

@media (max-width: 1024px), (pointer: coarse) {
    .eod-tick { min-height: 44px; padding-inline: 0.9rem; }
}

/* ── Form polish ────────────────────────────────────────────────────────────
   The signalment form is the first thing a vet fills in, so it sets the tone
   for how finished the app feels. */

/* Paired number + unit, e.g. Age. The two halves must split their cell exactly.
   `min-width: 0` on BOTH the group and the input is load-bearing: <input
   type="number"> carries an intrinsic minimum width (browsers reserve room for
   the spinners), and a flex item defaults to min-width:auto, so without this the
   two groups refuse to shrink evenly and the second one wraps to its own line —
   which is what made the Age cell a row taller than its neighbours. */
.ed-form-units {
    display: flex;
    gap: 0.5rem;
}

.ed-form-units .input-group {
    flex: 1 1 0;
    min-width: 0;
}

.ed-form-units .input-group .form-control {
    min-width: 0;
}

/* Two full form groups sharing a row — label, control and help text each.
   Distinct from .ed-form-units, which pairs two halves of ONE field (the y/mo age
   boxes) and must never wrap.

   Use this instead of Bootstrap's .row for a pair sitting among single-column
   fields: .row carries a negative outer margin (--bs-gutter-x * -.5), so it hangs
   proud on both sides of every plain field above and below it. The flex-basis
   wraps the pair to one column when there is not room for two. */
.ed-form-pair {
    display: flex;
    flex-wrap: wrap;
    column-gap: 1rem;
}

    .ed-form-pair > * {
        flex: 1 1 16rem;
        min-width: 0;
    }

/* A unit suffix is a label, not a button. It was carrying the same weight as a
   filled control, so "y" and "mo" read as tappable. Quiet it and let it share
   the input's own border so the pair reads as one field. */
.input-group-text {
    background: transparent;
    border-color: var(--ed-hairline-strong);
    border-left: none;
    color: var(--ed-mute);
    font-family: var(--ed-ui);
    font-size: max(0.78rem, var(--ed-fs-floor, 0rem));
    padding-inline: 0.55rem;
}

.input-group:focus-within .input-group-text {
    border-color: var(--ed-eucalypt);
}

/* The number half must not draw a border between itself and its unit. */
.input-group > .form-control:not(:last-child) {
    border-right: none;
}

/* Field cells in a paired row: keep the control at the same height whatever sits
   under it (the weight-plausibility warning, a validation message), so the row
   below still starts on one line. */
.ed-form > [class*="col-"] {
    display: flex;
    flex-direction: column;
}

.ed-form > [class*="col-"] > .alert {
    margin-top: 0.5rem;
}

/* ── Comfort view ────────────────────────────────────────────────────────────
   data-comfort="on" is the accessibility sibling of data-theme: a persisted
   root attribute, toggled beside the theme button, composing with either theme.
   Built for two audiences at once — a 1280x720 practice screen and older eyes.

   The mechanism is the ONE root font-size rule: everything in this app is sized
   in rem (Bootstrap controls, app.css, and the scoped .razor.css sheets — rem
   resolves against the root regardless of Blazor scope attributes), so a single
   bump scales type, controls, paddings, and icons coherently. 118% keeps a
   720p viewport workable; past ~125% the tool pages start trading scrolling for
   legibility and lose the trade.

   Everything else here is deliberately small: stronger secondary ink (the
   0.75rem muted text this app is fond of is exactly what tired eyes lose
   first), fatter hairlines, honest hit targets, and a focus ring that can be
   found again after looking away. Tokens only — the css-hygiene suite enforces
   that every token re-bound here is re-bound for dark+comfort too. */

html[data-comfort="on"] {
    font-size: 118%;
}

[data-comfort="on"] {
    /* Secondary ink steps toward full ink; hairlines thicken. */
    --ed-ink-soft:        #3f3c30;
    --ed-hairline-strong: rgba(31, 29, 24, 0.4);

    /* The sidebar grows with the type it holds. At the comfort root the two
       longest nav labels ("Owner Discharge", "Patient Summary") overflow a
       250px rail by ~10px and clip without ellipsis — measured by the layout
       audit, comfort-only. */
    --sidebar-width: 272px;

    /* The micro-type floor. 0.8rem at the comfort root is ~15.1px — the smallest
       size an information-bearing word (a dose qualifier, a reviewed/unreviewed
       badge, "N abnormal") may render for the eyes this mode serves. Everything
       authored below the floor meets AT the floor, so the type scale keeps its
       order — nothing small overtakes anything that was already larger. */
    --ed-fs-floor: 0.8rem;
}

/* Honest micro targets. .ed-text-btn is a bare glyph with padding:0 (~12x15px) —
   half the 24px pointer minimum, and what it usually does is destroy something.
   Real padding (not negative-margin hit-area tricks) so the control also gains
   SEPARATION from the high-frequency button it invariably sits beside. */
[data-comfort="on"] .ed-text-btn {
    padding: 0.3rem 0.45rem;
}

[data-theme="dark"][data-comfort="on"] {
    --ed-ink-soft:        #d9d2c1;
    --ed-hairline-strong: rgba(237, 230, 213, 0.38);
}

/* Reading rhythm: a touch more leading for paragraphs and labels. */
[data-comfort="on"] body {
    line-height: 1.55;
}

/* Honest hit targets. 2.6rem here is ~49px after the root bump — above the
   44px floor the pointer-coarse media query already uses. */
[data-comfort="on"] .btn,
[data-comfort="on"] .form-control,
[data-comfort="on"] .form-select {
    min-height: 2.6rem;
}

[data-comfort="on"] .form-check-input {
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.15em;
}

[data-comfort="on"] .ed-pill {
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

/* A focus ring an older keyboard user can actually re-find. :focus-visible
   keeps it off mouse clicks, so the quiet default look is undisturbed. */
[data-comfort="on"] :focus-visible {
    outline: 3px solid var(--ed-eucalypt);
    outline-offset: 2px;
}

/* ── Floating bar clearance (2026-10-17) ─────────────────────────────────────────
   The masthead floats over the top of the scroller (MainLayout.razor.css), so the
   scroller starts at main's top and its padding puts every page's first line below the
   capsule — the 1.1rem the article always had, plus the clearance. Content then scrolls
   up under the glass. scroll-padding-top is the same clearance, so focus, anchors and
   scrollIntoView({block: 'start'}) stop below the bar, not behind it; a sticky header
   stops at the padding edge (Chromium holds sticky boxes off the scroller's padding).

   When a chrome row sits between the bar and the article — the consult stepper, the
   held-audio banner, and in phone mode the update pill, all in main's flow — the
   clearance moves to main instead: those rows sit below the capsule and the article
   below them, as it did before. The capsule is out of main's flow, so main's padding is
   the only thing that can hold the rows down.

   Desktop shell from 641px in either mode; below 641px only in phone mode, where the
   bar is fixed. Below 641px without phone mode the masthead stays in the flow and
   scrolls away with the page, so nothing here applies. */
@media (min-width: 641px) {
    main > article.content {
        padding-top: calc(var(--shell-bar-clear) + 1.1rem);
        scroll-padding-top: var(--shell-bar-clear);
    }

    main:has(> :is(.consult-stepper-wrap, .held-audio-banner)) {
        padding-top: var(--shell-bar-clear);
    }

    main:has(> :is(.consult-stepper-wrap, .held-audio-banner)) > article.content {
        padding-top: 1.1rem;
        scroll-padding-top: 0;
    }
}

@media (max-width: 640.98px) {
    /* The page is the scroller here, so the root carries the scroll padding. */
    :root[data-phone="on"] {
        scroll-padding-top: var(--shell-bar-clear);
    }

    :root[data-phone="on"] main > article.content {
        padding-top: calc(var(--shell-bar-clear) + 1.1rem);
    }

    :root[data-phone="on"] main:has(> :is(.consult-stepper-wrap, .held-audio-banner, .update-pill)) {
        padding-top: var(--shell-bar-clear);
    }

    :root[data-phone="on"] main:has(> :is(.consult-stepper-wrap, .held-audio-banner, .update-pill)) > article.content {
        padding-top: 1.1rem;
    }
}

/* On the sign-in pages the masthead is FLAT (2026-10-17 review). The sign-in card is glass
   over the outback photo, and on a short window or under a phone keyboard it scrolls up
   under the capsule: the card keeps the one blur, the bar keeps its shape on a near-solid
   pane with no backdrop-filter. :root lifts both past the phone sheet's (0,3,0) and (0,3,1). */
:root main:has(.auth-page) > .top-row {
    background: var(--glass-flat);
}

:root main:has(.auth-page) > .top-row::before {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

/* The masthead menus hang from the CAPSULE, not from their chips (2026-10-17). Anchored
   to a chip, "100% + 0.3rem" put a menu's top edge inside the bar (measured: 3.7px of the
   account menu over the capsule) — two blurs on one strip. With the switchers static the
   capsule is their containing block, so 100% is its bottom edge; left/right auto keep
   each menu horizontally where it always opened, at its own chip (the static position),
   and the account menu keeps its right edge. Wherever the capsule floats. */
@media (min-width: 641px) {
    main > .top-row .case-switcher,
    main > .top-row .vet-switcher,
    main > .top-row .account-menu {
        position: static;
    }

    main > .top-row .case-switcher-menu,
    main > .top-row .vet-switcher-menu,
    main > .top-row .account-menu-panel {
        top: calc(100% + 0.5rem);
    }

    /* left: auto on both, or the scoped left: 0 measures from the capsule instead of the chip. */
    main > .top-row .case-switcher-menu,
    main > .top-row .vet-switcher-menu { left: auto; right: auto; }
    main > .top-row .account-menu-panel { right: 0.5rem; }
}

@media (max-width: 640.98px) {
    :root[data-phone="on"] main > .top-row .case-switcher,
    :root[data-phone="on"] main > .top-row .account-menu {
        position: static;
    }

    :root[data-phone="on"] main > .top-row .case-switcher-menu,
    :root[data-phone="on"] main > .top-row .vet-switcher-menu,
    :root[data-phone="on"] main > .top-row .account-menu-panel {
        top: calc(100% + 0.5rem);
    }

    :root[data-phone="on"] main > .top-row .case-switcher-menu { left: auto; }
    :root[data-phone="on"] main > .top-row .account-menu-panel { right: 0; }
}

/* In phone mode at 641px and wider the update pill is a static row too (phone/shell.css). */
@media (min-width: 641px) {
    :root[data-phone="on"] main:has(> .update-pill) {
        padding-top: var(--shell-bar-clear);
    }

    :root[data-phone="on"] main:has(> .update-pill) > article.content {
        padding-top: 1.1rem;
        scroll-padding-top: 0;
    }
}

/* ── App-shell page sizing (desktop) ─────────────────────────────────────────
   With the chrome owning the viewport (MainLayout.razor.css, 2026-07-30), the
   article is the only scroller and its height already accounts for the top row,
   the stepper, and any held-audio banner. The old per-page
   "calc(100dvh - 3.5rem)" budgets ignored everything but the top row, which is
   exactly what left every page with a phantom scrollable band. Pages with
   internal panel scrolling get a hard 100%; document-flow pages get a floor and
   grow naturally inside the article. Mobile (<641px) keeps the original
   document-flow budgets. */
@media (min-width: 641px) {
    .ed-page,
    .auth-page,
    .cases-page,
    .live-consult-page,
    .backup-page,
    .faq-page {
        min-height: 100%;
    }

    /* In the 641–900px band the tool pages use their STACKED layout (the
       max-width:900px block above: column tool-body, visible overflow) and must
       flow naturally inside the scrolling article — a hard height:100% here
       re-fixed their height and cut the background mid-form. */
    .tool-page {
        min-height: 100%;
    }

    .chat-page {
        height: 100%;
        min-height: 0;
    }

    /* The legal footer scrolls with document-flow pages, but on viewport-fit
       pages it added a permanent ~40px scroll band below a page that exactly
       fills the article — wheel input then shifted the whole frame to reveal
       it. Those pages carry the same links in the sidebar's legal block. */
    .content:has(> .tool-page) > .app-footer,
    .content:has(> .chat-page) > .app-footer {
        display: none;
    }
}

/* Two-panel desktop proper: the internal-scroll design needs the fixed height. */
@media (min-width: 901px) {
    .tool-page {
        height: 100%;
        min-height: 0;
    }
}

/* ── Practice connections panel (settings/practice) ──────────────────────────
   The clinic's own list of devices holding a connection. Global rather than
   scoped because the page has no scoped stylesheet of its own. */
.practice-devices {
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.practice-device-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: var(--color-surface-solid);
}

.practice-device-row + .practice-device-row {
    border-top: 1px solid var(--color-green-border);
}

.practice-device-main { min-width: 0; }

.practice-device-label {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Each vet's registration details on Practice details (2026-11-29): one framed group per
   person, the same frame as the device list above. */
.vet-details {
    margin: 0 0 0.9rem;
    padding: 0.75rem 0.85rem 0.85rem;
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-solid);
}

.vet-details-name {
    float: none;
    width: auto;
    margin: 0 0 0.4rem;
    padding: 0;
    font-family: var(--ed-ui);
    font-size: 1rem;
    font-weight: 700;
}

.vet-details-msg {
    margin-left: 0.6rem;
    font-family: var(--ed-ui);
    font-size: 0.88rem;
}

/* ── Prescription (2026-11-29) ───────────────────────────────────────────────
   One framed group per medicine on the saved list; ticked, it opens to the fields the
   list does not hold. Tokens only. */
.rx-legal-list {
    margin: 0.35rem 0;
    padding-left: 1.2rem;
}

.rx-med {
    margin: 0 0 0.75rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-solid);
}

.rx-med--on { border-color: var(--ed-eucalypt); }

.rx-med-pick .form-check-input,
.dsx-basis .form-check-input { margin-top: 0.3rem; }

.rx-med-pick,
.dsx-basis .form-check { min-height: 2.2rem; }

.rx-med-as {
    display: block;
    font-family: var(--ed-ui);
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

.rx-med-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.6rem 0.75rem;
    margin-top: 0.6rem;
}

.rx-med-wide { grid-column: 1 / -1; }

.rx-med-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Consent wording, read in one place (2026-11-29). */
.consent-wording { max-width: 48rem; }

.consent-wording-form {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-green-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-solid);
}

.consent-wording-form ul { margin-bottom: 0; padding-left: 1.2rem; }
.consent-wording-form li + li { margin-top: 0.3rem; }

.dsx-basis { margin: 0; padding: 0; border: 0; }
.dsx-basis legend { float: none; width: auto; font-size: inherit; }
.dsx-here-date { margin: 0.25rem 0 0.5rem 1.6rem; max-width: 18rem; }

@media (max-width: 1024px), (pointer: coarse) {
    .rx-med-pick,
    .dsx-basis .form-check { min-height: 44px; }
    .rx-med-actions .btn { flex: 1 1 12rem; min-height: 44px; }
}

/* ── Cases grouped by day (2026-08-15)───────────────────────────────────────
   Asked for by a vet tester: the list was one long scroll. The heading sticks so
   the day stays named while you read down a busy Tuesday.

   Sticky within article.content, which is the only desktop scroller in the app
   shell — a heading that stuck to the VIEWPORT would float over the masthead. */
.cases-day-heading {
    position: sticky;
    top: var(--shell-sticky-top);   /* under the fixed phone masthead (2026-10-17) */
    z-index: 2;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 1.25rem 0 0.5rem;
    padding: 0.35rem 0;
    font-family: var(--ed-ui);
    font-size: max(0.82rem, var(--ed-fs-floor, 0rem));
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    background: var(--color-surface-solid);
    border-bottom: 1px solid var(--color-green-border);
}

.cases-day-heading:first-of-type { margin-top: 0; }

.cases-day-count {
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    opacity: 0.75;
}

/* Record more against a case that already exists. Sibling of the card anchor, so
   it sits beside Archive in the footer. */
.case-card-addinfo {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.4rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm, 6px);
    font-family: var(--ed-ui);
    font-size: max(0.74rem, var(--ed-fs-floor, 0rem));
    color: var(--color-text-muted);
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.case-card-addinfo:hover {
    background: var(--color-green-bg);
    color: var(--color-text);
}

/* The note-format picker in the SOAP header. Sized to the longest name so the
   header does not reflow when the format changes. */
.soap-format-picker {
    width: auto;
    min-width: 11rem;
}

/* The named-template picker beside it (2026-10-18). Capped, so a long template name
   cannot push the header's buttons off the row. */
.soap-template-picker {
    width: auto;
    min-width: 8rem;
    max-width: 16rem;
}

/* ═══ Phone layout (opt-in, 2026-08-20) ═══════════════════════════════════════
   A WORKFLOW mode, not a screen-size adaptation: toggled from the user menu,
   persisted per browser, applied as data-phone="on" on the root — the third
   sibling of data-theme and data-comfort, composing with both. Everything the
   mode does hangs off this one attribute, in this one section.

   The bar's five destinations live in PhoneChrome.razor; everything else stays
   reachable the way it already is — tools from the case's own rail, admin and
   account from the user menu — which is why the sidebar can go entirely. */

/* The sidebar goes; the bottom bar is the nav now. Not display:none on NavMenu's
   own classes — the whole .sidebar column leaves the flex row, so the article
   takes the full width. */
[data-phone="on"] .sidebar {
    display: none;
}

/* The one rule that makes a fixed bar livable: the scroller clears it, plus the
   home-indicator inset on modern phones. Padding rather than margin so the
   article's scrollbar still reaches the bar's edge.

   5.6rem, not the bar's own 3.4: the raised Record slot pokes ~0.9rem above the
   bar's top edge, and the pages' PRIMARY buttons live at the bottom of their
   panels — the consent gate's "start recording" and Medications' "Save &
   continue" were both measured sitting under the raised circle (audit,
   2026-08-21; re-measured to the pixel — 5.2rem still left a 1px kiss at full
   scroll). Clearance is to the highest painted pixel, not the bar's box. */
[data-phone="on"] article.content {
    padding-bottom: calc(5.6rem + var(--phone-bar-float) + env(safe-area-inset-bottom));
}

[data-phone="on"] .phone-chrome {
    position: fixed;
    /* A floating capsule since 2026-10-17: 12px off the sides, --phone-bar-float off the
       bottom plus the home indicator, which no longer sits inside the bar's padding.
       Its body is the same 0.3rem + slot as when it was docked, so every control parked
       above it moves up by exactly --phone-bar-float, and each of those offsets says so. */
    inset: auto 12px calc(var(--phone-bar-float) + env(safe-area-inset-bottom)) 12px;
    /* Over the article (in-page max is 30) and DELIBERATELY under every modal and
       toast (1000+): a dialog the vet must answer has to cover these tap targets,
       or a thumb aiming at Cases dismisses nothing and navigates mid-question. */
    z-index: 100;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    padding: 0.3rem 0.5rem;
    border-radius: 30px;
    /* Glass; the list scrolls under it. The only blur at the foot of the screen: the
       toasts and the fixed Save rows above it stop short of its top edge. */
    background: var(--glass-tabbar);
    border: 1px solid var(--glass-float-edge);
    box-shadow: inset 0 1px 0 var(--glass-float-light), 0 14px 36px var(--glass-float-shade);
}

/* Hidden outside the mode as belt-and-braces: MainLayout only renders the bar
   when the mode is on, but a stale render during the toggle must not flash a
   bar over a desktop shell. */
.phone-chrome { display: none; }

[data-phone="on"] .phone-chrome-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    /* ~44px thumb target at five slots on a 375px bar. */
    min-width: 3.2rem;
    padding: 0.35rem 0.4rem;
    border-radius: 0.6rem;
    text-decoration: none;
    color: var(--ed-ink-soft);
    font-size: max(0.72rem, var(--ed-fs-floor, 0rem));
}

[data-phone="on"] .phone-chrome-item .ic {
    font-size: 1.25rem;
}

[data-phone="on"] .phone-chrome-item.active {
    color: var(--ed-terracotta);
    /* The current tab is a lit capsule, as in the sidebar. Its tint sits on solid paper,
       not on the bar's glass: over the frosted band's dark end the chestnut label on a
       bare 13% tint measured 3.8:1; on the warm paper under the same tint it is 4.8:1. */
    background: linear-gradient(var(--ed-terracotta-soft), var(--ed-terracotta-soft)), var(--ed-paper-warm);
    box-shadow: inset 0 1px 0 var(--glass-float-light);
}

/* Record: the raised centre slot. Recording is what the phone is FOR in this
   workflow — the tester's own scenario is carrying the consult to the kennel. */
[data-phone="on"] .phone-chrome-item--primary {
    background: var(--ed-eucalypt);
    color: var(--ed-paper);
    margin-top: -0.9rem;
    /* A lit top edge on the raised tile, as on the capsule it rises from. */
    box-shadow: inset 0 1px 0 var(--glass-toast-light), 0 6px 16px var(--glass-float-shade);
}

[data-phone="on"] .phone-chrome-item--primary.active {
    background: var(--ed-terracotta);
    color: var(--ed-paper);
}

/* Tool-page headers: the actions row goes full-width and left-aligned. The
   desktop shape — actions right of the title via margin-left:auto — wraps into
   a ragged right-hanging STACK once four actions and a format picker meet
   375px (the SOAP page was the worst: ~450px of stagger before the note).
   One tidy wrapping row, reading top-left like everything else. */
:root[data-phone="on"] .tool-header-actions {
    margin-left: 0;
    flex: 1 1 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    row-gap: 0.5rem;
}

/* The two intentional horizontal swipe-strips (the stepper, the case rail)
   keep scrolling but drop their scrollbar chrome: on a phone the bar renders
   as a permanent thick grey rule under the strip, reading as a broken border
   on every single page. Swiping is the phone gesture; the bar taught nothing. */
/* The tool rail used to be in this pair; it stopped scrolling when phone mode
   made it a grid (2026-08-23, see the rail section below). */
:root[data-phone="on"] .consult-stepper-wrap {
    scrollbar-width: none;
}

:root[data-phone="on"] .consult-stepper-wrap::-webkit-scrollbar {
    display: none;
}

/* The masthead on a phone row. Measured before writing (375px, no case open):
   the vet switcher's unset label ("Who's using this?") is 169px of non-shrinking
   content, which starved .case-switcher — flex-basis auto over a width:100%
   trigger computes to an intrinsic 0 — so the patient chip collapsed to nothing
   and its trigger's padding PAINTED OVER the vet switcher beside it. The fix is
   a floor for one and a ceiling with real ellipsis for the other; ellipsis must
   sit on the text SPANS, because a flex container clips but never elides. */
[data-phone="on"] .case-switcher {
    flex: 1 1 8rem;
    min-width: 6.5rem;
}

[data-phone="on"] .case-switcher-trigger .case-switcher-name,
[data-phone="on"] .case-switcher-trigger .case-switcher-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* :root on these three, not decoration: the vet switcher is styled in its own
   SCOPED sheet, which loads after this file and wins every specificity tie —
   the bare-attribute form of these rules computed to nothing (measured). The
   extra pseudo-class outranks .vet-switcher-trigger[b-xxx] cleanly. */
:root[data-phone="on"] .vet-switcher {
    min-width: 0;
    flex: 0 1 auto;
}

:root[data-phone="on"] .vet-switcher-trigger {
    max-width: 34vw;
    min-width: 0;
}

:root[data-phone="on"] .vet-switcher-trigger .vet-switcher-name {
    /* min-width: 0 is what makes the ellipsis REAL. A flex child's min-width
       defaults to auto, so without it the span refuses to shrink below its text
       and the overflow paints straight over whatever sits to the right — which
       is exactly the overlap the owner photographed (2026-08-21). */
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* In phone mode the comfort and theme buttons leave the masthead for the account
   menu's Display section (MainLayout renders them there when the mode is on).
   Even with ellipses working, chip + chip + three buttons + avatar cannot share
   a 375px row once comfort view inflates the type — the photographed overlap.
   Three things fit; five only ever nearly did.

   :has(.account-menu) scopes this to the SIGNED-IN masthead (sweep, 2026-08-21):
   the account menu is the only place the relocated toggles live, and it does not
   exist on the login screen — hiding unconditionally left a signed-out phone
   with no theme control at all. The degradation is chosen too: a browser
   without :has() keeps the buttons visible, which crowds the row but loses
   nothing — the failure that removes a control outranks the one that squeezes. */
:root[data-phone="on"] .top-row-controls:has(.account-menu) .btn-theme-toggle {
    display: none;
}

/* Everything else fixed to the bottom edge steps over the bar (sweep,
   2026-08-21): the save toast fires after EVERY save and, at z 1090 over the
   bar's 100, was covering the Notes and Meds slots each time. Same clearance the
   article uses, plus breathing room. The update pill sat on Record too; lifted
   here it then sat on the fixed Save rows, so it lives under the masthead in
   phone mode instead (css/phone/shell.css, QoL 2026-10-04 phone#14). */
:root[data-phone="on"] .save-toast,
:root[data-phone="on"] .app-toast {
    bottom: calc(4.4rem + var(--phone-bar-float) + env(safe-area-inset-bottom));
}

/* The foot stack's one phone rule (2026-10-17 review): the two toasts share this row, so
   while an app toast is up the save toast takes the row above it. */
:root[data-phone="on"] .save-toast {
    bottom: calc(4.4rem + var(--phone-bar-float) + env(safe-area-inset-bottom) + var(--foot-app, 0px));
}

/* The toast's Undo is a thumb tall (text #16); the pill grows to hold it. */
:root[data-phone="on"] .save-toast-action {
    min-height: 44px;
    padding-inline: 0.6rem;
}

/* And the controls that remain never give up width — an overlong chip label
   must cost its own ellipsis, not the avatar's hit target. */
:root[data-phone="on"] .top-row-controls {
    flex-shrink: 0;
}

/* ── Phone mode: the case screen's tool rail becomes a grid ──────────────────
   Measured 2026-08-23: the ≤900px strip is 2,013px of buttons in a 317px
   viewport with its scrollbar hidden — one visible action out of nine, and the
   half-visible next chip is the only affordance. That trade was chosen for the
   RESPONSIVE tier, where the sidebar still exists; in phone mode the sidebar is
   gone and these tiles are the only tool entries there are, so reachability
   outranks the vertical cost the strip was avoiding. Two columns of wrapping
   tiles: every action on screen at once, ~5 rows for the stock nine. */
:root[data-phone="on"] .cv-toolrail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    overflow-x: visible;
}

:root[data-phone="on"] .cv-quicklink {
    min-height: 44px;
    display: flex;
    align-items: center;
    white-space: normal;
    border-radius: 14px;
    padding: 0.45rem 0.7rem;
}

/* Recording keeps the visual weight it has everywhere else: full row, centred. */
:root[data-phone="on"] .cv-quicklink--primary {
    grid-column: 1 / -1;
    justify-content: center;
}

/* The desk tools' phone entries (Patient Summary, Referral, Certificates, PMS
   export). With the sidebar hidden they were reachable by typed URL
   only; on desktop the sidebar already lists them, so there they stay out of the
   rail. Hidden via :not rather than a bare display:none — the mode's own
   .cv-quicklink display rule above outranks a single class, so a bare rule would
   lose exactly when it mattered. */
:root:not([data-phone="on"]) .cv-quicklink--phone-extra {
    display: none;
}

/* ── Phone mode: the Review screen's actions ride above the bottom chrome ────
   Measured 2026-08-23: with a real 14-minute consult the pre-save row sat
   1,563px down a 1,810px page — two full screens of scrolling between Stop and
   Save. Fixed above the bottom bar instead: stop, skim, save, all thumb-only.
   4.9rem clears the bar's raised Record slot (bar body 3.4rem + the slot's
   0.9rem poke + breathing room); z 60 sits over page content and under the bar
   (100) and every overlay (1000+). */
:root[data-phone="on"] .live-consult-review-actions {
    position: fixed;
    left: 0.6rem;
    right: 0.6rem;
    bottom: calc(4.9rem + var(--phone-bar-float) + env(safe-area-inset-bottom));
    z-index: 60;
    flex-wrap: nowrap;
    padding: 0.5rem;
    background: var(--ed-paper);
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(31, 27, 22, 0.18);
}

/* Discard demoted beside the fixed Save: stacked same-size above it (the flow
   layout), a mis-tap is a lost consult. Content width, quieter type; Save keeps
   its flex-grow and stays the button a thumb falls on. */
:root[data-phone="on"] .live-consult-review-actions .btn-outline-danger {
    flex: 0 0 auto;
    font-size: 0.85rem;
    padding: 0.45rem 0.7rem;
}

/* Save keeps inside its bar (W4, QoL 2026-10-04). Measured at 375x812: the bar ends
   at x=364.8 and "Save consult summary" at btn-lg size ran on to x=375.4, flush with
   the screen. Every .btn takes min-width: fit-content, so beside Discard it could not
   give up a pixel, and the nowrap row overflowed instead. A zero basis and no minimum
   let it take what Discard leaves; at 1.05rem the label stays one line down to a
   360 px phone, and wraps inside the bar rather than leave it on a narrower one. */
:root[data-phone="on"] .live-consult-review-actions .btn-success {
    flex: 1 1 0;
    min-width: 0;
    font-size: 1.05rem;
    line-height: 1.2;
    white-space: normal;
}

/* Clearance so the retention checkbox and the save-blocked reason — the last
   things in flow — cannot hide under the fixed row. */
:root[data-phone="on"] .live-consult-review {
    padding-bottom: 5.5rem;
}

/* ── Phone mode: wording that depends on which end you are holding ───────────
   A label written from the PC's side reads as nonsense ON the phone. Pair of
   visibility utilities, higher-specificity phone rules so the swap always wins
   inside the mode. */
.phone-mode-only {
    display: none;
}

:root[data-phone="on"] .phone-mode-only {
    display: inline;
}

:root[data-phone="on"] .desktop-mode-only {
    display: none;
}

/* ── Phone mode: the audit's under-thumb-size cluster ────────────────────────
   Cases footer pills measured 24-25px tall, timeline entry pills 25-32px,
   Today's Prep expander 24px. Heights only — type and desktop layout untouched.
   44px, not the 40px this first set (QoL 2026-10-04, phone#6): at (0,3,0) it beat
   CaseView's own 44px coarse floor, so the phone was the one touch screen whose
   timeline pills fell short. */
:root[data-phone="on"] .case-card-addinfo,
:root[data-phone="on"] .case-card-archive,
:root[data-phone="on"] .cv-pill--small,
:root[data-phone="on"] .ed-text-btn {
    min-height: 44px;
    align-items: center;
}

/* The SOAP source picker's ticks render 13px square; the 58px row label is the
   real target, but a 13px box does not look tappable standing in a kennel. */
:root[data-phone="on"] .note-sources input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
}

/* ── Drop target for lab PDFs (js/drop-zone.js) ────────────────────────────
   The zone is the whole entry panel, so a report dragged anywhere near the
   box lands; the dashed outline appears only while a drag is over it. */
.lab-drop-zone { border-radius: 10px; transition: outline-color 120ms ease-out, background-color 120ms ease-out; outline: 2px dashed transparent; outline-offset: 4px; }
.lab-drop-zone.is-dragover { outline-color: var(--ed-eucalypt); background: var(--ed-paper-warm); }

/* Drug Book: approve a whole drug (confirm inline; Bootstrap JS is not loaded). */
.drugbook-approve-drug { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.5rem 0 1rem; }
.drugbook-approve-drug > span { flex: 1 1 100%; color: var(--ed-ink-soft); }

/* ── Glass surfaces (Zoolytic) ─────────────────────────────────────────────────
   One recipe, tokens above: translucent fill, blur behind, a 1px edge, and a lit
   top line. Each rule below only says which glass and where. */
.auth-card {
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
}

/* The floating family (2026-10-17): blur + frost, one token each, off together in every
   solid fallback. The phone bar can carry its own filter: it holds no fixed box. */
[data-phone="on"] .phone-chrome {
    -webkit-backdrop-filter: var(--glass-float-filter);
    backdrop-filter: var(--glass-float-filter);
}

.save-toast,
.app-toast {
    -webkit-backdrop-filter: var(--glass-toast-filter);
    backdrop-filter: var(--glass-toast-filter);
}

/* The update pill is FLAT dark glass (2026-10-17 review): solid sidebar green, no blur.
   It shares the desktop foot with the app toast and the recording capsule, both blurred;
   flat, it can never be the second blur in an overlap, and its cream words never depend
   on what is behind it. */
.update-pill {
    background: var(--color-sidebar-to);
    border-color: var(--glass-edge-dark);
    color: var(--zl-mark-ink-on-dark);
    box-shadow: inset 0 1px 0 var(--glass-edge-dark), 0 10px 30px var(--glass-shade);
}
.update-pill-btn {
    background: var(--zl-mark-ink-on-dark);
    color: var(--color-sidebar-to);
}
.update-pill-btn:hover:not(:disabled) { background: var(--zl-mark-accent-on-dark); }
.update-pill-dismiss { color: var(--zl-mark-ink-on-dark); }
.update-pill-dismiss:hover { color: var(--zl-mark-ink-on-dark); background: var(--glass-edge-dark); }

/* Controls pick up the lit top edge: the primary button reads as a pressed-glass
   capsule rather than a flat slab. */
.btn-primary {
    box-shadow: inset 0 1px 0 var(--glass-edge), var(--shadow-accent);
}

/* ── Floating recording capsule (LiveConsultIndicator) ──────────────────────────
   Dark glass at the foot of every page but the consult's own, while the microphone
   is open. Under the toasts and the update pill (1080/1090) and every modal, over the
   page. Off-phone only: phone mode's bottom bar carries the live clock, so there the
   capsule hides and the top-bar chip stays; everywhere else the capsule replaces it.

   990, just under the overlay band (1000+), and over the chrome (top-row 40). It was
   1070 until the 2026-10-15 sweep (shell-brand-pwa#15): that is ABOVE the 1050 scrims
   of ConsultStarter's "Existing patient record found" chooser and FilmMeasure, so
   Return stayed bright and tappable mid-question, and above .app-toast (1000) and the
   crash strip — not under them, as this note always said. */
.live-capsule {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    z-index: 990;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    max-width: calc(100vw - 2rem);
    padding: 0.4rem 0.4rem 0.4rem 1.1rem;
    border-radius: 999px;
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
    background: var(--glass-dark);
    border: 1px solid var(--glass-edge-dark);
    box-shadow: inset 0 1px 0 var(--glass-edge-dark), 0 12px 32px var(--glass-shade);
    color: var(--zl-mark-ink-on-dark);
    font-family: var(--ed-ui);
    font-size: 0.9rem;
    white-space: nowrap;
}

.live-capsule-dot {
    position: relative;
    flex-shrink: 0;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--ed-rust);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ed-rust) 30%, transparent);
}

/* The pulse is a ring that grows and fades (2026-10-17 review): transform and opacity
   only, so the compositor runs it without repainting the blurred capsule every frame,
   which the animated box-shadow did for as long as the microphone was open. */
.live-capsule-dot::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--ed-rust) 45%, transparent);
    animation: live-capsule-pulse 1.6s ease-out infinite;
    pointer-events: none;
}

.live-capsule--paused .live-capsule-dot {
    background: var(--ed-saffron);
    box-shadow: none;
}

/* The microphone has stopped (sweep 2026-10-15, shell-brand-pwa#2): the dot holds still,
   because motion is what says "listening", and the alert line takes the name's place. */
.live-capsule--failed .live-capsule-dot {
    background: var(--ed-rust);
    box-shadow: none;
}

.live-capsule--paused .live-capsule-dot::after,
.live-capsule--failed .live-capsule-dot::after {
    animation: none;
    opacity: 0;
}

.live-capsule-alert { font-weight: 700; }

.live-capsule-time {
    font-size: 1.05rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.live-capsule-name {
    min-width: 0;
    max-width: 14rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-capsule-btn {
    flex-shrink: 0;
    min-height: 44px;
    padding: 0 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--glass-edge-dark);
    background: transparent;
    color: var(--zl-mark-ink-on-dark);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.live-capsule-btn:hover { background: var(--glass-edge-dark); }

.live-capsule-btn--primary {
    border-color: transparent;
    background: var(--zl-mark-ink-on-dark);
    color: var(--color-sidebar-to);
}

.live-capsule-btn--primary:hover { background: var(--zl-mark-accent-on-dark); }

/* Keyboard focus on the dark glass (2026-10-15 sweep). The global ring is chestnut
   over a paper gap, made for cream: on this glass chestnut measured 1.39:1, and on
   the cream Refresh / Return buttons the paper gap merged into the fill (1.10:1), so
   focus read only as the button swelling 2px. The on-dark gold ring (3.66:1 on the
   glass over cream) over a dark gap parts the ring from a cream fill too. (0,2,0)
   out-ranks button:focus-visible. */
.update-pill :focus-visible,
.live-capsule :focus-visible,
.save-toast :focus-visible {
    outline: 3px solid var(--zl-mark-accent-on-dark);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--color-sidebar-to);
}

@keyframes live-capsule-pulse {
    from { transform: scale(1);   opacity: 0.9; }
    to   { transform: scale(2.6); opacity: 0; }
}

/* Reduced motion: no ring at all; the dot and its still halo say "recording". */
@media (prefers-reduced-motion: reduce) {
    .live-capsule-dot::after { animation: none; opacity: 0; }
}

:root[data-phone="on"] .live-capsule:not(.live-capsule--asking) { display: none; }

/* The attention question and the automatic pause are said on a phone too (sweep
   2026-11-29): above the floating bottom bar, and free to wrap on a narrow screen. */
:root[data-phone="on"] .live-capsule--asking {
    bottom: calc(4.9rem + var(--phone-bar-float) + env(safe-area-inset-bottom));
    flex-wrap: wrap;
    justify-content: center;
    white-space: normal;
    border-radius: 1.25rem;
    padding: 0.5rem 0.75rem;
}

:root:not([data-phone="on"]) .live-chip--recording,
:root:not([data-phone="on"]) .live-chip--paused { display: none; }

/* ── The foot stack (2026-10-17 review) ─────────────────────────────────────────
   Four things live at the foot of a desktop screen: the recording capsule, the update
   pill, the app toast ("Copied to clipboard") and the save toast. They used to be placed
   with fixed offsets per width, and every new size broke one — the pill's 44px buttons
   below 1024px, its long "after this consult" line wrapping, the save toast's full-width
   row below 640px landing on the app toast. Now they STACK, in one order at every width:
     capsule (when recording) → pill → app toast → save toast,
   each starting above everything under it. --foot-base is where the pill sits (the
   capsule's top when recording); --foot-pill is the pill's MEASURED height (app.js
   vhWatchFootPill sets --foot-pill-h; 4.75rem until it has) plus a gap; --foot-app is
   the app toast's row, which is one line by construction (nowrap, ellipsis). So no two of
   them can share a row, whatever the width or the pill's wording; the pill is flat, so
   even an overlap could not put glass on glass.

   The capsule joined the stack on 2026-10-15 (sweep, shell-brand-pwa#1 and #15): centred
   at 1.5rem the app toast sat exactly under it and was never seen. */
:root:not([data-phone="on"]) body:has(.live-capsule) {
    --foot-base: 5.25rem;
}

:root:not([data-phone="on"]) body:has(.update-pill) {
    --foot-pill: calc(var(--foot-pill-h, 4.75rem) + 0.5rem);
}

:root body:has(.app-toast) {
    --foot-app: 3.1rem;
}

:root:not([data-phone="on"]) .update-pill {
    bottom: var(--foot-base, 1.25rem);
}

:root:not([data-phone="on"]) .app-toast {
    bottom: calc(var(--foot-base, 1.25rem) + var(--foot-pill, 0px) + 0.25rem);
}

:root:not([data-phone="on"]) .save-toast {
    bottom: calc(var(--foot-base, 1.25rem) + var(--foot-pill, 0px) + var(--foot-app, 0px) + 0.25rem);
}

/* And the page keeps the capsule's band clear, as [data-phone] article.content's padding
   does of the phone bar (sweep 2026-10-15 shell-brand-pwa#15; review of the 2026-10-15
   fixes, finding 9 — the two found it separately and this is the one copy): it sits over the
   centre of the main column's foot, so the Medications page's stuck "Save & continue" was
   under it at 1024, 1280 and 1366 wide, and so was the last line of any page scrolled to its
   end. The band is 1.25rem + ~3.7rem of capsule; 5.5rem leaves a little air.
   On a document page the padding ends the scroll above it; a tool page (height: 100% from 901px)
   ends above it, so its own scroller and the bar stuck to that scroller's foot do too; and from
   641 to 900px, where the article is the list's scroller, Chromium holds a sticky bar off the
   scroller's padding edge — tools.css raises Medications' own scroll padding to match. The
   scroll padding keeps a field the vet Tabs into from landing behind the capsule. */
:root:not([data-phone="on"]) body:has(.live-capsule) article.content {
    padding-bottom: 5.5rem;
    scroll-padding-bottom: 5.5rem;
}

/* ── Deposit on save (micro-rewards, 2026-10-17) ─────────────────────────────
   The July deposit trace, restored and retargeted at the masthead patient chip
   (faunaDepositTrace, app.js; fired by CaseSwitcher from MotionCueService, so only after a
   CONFIRMED save to the chip's own patient). The arc is two nested transforms with two
   easings — x accelerating into the chip, y rising early — so it never touches layout.
   The chip inhales once (1.045, 400ms) and a 2px underline draws under the name (280ms),
   holds (600ms) and fades (500ms): never persistent, nothing accumulates. Timings and
   curves are the owner-approved mockup's. */
.fauna-deposit-x {
    position: fixed;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 3000;
    animation: fauna-deposit-x 420ms cubic-bezier(0.55, 0.05, 0.85, 0.35) forwards;
}

.fauna-deposit-dot {
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--ed-eucalypt);
    /* A paper ring so the dot reads over a eucalypt button or the chip's own border. */
    box-shadow: 0 0 0 2px var(--ed-paper-warm);
    animation: fauna-deposit-y 420ms cubic-bezier(0.15, 0.65, 0.35, 1) forwards;
}

@keyframes fauna-deposit-x {
    from { transform: translateX(var(--dep-x0, 0)); }
    to   { transform: translateX(var(--dep-x1, 0)); }
}

@keyframes fauna-deposit-y {
    0%   { transform: translateY(var(--dep-y0, 0)); opacity: 1; }
    88%  { opacity: 1; }
    100% { transform: translateY(var(--dep-y1, 0)); opacity: 0; }
}

/* Positioned only while it acknowledges: the underline below is placed from it. */
.case-switcher-trigger--absorb {
    position: relative;
    animation: case-switcher-inhale 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.case-switcher-trigger--absorb::after {
    content: "";
    position: absolute;
    left: var(--deposit-ul-left, 0);
    top: var(--deposit-ul-top, 100%);
    width: var(--deposit-ul-width, 100%);
    height: 2px;
    border-radius: 2px;
    background: var(--ed-eucalypt);
    pointer-events: none;
    transform: scaleX(0);
    transform-origin: left center;
    animation: case-switcher-underline 1380ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.case-switcher-trigger--exhale {
    animation: case-switcher-exhale 600ms ease-in-out;
}

@keyframes case-switcher-inhale {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.045); }
    100% { transform: scale(1); }
}

/* draw 0-280ms, hold to 880ms, fade out by 1380ms */
@keyframes case-switcher-underline {
    0%   { transform: scaleX(0); opacity: 1; }
    20%  { transform: scaleX(1); opacity: 1; }
    64%  { transform: scaleX(1); opacity: 1; }
    100% { transform: scaleX(1); opacity: 0; }
}

@keyframes case-switcher-exhale {
    0%   { opacity: 1; }
    40%  { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Reduced motion: no dot and no inhale or underline — one gentle opacity exhale on the
   chip. faunaDepositTrace already takes this path under the media query; these rules are
   the backstop for a dot or class already in flight when the setting changes. */
@media (prefers-reduced-motion: reduce) {
    .fauna-deposit-x,
    .fauna-deposit-dot { display: none; }
    .case-switcher-trigger--absorb { animation: case-switcher-exhale 600ms ease-in-out; }
    .case-switcher-trigger--absorb::after { content: none; animation: none; }
}

/* ── Clinic handover (2026-10-18) ─────────────────────────────────────────────
   The vet-switch cards and one-tap send results, the case page's Hand over row,
   the Collect list and Clinic devices. Tokens only. The cards are a SOLID panel
   (no blur): they sit under the floating glass masthead, and glass on glass is the
   one thing the 2026-10-17 rules forbid; solid also needs nothing for lite or dark.
   Fixed top right UNDER the masthead (z 35, below the top row's 40, so its open
   menus cover a card) and well clear of the foot stack (capsule, update pill, app
   toast, save toast), which owns the bottom of the screen. */
.clinic-moments {
    position: fixed;
    top: 4.6rem;
    right: 1rem;
    z-index: 35;
    width: min(24rem, calc(100vw - 2rem));
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.clinic-moment {
    background: var(--color-surface-solid);
    color: var(--ed-ink);
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 12px;
    box-shadow: 0 6px 20px var(--glass-shade);
    padding: 0.7rem 0.85rem;
    font-family: var(--ed-ui);
    font-size: 0.9rem;
}
.clinic-moment--warn { border-color: var(--ed-terracotta); }
.clinic-moment-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.45rem;
}
[data-phone="on"] .clinic-moments {
    top: 4.25rem;
    left: 16px;
    right: 16px;
    width: auto;
}

/* Over a recording on the consult page (sweep 2026-10-18, #18) the cards covered the
   patient line and its timer on a phone: they fold to one small pill at the top right,
   beside the short "Recording" status, and open over the page only on a tap. The pill
   is markup only there; elsewhere it is never shown. */
.clinic-moments-pill { display: none; }
[data-phone="on"] .clinic-moments--capturing {
    left: auto;
    align-items: flex-end;
    max-width: calc(100vw - 32px);
}
[data-phone="on"] .clinic-moments--capturing.is-open { left: 16px; align-items: stretch; }
[data-phone="on"] .clinic-moments--capturing.is-open .clinic-moments-pill { align-self: flex-end; }
[data-phone="on"] .clinic-moments--capturing:not(.is-open) .clinic-moment { display: none; }
[data-phone="on"] .clinic-moments--capturing .clinic-moments-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;   /* a 44px target */
    padding: 0 0.85rem;
    border: 1px solid var(--ed-hairline-strong);
    border-radius: 999px;
    background: var(--color-surface-solid);
    color: var(--ed-ink);
    box-shadow: 0 4px 14px var(--glass-shade);
    font-family: var(--ed-ui);
    font-size: 0.85rem;
    white-space: nowrap;
}

.clinic-handover-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    margin-top: 0.6rem;
    font-family: var(--ed-ui);
    font-size: 0.875rem;
}
.clinic-handover-status { color: var(--ed-ink-soft); min-width: 0; }
.clinic-handover-error { flex-basis: 100%; }

.clinic-collect-list,
.clinic-members {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}
.clinic-collect-item,
.clinic-member {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--ed-hairline);
}
.clinic-collect-main { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.clinic-member-name { font-weight: 600; overflow-wrap: anywhere; }
.clinic-member-tag {
    font-size: 0.8rem;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    background: var(--ed-terracotta-soft);
    color: var(--ed-ink);
}
.clinic-member-remove { margin-left: auto; }
.clinic-card {
    border: 1px solid var(--ed-hairline);
    border-radius: 10px;
    padding: 0.8rem 0.9rem;
    margin-bottom: 1rem;
    background: var(--color-surface-solid);
}
.clinic-card--holding { border-color: var(--ed-terracotta); }
.clinic-confirm {
    border: 1px solid var(--ed-terracotta);
    border-radius: 10px;
    padding: 0.7rem 0.8rem;
}
.clinic-danger { margin-top: 1.25rem; }
/* Phone: .tool-body--single centres its panel vertically; a short Collect list sat
   mid-screen under an empty band. The clinic pages read top-down like a list. */
[data-phone="on"] .tool-body--single > .clinic-panel { margin-bottom: auto; }