/* Accu-Med Billing Solutions: the one stylesheet. Calm by design: a pale ground, flat white sheets edged by hairlines
 * (no shadow but under what floats), text at a regular weight with only titles and headings stressed; the accent marks
 * the current section and the main action, the signal what needs attention.
 *
 * SECTIONS
 *
 *   1. Tokens        every colour, size, radius and shadow, named once
 *   2. Base          the reset, type, links, headings
 *   3. Masthead      the bar across the top: the sections, search, the account
 *   4. Page          main, the page head, panels, columns, facts
 *   5. Forms         labels, inputs, fields and rows, fieldsets, checks
 *   6. Buttons       buttons, chips, choices, tabs
 *   7. Tables        the grid, its variants, the empty state
 *   8. Tags and messages
 *   9. Components    everything that is one thing used in several places
 *  10. Pages        what serves one page only, grouped by page; the sign-in page last
 *  11. Utilities     the small set of single-purpose classes, listed there
 *  12. Print
 *
 * RULES FOR CHANGING THIS FILE
 *
 * - No `style=` attribute in a template; styles go here, under a component or in section 11 (except a colour computed from data).
 * - Spacing comes from the scale in section 1 (--s1 .. --s5) and the gaps.
 * - Every control is --control tall and every corner --r or --r-lg.
 * - A component styles its own children in one place; a page does not restyle it.
 * - A rule that serves one page only goes in section 10, under that page.
 * - Colour is a token. No hex value below section 1.
 * - Three widths change the layout: 820, 1100 and 1420 pixels. A new media query uses one of them. The menu down the
 *   left alone has a fourth, 1520: open from 1521, a strip of icons from 1421.
 * - A section's pages are .section-nav and a page's lists are .tabs; both are drawn by the one set of tab rules. Narrowing a list is a joined button row.
 */

/* === 1. Tokens ========================================================= */

:root {
  /* Ink and paper, each with a little of the accent's blue in it. */
  --ink: #13222c;
  --ink-soft: #33475a;
  /* The quiet ink, for captions, column headings and notes: a step back from the text, yet 7.1 on the page and 7.7 on
     white. */
  --ink-faint: #425566;
  --rule: #dee6ec;
  --rule-soft: #e9f0f4;
  --rule-strong: #becdd6;
  /* The edge of a field, a drop zone or a switch, which is what shows the control is there: 3.3 on white, the page and
     the required sand, above the 3 WCAG 1.4.11 asks of a control's edge. */
  --field-line: #768b97;
  --paper: #f6f8fa;
  --panel: #ffffff;
  --raised: #f6f9fc;
  /* Every second row of a grid: a pale sand, the warm complement of the accent's blue. A field that must be filled in is drawn on the same sand. */
  --row-alt: #fbf8f3;
  --required-wash: var(--row-alt);
  --zebra: #f8fbfe;
  /* Behind a list's column headings: the sheet itself; a hairline under them sets them apart. */
  --grid-head: var(--panel);

  /* The accent, a sea blue, with a deep, a wash and a line. White reads on it at 6.1. */
  --accent: #006994;
  --accent-deep: #054e6e;
  --accent-wash: #e4f3fc;
  --accent-line: #b2d7ee;
  /* The palest sea blue, for a Messages row with something unread. */
  --unread-wash: #f2f9fd;
  /* The sign-in pane and the main button: the accent at its brightest and darkest, a sea-green glow, and gold, the warm colour across from the blue, for the line under the name. */
  --accent-bright: #1184b7;
  --accent-night: #001e2e;
  --glow: rgba(64, 196, 196, 0.36);
  --gold: #f2b84b;
  /* What was found in a file's text, marked as a highlighter would. */
  --mark: rgba(242, 184, 75, 0.38);
  /* The main button lies flat on the page; only the sign-in pane's and a button floating over a section lift. */
  --primary-lift: 0 6px 16px rgba(5, 78, 110, 0.28);
  /* Home's band across the top: the deep accent to its night, as the sign-in pane, with light words and marks on it. */
  --hero-deep: #054e6e;
  --hero-night: #001e2e;
  --on-hero-soft: rgba(255, 255, 255, 0.78);
  --hero-rule: rgba(255, 255, 255, 0.16);
  --hero-track: rgba(255, 255, 255, 0.34);
  --hero-foot: rgba(0, 12, 20, 0.22);
  --hero-dots: rgba(255, 255, 255, 0.12);
  --hero-glow: rgba(17, 132, 183, 0.5);
  /* A second series drawn beside the accent. */
  --accent-mid: #75b0d3;
  /* Text and marks drawn on the accent. */
  --on-accent: #fff;
  /* A plain white ground, and the black of a scanned code. */
  --white: #fff;
  --black: #000;

  --signal: #c2491d;
  --signal-deep: #9c3814;
  --signal-wash: #fbeee9;
  --signal-line: #efc9bd;
  --signal-wash-deep: #f6dfd6;

  /* Standing for good, a warning and a fault. */
  --warn: #8a5a00;
  --warn-wash: #fdf3e0;
  --warn-line: #e6d3a8;
  --wanted-line: #d8c58a;
  --bad: #9b2226;
  --bad-wash: #fbeceb;
  /* Behind a field the last save refused: paler than a message's wash. */
  --invalid-wash: #fdf4f3;
  --bad-line: #e6bcbb;
  --good: #1f6b3f;
  --good-wash: #eaf4ee;
  --good-line: #bcd9c7;
  /* Sent, and with somebody else: the one indigo, clear of the sea blue accent. */
  --wait: #5a54a0;
  --wait-wash: #ededff;
  --wait-line: #cdcdf8;
  /* Entered or altered by the office over the ministry's lists: one magenta, clear of every other colour. */
  --office: #a81f73;
  --office-wash: #fbe9f3;

  /* Geist, a face drawn for screens: flat stroke ends, open letters and even spacing keep small text crisp. Geist Mono,
     its mono cut, draws a health number, a code or a batch's name the same on every machine. One variable file holds
     every weight; served from public/fonts (SIL Open Font License); nothing is fetched from a font host. */
  --sans: Geist, "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  /* The name, on the sign-in page and in the bar: Sora, from the same folder under the same licence. */
  --display: Sora, Geist, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  /* The weights. Running text is Regular; what is pressed or names a state (a button, a tab, a tag, a count, a column's
     heading, a field's label) is Medium; titles, headings and anything stressed are Semibold, never Bold, so a page
     reads light. Every rule below takes one of these. */
  --w-light: 400;
  --w-text: 400;
  --w-mid: 500;
  --w-strong: 600;

  /* The spacing scale. Everything is one of these, or a gap below. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  /* Between panels and sections; inside a row of fields. */
  --gap: 14px;
  --gap-fields: 10px;
  /* Between one section of a page and the next. */
  --gap-section: 30px;

  --r: 6px;
  --r-lg: 10px;
  /* A pill (a tag of words, the page's word), a count beside a name, a chip, a switch's track and the card's outline. */
  --r-pill: 999px;
  --r-count: 9px;
  --r-chip: 12px;
  --r-round: 10px;
  /* Every button, input and select is this tall: a line of text, its padding and its border. A row of joined buttons takes it too. */
  --control: 36px;
  /* How tall the bar across the top is while its sections fit on one row. */
  --bar: 56px;
  /* How tall the band above the bar is on a copy that holds sample data. */
  --sample-band: 28px;
  /* How tall the portal's sections are along the foot of a phone's screen. */
  --phone-tabs: 66px;

  /* Elevation. A panel sits on the paper; a menu floats over it. */
  /* The save bar that follows the page, a little see-through. */
  --veil: rgba(244, 246, 249, 0.94);
  /* The dim behind a dialog, and the lighter one behind the claim drawer. */
  --scrim: rgba(9, 22, 38, 0.44);
  --scrim-soft: rgba(9, 22, 38, 0.18);
  /* Which copy of the mark is drawn, and the tile under the office's own logo: none on the white bar, white on the dark one. */
  --mark-on-light: block;
  --mark-on-dark: none;
  --logo-tile: transparent;
  /* A section of a page lies flat on the paper, its hairline edge enough: no shadow under a sheet or the page's head. */
  --lift: none;
  --lift-card: none;
  --head-shade: none;
  --lift-2: 0 2px 6px rgba(20, 26, 36, 0.07), 0 1px 2px rgba(20, 26, 36, 0.05);
  --float: 0 16px 40px rgba(16, 24, 40, 0.16), 0 2px 8px rgba(16, 24, 40, 0.06);
  --ring: 0 0 0 3px rgba(0, 105, 148, 0.2);
  /* A button's edge: a hairline of shade along its foot, so a control reads as one that presses. A pressed main button
     takes a light along its top edge. */
  --press-lift: 0 1px 2px rgba(16, 24, 40, 0.06);
  --press-light: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  /* What a person has selected in the page's text. */
  --selection: rgba(0, 105, 148, 0.18);
  /* A shadow cast upwards by a bar fixed at the foot of the window: the settings' Save bar, the bar for ticked rows. */
  --shade: rgba(0, 0, 0, 0.25);
  --lift-up: 0 -6px 16px -10px var(--shade);
  --lift-up-near: 0 -6px 14px -10px var(--shade);
  /* A switch's knob, the edge of a colour swatch, a page drawn as a sheet of paper. */
  --knob: 0 1px 2px var(--shade);
  --swatch-edge: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  --sheet: 0 1px 2px rgba(0, 0, 0, 0.12), 0 8px 24px -12px rgba(0, 0, 0, 0.3);
  /* A notice floating on the deep accent: the idle warning. */
  --float-accent: 0 8px 24px rgba(10, 61, 127, 0.28);
  /* The edge of a key drawn on the main button. */
  --on-accent-line: rgba(255, 255, 255, 0.45);
  /* The camera's dark ground, and the dim round the card's outline. */
  --camera-ground: rgba(10, 30, 60, 0.92);
  --camera-dim: rgba(10, 30, 60, 0.35);
  /* The sign-in pane's rings, its bright corner and its dots. */
  --sign-in-ring: rgba(255, 255, 255, 0.05);
  --sign-in-ring-far: rgba(255, 255, 255, 0.03);
  --sign-in-bright: rgba(17, 132, 183, 0.55);
  --sign-in-dots: rgba(255, 255, 255, 0.16);
  /* The focus ring: two rings, so it reads on white, on accent and on a tinted row alike. */
  --focus: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);

  /* The type scale, one size for each part a page has: page title 24, a section's heading 16, running text, a cell, a
     field and a button 14, and everything secondary 13 (a label, a column's heading, a tag, a count, a small button, a
     caption, a lede). A heading inside a section is running text's size, stressed. */
  --t-page: 24px;
  --t-panel: 16px;
  --t-body: 14px;
  --t-dense: 13px;
  --t-small: 13px;
  /* The caption is the floor: nothing a person has to read is set smaller than 13px. */
  --t-caption: 13px;
  /* The bar across the top: the sections and the person's name; where the window is narrower, its sections a step smaller, so
     each section keeps its place on the bar. */
  --t-bar: 14px;
  --t-bar-narrow: 13px;
  /* The name on the sign-in page. */
  --t-money: 40px;
  /* The one large figure on Home's band: the days to the cut-off. */
  --t-hero: 64px;
  /* The value of every figure, money or a count, boxed or on a board; the sum at a form's foot; the question in an ask
     window. */
  --t-figure: 20px;
  --t-sum: 15px;
  --t-question: 16px;
  /* The sort arrow beside a column heading: a mark, not words. */
  --t-arrow: 9px;
  /* Recovery keys and code: the large key, a key, a list of keys, a block of code. */
  --t-key-large: 28px;
  --t-key: 22px;
  --t-key-list: 18px;
  --t-code: 13px;
  /* The sign-in pane: its heading and its line. */
  --t-sign-in: 28px;
  --t-sign-in-line: 26px;
  /* A box's words on a phone: an iPhone zooms the page in when a box under 16 px takes the cursor. */
  --t-phone-box: 16px;
}

/* Dark mode, chosen in the menu under the person's name: the same tokens, light on dark; print is always dark on white. */
@media screen {
  html.dark {
    color-scheme: dark;
    --ink: #eef5fa;
    --ink-soft: #cddde7;
    --ink-faint: #a9c0cf;
    --rule: #1d3543;
    --rule-soft: #152d3a;
    --rule-strong: #325062;
    /* 3.4 on the dark panel, the dark required wash and the page. */
    --field-line: #5e7d90;
    --paper: #0b161d;
    --panel: #101f29;
    --raised: #152934;
    --row-alt: #14232b;
    /* On a dark panel a field needs a step more than a grid's row to be told from its neighbours. */
    --required-wash: #1a2a31;
    --zebra: #10242f;
    --grid-head: var(--panel);

    --accent: #60bcf0;
    --accent-deep: #9ad7fb;
    --accent-wash: #122f3f;
    --accent-line: #1d506b;
    --unread-wash: #0f2531;
    --accent-bright: #72c9fb;
    --accent-mid: #35799f;
    --on-accent: #041824;
    --primary-lift: 0 6px 16px rgba(0, 0, 0, 0.45);
    --hero-deep: #0a4561;
    --hero-night: #03121b;

    --signal: #f0865e;
    --signal-deep: #f6a585;
    --signal-wash: #3a221a;
    --signal-line: #6b3b2b;
    --signal-wash-deep: #482a20;

    --warn: #e6b95e;
    --warn-wash: #332a10;
    --warn-line: #5f4d1f;
    --wanted-line: #6a5b26;
    --bad: #f39090;
    --bad-wash: #3b1d1f;
    --invalid-wash: #2a1b1f;
    --bad-line: #703437;
    --good: #72d19a;
    --good-wash: #173120;
    --good-line: #305f43;
    --wait: #afadff;
    --wait-wash: #2b2949;
    --wait-line: #524f86;
    --office: #f291cb;
    --office-wash: #3a1a2d;

    --veil: rgba(16, 31, 41, 0.94);
    --scrim: rgba(3, 8, 11, 0.66);
    --scrim-soft: rgba(3, 8, 11, 0.4);
    --mark-on-light: none;
    --mark-on-dark: block;
    --logo-tile: #ffffff;
    --lift-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --float: 0 16px 40px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
    --ring: 0 0 0 3px rgba(96, 188, 240, 0.3);
    --press-lift: 0 1px 2px rgba(0, 0, 0, 0.3);
    --press-light: inset 0 1px 0 rgba(255, 255, 255, 0.2);
    --selection: rgba(96, 188, 240, 0.3);
  }
  /* Larger text and bolder text, each chosen in the same menu: the type scale and the weights a step up. */
  html.larger {
    --t-page: 26px;
    --t-panel: 18px;
    --t-body: 15px;
    --t-dense: 14px;
    --t-small: 14px;
    --t-caption: 14px;
    --t-bar: 15px;
    --t-bar-narrow: 14px;
    --control: 38px;
  }
  html.bolder {
    --w-light: 500;
    --w-text: 500;
    --w-mid: 600;
    --w-strong: 700;
  }
  /* A grid has room for larger text on a wide window, and as cards on a phone; between the two it keeps the standard sizes, so it never scrolls sideways. */
  @media (min-width: 820px) and (max-width: 1420px) {
    html.larger .table-wrap {
      --t-body: 14px;
      --t-dense: 13px;
      --t-small: 13px;
      --t-caption: 13px;
      --control: 36px;
    }
  }
}

/* === 2. Base =========================================================== */


/* Geist: Latin and its extension (a Polish or Vietnamese name), upright and italic, and Geist Mono upright; every weight in
   one file each. */
@font-face { font-family: Geist; font-weight: 100 900; font-style: normal; font-display: swap;
             src: url("fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
             unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Geist; font-weight: 100 900; font-style: normal; font-display: swap;
             src: url("fonts/geist-latin-ext-wght-normal.woff2") format("woff2-variations");
             unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Geist; font-weight: 100 900; font-style: italic; font-display: swap;
             src: url("fonts/geist-latin-wght-italic.woff2") format("woff2-variations");
             unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Geist; font-weight: 100 900; font-style: italic; font-display: swap;
             src: url("fonts/geist-latin-ext-wght-italic.woff2") format("woff2-variations");
             unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Geist Mono"; font-weight: 100 900; font-style: normal; font-display: swap;
             src: url("fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
             unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist Mono"; font-weight: 100 900; font-style: normal; font-display: swap;
             src: url("fonts/geist-mono-latin-ext-wght-normal.woff2") format("woff2-variations");
             unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

@font-face { font-family: Sora; font-weight: 400; font-style: normal; font-display: swap;
             src: url("fonts/sora-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: Sora; font-weight: 600; font-style: normal; font-display: swap;
             src: url("fonts/sora-latin-600-normal.woff2") format("woff2"); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar) + 76px);
       /* The window's scroll bar in the page's greys, not the machine's. */
       scrollbar-color: var(--rule-strong) var(--paper); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--w-text) var(--t-body)/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
}
/* Text a person selects takes the accent's tint. */
::selection { background: var(--selection); }
/* A box that scrolls inside the page (a list, a menu, a dialog) has a slim bar in the same greys. */
:is(.table-wrap, .dropdown-menu, dialog, .sheet-body, textarea) { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
/* A sentence breaks where it reads better, not leaving one word stranded on the last line. */
p, .lede, .why, .empty, .message { text-wrap: pretty; }

/* One focus ring for every control, drawn here, not by the browser. */
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-deep); }

/* At heading sizes the letters are drawn a little closer, as a title is set. */
h1 { font-size: var(--t-page); font-weight: var(--w-strong); margin: 0 0 var(--s1);
     line-height: 1.25; color: var(--ink); letter-spacing: -0.025em; }
h2 { font-size: var(--t-panel); font-weight: var(--w-strong); margin: 0 0 var(--s2);
     line-height: 1.35; color: var(--ink); letter-spacing: -0.01em; }
/* A heading inside a section, wherever it is drawn: running text's size, stressed. */
h3 { font-size: var(--t-body); font-weight: var(--w-strong); margin: 0 0 6px; line-height: 1.4; color: var(--ink); }
/* What a browser sets bold by itself is the strong weight. */
b, strong, th { font-weight: var(--w-strong); }
/* A control takes the page's typeface, which a browser does not give it. */
button, input, select, textarea { font: inherit; }
/* A tick and a chosen radio take the accent, not the browser's blue. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
/* A tick box big enough to hit, with room round it in a row of a list. */
input[type="checkbox"]:not(.switch), input[type="radio"] { width: 16px; height: 16px; }
table.grid td > input[type="checkbox"], table.grid th > input[type="checkbox"] { margin: var(--s1); vertical-align: middle; }
p { margin: 0 0 var(--s3); }
p:last-child { margin-bottom: 0; }
/* The one sentence under a heading, wherever it appears. */
.lede { font-size: var(--t-dense); line-height: 1.5; color: var(--ink-soft); }

/* On a phone a box's words are 16 px, in the office and on the portal alike: smaller, an iPhone zooms the page in when
   the box takes the cursor, as a dialog's first box does on opening, and the dialog's X goes out of view. */
@media (max-width: 820px) {
  :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"]), select, textarea) { font-size: var(--t-phone-box) !important; }
}

/* Parts that need the script are hidden until it runs; their stand-ins are hidden once it has. */
html:not(.js) .js-only { display: none !important; }
html.js .js-hidden { display: none !important; }

/* === 3. Masthead ======================================================= */

/* Above the bar on a copy that holds sample data, on every page, the sign-in pages among them: one line of a fixed
   height, so the sign-in page's pane can start below it. */
.sample-band {
  position: relative;
  z-index: 30;
  height: var(--sample-band);
  padding: 0 var(--s5);
  line-height: calc(var(--sample-band) - 1px);
  background: var(--warn-wash);
  border-bottom: 1px solid var(--warn-line);
  color: var(--warn);
  font-size: var(--t-small);
  font-weight: var(--w-strong);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* One white bar across the top: the mark, the sections, search, and the person signed in; fixed while the page scrolls. */
.masthead {
  display: flex;
  align-items: center;
  gap: var(--s4);
  min-height: var(--bar);
  padding: 0 var(--s5);
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 20;
}

.mark { display: flex; align-items: center; gap: 9px; color: var(--ink); text-decoration: none; flex: 0 0 auto; }
.mark:hover { color: var(--ink); }
.mark img { display: block; width: 28px; height: 28px; }
/* The mark has a navy stroke; a copy with that stroke drawn light is shown in dark mode. */
.mark img.on-light { display: var(--mark-on-light); }
.mark img.on-dark { display: var(--mark-on-dark); }
/* The office's own logo at the mark's height, its own shape kept; in dark mode it sits on a white tile, as it was drawn for paper. */
.mark img.office { width: auto; height: 28px; max-width: 140px; }
.mark img.office { padding: 2px; background: var(--logo-tile); border-radius: 4px; }
.wordmark { display: flex; flex-direction: column; line-height: 1.15; font-family: var(--display); font-size: var(--t-bar);
            font-weight: var(--w-strong); letter-spacing: -0.01em; white-space: nowrap; }
.wordmark small { font-size: var(--t-caption); font-weight: var(--w-text); letter-spacing: 0.02em; color: var(--ink-faint); }

/* No overflow rule here: a menu is positioned against this row and a clipping ancestor cuts it off. */
.sections { display: flex; align-items: center; flex: 0 1 auto; gap: 2px; min-width: 0; }
.sections a, .sections summary {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 var(--s3);
  border-radius: var(--r);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: var(--t-bar);
  font-weight: var(--w-mid);
  white-space: nowrap;
  transition: background-color 120ms ease, color 120ms ease;
}
.sections a:hover, .sections summary:hover, .sections .dropdown[open] > summary { background: var(--raised); color: var(--ink); border-color: transparent; }
/* The section a person is in is a soft pill of the accent's wash, its words in the deep accent. */
.sections a.current, .sections summary.current { background: var(--accent-wash); color: var(--accent-deep); font-weight: var(--w-strong);
  box-shadow: inset 0 0 0 1px var(--accent-line); }
.sections summary svg { opacity: 0.7; }
/* How much a section, a tab, a folder or a section of a page is holding, beside its name: one small rounded badge
   wherever it is drawn. */
:is(.sections, .tabs, .section-nav, .folder, .panel-head, .dropdown > summary, .dropdown-menu, .settings-menu a) .count, .count.office {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--rule-soft);
  color: var(--ink-soft);
  font-size: var(--t-caption);
  font-weight: var(--w-mid);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  align-self: center;
}
/* A number that holds something late or gone wrong; the rest stay grey. */
.sections .count.late { background: var(--signal-wash); color: var(--signal-deep); }
.sections a.current .count, .sections summary.current .count { background: var(--accent); color: var(--on-accent); }
/* The sections that sit in More until the bar has room for them, one at a time in order, and leave it when on the bar. */
.sections a.extra { display: none; }
.sections a.extra.on-bar { display: flex; }
.more-menu a.in-more.on-bar { display: none; }
.sections summary.from-extra.on-bar { background: none; color: var(--ink-soft); font-weight: var(--w-text); }
/* With every section on the bar they sit a little closer, so a laptop's width holds them. */
.masthead.roomy .sections > a { padding: 0 9px; }
/* More: the office's own pages in columns under their headings, opening leftward from the button. */
.sections .dropdown-menu.more-menu { left: auto; right: 0; display: flex; flex-direction: column; padding: var(--s2) 0; }
.more-columns { display: flex; align-items: flex-start; }
/* Settings: one row across the foot of More, under every column. */
.sections .dropdown-menu.more-menu a.more-foot { justify-content: flex-start; gap: 7px; margin-top: var(--s2); padding: var(--s2) var(--s4) var(--s1); border-top: 1px solid var(--rule-soft); font-weight: var(--w-strong); color: var(--accent-deep); }
.more-foot .heading-icon { flex: none; color: var(--accent); }
.more-column { min-width: 190px; padding: 0 var(--s1); }
.more-column + .more-column { border-left: 1px solid var(--rule-soft); }
.more-column h3 { display: flex; align-items: center; gap: 7px; margin: var(--s2) 0 2px; padding: 0 var(--s3); font-size: var(--t-small); font-weight: var(--w-strong); color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
/* A heading's icon, in the accent, sets it apart from the pages under it. */
.more-column h3 .heading-icon { flex: none; color: var(--accent); }
.more-column h3:first-child, .masthead.all-extras .more-column a.in-more + h3 { margin-top: var(--s1); }
.more-column a.in-more + h3 { margin-top: var(--s3); }
/* The Ministry connection not set up: a dot on More's Settings row, on its section and on its tab. */
.more-foot .dot, .settings-menu .dot, .settings-main > .tabs .dot { flex: none; display: inline-block; width: 7px; height: 7px; margin-left: var(--s2); border-radius: 50%; background: var(--signal); vertical-align: middle; }
.sections .dropdown-menu { top: calc(100% + 8px); left: 0; right: auto; min-width: 190px; }
.sections .dropdown-menu a { height: auto; padding: var(--s2) var(--s3); border-radius: 0; font-size: var(--t-body); color: var(--ink); justify-content: space-between; }
.sections .dropdown-menu a.current { background: var(--accent-wash); color: var(--accent-deep); }

/* The search that opens the command palette: a trigger, not a field. */
/* Only as wide as its word and its key. */
.bar-find { flex: 0 1 150px; max-width: 150px; min-width: 132px; margin-left: auto; }
.bar-find input { cursor: pointer; background: var(--panel); padding-right: 62px; }
.bar-find input:hover { border-color: var(--rule-strong); }
.bar-find kbd { position: absolute; right: var(--s2); top: 50%; transform: translateY(-50%); pointer-events: none; }

/* Who is signed in, at the far end of the bar. */
.who { display: flex; align-items: center; gap: var(--s1); color: var(--ink-soft); flex: 0 0 auto; }
/* With no search beside it, as on the physician's side, the person still sits at the far end. */
.masthead > .who { margin-left: auto; }
.masthead > .bar-find + .who { margin-left: 0; }
/* Notifications and reminders as icons, each with a dot while something is unread or due; how many is in its name. */
.who .tray {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r); color: var(--ink-soft); text-decoration: none;
}
.who .tray:hover { background: var(--raised); color: var(--ink); }
.who .tray .new-dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--signal); box-shadow: 0 0 0 2px var(--panel);
}
.who .tray-menu > summary { cursor: pointer; }
.who .tray-menu[open] > summary { background: var(--raised); color: var(--ink); }
/* The panel under the bell or the clock: its name, the newest five, and the way to the rest. */
.dropdown-menu.latest { top: calc(100% + 8px); width: 340px; max-width: calc(100vw - 2 * var(--s3)); padding: 0; }
.latest-head { padding: var(--s3) var(--s3) var(--s2); font-weight: var(--w-strong); }
.dropdown-menu.latest a { display: block; padding: var(--s2) var(--s3); white-space: normal; border-top: 1px solid var(--rule-soft); }
.dropdown-menu.latest a strong { display: block; font-weight: var(--w-strong); }
.latest-sub { display: block; font-size: var(--t-small); font-weight: var(--w-text); color: var(--ink-soft); }
.latest-none { margin: 0; padding: var(--s2) var(--s3); border-top: 1px solid var(--rule-soft); font-size: var(--t-dense); color: var(--ink-soft); }
.dropdown-menu.latest a.see-all { border-top: 1px solid var(--rule); background: var(--raised); color: var(--accent-deep); font-weight: var(--w-strong); text-align: center; }
/* The person, as a menu: their account pages and the way out. */
.who .account > summary {
  display: flex; align-items: center; gap: var(--s2); height: 36px; padding: 0 var(--s2);
  border-radius: var(--r); color: var(--ink);
}
.who .account > summary:hover, .who .account[open] > summary { background: var(--raised); border-color: transparent; }
.who .account > summary > svg:last-child { opacity: 0.6; }
.who .named { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.who .name { font-size: var(--t-bar); white-space: nowrap; }
.who .role { font-size: var(--t-caption); color: var(--ink-faint); }
.who .account .dropdown-menu { top: calc(100% + 8px); }
.who .account .dropdown-menu button { white-space: nowrap; }
.dropdown-menu form { margin: 0; }
.dropdown-menu button {
  display: flex; width: 100%; padding: 7px var(--s3); border: 0; background: none; cursor: pointer;
  color: var(--ink); font: inherit; font-size: var(--t-body); text-align: left;
}
.dropdown-menu button:hover { background: var(--accent-wash); color: var(--accent-deep); }
.dropdown-menu button.danger, .dropdown-menu button.danger:hover { color: var(--bad); }
.dropdown-menu button.danger:hover { background: var(--bad-wash); }
/* A menu of choices ticked on or off (a thread's labels, whom it is assigned to): each tick in a column of its own. */
.dropdown-menu :is([role="menuitemcheckbox"], [role="menuitemradio"]) { align-items: center; gap: var(--s2); }
.dropdown-menu :is([role="menuitemcheckbox"], [role="menuitemradio"]) .mark { display: inline-block; width: 1em; color: var(--accent); font-weight: var(--w-strong); }
/* Where the bar is tight the links close up and the role is hidden. */
@media (max-width: 1420px) {
  .masthead { gap: var(--s2); padding: 0 var(--s4); }
  .sections a, .sections summary { padding: 0 var(--s2); font-size: var(--t-bar-narrow); }
  .who .role { display: none; }
}
/* Narrower still, the sections take a row of their own under the mark. */
@media (max-width: 1100px) {
  .who .named { display: none; }
  .masthead { flex-wrap: wrap; row-gap: 0; }
  .sections { order: 3; flex: 1 0 100%; flex-wrap: wrap; padding-bottom: var(--s2); }
}
/* On a phone the bar is one row: menu button, mark, search icon, person; the sections open under it as a list. */
.bar-toggle {
  display: none; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; padding: 0;
  border: 0; border-radius: var(--r); background: none; color: var(--ink-soft); cursor: pointer;
}
.bar-toggle:hover, .masthead.open .bar-toggle { background: var(--raised); color: var(--ink); }
@media (max-width: 820px) {
  .js .bar-toggle { display: inline-flex; }
  .js .masthead { gap: var(--s1); padding: 0 var(--s3); }
  .js .masthead:not(.open) .sections { display: none; }
  /* The bar is one row on the narrowest phone too, a folding phone's front screen among them: the name without the line
     under it, the person's menu without its arrow, and the name the part that gives way. */
  .js .masthead:not(.open) { flex-wrap: nowrap; }
  .js .masthead > .mark { flex: 0 1 auto; min-width: 0; gap: 6px; }
  .js .masthead .wordmark { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .js .masthead .wordmark small { display: none; }
  .js .masthead .who .account > summary > svg:last-of-type { display: none; }
  .js .masthead.open { align-content: flex-start; padding-top: 10px; row-gap: 10px; }
  .js .masthead.open .sections { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; padding: var(--s1) 0 var(--s2); border-top: 1px solid var(--rule); }
  .js .masthead.open .sections a { height: 40px; justify-content: flex-start; }
  .js .masthead.open .sections a :is(.count, .dot) { margin-left: auto; }
  /* More opens in the list, its columns one under another. */
  .js .masthead.open .sections .dropdown.more { flex-direction: column; align-items: stretch; }
  .js .masthead.open .sections .dropdown-menu.more-menu { position: static; flex-direction: column; border: 0; box-shadow: none; padding: 0 0 var(--s1) var(--s3); }
  .js .masthead.open .more-columns { flex-direction: column; }
  .js .masthead.open .more-column { min-width: 0; padding: 0; }
  .js .masthead.open .more-column + .more-column { border-left: 0; }
  /* Search is its glass alone: there is no room for a word that would be cut short. */
  .js .bar-find { flex: 0 0 var(--control); min-width: var(--control); }
  .js .bar-find input { padding-right: 0; color: transparent; }
  .js .bar-find input::placeholder { color: transparent; }
  .js .bar-find kbd { display: none; }
}
/* The portal on a phone: its sections along the foot of the screen, under the thumb, in place of the menu button. Each
   is its icon over its word; the one open has its icon on the accent's wash; a count sits on the icon's corner. */
.phone-tabs { display: none; }
@media (max-width: 820px) {
  body[data-portal] .masthead .sections, .js body[data-portal] .bar-toggle { display: none; }
  body[data-portal] { padding-bottom: calc(var(--phone-tabs) + env(safe-area-inset-bottom, 0px)); }
  /* The warning before signing out sits above the sections, not over them. */
  body[data-portal] .idle-warning { bottom: calc(var(--phone-tabs) + env(safe-area-inset-bottom, 0px) + var(--s3)); }
  body[data-portal] .phone-tabs {
    position: fixed; inset: auto 0 0 0; z-index: 20;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    min-height: var(--phone-tabs); padding: var(--s1) var(--s1) calc(var(--s1) + env(safe-area-inset-bottom, 0px));
    background: var(--panel); border-top: 1px solid var(--rule); box-shadow: var(--lift-up);
  }
  .phone-tabs a {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 2px;
    min-width: 0; min-height: 56px; padding: 6px 2px var(--s1); border-radius: var(--r);
    color: var(--ink-soft); text-decoration: none; font-size: var(--t-caption); line-height: 1.15; text-align: center;
  }
  .phone-tab-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 28px; border-radius: var(--r-chip); }
  .phone-tab-word { max-width: 100%; overflow-wrap: anywhere; }
  .phone-tabs a.current { color: var(--accent-deep); font-weight: var(--w-strong); }
  .phone-tabs a.current .phone-tab-icon { background: var(--accent-wash); color: var(--accent); }
  .phone-tabs .count {
    position: absolute; top: -3px; left: calc(50% + 6px); min-width: 18px; padding: 0 5px; box-sizing: border-box;
    border-radius: var(--r-count); background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--panel);
    font-size: var(--t-caption); font-weight: var(--w-strong); line-height: 18px; text-align: center; font-variant-numeric: tabular-nums;
  }
}

button.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
main button.link { color: var(--accent); font-size: var(--t-small); font-weight: var(--w-text); }
main button.link:hover { color: var(--accent-deep); }

/* === 4. Page =========================================================== */

main { padding: var(--s4) var(--s5) 64px; max-width: none; margin: 0; }

/* Page kinds (src/web/page-kind.ts): only a record's title marks its word, as a soft chip of the accent. */
main.kind-record > .page-head h1 .page-word:not(.alone) {
  padding: 2px 8px; border-radius: var(--r); background: var(--accent-wash); color: var(--accent-deep);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
main.kind-record > .page-head h1 .page-word:not(.alone) .icon { opacity: 1; color: var(--accent); }

/* A form drawn as a page is a white sheet with a hairline border; the claim form has no `.form-body` and keeps the whole page.
   A record's form a person may only read holds its body in a disabled fieldset. */
main.kind-form > :is(form, div):has(> fieldset.read-only > .form-body),
main.kind-form > form:has(> .form-body) {
  max-width: none;
  margin: 0;
  padding: var(--s4) var(--s5);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--lift);
}
/* A form that shares its page with a list keeps the gap every section has. */
main.kind-form > :is(form, div):has(> .form-body, > fieldset.read-only > .form-body):not(:last-child) { margin-bottom: var(--gap); }
/* The sheet's heading stays under the bar like every page's (the rule for .page-head, further down); here it is the sheet's own white, and sits flush on the fields. */
main.kind-form > div:has(> fieldset.read-only) > .page-head,
main.kind-form > form > .page-head {
  align-items: flex-end;
  margin-bottom: 0;
  background: var(--panel);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
main.kind-form > div:has(> fieldset.read-only) > .page-head h1,
main.kind-form > form > .page-head h1 { font-size: var(--t-page); color: var(--ink); }
main.kind-form > div:has(> fieldset.read-only) > .page-head .lede,
main.kind-form > form > .page-head .lede { color: var(--ink-soft); font-size: var(--t-dense); }
main.kind-form > :is(form, div) > fieldset.read-only > .form-body,
main.kind-form > form > .form-body { padding: var(--s5) 0; background: none; }
main.kind-form > :is(form, div) > fieldset.read-only > .form-body textarea,
main.kind-form > form > .form-body textarea { max-width: 60rem; }
/* A part of a form that is seldom wanted, behind its own line. */
/* A ministry answer in one line, its tag first; the fields behind it fold under Details. */
.answer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 0; }
.answer + .more-of-form { margin-top: var(--s2); }
/* Undo, at the end of the band that says what was done. */
.message form.undo { display: inline-flex; margin: 0 0 0 auto; }

/* Nothing pressed is under 24px tall: the words that open something, the way back, a file's link. */
details:not(.dropdown) > summary, button.link, a.journey-file { min-height: 24px; }
button.link, a.journey-file { display: inline-flex; align-items: center; }
.button.small.remove { min-width: 24px; }

/* For whoever has asked their machine for less motion: nothing slides, turns or fades. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Said to a screen reader and not drawn. */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Settings: a short menu down the left, and one section for each thing that is set. */
.settings { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s5); align-items: start; }
.settings-menu { display: grid; gap: 2px; position: sticky; top: calc(var(--bar) + var(--s3)); }
.settings-menu a { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--r); color: var(--ink-soft); text-decoration: none; font-weight: var(--w-text); }
.settings-menu a:hover, .settings-menu a:focus-visible { background: var(--accent-wash); color: var(--accent-deep); }
/* The section open is a soft pill, as on the bar and the menu down the left; each section carries its icon. */
.settings-menu a.current { background: var(--accent-wash); color: var(--accent-deep); }
.settings-menu .settings-icon { flex: none; opacity: 0.8; }
.settings-menu a.current .settings-icon { opacity: 1; }
/* Reference data's menu: wide enough that no entry wraps; a rule sets the code lists and the rules apart. */
.settings.reference { grid-template-columns: 230px minmax(0, 1fr); }
.settings-menu hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s2) var(--s3); }
/* The lists' menu scrolls with the page instead of sticking under the page's heading. */
.settings-menu.lists { position: static; }
/* Settings under More: Find a setting and the sections down the left, the page's tabs and cards beside them, and the
   Save bar at the foot of the window. */
.settings.place { grid-template-columns: 240px minmax(0, 1fr); gap: var(--s4); }
.settings-side { display: grid; gap: var(--s3); position: sticky; top: calc(var(--bar) + var(--page-head, 0px) + var(--s3)); }
.settings.place .settings-menu { position: static; }
.settings-menu a .count { margin-left: auto; }
/* On the open entry a plain count takes the entry's deep accent; the office's count keeps its own chip. */
.settings-menu a.current .count:not(.office) { color: var(--accent-deep); }
.settings-find label { margin-bottom: 3px; }
.settings-find input { width: 100%; }
.settings-main { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); min-width: 0; align-content: start; }
.settings-main > .tabs { margin: 0; }
/* A page of rules keeps its rows to a reading width; a page with a list or a form of its own takes the column. */
.settings-main:not(.own) { max-width: 920px; }
.settings-main:not(.own) > .panel, .settings-main:not(.own) > p { max-width: 920px; }
/* Every page's head in one place: its name where the section has no tabs, its line, and Audit history with the page's
   own buttons at the right. */
.settings-main > .page-head { margin: 0; min-height: 40px; }
/* Under tabs the head is not a row of its own: Audit history and the page's buttons stand at the end of the tab row,
   with the help beside them where the page says nothing more; a line of its own goes under the tabs. A heading that
   says the current tab's name again is left to screen readers. */
.settings-main.tabbed { grid-template-columns: minmax(0, 1fr) auto auto; column-gap: var(--s3); }
.settings-main.tabbed > * { grid-column: 1 / -1; }
.settings-main.tabbed > .tabs { grid-column: 1; grid-row: 1; align-self: end; }
.settings-main.tabbed > .tabs + .page-head { display: contents; }
.settings-main.tabbed > .tabs + .page-head > .actions { grid-column: 3; grid-row: 1; align-self: center; }
.settings-main.tabbed > .tabs + .page-head > div:first-child { grid-column: 1 / -1; grid-row: 2; }
.settings-main.tabbed > .tabs + .page-head > div:first-child:not(:has(> :not(h2.tab-name, .help-link))) { grid-column: 2; grid-row: 1; align-self: center; }
/* A page that says only one line under its tabs: the question mark stands after the line, not alone above it. */
.settings-main.tabbed > .tabs + .page-head > div:first-child:has(> h2.tab-name + .help-link + .lede:last-child) { display: flex; align-items: center; gap: var(--s2); }
.settings-main.tabbed > .tabs + .page-head > div:first-child:has(> h2.tab-name + .help-link + .lede:last-child) > .lede { order: -1; flex: 0 1 auto; width: auto; margin: 0; }
.settings-main.tabbed > .tabs + .page-head h2.tab-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.settings-form { display: grid; gap: var(--gap); max-width: 920px; }
.settings-main.own .settings-form { max-width: none; }
.settings-form > .panel > .rule:last-of-type { border-bottom: 0; padding-bottom: 0; }
.settings-save { position: sticky; bottom: 0; z-index: 5; display: flex; gap: var(--s2); align-items: center; justify-content: flex-end;
  padding: var(--s3) var(--s4); background: var(--panel); border: 1px solid var(--rule-strong); border-radius: var(--r-lg);
  box-shadow: var(--lift-up); }
.settings-save[hidden] { display: none; }
.settings-unsaved { margin-right: auto; color: var(--ink-soft); font-size: var(--t-dense); }
/* What a setting does in full, and who has their own value, opened in place under it. */
.rule-fold { grid-column: 1 / -1; margin-top: var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--raised); color: var(--ink-soft); font-size: var(--t-dense); display: grid; gap: var(--s2); }
.rule-fold[hidden] { display: none; }
.rule-fold p { margin: 0; }
.rule-head .help-link { margin-left: var(--s1); }
/* A narrow window: the list menu becomes one dropdown above the grid. */
.list-jump { display: none; }
@media (max-width: 820px) {
  .settings.reference { grid-template-columns: minmax(0, 1fr); }
  .settings.reference .settings-menu { display: none; }
  .settings.place { grid-template-columns: minmax(0, 1fr); }
  .settings.place .settings-menu { display: none; }
  .settings-side { position: static; }
  .list-jump { display: block; margin-bottom: var(--s3); }
}
/* A count of the office's own rows, on a tab, a list's name or a button. */
.count.office { background: var(--office-wash); color: var(--office); }
/* The line under a row's title: its list, where it came from and since when. */
.record-line { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin: 0 0 var(--s3); }
/* A service code's star on its own page: the code kept in, or taken out of, Favourite codes on New claim. */
.favourite-code { padding: 0; border: 0; background: none; font: inherit; color: var(--accent); cursor: pointer; }
.favourite-code:hover { text-decoration: underline; }
/* Alter or end: with End chosen the values are out of use. */
.choice-row { display: flex; gap: var(--s5); flex-wrap: wrap; margin-bottom: var(--s3); }
fieldset.row-history { margin-top: var(--gap); }
/* A record form shown to somebody who may only read it: the fields are disabled and the box is invisible. */
fieldset.read-only { border: 0; padding: 0; margin: 0; min-width: 0; }
/* Short boxes share a row evenly, each wide enough for its label. */
.reference-row .row-values .field-row > .field.narrow { flex: 1 1 150px; max-width: 200px; }
/* A row as it is read by someone who cannot change it: its values as facts, a long text on its own lines. */
.reference-row .row-facts { margin-bottom: var(--gap); font-size: var(--t-body); }
/* A long row of tabs, set closer. */
.tabs.close a { padding-left: 10px; padding-right: 10px; }
@media (max-width: 1420px) {
  .tabs.close a { padding-left: 6px; padding-right: 6px; gap: 5px; }
  .tabs.close a .count { padding: 0 4px; min-width: 18px; }
}
/* The health card check that came with an intake item: its result, the ministry's words, who checked and when. */
.card-check-line { display: grid; gap: 2px; margin-top: var(--s2); }
/* What follows it in the card (the box to link a patient, a patient of the same number) stands apart from it. */
.card-check-line:not(:last-child) { margin-bottom: var(--s3); }
/* Roles and permissions: a card a group, a tick box a permission with what it allows under its name. */
.permission-groups { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(330px, 100%), 1fr)); }
.permission-group { margin: 0; padding: var(--s3) var(--s4); border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--panel); }
.permission-group { min-width: 0; }
.permission-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin-bottom: var(--s1); }
.permission-group-head h3 { margin: 0; }
.permission-group-set { display: flex; gap: var(--s3); }
.permission { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s2) 0; border-top: 1px solid var(--rule); cursor: pointer; }
.permission:first-of-type { border-top: 0; }
.permission input { margin-top: 3px; flex: none; }
.permission-words { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.permission-label { font-weight: var(--w-strong); }
.permission-says { color: var(--ink-faint); font-size: var(--t-small); }
.permission:has(input:disabled) { cursor: default; }
.permission.own .permission-label { color: var(--office); }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
/* Choosing a role for a person: each role a row with what it is for and how much it holds. */
/* Each choice says what the role is for on as many lines as it needs: a label elsewhere keeps to one. */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: var(--s1) var(--s2); }
.choice-card { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s3); align-items: start; padding: var(--s2) var(--s3); border: 1px solid var(--rule); border-radius: var(--r); cursor: pointer; white-space: normal; }
.choice-card:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.choice-card.off { opacity: 0.55; cursor: default; }
.choice-card-words { display: grid; gap: 1px; min-width: 0; }
/* Reference data: the lists of a tab down the left, the chosen list beside them. */
.reference-list { min-width: 0; }
/* What a list is read from: one line per publication, its edition and load, and the way to a new edition. */
.list-source { margin-top: var(--s2); }
/* A list's name and what it holds keep a readable width: its buttons go under them where the two do not fit side by side. */
.reference-list .panel-head.split { flex-wrap: wrap; }
.reference-list .panel-head.split > :first-child { flex: 1 1 320px; }
/* A code the office added or altered, and the ministry's value it stands over. */
.office-code, .office-code a, input[type="text"].office-code, .chip.office-code, .shortcut .office-code, .picker-code.office-code { color: var(--office); font-weight: var(--w-strong); }
/* The mark after it, so it does not rest on colour: a diamond on a code the office added, a ring on one it altered. */
span.office-code::after, button.office-code::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: var(--s1);
  vertical-align: 2px; border: 1.5px solid currentColor; border-radius: 50%; }
span.office-new::after, button.office-new::after { border-radius: 1px; transform: rotate(45deg); background: currentColor; }
.line-facts .office-note { color: var(--office); font-weight: var(--w-strong); }
.line-facts .office-note:not(:empty)::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: var(--s1);
  vertical-align: 1px; border: 1.5px solid currentColor; border-radius: 50%; }
s.was { color: var(--ink-faint); font-size: var(--t-small); margin-left: var(--s1); }
table.grid.bands { max-width: 420px; }
fieldset.try-it { margin-top: var(--gap); }
.try-result { margin-top: var(--s3); }
/* The office's logo as it is on file, at about the size a document prints it. */
.logo-on-file { margin: 0 0 var(--s2); }
.logo-on-file img { display: block; max-height: 56px; max-width: 280px; }

/* Business rules: each rule is its label, the sentence that says what happens, and its box on the right. */
.rules { display: grid; max-width: 920px; }
.rule { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 2px var(--s5); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.rule:first-of-type { padding-top: 0; }
.rule-head { grid-column: 1; display: flex; align-items: center; }
/* One face for every rule, whatever its box: the name, then the value, then the words about it. */
.rule .rule-label { display: inline; margin: 0; font-size: var(--t-body); font-weight: var(--w-strong); line-height: 1.4; color: var(--ink); white-space: normal; }
.rule-control input[type="text"], .rule-control select, .rule-control .check label {
  font-family: inherit; font-size: var(--t-body); font-weight: var(--w-text); color: var(--ink);
}
.rule-control .check label { margin: 0; }
.rule-control { grid-column: 2; grid-row: 1 / span 3; align-self: start; }
.rule-control select, .rule-control input.choose { width: 100%; }
.rule-control .check { margin: 0; }
.rule-control .error { margin: 3px 0 0; }
.rule-says { grid-column: 1; margin: 0; color: var(--ink-soft); font-size: var(--t-dense); line-height: 1.5; }
.rule-meta { grid-column: 1; margin: 2px 0 0; }
.rules > .actions { padding-top: var(--s4); }
/* A number with its unit beside it. */
.with-unit { display: inline-flex; align-items: center; gap: var(--s2); }
/* A password box with its eye at the end, inside the box; the browser's own eye (Edge) is left out so there is one. */
.with-reveal { position: relative; display: flex; }
.with-reveal input { flex: 1 1 auto; min-width: 0; padding-right: 40px; }
.with-reveal input::-ms-reveal, .with-reveal input::-ms-clear { display: none; }
.with-reveal .reveal { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r); background: transparent; color: var(--ink-faint); cursor: pointer; }
.with-reveal .reveal:hover, .with-reveal .reveal:focus-visible { color: var(--accent-deep); background: var(--accent-wash); }
.with-reveal .reveal .when-shown, .with-reveal .reveal[aria-pressed="true"] .when-hidden { display: none; }
.with-reveal .reveal[aria-pressed="true"] .when-shown { display: inline; }
/* What a new password must be, under its boxes: a dot for each line, ticked green once met, red once typed and not. */
.password-checks { list-style: none; margin: calc(-1 * var(--s1)) 0 var(--s3); padding: 0; display: grid; gap: 2px; font-size: var(--t-small); color: var(--ink-soft); }
.password-checks li { display: flex; align-items: center; gap: var(--s2); }
.password-checks li::before { content: ""; flex: none; width: 8px; height: 8px; margin: 0 3px; border-radius: 50%; background: var(--rule-strong); }
.password-checks li.met { color: var(--good); }
.password-checks li.met::before { width: 14px; height: 14px; margin: 0; background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.4l3 3 6-6.6' fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat; }
.password-checks li.unmet { color: var(--bad); }
.password-checks li.unmet::before { background: var(--bad); }
.with-unit input { width: 96px; }
/* In a form's field the box keeps its short width and the unit stays on its line. */
.field > .with-unit { display: flex; }
.field > .with-unit input { flex: 0 0 96px; }
.field > .with-unit .unit { white-space: nowrap; }
.with-unit.list input { width: 150px; }
.with-unit .unit { color: var(--ink-soft); font-size: var(--t-dense); }
@media (max-width: 820px) {
  .rule { grid-template-columns: minmax(0, 1fr); }
  .rule-control { grid-column: 1; grid-row: auto; margin-top: var(--s2); }
}

/* Notification choices: a grid of ticks kept as narrow as the business rules, so each tick sits near its label. */
.notice-choices { display: grid; gap: var(--s4); max-width: 920px; }

/* On a record's card: the rules it may set for itself, each on a line with the value that applies; the same lines list the office's rules on the screen they act on. */
.panel > .rules .rule:last-of-type { padding-bottom: 0; border-bottom: 0; }
.own-rules { display: grid; margin: 0; padding: 0; list-style: none; font-size: var(--t-dense); }
.own-rules li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s4); padding: var(--s2) 0; border-top: 1px solid var(--rule-soft); }
.own-rules li:first-child { padding-top: 0; border-top: 0; }
.own-rules li:last-child { padding-bottom: 0; }
.own-rule-label { flex: 1 1 320px; min-width: 0; color: var(--ink-soft); }
.own-rule-value { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.own-rules form { margin: 0; }

/* The help icon: opens the long explanation in the dialog, or on Settings in place. Always shown, unlike a field's hover tip. */
a.help-link, button.help-link {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 16px; height: 16px; margin-left: 6px; padding: 0; vertical-align: 1px;
  border: 1px solid var(--rule-strong); border-radius: 50%;
  background: var(--panel); color: var(--ink-faint); cursor: pointer;
  font-family: inherit; font-size: var(--t-caption); font-weight: var(--w-strong); line-height: 1; text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
a.help-link:hover, a.help-link:focus-visible, button.help-link:hover, button.help-link:focus-visible, button.help-link[aria-expanded="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); outline: none; }
a.help-link:focus-visible, button.help-link:focus-visible { box-shadow: var(--focus); }
.help-body { padding: var(--s4) var(--s5) var(--s5); max-width: 62ch; overflow-y: auto; }
.help-body p { margin: 0 0 var(--s3); line-height: 1.6; }
.help-body p:last-child { margin-bottom: 0; }
.help-body h3 { margin: var(--s4) 0 var(--s1); }
main > .help-body { padding-left: 0; }
.sheet .help-body { max-width: none; }
/* A help topic opened from inside a dialog: at the top of what the dialog holds, over the form, which stays as it was. */
.help-here { margin: 0 0 var(--s4); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: var(--r); background: var(--raised); }
.help-here-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4) 0; }
.help-here-head h3 { margin: 0; }
.sheet .help-here .help-body { padding: var(--s2) var(--s4) var(--s4); }
@media (max-width: 820px) {
  .settings { grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
  .settings-menu { position: static; display: flex; flex-wrap: wrap; }
}
/* A form behind its own button: the button is all there is until it is pressed. */
.opens > summary { display: inline-flex; list-style: none; }
.opens > summary::-webkit-details-marker { display: none; }
.opens[open] > summary { margin-bottom: var(--s4); }
.more-of-form { margin-top: var(--s3); }
.more-of-form > summary { cursor: pointer; color: var(--ink-soft); font-size: var(--t-dense); }
.more-of-form > summary:hover { color: var(--accent-deep); }
.more-of-form[open] > summary { margin-bottom: var(--s2); }
/* A field on its own line of a form is no wider than what is typed in it. */
.form-body > .field { max-width: 420px; }
.form-body > .field:has(textarea) { max-width: 60rem; }
main.kind-form > form > .form-actions {
  margin: 0;
  padding: var(--s3) 0;
  border-top: 1px solid var(--rule);
  background: none;
}
/* A sheet's buttons kept in view are the sheet's own foot, to its edges and inside its border, not the page's. */
main.kind-form > form:has(> .form-body) > .form-foot {
  margin: 0 calc(-1 * var(--s5)) calc(-1 * var(--s4));
  padding-left: var(--s5); padding-right: var(--s5);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
/* Inside the sheet the measure classes do not limit the width. */
main.kind-form > :is(form, div) > fieldset.read-only > .form-body > :is(.measure, .panel),
main.kind-form > form > .form-body > .measure,
main.kind-form > form > .form-body > .panel { padding: 0; margin: 0; }


.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s4);
}
/* The page's heading, with its pill and its buttons, stays under the bar while the page scrolls. */
/* It is a white band across the window, joined to the bar above it, with a soft shade along its foot: the page's name
   and its buttons read as the head of the sheets below. */
main > .page-head, main > form > .page-head, main > div:has(> fieldset.read-only) > .page-head {
  position: sticky; top: var(--bar); z-index: 12;
  margin: calc(-1 * var(--s4)) calc(-1 * var(--s5)) var(--s4); padding: var(--s3) var(--s5);
  background: var(--panel); border-bottom: 1px solid var(--rule); box-shadow: var(--head-shade);
}
/* A window this short (a phone held sideways): the bar, the page's heading and the parts kept beside them scroll away
   with the page, which would otherwise be left a strip to read between them. */
@media (max-height: 500px) {
  .masthead, main > .page-head, main > form > .page-head, main > div:has(> fieldset.read-only) > .page-head,
  table.grid > thead th, .settings-menu, .settings-side, .beside > .beside-file, .template-preview, .mail-folders, .mail-read { position: static; }
  html { scroll-padding-top: 0; }
}
main > form.panel > .page-head { background: var(--panel); border-radius: var(--r) var(--r) 0 0; }
/* Under a section's page links the heading keeps its place below them. */
main > .section-nav + .page-head { margin-top: 0; }
/* Beside Admin's menu the heading keeps to its own column. */
@media (max-width: 820px) {
  main > .page-head, main > form > .page-head, main > div:has(> fieldset.read-only) > .page-head { position: static; }
}
/* The title row of every page: the pill, the title, its count, its tags and the help icon, set apart by the one gap,
   with no margin or nudge of their own. Words sit on the line of the title's words: a sentence or a count beside it,
   and the title's own words after the pill; the pill, tags and icons are centred on the row. A sentence marked
   under-title starts a line of its own. */
.page-head > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s2); min-width: 0; }
.page-head > div:first-child > * { margin-top: 0; margin-bottom: 0; }
.page-head > div:first-child > :is(.tag, .help-link) { align-self: center; }
.page-head h1 { margin: 0; display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s3); line-height: 1.2; }
.page-head h1 > :is(.page-word:not(.alone), .tag, .help-link, .icon-button) { align-self: center; }
.page-head .help-link { margin-left: 0; vertical-align: 0; }
/* A name in a title that leads to its record reads as the title, and is underlined under the pointer. */
/* A title of two parts, such as a patient and a day: a dot between them on one line, none where the second drops
   under. Each part carries its dot in a gutter at its left, and the gutter at the start of a line is cut off. */
.title-parts { display: flex; flex-wrap: wrap; min-width: 0; margin-left: -0.9em; clip-path: inset(0 0 0 0.9em); }
.title-part { position: relative; padding-left: 0.9em; }
.title-part::before { content: "·"; position: absolute; left: 0; width: 0.9em; text-align: center; }
.page-head h1 a { color: inherit; text-decoration: none; }
/* The pencil beside a title is as quiet as every other pencil until it is pointed at. */
.page-head h1 a.icon-button { color: var(--field-line); }
.page-head h1 a.icon-button:hover { color: var(--accent-deep); }
.page-head h1 a:hover, .page-head h1 a:focus-visible { text-decoration: underline; }
.page-head .lede { color: var(--ink-soft); margin: 0; }
/* A second line under a record's title: the facts that place it, apart from whose it is. */
.page-head .lede.under-title { flex-basis: 100%; font-size: var(--t-dense); }
/* How many the list holds, quiet beside its title; no full stop on a count. */
.title-count { color: var(--ink-faint); font-size: var(--t-bar); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A heading with a count sets the count apart the same way whether or not its section folds. */
h2:not(.fold-title):has(> .title-count) { display: flex; align-items: baseline; gap: var(--gap-fields); }
/* The count sits on the line of the heading's words, a folding heading's too; its buttons and icons stay centred. */
.fold-title:has(> .title-count) { align-items: baseline; }
:is(h2, .fold-title):has(> .title-count) > :is(.help-link, button, .icon-button, .tip) { align-self: center; }
/* The actions keep to one row beside the title, and a long title wraps; where they leave the title less than its
   least room they go on a row of their own under it, and wrap there only when that row is too narrow for them. */
.page-head { flex-wrap: wrap; }
.page-head .actions { display: flex; gap: var(--s2); align-items: center; flex: 0 1 auto; flex-wrap: wrap; max-width: 100%; }
.page-head > div:first-child { flex: 1 1 22rem; }
@media (max-width: 820px) {
  .page-head .actions { flex: 1 1 auto; }
}
.page-head .actions form { margin: 0; display: flex; gap: var(--s2); align-items: center; }
.page-head .actions .check { margin: 0; }

/* A section's pages, above the heading. They are drawn as tabs, by the one set of tab rules further down; this is only where the row sits. */
.section-nav { margin-bottom: var(--s4); }

/* A button with the rest of what it can do behind an arrow joined to it. A section's heading is .panel-head.split: its buttons stand alone. */
.split { display: inline-flex; }
.split:not(.panel-head) > .button, .split:not(.panel-head) > form > .button { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split:not(.panel-head) > .dropdown > .button { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; padding-left: 6px; padding-right: 6px; }
.dropdown { position: relative; display: inline-flex; }
.dropdown > summary { list-style: none; cursor: pointer; }
/* A button that opens a menu carries a chevron after its words, turned up while the menu is open. */
details.dropdown:has(> .dropdown-menu) > summary.button::after {
  content: ""; display: inline-block; width: 6px; height: 6px; margin: -4px 0 0 var(--s2);
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform 120ms;
}
details.dropdown[open]:has(> .dropdown-menu) > summary.button::after { margin-top: 3px; transform: rotate(-135deg); }
/* The arrow joined to a button is the chevron alone. */
.split:not(.panel-head) > details.dropdown > summary.button::after { margin-left: 0; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown[open] > summary { background: var(--raised); border-color: var(--rule-strong); }
.dropdown-menu {
  position: absolute; top: calc(100% + 3px); right: 0; z-index: 40; min-width: 210px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r);
  box-shadow: var(--float); padding: var(--s1) 0;
}
.dropdown-menu a {
  display: flex; align-items: center; gap: 7px; padding: 7px var(--s3);
  color: var(--ink); font-weight: var(--w-text); font-size: var(--t-body); text-decoration: none; white-space: nowrap;
}
.dropdown-menu a:hover { background: var(--accent-wash); color: var(--accent); }
/* A choice under a page's More that removes or ends something. */
.dropdown-menu a.danger, .dropdown-menu a.danger:hover { color: var(--bad); }
.dropdown-menu a.danger:hover { background: var(--bad-wash); }
/* The ministry connection in the account menu: a dot, green set up, red not. */
.dropdown-menu .connection {
  display: flex; align-items: center; gap: var(--s2); padding: 7px var(--s3); margin-bottom: var(--s1);
  border-bottom: 1px solid var(--rule-soft); color: var(--ink); font-weight: var(--w-strong); font-size: var(--t-body); white-space: nowrap;
}
.dropdown-menu .connection .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
.dropdown-menu .connection.on .dot { background: var(--good); }
/* A tick box in a menu takes the menu's own margin, like its links. */
.dropdown-menu > .check { padding: 5px var(--s3); margin: 0; font-size: var(--t-body); }
/* An entry that posts is drawn as an entry that links: its icon faint, a gap before its words. */
.dropdown-menu button:has(> .icon) { align-items: center; gap: 7px; }
.dropdown-menu a .icon, .dropdown-menu button > .icon { color: var(--ink-faint); }
/* A panel is a section of a page: a white sheet with a hairline round it and its name at its head. */
.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s5) var(--s5);
  margin-bottom: var(--gap);
  box-shadow: var(--lift-card);
}
.panel:last-child { margin-bottom: 0; }
/* A panel inside a panel, or inside a dialog, is a group and not a second sheet. */
.panel .panel, .sheet .panel { background: none; border: 0; border-radius: 0; padding: 0; box-shadow: none; margin-bottom: var(--gap-section); }
.panel > .panel-head {
  background: none;
  color: inherit;
  margin: 0 0 var(--s3);
  padding: 0;
  border: 0;
  border-radius: 0;
}
.panel > .panel-head h2 {
  font-size: var(--t-panel);
  font-weight: var(--w-strong);
  line-height: 1.35;
  color: var(--ink);
  border: 0;
  padding: 0;
  margin: 0;
}
.panel > .panel-head > .lede, .panel > .panel-head > .card-name > .lede, .panel > .lede {
  color: var(--ink-faint);
  font-size: var(--t-dense);
  margin: 2px 0 0;
}
.panel > .lede { margin-bottom: var(--s3); }
/* A count or a tab set beside the name. */


.panel.flush { padding: 0; overflow: visible; }
/* A head with nothing in it takes no room. */
.panel > .panel-head:not(:has(*)) { display: none; }
/* A flush panel holds a table edge to edge; its head keeps the panel's own margin. */
.panel.flush > .panel-head {
  padding: var(--s4) var(--s5) 0;
  border-bottom: 0;
  margin: 0 0 var(--s3);
  background: none;
  border-radius: 0;
}
/* A heading with something beside it: the heading takes the room so the end lines up across panels. */
/* A list's filters inside its panel: a row of their own under the title. */
.panel.flush > form.finder { padding: 0 var(--s5); margin: 0 0 var(--s3); }
/* A band about the list stands under the title within the panel's margin, as the filters do. */
.panel.flush > .message { margin: 0 var(--s5) var(--s3); }
.panel-head.split { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.panel-head.split > :first-child { flex: 1; min-width: 0; }
/* On a phone a heading keeps its words whole: what stands beside it goes under it when both do not fit. */
@media (max-width: 820px) {
  .panel-head.split { flex-wrap: wrap; }
  .panel-head.split > :first-child { flex-basis: 9rem; }
}

/* A panel that narrows a list: no sheet, a rule under it, small labels above the controls. */
.panel.filters, form.panel.narrowing {
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  box-shadow: none;
  padding: 0 0 var(--s3);
  border-radius: 0;
}
.panel.filters, form.panel.narrowing { margin-bottom: var(--gap); }
/* A filter's label is a field's label: the same size and ink as on a form. */
.panel.filters label, form.panel.narrowing label {
  font-size: var(--t-dense);
  font-weight: var(--w-text);
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: 3px;
}
.panel.filters input, .panel.filters select,
form.panel.narrowing input, form.panel.narrowing select { background-color: var(--panel); }

/* The section that wants somebody: a hairline of the signal down the table's left edge. */
.panel.attention > .table-wrap, .panel.attention > .fold-body .table-wrap { border-left: 2px solid var(--signal); }
.panel-foot {
  padding: var(--s2) var(--gap);
  border-top: 1px solid var(--rule);
  background: var(--raised);
  font-size: var(--t-small);
  color: var(--ink-soft);
}
/* A form kept behind its button at a section's foot: opened, it is the section's own sheet at the body's size. */
details.opens.panel-foot { padding-block: var(--s3); }
details.opens.panel-foot[open] { padding: var(--s4) var(--gap); background: var(--panel); font-size: var(--t-body); color: var(--ink); }
/* The documents an email carried, one after another on a line, a dot between two. */
.sent-doc { display: inline-block; }
.sent-doc:not(:last-child)::after { content: "·"; margin: 0 var(--s1) 0 var(--s2); color: var(--ink-faint); }
/* A foot that is only the way on to the whole list is a link, at a link's size. */
.panel-foot > a:only-child { font-size: var(--t-body); }
/* A foot that ends its panel takes the panel's corners. */
.panel.flush > .panel-foot:last-child, .panel.flush > :is(div, form):last-child > .panel-foot:last-child { border-bottom-left-radius: calc(var(--r-lg) - 1px); border-bottom-right-radius: calc(var(--r-lg) - 1px); }
.panel-foot.actions { display: flex; gap: var(--gap-fields); align-items: center; flex-wrap: wrap; }
/* What can be done with the rows ticked: shown while any is, fixed at the bottom of the window. */
.panel-foot.actions[data-selection] { position: sticky; bottom: 0; z-index: 4; box-shadow: 0 -1px 0 var(--rule), var(--lift-up-near); }
.js form:not(:has(tbody input[type="checkbox"]:checked)) .panel-foot.actions[data-selection] { display: none; }
.selection-count { margin-right: var(--s2); font-variant-numeric: tabular-nums; }
.selection-every { margin-right: var(--s2); }
.panel-foot.actions[data-selection] input[type="text"] { flex: 0 1 20rem; width: 20rem; }
.panel-foot.actions[data-selection] select, .panel-foot.actions[data-selection] input.choose { flex: 0 1 14rem; width: 14rem; }
/* A line of text inside a flush panel, where a table would be. */
.panel.flush .padded { padding: var(--s3) var(--gap); margin: 0; }

.notice {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--lift);
}
.notice .notice-find { max-width: 420px; margin: var(--s3) 0; }
.notice .label { display: block; font-size: var(--t-small); color: var(--ink-soft); margin-bottom: 2px; }

/* A page is one column: its sections stack at full width, and what follows them keeps the same space. */
.columns { display: grid; gap: var(--gap); align-items: start; grid-template-columns: minmax(0, 1fr); }
.columns:not(:last-child) { margin-bottom: var(--gap); }
@media (min-width: 1100px) {
  /* Facts in a full-width section run two pairs to a line. */
  .columns .kv { grid-template-columns: max-content 1fr max-content 1fr; column-gap: var(--s5); }
}
/* On a wide window they run three pairs to a line, so the section is used across its whole width. */
@media (min-width: 1420px) {
  .columns .kv { grid-template-columns: repeat(3, max-content 1fr); }
}
/* The portal's item beside the file it was sent with: one column, and on a wide window the file at the right, in view while the item scrolls. */
.beside { display: grid; gap: var(--gap); align-items: start; grid-template-columns: minmax(0, 1fr); }
.beside > * { min-width: 0; }
@media (min-width: 1420px) {
  .beside { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  /* Clear of the page's sticky heading however many lines it wraps to; the viewer takes what the column's other parts leave. */
  .beside > .beside-file { position: sticky; top: calc(var(--bar) + var(--page-head, 76px) + var(--s3)); display: flex; flex-direction: column; height: calc(100vh - var(--bar) - var(--page-head, 76px) - var(--s3) - var(--gap)); overflow-y: auto; }
  .beside > .beside-file > .file-viewer { flex: 1 1 auto; height: auto; min-height: 320px; margin-bottom: 0; }
}
/* An intake item, a claim and the claim form: the record, then the file it was made from under it at the page's full width,
   as tall as the window leaves under the sticky heading, which a link to it clears. */
.with-file > .file-pane { scroll-margin-top: calc(var(--bar) + var(--page-head, 0px) + var(--s3)); }
.with-file > .file-pane > .file-viewer:not(:has(.fv-text)) { height: calc(100vh - var(--bar) - var(--page-head, 76px) - var(--s3) - var(--gap)); min-height: 420px; }
/* A record's parts and what follows them, the file or more of the record, a section's gap apart, where the last part is a
   panel that keeps none of its own (a row of cards keeps its gap). */
.with-file-main:not(:last-child) > .panel:last-child { margin-bottom: var(--gap); }
/* The patient's recent billing on the claim form is drawn again in place; while it is there it keeps a section's gap under it. */
[data-live-region="patient-recent"]:has(> .panel) { margin-bottom: var(--gap); }
.billed-from { margin: 0 0 var(--gap); }
/* The paperclip beside what opens a row's record, on every list: how many documents or files the record holds. */
.kept-count { display: inline-flex; align-items: center; gap: 2px; margin-left: var(--s2); color: var(--ink-faint); font-family: var(--sans); font-size: var(--t-caption); font-variant-numeric: tabular-nums; text-decoration: none; }
.kept-count:hover { color: var(--accent-deep); }
/* The viewer in a file column, among the column's other sections: most of the window's height. */
.beside-file > .file-viewer, .file-pane > .file-viewer { height: calc(100vh - var(--bar) - 200px); min-height: 380px; margin-bottom: var(--gap); }
/* A file shown by its words is as tall as they are, up to that height: a note of four lines is not a window of blank paper. */
.beside-file > .file-viewer:has(:where(.fv-text)), .file-pane > .file-viewer:has(:where(.fv-text)) { height: auto; min-height: 0; max-height: calc(100vh - var(--bar) - 200px); }
.beside-file > .fv-choose, .file-pane > .fv-choose { margin-bottom: var(--s2); }
/* The files of an intake item as tabs over its viewer, Add file at the end; the file's facts under the viewer. */
.file-tabs-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.file-tabs-row > .file-tabs { flex: 1 1 auto; min-width: 0; }
.file-tabs .chip { max-width: 100%; }
.file-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 18rem; }
.file-tabs .chip.left-out-chip { border-color: var(--warn-line); color: var(--warn); }
.file-add { position: relative; }
.file-add > summary { list-style: none; }
.file-add > summary::-webkit-details-marker { display: none; }
/* The panel Add file opens is the row's next line, so the button stays where it was pressed. */
.file-tabs-row > .file-add-panel { display: none; flex: 1 0 100%; padding: var(--s3); border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--panel); }
.file-tabs-row:has(> .file-add[open]) > .file-add-panel { display: block; }
.file-gone { display: flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s2); }
.file-facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); margin-bottom: var(--s2); }
.file-facts .file-role { display: inline-flex; align-items: center; gap: var(--s2); margin: 0; }
.file-facts .file-role label { margin: 0; color: var(--ink-faint); white-space: nowrap; }
.file-facts .file-role select { width: auto; }
.file-facts .file-facts-end { margin-left: auto; }
/* The file's name is on its tab: the viewer's bar does not say it again. */
.beside-file:has(> .file-tabs-row) .fv-name, .file-pane:has(> .file-tabs-row) .fv-name { display: none; }
/* A document shown by its own words: a note over them. */
.fv-words-note { margin: var(--s2) var(--s3) 0; }
/* A service read off a file says its code's words; the line as read is under them. */
table.grid td .sub { display: block; color: var(--ink-faint); font-size: var(--t-small); }
/* A file column that a phone leaves out: the record's own list opens the file there. */
@media (max-width: 820px) {
  .beside > .beside-file.not-on-phone { display: none; }
}
.fv-choose .chip.current { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-deep); }
/* The figures over a list in a flush section keep the section's margin. */
.panel.flush.recent-billing > .figures { padding: 0 var(--s5); margin: 0 0 var(--s4); }
/* A message mark leads a row's first words: it has no ring of its own beside the tag's, and sits clear of the name. */
.tag.word-mark { margin-right: var(--s2); text-decoration: none; }
/* An intake row's patient: the name whole on its line, the marks on the line under it. */
.patient-cell .who { display: block; white-space: nowrap; }
.patient-cell .marks { display: flex; flex-wrap: wrap; gap: var(--s1); }
.patient-cell .marks:not(:has(.tag)) { display: none; }
.patient-cell .marks .word-mark { margin-right: 0; }
.tag.word-mark.word-mark::before { content: none; display: none; }
.tag.word-mark svg { margin-right: 3px; vertical-align: -1px; }
/* The short sections of a record sit side by side as cards, all one height. A long list is a section under them. */
.cards { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: stretch; margin-bottom: var(--gap); }
.cards > * { margin-bottom: 0; min-width: 0; }
/* An empty row of cards takes no room. */
.cards:not(:has(> *)) { display: none; }
/* Two things side by side inside one section, level at the top; one under the other on a narrow window. */
.pair { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); align-items: start; }
.pair > *, .pair > .message { min-width: 0; margin: 0; }
/* A short form in a card wraps inside it. */
.cards .inline-form { flex-wrap: wrap; }
.cards .inline-form input { flex: 1 1 140px; width: auto; min-width: 0; }
/* One of several records listed in a card, each with its own pencil: a rule between two. */
.covered + .covered { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--rule); }
.covered .icon-button { vertical-align: middle; }
/* A long address or key in a card breaks where it must rather than widening the card. */
.wrap-anywhere { overflow-wrap: anywhere; }
/* Facts in a card run one pair to a line, whatever the page around it does. */
.cards .kv { grid-template-columns: max-content 1fr; column-gap: var(--gap); }
/* Cards that each hold a small table go two to a row; one alone takes the row. */
.cards.halves { grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); }
/* A card's head: its name, and the pencil that opens it, or Cancel and Save while it is open. */
.card-head { align-items: center; min-height: 28px; }
/* A head of one line, where the page's head names the card, keeps the line's own height. */
.card-head:not(:has(h2)) { min-height: 0; }
.card-head .button-row { flex-wrap: nowrap; }
/* On a phone a card's buttons wrap under one another, and a long button's words wrap inside it, never past the screen. */
@media (max-width: 820px) {
  .card-head .button-row { flex-wrap: wrap; }
  :is(a, button).button { max-width: 100%; white-space: normal; }
}
/* A long name breaks rather than widening its card; an icon before it, in the accent, sets a group apart. */
.card-head h2 { overflow-wrap: break-word; }
.card-head h2:has(> .heading-icon) { display: flex; align-items: center; gap: var(--s2); }
.card-head .heading-icon { flex: none; color: var(--accent); }
/* A card with nothing in it yet is one line: its name, what is not there, and its presses at the right. */
/* Beside a taller card in a row, the line stays in the middle of its card. */
.panel.empty-line { display: flex; flex-direction: column; justify-content: center; padding: var(--s3) var(--s5); }
.panel.empty-line > .panel-head { margin: 0; padding: 0; }
@media (max-width: 820px) {
  .card-head > h2 { flex: 0 1 auto; max-width: 100%; }
  .card-head > h2, .card-head > h2 * { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
}
.panel.empty-line > .under-head:not([hidden]) { margin-top: var(--s3); }
/* An empty card's name never breaks inside a word: on a narrow card, No ... yet goes under it instead. */
.panel-head.split:has(> .card-empty) { flex-wrap: wrap; row-gap: var(--s1); }
.panel-head.split:has(> .card-empty) > :first-child { flex: 0 0 auto; }
.card-head > .card-empty { flex: 1 1 12rem; min-width: 0; margin: 0; color: var(--ink-soft); }
.card-head > .card-empty + * { margin-left: auto; }
/* On a phone what is not there goes under the name. */
@media (max-width: 820px) { .card-head > .card-empty { flex-basis: 100%; order: 1; } }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex: none;
  border-radius: var(--r); color: var(--field-line); vertical-align: middle; transition: background-color 120ms ease, color 120ms ease;
}
.icon-button:hover { background: var(--accent-wash); color: var(--accent-deep); }
button.icon-button { padding: 0; border: 0; background: none; cursor: pointer; }
button.icon-button:hover { background: var(--accent-wash); }
/* Two small cards share a column; the last takes what height is left. */
.cards > .stack { display: flex; flex-direction: column; gap: var(--gap); }
.cards > .stack > .panel { margin-bottom: 0; }
.cards > .stack > .panel:last-child { flex: 1; }
/* Such a pair in a fourth place: where three cards fit a row it lies under them side by side, not alone in one column;
   where four fit, or two, it is a column as the rest. */
.cards:has(> .stack:nth-child(4):last-child) { display: flex; flex-wrap: wrap; }
.cards:has(> .stack:nth-child(4):last-child) > * { flex: 1 1 300px; }
.cards > .stack:nth-child(4):last-child { flex-direction: row; flex-wrap: wrap; }
.cards > .stack:nth-child(4):last-child > .panel { flex: 1 1 300px; }

/* A block of facts: label on the left, value on the right. */
/* A value with no place to break (an address, a long file name) wraps inside its box rather than running out of it. */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s1) var(--gap); margin: 0; font-size: var(--t-dense); }
.kv dt { color: var(--ink-faint); font-size: var(--t-small); padding-top: 1px; white-space: nowrap; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
/* On a narrow window a long label wraps within under half the width, so the facts never push the page sideways. */
@media (max-width: 820px) {
  .kv, .cards .kv, .record-card .kv { grid-template-columns: fit-content(45%) minmax(0, 1fr); }
  .kv dt { white-space: normal; }
  .kv dd { overflow-wrap: anywhere; }
}

/* A record's details: its short parts in two columns, each a small heading with its pencil over label and value rows,
   the labels at least one width across the parts so the values line up, a longer label on one line. One column on a
   narrow window. */
.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--gap-section); }
.details-column { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
/* Two lists of facts in one part stand a step apart. */
.details .kv + .kv { margin-top: var(--s2); }
/* A Details panel of one part (a tab of Settings) runs the panel's width. */
.details > :only-child { grid-column: 1 / -1; }
.part-head { display: flex; align-items: center; gap: var(--s2); min-height: 26px; margin-bottom: var(--s2); padding-bottom: var(--s1); border-bottom: 1px solid var(--rule-soft); }
.part-head h3 { flex: 1; min-width: 0; margin: 0; font-size: var(--t-body); font-weight: var(--w-strong); color: var(--ink); }
.details .kv { grid-template-columns: minmax(10.5rem, max-content) minmax(0, 1fr); }
.details .kv dd .icon-button { width: 22px; height: 22px; vertical-align: middle; }
.part-empty { margin: 0; font-size: var(--t-dense); }
.details .covered { font-size: var(--t-dense); }
.details .covered + .covered { margin-top: var(--s2); padding-top: var(--s2); border-top-color: var(--rule-soft); }
/* What a part holds beyond its rows, folded on the row it belongs to: the ministry's whole answer on a health card. */
.details details.on-row { display: inline; }
.details details.on-row > summary { display: inline; cursor: pointer; color: var(--accent); font-size: var(--t-dense); }
.details details.on-row[open] > summary { margin-bottom: var(--s2); }
.details details.on-row > .on-row-body { display: block; margin-top: var(--s2); }
@media (max-width: 820px) {
  .details { grid-template-columns: minmax(0, 1fr); row-gap: var(--s4); }
  .details .kv { grid-template-columns: fit-content(45%) minmax(0, 1fr); }
}

/* A section's form behind a press in its head (Add note, Set reminder, Send question): shown under the head only once
   the press is pressed (panels.js). */
.under-head { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.under-head[hidden] { display: none; }
.under-head > .button { justify-self: start; }

/* A page of short points: each heading, with its glyph, over a sentence or two. */
.points { margin: 0; }
.points dt { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s4); font-weight: var(--w-strong); color: var(--ink); }
.points dt:first-child { margin-top: 0; }
/* The glyphs differ in width; each sits in the same box, so the headings start on one line. */
.points dt svg { flex: 0 0 18px; color: var(--accent); }
.points dd { margin: var(--s1) 0 0; font-size: var(--t-dense); line-height: 1.5; color: var(--ink-soft); }

/* === 5. Forms ========================================================== */

label { display: block; font-size: var(--t-dense); font-weight: var(--w-mid); color: var(--ink-soft); margin-bottom: 3px;
        white-space: nowrap; }
/* A label's name stays on one line; a long hint after it wraps before it would push a phone's page sideways. */
label .hint { font-weight: var(--w-text); color: var(--ink-faint); white-space: normal; }

input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="date"],
input[type="time"], input[type="month"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  padding: 6px var(--s2);
  border: 1px solid var(--field-line);
  border-radius: var(--r);
  background: var(--panel);
  font: inherit;
  font-size: var(--t-body);
  color: var(--ink);
  min-height: var(--control);
}
input[type="search"] { -webkit-appearance: none; appearance: none; }
/* A choice box is drawn like the other fields, with the application's own caret; a multi-row list keeps the browser's look. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none; padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
/* Where a file is chosen or dropped (file-field.js): one dashed box everywhere, which lights when a file is over it and names the file once it has one. */
.drop {
  position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 52px; margin: 0; padding: var(--s3) var(--s4);
  border: 1.5px dashed var(--field-line); border-radius: var(--r-lg); background: var(--raised); cursor: pointer; white-space: normal;
  transition: border-color 120ms, background-color 120ms;
}
.drop:hover, .drop.over, .drop:focus-within { border-color: var(--accent); background: var(--accent-wash); }
.drop:focus-within { box-shadow: var(--focus); }
.drop-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--panel); border: 1px solid var(--rule); color: var(--accent-deep); }
.drop-words { font-size: var(--t-body); color: var(--ink-soft); }
.drop-words strong { color: var(--accent-deep); font-weight: var(--w-strong); }
.drop-chosen { flex: 1 1 auto; min-width: 0; font-size: var(--t-body); font-weight: var(--w-strong); color: var(--ink); overflow-wrap: anywhere; }
.drop.has { border-style: solid; border-color: var(--accent-line); background: var(--panel); cursor: default; }
.drop.has .drop-icon { background: var(--accent-wash); border-color: var(--accent-line); }
.drop-clear { flex: none; margin-left: auto; }
/* The field stays in the box, out of sight, for the keyboard and for the form. */
.drop > input.drop-field { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; clip-path: inset(50%); }
.drop-then { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); }
.drop-then label { margin: 0; }
.drop-then select, .drop-then input.choose { width: auto; }
.js form[data-drop]:not(.has-file) .drop-then { display: none; }
.panel-foot.attach { background: var(--panel); }
/* On a record, and in a row of other fields, the drop zone is one line, not a band. */
:is(.panel-foot.attach, .field.slim) .drop { padding: var(--s2) var(--s3); }
:is(.panel-foot.attach, .field.slim) .drop-words { font-size: var(--t-dense); color: var(--ink-soft); }
.field.slim .drop { min-height: var(--control); padding-top: 0; padding-bottom: 0; }
.field.slim .drop-icon { width: 24px; height: 24px; border: 0; background: none; }
.paid-line a { color: inherit; }
/* A panel that is a report under a list: closed until its heading or a link opens it. */
details.panel.folding > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
details.panel.folding > summary::-webkit-details-marker { display: none; }
details.panel.folding > summary::after {
  content: ''; width: 8px; height: 8px; margin-right: var(--s2); flex: 0 0 auto;
  border-right: 1.6px solid var(--ink-faint); border-bottom: 1.6px solid var(--ink-faint);
  transform: rotate(45deg); transition: transform 0.15s;
}
details.panel.folding[open] > summary::after { transform: rotate(225deg); }
details.panel.folding:not([open]) > summary { border-bottom: 0; }
/* A picture that came with an intake item, as wide as the half of the page it has. */
form.attach { margin-top: var(--s3); }
/* The button that chooses a file is one of the application's buttons. */
input[type="file"] { max-width: 100%; font-size: var(--t-dense); color: var(--ink-soft); }
input[type="file"]::file-selector-button {
  margin-right: var(--s3); padding: 6px var(--s3); border: 1px solid var(--field-line); border-radius: var(--r);
  background: var(--panel); color: var(--ink); font: inherit; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--raised); }
/* A fold opens on the application's own caret, which turns as it opens. */
details:not(.dropdown) > summary { list-style: none; cursor: pointer; }
details:not(.dropdown) > summary::-webkit-details-marker { display: none; }
details:not(.dropdown):not(.view-item):not(.opens):not(.secure-note) > summary::before {
  content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 9px 2px 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s ease;
}
details[open]:not(.dropdown):not(.view-item):not(.opens):not(.secure-note) > summary::before { transform: rotate(45deg); }
/* A card whose pencil unfolds a form under its head, where the form is a new record and not an edit of the card. */
/* Date and time controls are held to the text box height. */
input[type="date"], input[type="time"], input[type="month"] { height: var(--control); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
textarea { min-height: 0; }

/* A field in focus takes an accent border and a soft ring, not the double ring of section 2. */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
/* Under the pointer a field's edge darkens a step; its edge and ring change softly. */
:is(input, select, textarea):not([type="checkbox"], [type="radio"], [type="range"], [readonly], [disabled]):hover:not(:focus) { border-color: var(--ink-faint); }
:is(input, select, textarea):not([type="checkbox"], [type="radio"], [type="range"]) { transition: border-color 120ms ease, box-shadow 120ms ease; }

input[readonly] { background: var(--raised); color: var(--ink-soft); }
/* Start and End where the code needs no time: greyed, a click opens them. */
input.times-off { border-style: dashed; cursor: pointer; }
/* A box that cannot be typed in looks it. */
:is(input:not([type="checkbox"], [type="radio"]), select, textarea):disabled { background: var(--raised); color: var(--ink-soft); cursor: not-allowed; opacity: 1; }
input.money, input.number { text-align: right; font-variant-numeric: tabular-nums; }
input.upper { text-transform: uppercase; }
input.upper::placeholder { text-transform: none; }
::placeholder { color: var(--ink-faint); opacity: 1; }

/* A field that must be filled in is drawn on the pale sand, on every form: the control says so itself (`required`, or
   `aria-required` where the server alone checks it), and no page colours one. Where the field is not one box, the box that
   holds it is drawn on the sand: a set of choices of which one must be made says so on its `radiogroup` or `group`, and a
   file that must be chosen on the box it is dropped on. A message is typed in a box over its field, and that box says so. */
:is([role="radiogroup"], [role="group"])[aria-required="true"], .drop:where(:has(> input:is(:required, [aria-required="true"]))), .rich-text[aria-required="true"],
:is(input, select, textarea):where(:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"], [readonly], :disabled)):is(:required, [aria-required="true"]) { background-color: var(--required-wash); }
/* A field the ministry requires for the codes on the claim and that is not filled in yet: the same sand, and a line round it. */
input.wanted, select.wanted { background-color: var(--required-wash); border-color: var(--wanted-line); }
/* A field the last save refused, or the browser held the form on, whether it must be filled in or not: a very pale red. */
:is(input, select, textarea):where(:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])):is(.invalid, :user-invalid),
:is([role="radiogroup"], [role="group"], .drop).invalid, .drop:has(> input:user-invalid), .rich-text.invalid,
.field:has(> .field-error:not([hidden], :empty)) :is(input, select, textarea):where(:not([type="checkbox"], [type="radio"], [type="file"], [type="hidden"])) { border-color: var(--bad); background-color: var(--invalid-wash); }
/* A set of choices on the sand or the pale red is a box of its own, as a field is. */
:is([role="radiogroup"], [role="group"]):is([aria-required="true"], .invalid) { padding: var(--s2) var(--s3); border: 1px solid var(--rule); border-radius: var(--r); }
:is([role="radiogroup"], [role="group"]).invalid { border-color: var(--bad); }

/* Inputs with a fixed job get a fixed width, named by the job. */
input.w-code { width: 72px; }
input.w-dx { width: 60px; }
input.w-qty { width: 48px; }
input.w-pct { width: 50px; }
input.w-money { width: 76px; }
input.w-account { width: 104px; }
/* The browser's time and date controls, as narrow as they will draw. */
input.w-time { width: 84px; }
input.w-date { width: 128px; }
input.w-search { width: 220px; max-width: 100%; }

.field { margin-bottom: var(--gap-fields); min-width: 0; }
.field-note { font-size: var(--t-small); color: var(--ink-faint); margin-top: 3px; }
.field-note.tight { margin-top: -4px; }
/* How what is sent on the portal is protected: a lock in the accent before the words, and the points folded under them,
   opened in place so the form being filled in stays as it is. */
.secure-note > summary { display: flex; align-items: flex-start; gap: var(--s2); }
.secure-note > summary > svg { flex: none; margin-top: 0.2em; color: var(--accent); }
.secure-note .secure-more { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
.secure-note > summary:hover .secure-more { color: var(--accent); }
.secure-note .secure-more::after {
  content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 2px 2px 7px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform 0.15s ease;
}
.secure-note[open] .secure-more::after { transform: rotate(225deg); margin-bottom: -1px; }
.secure-note > .points { margin: var(--s3) 0 var(--s2) calc(var(--s3) + var(--s2)); }
.secure-note.on-page { margin: 0 0 var(--s4); }
.field-error { font-size: var(--t-small); color: var(--bad); margin-top: 3px; }
/* Under a narrow field in a row the field takes the room its message or its code's name needs, up to the row's width, where it wraps; the control keeps its width. */
.field-row > .field:is(.narrow, .tiny):is(:has(> .field-error), :has(> [data-term-name]:not([hidden]))) { flex: 0 1 auto; width: max-content; max-width: 100%; }
.field-row > .field:is(.narrow, .tiny):is(:has(> .field-error), :has(> [data-term-name]:not([hidden]))) > :not(label, .field-error, .field-note) { max-width: var(--field-width); }

/* A row of fields, each sized by what goes in it; a button in the row sits level with the inputs. */
.field-row { display: flex; gap: var(--gap-fields); flex-wrap: wrap; align-items: flex-start; }
.field-row > .field { flex: 1 1 140px; max-width: 22rem; margin-bottom: var(--gap-fields); }
/* A button in the row stands level with the boxes, not with their labels. */
.field-row > .button { align-self: flex-end; margin-bottom: var(--gap-fields); }
/* Fields that stay beside each other when the row breaks. */
.field-row > .together { flex: 1 1 290px; display: flex; gap: var(--gap-fields); min-width: 0; }
.field-row > .together > .field { flex: 1 1 140px; min-width: 0; max-width: 22rem; margin-bottom: var(--gap-fields); }
@media (max-width: 820px) {
  /* On a phone the fields kept together stack, each the width of the screen. */
  .field-row > .together { flex-wrap: wrap; }
  .field-row > .together > .field { flex-basis: 100%; max-width: none; }
  /* The physician's portal is used on a phone: every control there is tall enough for a thumb. */
  body[data-portal] { --control: 44px; }
  body[data-portal] .button.small { min-height: 44px; min-width: 44px; padding: 6px var(--s3); }
  body[data-portal] .dictate-over:has(> .dictate:not([hidden])) > textarea { padding-bottom: 56px; }
  body[data-portal] button.link { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
  body[data-portal] .stepper .button { min-width: 44px; justify-content: center; }
  body[data-portal] table.entry :is(input, select) { min-height: 44px; }
  body[data-portal] :is(.code-bar, .pick-group) .chip { min-height: 44px; padding: var(--s2) 14px; }
  body[data-portal] .dropdown-menu :is(a, button) { min-height: 44px; align-items: center; }
  body[data-portal] :is(.tabs, .section-nav) a { display: inline-flex; align-items: center; min-height: 44px; }
  body[data-portal] .chips.files .chip { display: inline-flex; align-items: center; min-height: 44px; }
  /* Its figures sit two abreast on a phone, so the list under them starts on the first screen. */
  body[data-portal] .figures { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  body[data-portal] .figure { padding-left: var(--s3); padding-right: var(--s3); }
  /* A page number is as tall as a thumb, and a list already the width of the phone has no Full screen. */
  body[data-portal] .pager-links :is(a, button, .current, .off) { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 7px; }
  body[data-portal] .pager { gap: var(--s3); }
  body[data-portal] .full-toggle { display: none; }
  /* The line that opens a folded message is tall enough to press. */
  body[data-portal] .thread details > summary { padding: var(--s2) 0; }
  /* And so is each tool over a message being written; the tools share one row. */
  body[data-portal] .rich-tools { flex-wrap: wrap; }
  body[data-portal] .rich-tools button { flex: 0 0 44px; width: 44px; height: 44px; }
  /* Seven tools of that size take two rows on a phone: the second mark between them, where the row breaks, is left out. */
  body[data-portal] .rich-tools .rich-gap ~ .rich-gap { display: none; }
  /* A list's search box takes the phone's width. */
  body[data-portal] .filter-row > form.filters { flex-basis: 100%; }
  body[data-portal] .filter-row > form.filters > .field.wide { flex: 1 1 100%; max-width: none; }
}
/* A short field's label, its hint too, stays on one line and the field is at least as wide, so its box is level with the row's. */
.field-row > .field:is(.tiny, .narrow) { min-width: min-content; }
.field-row > .field:is(.tiny, .narrow) > label .hint { white-space: nowrap; }
/* Two, four or six characters: a code, a version, a province. */
.field-row > .field.tiny, .finder > .field.tiny { flex: 0 0 76px; --field-width: 76px; }
/* A number, a date, a short choice. */
.field-row > .field.narrow, .finder > .field.narrow { flex: 0 0 132px; --field-width: 132px; }
/* A month and its year, with the browser's picker beside it. */
.field-row > .field.month, .finder > .field.month { flex: 0 0 196px; }
/* A name, a choice with long options. */
.field-row > .field.medium, .finder > .field.medium { flex: 0 1 240px; }
/* On a phone no field is wider than the screen; a row of options in it wraps. */
@media (max-width: 820px) { .finder > .field, .field-row > .field { max-width: 100%; min-width: 0; } }
.field-row > .field.wide, .finder > .field.wide { flex: 3 1 260px; max-width: 34rem; }
.field-row > .field.at-end { display: flex; align-items: flex-end; align-self: stretch; flex: 0 0 auto; gap: var(--gap-fields); }
.field-row > .field.at-end .button { justify-content: center; }
.field-row:last-child > .field { margin-bottom: 0; }
/* A row set apart from the one above it by a rule. */
.field-row.separated { margin-top: var(--gap); padding-top: var(--s3); border-top: 1px solid var(--rule); }

/* A fieldset is a section of a form, and a panel of its own. */
/* A fieldset is a group of fields, not a box: a caption over them and a rule under it. */
fieldset {
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  padding: var(--s3) 0 0;
  margin: 0 0 var(--gap-section);
  background: none;
  box-shadow: none;
  min-width: 0;
}
fieldset:last-child { margin-bottom: 0; }
/* The section that opens a form's sheet has nothing above it to be ruled off from; a hidden box or a band not yet
   shown is nothing. */
.form-body > fieldset:not(:not(input[type="hidden"], [hidden]) ~ *),
.form-body > .form-stack:not(:not(input[type="hidden"], [hidden]) ~ *) > fieldset:first-child { border-top: 0; padding-top: 0; }
legend { padding: 0 6px; margin: 0 0 6px -6px; font-size: var(--t-body); font-weight: var(--w-strong);
         color: var(--ink); float: left; width: 100%; }
/* Everything after the legend starts under it, whatever comes between. */
legend ~ * { clear: both; }
/* A long form: fieldsets stack, two abreast on a wide screen; one marked `full` takes the width. */
.form-stack { display: grid; grid-template-columns: 1fr; gap: var(--gap); margin-bottom: var(--gap); }
.form-stack > fieldset { margin: 0; }
/* A fixed value shown as a fact among the fields keeps a field's space after it. */
.form-stack fieldset > .kv:not(:last-child) { margin-bottom: var(--gap-fields); }
/* A section whose last field takes the height its neighbour leaves: a note beside a taller section. */
.form-stack > fieldset.fills { display: flex; flex-direction: column; }
.form-stack > fieldset.fills > .field:last-child { flex: 1 1 auto; display: flex; flex-direction: column; margin-bottom: 0; }
.form-stack > fieldset.fills > .field:last-child > :is(textarea, .dictate-over),
.form-stack > fieldset.fills > .field:last-child > .dictate-over > textarea { flex: 1 1 auto; resize: none; }
/* A wrapper a script shows and hides as one is not a cell: its fieldsets lay out as if unwrapped. */
.form-stack > div { display: contents; }
@media (min-width: 1100px) {
  .form-stack { grid-template-columns: 1fr 1fr; }
  .form-stack > fieldset.full { grid-column: 1 / -1; }
  /* A long section beside two short ones takes both rows, so the second short one starts under the first. */
  .form-stack > fieldset.tall { grid-row: span 2; }
  /* Where the second of two holds rows of a set length, it takes that and the first takes the rest. */
  /* Two abreast at the head of a form, on a page or in the widest dialog: the one beside the first starts level with it. */
  :is(main, .sheet.widest) .form-body > .form-stack:not(:not(input[type="hidden"], [hidden]) ~ *) > fieldset:first-child:not(.full) + fieldset:not(.full) { border-top: 0; padding-top: 0; }
  /* The same where the one beside the first is the first of a wrapper shown and hidden as one. */
  :is(main, .sheet.widest) .form-body > .form-stack:not(:not(input[type="hidden"], [hidden]) ~ *) > fieldset:first-child:not(.full) + div > fieldset:first-child:not(.full) { border-top: 0; padding-top: 0; }
}

.check { display: flex; align-items: center; gap: 6px; font-size: var(--t-dense); margin-bottom: var(--s1); }
.check label { margin: 0; font-weight: var(--w-text); color: var(--ink); white-space: normal; }
.check input { width: auto; }
/* A switch: a track, a sliding knob, and the word for where it stands. */
input[type="checkbox"].switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 36px; height: 20px; margin: 0;
  border: 0; border-radius: var(--r-round); background: var(--field-line); cursor: pointer; transition: background 0.15s ease;
}
input[type="checkbox"].switch::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--white); box-shadow: var(--knob); transition: transform 0.15s ease;
}
input[type="checkbox"].switch:checked { background: var(--accent); }
input[type="checkbox"].switch:checked::before { transform: translateX(16px); }
input[type="checkbox"].switch:focus-visible { outline: none; box-shadow: var(--focus); }
.switch:checked + label .when-off, .switch:not(:checked) + label .when-on { display: none; }

/* A search bar above a table. */
.finder { display: flex; gap: var(--gap-fields); flex-wrap: wrap; align-items: flex-end; }
.finder .field { margin-bottom: 0; }
/* A finder's fields take the field row's sizes, set once above. */
.finder > .field { flex: 1 1 160px; max-width: 320px; }
.finder > .field.at-end { flex: 0 0 auto; }
/* A control that belongs to the table, not to the search, goes to the far end of the row. */
.finder > .field[hidden] { display: none; }
/* The filters a list is seldom narrowed by wait behind More filters. */
html.js form:not(.show-extra) .finder > .field.extra, html.js form.filters:not(.show-extra) > .field.extra { display: none; }
/* A field drawn as joined buttons is as wide as its buttons. */
.field-row > .field:has(> .segmented), .finder > .field:has(> .segmented) { flex: 0 0 auto; max-width: none; }
@media (max-width: 820px) { .field-row > .field:has(> .segmented), .finder > .field:has(> .segmented) { flex: 0 1 auto; max-width: 100%; } }
/* A day either side of the period: two small buttons as one control; a spent one is drawn, not removed. */
.stepper { display: flex; align-items: stretch; }
.stepper > :first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.stepper > :last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.stepper .button { padding-left: var(--s3); padding-right: var(--s3); }
/* The days the period runs, between its two steps. */
.stepper-range {
  display: flex; align-items: center; padding: 0 var(--s3); margin: 0 -1px;
  border: 1px solid var(--field-line); background: var(--panel);
  font-size: var(--t-dense); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink);
}
.button.spent { color: var(--ink-faint); background: var(--raised); cursor: default; box-shadow: none; }
form[aria-busy="true"] .finder { opacity: 0.72; transition: opacity 120ms ease; }

/* A one-line search: a box and a button. */
.inline-form { display: flex; gap: 6px; align-items: center; }
/* Whose report a file is: the name and billing number in full. */
.inline-form.file-physician select, .inline-form.file-physician input.choose { min-width: 22rem; }
/* A choice saved as it is made needs no button; it says Saved beside itself for a moment. A named button does more
   than save the choice, such as Approve all on a list of ticks, and stays. */
.js form[data-save-on-change] button[type="submit"]:not([name]) { display: none; }
.saved-note { font-size: var(--t-small); color: var(--good); }
.saved-note.bad { color: var(--bad); }
/* A health card validation refused, said in its status line. */
.bad-note { color: var(--bad); }
.inline-form input { width: 220px; min-height: 30px; padding: var(--s1) var(--s2); }

/* The buttons under a form. */
.button-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
/* A row of presses under a section's facts stands apart from them, as a form's buttons do. */
:is(.kv, .pair) + .button-row { margin-top: var(--gap); }
.button.dictate { gap: 6px; }
.dictate-line { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0; border: 1px solid var(--field-line); border-radius: var(--r); background: var(--panel); color: var(--ink-soft); cursor: pointer; }
.dictate.recording { border-color: var(--bad); background: var(--bad-wash); color: var(--bad); }
.dictate:disabled { opacity: 0.6; cursor: progress; }
/* Dictation, under the box it fills (dictate.js), drawn as a call in progress: a red dot that pulses, the voice as bars
   running in from the right, the time against the two-minute limit, and Stop. Silence turns the words amber; while the
   words are made the bars become a wave in the accent; the box the words go into is lit for a moment. */
.dictation {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3);
  margin-top: var(--s2); padding: var(--s2) var(--s2) var(--s2) var(--s4);
  border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--rule)); border-radius: var(--r-lg);
  background: linear-gradient(90deg, var(--bad-wash), var(--panel) 65%); box-shadow: var(--lift-2);
  animation: dictation-in 180ms ease-out;
}
.dictation.leaving { opacity: 0; transform: translateY(-4px); transition: opacity 160ms ease, transform 160ms ease; }
.dictation-dot { position: relative; width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--bad); }
.dictation-dot::after { content: ""; position: absolute; inset: -5px; border: 2px solid var(--bad); border-radius: 50%; opacity: 0; animation: dictation-ring 1.4s ease-out infinite; }
.dictation-meter { display: flex; align-items: center; gap: 2px; flex: 1 1 140px; min-width: 112px; max-width: 260px; height: 28px; }
.dictation-meter i { flex: 1 1 0; height: 100%; border-radius: 2px; background: var(--bad); transform: scaleY(var(--level, 0.08)); transition: transform 70ms linear; }
.dictation-time { font-size: var(--t-dense); font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; }
.dictation-words { flex: 1 1 12rem; min-width: 0; font-size: var(--t-dense); color: var(--ink); }
.dictation-end { display: inline-flex; gap: var(--s2); margin-left: auto; }
.dictation-stop { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 2px; background: currentColor; }
.dictation[data-state="quiet"] .dictation-words { color: var(--warn); font-weight: var(--w-strong); }
.dictation[data-state="quiet"] .dictation-meter i { background: var(--ink-faint); }
.dictation:is([data-state="writing"], [data-state="done"]) { border-color: color-mix(in srgb, var(--accent) 30%, var(--rule)); background: linear-gradient(90deg, var(--accent-wash), var(--panel) 65%); }
.dictation:is([data-state="writing"], [data-state="done"]) .dictation-dot { background: var(--accent); }
.dictation[data-state="writing"] .dictation-dot::after { border-color: var(--accent); }
.dictation:is([data-state="writing"], .unmetered[data-state="recording"]) .dictation-meter i { transition: none; animation: dictation-wave 1.1s ease-in-out infinite; animation-delay: calc(var(--at) * 40ms); }
.dictation[data-state="writing"] .dictation-meter i { background: var(--accent); }
.dictation:is([data-state="done"], [data-state="failed"]) :is(.dictation-meter, .dictation-time) { display: none; }
.dictation:is([data-state="done"], [data-state="failed"]) .dictation-dot::after { animation: none; }
.dictation[data-state="failed"] { border-color: color-mix(in srgb, var(--warn) 35%, var(--rule)); background: var(--warn-wash); }
.dictation[data-state="failed"] .dictation-dot { background: var(--warn); }
/* The button pressed to record glows while it records. */
.dictate.recording { animation: dictation-glow 1.4s ease-out infinite; }
/* The box the words went into, lit for a moment so the eye finds them. */
:is(textarea, input).dictated { animation: dictated 1.8s ease-out; }
@keyframes dictation-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes dictation-ring { 0% { transform: scale(0.6); opacity: 0.7; } 100% { transform: scale(1.7); opacity: 0; } }
@keyframes dictation-wave { 0%, 100% { transform: scaleY(0.15); } 50% { transform: scaleY(0.85); } }
@keyframes dictation-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 40%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes dictated { from { background: var(--accent-wash); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); } }
@media (prefers-reduced-motion: reduce) {
  .dictation, .dictation *, .dictation *::after, .dictate.recording, :is(textarea, input).dictated { animation: none; transition: none; }
}
/* On a form, Delete stands at the far end of the row, away from Save and Cancel. */
.form-actions > .button.danger { margin-left: auto; }

/* The buttons under a long form, kept in view while it is being filled in. */
.form-foot {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  gap: var(--s2);
  align-items: center;
  flex-wrap: wrap;
  margin: 0 calc(-1 * var(--s4)) -64px;
  padding: var(--gap-fields) var(--s4);
  background: var(--veil);
  backdrop-filter: blur(4px);
  border-top: 1px solid var(--rule);
}
/* The bar is at the foot of the window whether the form is long or short. The page is at least as tall as the window, and what holds the bar takes the room that is left. */
main:has(.form-foot) { display: flex; flex-direction: column; min-height: calc(100vh - var(--bar)); }
main :has(.form-foot) { flex: 1 0 auto; }
main :has(.form-foot):not(.settings, .settings-main) { display: flex; flex-direction: column; }
main .settings > .settings-main:has(.form-foot) { align-self: stretch; }
main .form-foot { margin-top: auto; }
/* What a ready claim still needs, at the right of the bar, as words after "Still needed:"; the total after them, at the
   right end of whichever line it falls on. */
.form-foot .foot-end { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--s1) var(--s4); margin-left: auto; }
.form-foot .ready { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--s1) var(--s4); font-size: var(--t-dense); }
.form-foot .ready[hidden] { display: none; }
.form-foot .ready-item { color: var(--ink-soft); }
.form-foot .ready-item strong { color: var(--ink); font-weight: var(--w-strong); }
/* How many warnings the save would keep, and on which lines: amber, red where one keeps the claim out of a file; a press goes to the first. */
.form-foot .ready-warnings {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px var(--s2); border: 0; border-left: 3px solid var(--warn-line);
  border-radius: 0 var(--r) var(--r) 0; background: var(--warn-wash); color: var(--warn); font: inherit; font-weight: var(--w-strong);
  white-space: nowrap; cursor: pointer;
}
.form-foot .ready-warnings.file { border-left-color: var(--bad); background: var(--bad-wash); color: var(--bad); }
.form-foot .sum { margin-left: var(--s2); font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; }
.form-foot .sum strong { color: var(--ink); font-size: var(--t-sum); margin-left: 6px; }
/* On a narrow window the bar wraps, so it stops following the page and sits at the end of the form. */
@media (max-width: 820px) {
  .form-foot { position: static; }
  .button kbd { display: none; }
  .form-foot .ready { justify-content: flex-start; }
  .form-foot .sum { margin-left: auto; }
}

/* The keys that press a button, on its face. */
.button kbd { margin-left: 2px; font-size: var(--t-caption); }
.button.primary kbd { background: transparent; border-color: var(--on-accent-line); color: inherit; }

/* === 6. Buttons ======================================================== */

.button, button.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-body);
  font-weight: var(--w-mid);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  min-height: var(--control);
  box-shadow: var(--press-lift);
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}
.button svg { opacity: 0.8; }
.button:hover { background: var(--raised); color: var(--ink); border-color: var(--ink-faint); }
.button:active:not([disabled]) { box-shadow: none; background: var(--rule-soft); }
/* The main button: the accent, lit a little along its top edge. */
.button.primary { background: var(--accent); border-color: var(--accent-deep); color: var(--on-accent); font-weight: var(--w-mid);
                  box-shadow: var(--press-light), var(--press-lift); }
.button.primary svg { opacity: 1; }
.button.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--on-accent); }
.button.primary:active:not([disabled]) { background: var(--accent-deep); box-shadow: none; }
/* A button on a row of a list is plain, whatever it does: only the page's one main step is filled. */
.button.danger { color: var(--bad); border-color: var(--bad-line); }
.button.danger:hover { background: var(--bad-wash); }
/* Three weights: primary for the page's main action, plain for the rest, quiet for a link that is a button; disabled is the same button faded. */
.button[disabled], .button[disabled]:hover {
  opacity: 0.7;
  cursor: not-allowed;
  box-shadow: none;
  background: transparent;
  border-color: var(--rule);
  border-style: solid;
  color: var(--ink-faint);
}
.button.small { padding: 3px 10px; font-size: var(--t-small); min-height: 28px; border-radius: var(--r); }
/* In the head of a section or of a part of one every button is the small one, however it is drawn, so no head stands
   taller than its name. */
:is(.card-head, .part-head) :is(.button, summary.button) { padding: 3px 10px; font-size: var(--t-small); min-height: 28px; }
.button.quiet { box-shadow: none; background: transparent; border-color: transparent; color: var(--accent); }
.button.quiet:hover { background: var(--accent-wash); border-color: transparent; }

/* A small pressable chip: a quick code, a billing profile. */
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip, button.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  background: var(--panel);
  font: inherit;
  font-size: var(--t-small);
  font-weight: var(--w-mid);
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.chip:hover { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent-deep); }
.chip .mono { font-weight: var(--w-strong); }

/* The Views menu: each view opens from its name; the pencil unfolds what can be done to it. */
.views-menu { min-width: 300px; }
/* A small heading over a group of things in a menu. */

.views-menu .view-item > summary { display: flex; align-items: center; list-style: none; cursor: pointer; padding-right: var(--s2); }
.views-menu .view-item > summary::-webkit-details-marker { display: none; }
.views-menu .view-item > summary a { flex: 1; white-space: normal; }
.views-menu .view-item > summary a.current { color: var(--accent-deep); font-weight: var(--w-strong); }
.views-menu .view-edit { display: inline-flex; padding: 5px 6px; border-radius: var(--r); color: var(--ink-faint); }
.views-menu .view-item > summary:hover .view-edit, .views-menu .view-item[open] .view-edit { background: var(--accent-wash); color: var(--accent-deep); }
.views-menu .view-forms { display: grid; gap: 6px; padding: var(--s2) var(--s3); background: var(--raised); }
.views-menu .inline-form input[type="text"] { flex: 1; width: auto; min-width: 0; }
.views-menu .view-new { padding: var(--s2) var(--s3) var(--s1); }
.views-menu .view-item + .view-new { border-top: 1px solid var(--rule); margin-top: var(--s1); }
.views-menu .button, .views-menu .button:hover {
  display: inline-flex; width: auto; padding: 3px var(--s2); border: 1px solid var(--rule-strong);
  background: var(--panel); font-size: var(--t-small); color: var(--ink);
}
.views-menu .button:hover { background: var(--accent-wash); }
.views-menu .button.primary, .views-menu .button.primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.views-menu .button.danger, .views-menu .button.danger:hover { color: var(--bad); border-color: var(--bad-line); }

/* A filter in use, under the form it belongs to: pressing it takes it off. */
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: calc(-1 * var(--s2)) 0 var(--gap); }
.chip.on, button.chip.on { padding: 3px var(--gap-fields); border-radius: var(--r); border-color: var(--accent);
                           background: var(--accent); color: var(--on-accent); font-weight: var(--w-strong); }
.chip.on:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.chip.on svg { opacity: 0.85; }
/* A choice that cannot be made here, such as a template not started from here: faded, and its title says why. */
.chip.pick:has(input:disabled), .chip.pick:has(input:disabled):hover { background: var(--raised); border-color: var(--rule); color: var(--ink-faint); cursor: not-allowed; }

/* A button among the filters that has opened a row under them stays marked while the row is open. */
.finder button.button[aria-expanded="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-deep); }

/* A list's columns as a row of buttons over it, opened by the Columns button: lined up at the right, under the button,
   so the pointer has little way to go. The set on the first line where the list has sets, then every column, ticked
   while it is shown. Reset keeps its place at the left end, unseen until there is something to reset, so nothing
   moves when it shows. */
.column-row { margin: 0 0 var(--gap); }
/* The Columns button is always the last thing on a list's tabs' row, at its far end, and its row of columns opens under
   the tabs, over the grid. The list's filters, however few, sit on a line of their own above the tabs, so the button is
   in the same place on every list at every width. */
.tabs > .tabs-end { margin-left: auto; align-self: center; padding: 0 0 5px var(--s3); }
.filter-row > .tabs:has(> .tabs-end) { flex: 1 1 auto; }
.filter-row:has(> .tabs > .tabs-end) > form.filters { flex-basis: 100%; }
.filter-row + .column-row { margin-top: calc(var(--s3) - var(--gap)); }
/* On a list with no tabs the button stays at the far end of the first line of its filters, however many lines they
   take: it is out of their flow, and they leave it its room. It stands under a line the height of a label, level with the boxes. */
:is(.filter-row form.filters, .finder):has(> .field.far-end) { position: relative; padding-right: calc(7.2em + var(--gap-fields)); }
:is(.filter-row form.filters, .finder) > .field.far-end { position: absolute; top: 0; right: 0; margin: 0; }
:is(.filter-row form.filters, .finder) > .field.far-end::before { content: "\00a0"; display: block; font-size: var(--t-dense); margin-bottom: 3px; }
/* Filters with the button among them run the width of the page, so the button is at its far end. */
.filter-row form.filters:has(> .field.far-end) { flex-grow: 1; }
html.js .column-row:not(.open) { display: none; }
.column-row > form { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2) var(--s4); flex-wrap: wrap;
                     padding: var(--s2) var(--s3); border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--panel); }
.column-row button[name="reset"] { margin-right: auto; }
.column-row button[name="reset"].idle { visibility: hidden; }
.column-row > form[aria-busy="true"] { opacity: 0.72; transition: opacity 120ms ease; }
.column-set { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s2); flex: 0 0 100%; }
.column-set-pick { display: inline-flex; align-items: center; gap: var(--s2); }
.column-set label { margin: 0; font-size: var(--t-dense); font-weight: var(--w-text); color: var(--ink); white-space: nowrap; }
.column-set select { width: 15rem; }
.column-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 1 1 0; min-width: 0; }
.chip.column { padding: var(--s1) var(--gap-fields) var(--s1) var(--s2); border-radius: var(--r); color: var(--ink-soft); }

/* A chooser of a few fixed options, as a row of joined buttons. */
.segmented { display: inline-flex; flex-wrap: nowrap; }
/* On a phone the options wrap under one another rather than run past the screen. */
@media (max-width: 820px) { .segmented { flex-wrap: wrap; max-width: 100%; } }
.segmented button {
  min-height: var(--control); padding: 0 var(--s3); margin-left: -1px;
  border: 1px solid var(--rule-strong); background: var(--panel); color: var(--ink-soft);
  font: inherit; font-weight: var(--w-mid); white-space: nowrap; cursor: pointer;
}
.segmented button:first-child { margin-left: 0; border-radius: var(--r) 0 0 var(--r); }
.segmented button:last-child { border-radius: 0 var(--r) var(--r) 0; }
.segmented button:hover { background: var(--raised); }
.segmented button[aria-pressed="true"] { position: relative; background: var(--accent-wash); border-color: var(--accent-line);
                                         color: var(--accent-deep); font-weight: var(--w-strong); }
/* The choice that narrows nothing is not a filter in use: it rests, and only a real choice takes the accent. */
.segmented button[aria-pressed="true"][value=""] { background: var(--rule-soft); border-color: var(--rule-strong); color: var(--ink); }
/* The same row as links that narrow a list on the server; the one in force is marked current. */
.segmented a {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--control); padding: 0 var(--s3); margin-left: -1px;
  border: 1px solid var(--rule-strong); background: var(--panel); color: var(--ink-soft); font-weight: var(--w-mid); text-decoration: none; white-space: nowrap;
}
.segmented a:first-child { margin-left: 0; border-radius: var(--r) 0 0 var(--r); }
.segmented a:last-child { border-radius: 0 var(--r) var(--r) 0; }
.segmented a:hover { background: var(--raised); }
.segmented a.current { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent-deep); font-weight: var(--w-strong); }
/* A record opened from a list (_walk.ejs): the list it goes back to, its place there, and the steps either way. A step
   with nothing past it rests in the same box, so the control keeps its width from one record to the next. */
.segmented.walk > span {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--control); padding: 0 var(--s3); margin-left: -1px;
  border: 1px solid var(--rule-strong); background: var(--panel); white-space: nowrap; font-size: var(--t-body);
}
.segmented.walk > .walk-place { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.segmented.walk > .walk-end { color: var(--ink-faint); background: var(--raised); }
.segmented.walk > .walk-end:last-child { border-radius: 0 var(--r) var(--r) 0; }

/* Tabs and the filters beside them, above a list. */
/* The row a page's tabs sit in; its rule runs the full width. */
.filter-row {
  display: flex;
  gap: var(--gap-fields);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: var(--gap);
  border-bottom: 1px solid var(--rule-strong);
}
/* Under tabs the rule is a hairline, and the chosen tab's line of the accent lies on it. */
:is(.filter-row:has(> .tabs), .section-nav) { border-bottom: 1px solid var(--rule); }
/* The top of a list is one component: its filters and its tabs. Where both fit on one row the tabs are at the left, on
   the rule over the grid, and the filters at the far end of the same row. Where they do not fit, the row wraps upward:
   the filters go above the tabs, from the left. Every list draws it with `_list-filters` and `_list-tabs`; the order
   is set here and nowhere else. Wrapping upward turns the row's cross axis over, so its start is the rule. */
.filter-row:has(> form.filters) { flex-wrap: wrap-reverse; align-items: flex-start; }
/* The tabs take the room the filters leave, which puts the filters at the far end of a shared row. */
.filter-row:has(> form.filters) > .tabs { flex: 1 1 auto; }
.filter-row form.filters {
  display: flex;
  gap: var(--gap-fields);
  align-items: flex-end;
  flex-wrap: wrap;
  order: 1;
  flex: 0 1 auto;
  padding-bottom: 6px;
}

/* Tabs. One look wherever a row of them is drawn: a page's lists (.tabs) and a section's pages (.section-nav).
   Change a tab here and every tab in the application changes with it. */
:is(.tabs, .section-nav) { display: flex; flex-wrap: wrap; gap: 2px; }
/* On a phone the tabs keep to one line and slide under the finger, where they wrapped to three. */
@media (max-width: 820px) {
  :is(.tabs, .section-nav) { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  :is(.tabs, .section-nav)::-webkit-scrollbar { display: none; }
  :is(.tabs, .section-nav) a { flex: 0 0 auto; white-space: nowrap; }
  /* The edge with more tabs past it fades out (app.js marks which). */
  :is(.tabs, .section-nav).more-after { -webkit-mask-image: linear-gradient(to right, var(--black) calc(100% - 40px), transparent); mask-image: linear-gradient(to right, var(--black) calc(100% - 40px), transparent); }
  :is(.tabs, .section-nav).more-before { -webkit-mask-image: linear-gradient(to left, var(--black) calc(100% - 40px), transparent); mask-image: linear-gradient(to left, var(--black) calc(100% - 40px), transparent); }
  :is(.tabs, .section-nav).more-before.more-after { -webkit-mask-image: linear-gradient(to right, transparent, var(--black) 40px, var(--black) calc(100% - 40px), transparent); mask-image: linear-gradient(to right, transparent, var(--black) 40px, var(--black) calc(100% - 40px), transparent); }
}
/* A tab: its words on the rule, the chosen one in the deep accent with a line of the accent along its foot. */
:is(.tabs, .section-nav) a {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: var(--s2) var(--s3) 9px;
  margin-bottom: -1px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: var(--w-mid);
  white-space: nowrap;
  border: 0;
  border-radius: 0;
  transition: color 120ms ease, box-shadow 120ms ease;
}
/* Under 1420 pixels a tab gives up a little side room, so a long row of tabs keeps to one line at 1280. */
@media (max-width: 1420px) {
  :is(.tabs, .section-nav) a { padding-left: 8px; padding-right: 8px; }
  :is(.tabs, .section-nav) a .count { padding: 0 5px; }
}
/* Under the pointer a tab takes a pale wash of the accent and a mid-blue line along its foot. */
:is(.tabs, .section-nav) a:hover { color: var(--ink); box-shadow: inset 0 -2px 0 var(--rule-strong); }
:is(.tabs, .section-nav) a.current {
  color: var(--accent-deep);
  font-weight: var(--w-strong);
  box-shadow: inset 0 -2px 0 var(--accent);
}
:is(.tabs, .section-nav) a .count { align-self: baseline; }
:is(.tabs, .section-nav) a.current .count { background: var(--accent-wash); color: var(--accent-deep); }


/* === 7. Tables ========================================================= */

.table-wrap {
  overflow-x: auto;
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
  background: var(--panel);
  box-shadow: none;
  margin-bottom: var(--gap);
}
.table-wrap:last-child { margin-bottom: 0; }
.panel > .table-wrap:last-child { margin-bottom: 0; }
/* Inside a panel the table carries no shadow of its own. */
.panel .table-wrap { box-shadow: none; }
/* A grid that starts or ends its panel takes the panel's corners: the grid's box, and the cells in its corners. */
.panel.flush > .table-wrap:first-child, .panel.flush > :is(div, form):first-child > .table-wrap:first-child {
  border-top: 0; border-top-left-radius: calc(var(--r-lg) - 1px); border-top-right-radius: calc(var(--r-lg) - 1px);
}
:is(.panel.flush > .table-wrap:first-child, .panel.flush > :is(div, form):first-child > .table-wrap:first-child) > table.grid > thead > tr:first-child > th:first-child { border-top-left-radius: calc(var(--r-lg) - 1px); }
:is(.panel.flush > .table-wrap:first-child, .panel.flush > :is(div, form):first-child > .table-wrap:first-child) > table.grid > thead > tr:first-child > th:last-child { border-top-right-radius: calc(var(--r-lg) - 1px); }
.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child {
  border-bottom-left-radius: calc(var(--r-lg) - 1px); border-bottom-right-radius: calc(var(--r-lg) - 1px);
}
:is(.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child) > table.grid > :is(tbody, tfoot):last-child > tr:last-child > :is(td, th):first-child { border-bottom-left-radius: calc(var(--r-lg) - 1px); }
:is(.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child) > table.grid > :is(tbody, tfoot):last-child > tr:last-child > :is(td, th):last-child { border-bottom-right-radius: calc(var(--r-lg) - 1px); }

/* Inside a fieldset a table runs past the fieldset's side edges. */
fieldset > .table-wrap {
  width: calc(100% + 2 * var(--gap));
  margin-left: calc(-1 * var(--gap));
  margin-right: calc(-1 * var(--gap));
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}
fieldset > .table-wrap:last-child {
  margin-bottom: calc(-1 * var(--gap));
  border-bottom: 0;
}
fieldset > .table-wrap > table.grid > tbody > tr:last-child > td { border-bottom: 0; }

/* A grid has no height limit; a wide table scrolls sideways in its wrapper, and one that fits (marked by panels.js) keeps its headings under the bar. */
.table-wrap.fits { overflow-x: visible; }
/* Under the bar and the page's heading, whose height the script measures. */
.table-wrap.fits > table.grid:not(.entry) > thead th { top: calc(var(--bar) + var(--page-head, 0px)); }
@media (max-width: 1100px) {
  .table-wrap.fits > table.grid:not(.entry) > thead th { position: static; }
}
/* A section opened to the full window scrolls by itself, with no bar above. */
.panel.full .table-wrap.fits > table.grid:not(.entry) > thead th { position: sticky; top: 0; }

table.grid { width: 100%; border-collapse: collapse; font-size: var(--t-body); line-height: 1.45; }
/* A column heading: small, quiet ink on the sheet, a hairline under it. */
table.grid th {
  text-align: left;
  font-size: var(--t-dense);
  font-weight: var(--w-mid);
  color: var(--ink-faint);
  padding: 9px var(--s3);
  vertical-align: bottom;
  border-bottom: 1px solid var(--rule);
  background: var(--grid-head);
  /* A heading breaks between its words only where the grid would otherwise be wider than its box; a sortable heading's
     last word keeps its arrow. */
  white-space: normal;
  position: sticky;
  top: 0;
  z-index: 2;
  /* The rule under the heading is drawn inside it, so it does not scroll away with the cell below. */
  box-shadow: inset 0 -1px 0 var(--rule);
}
/* Every cell of a row starts on one line: its first words share the row's baseline, however many lines a cell holds. */
table.grid td { padding: 11px var(--s3); border-bottom: 1px solid var(--rule-soft); vertical-align: baseline; }
table.grid th { padding-left: var(--s3); padding-right: var(--s3); }
/* First column identifies the row. */
table.grid tr:last-child td { border-bottom: 0; }
/* Compact rows, for a person who chose them; a table typed into keeps its own spacing. */
.compact table.grid:not(.entry):not(.mini) td { padding-top: 6px; padding-bottom: 6px; }
.compact table.grid:not(.entry):not(.mini) th { padding-top: 7px; padding-bottom: 7px; }
.compact table.grid:not(.entry) td .button.small { padding-top: 1px; padding-bottom: 1px; }
/* Rows are parted by a hairline, never banded. The row under the pointer is tinted, and a row coloured to say something
   keeps its colour: those rules follow this one and weigh the same. */
table.grid tbody tr:hover { background: var(--accent-wash); }
/* The row under the pointer carries a bar of the accent at its left edge, as the chosen tab carries one at its foot. */
table.grid:where(:not(.entry, .hours, .mini)) > tbody > tr:hover > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.grid tbody tr[data-href] { cursor: pointer; }
/* The row the keys have reached, on Messages and on a list marked data-keys (list-keys.js). */
table.grid > tbody > tr.keyed { outline: 2px solid var(--accent); outline-offset: -2px; }
/* A link in a table is underlined only under the pointer or focus; a row with a record behind it opens from anywhere (app.js). */
table.grid td a:not(.button) { text-decoration: none; }
table.grid td a:not(.button):hover, table.grid td a:not(.button):focus-visible { text-decoration: underline; }
table.grid:not(.entry):not(.hours) > tbody > tr:has(td a[href]:not(.button)) { cursor: pointer; }
/* A row somebody has to do something about. */
/* One figure in a row worth a second look. */
table.grid td.flagged, table.grid td .flagged { color: var(--signal-deep); font-weight: var(--w-strong); }
table.grid tbody tr.wants-attention { background: var(--signal-wash); }
table.grid tbody tr.wants-attention:hover { background: var(--signal-wash-deep); }
/* A row waiting on somebody's answer, a question to the physician: work waiting its turn, an amber bar at its left edge,
   never a fault's colour. On a phone the card carries the bar, the question is set apart under the name on amber's wash,
   and Answer takes the card's width at its foot. */
table.grid tbody tr.awaits > td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
@media (max-width: 1100px) {
  table.grid.stacks > tbody > tr.awaits { box-shadow: inset 4px 0 0 var(--warn); }
  table.grid.stacks > tbody > tr.awaits > td:first-child { box-shadow: none; }
  table.grid.stacks > tbody > tr.awaits > td.asked { order: -1; }
  table.grid.stacks > tbody > tr > td.asked::before { content: none; }
  table.grid.stacks > tbody > tr > td.asked > span {
    display: block; width: 100%; box-sizing: border-box; margin: var(--s1) 0 var(--s2); padding: var(--s2) var(--s3);
    border-radius: 2px var(--r-lg) var(--r-lg) var(--r-lg); background: var(--warn-wash); color: var(--ink); font-size: var(--t-body);
  }
  table.grid.stacks > tbody > tr > td.answer-cell { display: block; padding-top: var(--s2); }
  table.grid.stacks > tbody > tr > td.answer-cell::before { content: none; }
  table.grid.stacks > tbody > tr > td.answer-cell .button { display: flex; width: 100%; justify-content: center; }
}
/* The row a save just came back to. */
/* The last row of a grid that ends its panel sits in the panel's rounded corners. A colour that row takes is painted on
   its cells, which carry the corners; on the row itself it would square them off. */
:is(.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child) > table.grid > tbody:last-child > tr:last-child:is(:hover, .wants-attention) { background: none; }
:is(.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child) > table.grid > tbody:last-child > tr:last-child:hover > td { background: var(--accent-wash); }
:is(.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child) > table.grid > tbody:last-child > tr.wants-attention:last-child > td { background: var(--signal-wash); }
:is(.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child) > table.grid > tbody:last-child > tr.wants-attention:last-child:hover > td { background: var(--signal-wash-deep); }
/* A row with nothing in it, or nothing left in it. */
table.grid tbody tr.muted td, table.grid tr.quiet td { color: var(--ink-faint); }
table.grid tbody tr.muted a { color: var(--ink-soft); }

table.grid td.money, table.grid th.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A heading over amounts or counts breaks between its words, as any heading does, where the grid would otherwise be wider
   than its box; the amounts under it never break. */
table.grid th:is(.money, .right):not(.shrink) { white-space: normal; }
/* A note under an amount wraps, so a long one never widens its column. */
table.grid td.money .sub { white-space: normal; }
/* An amount of exactly nothing, faint, so a column of them does not bury the ones that are something. */
table.grid td.money.zero, table.grid td.money.zero strong { color: var(--ink-faint); font-weight: var(--w-text); }
/* A code, a date, a number: never broken across two lines. */
table.grid td.code { white-space: nowrap; }
/* A code's words under it wrap within a narrow column, so the code keeps its column narrow. */
table.grid td.code .code-words { white-space: normal; min-width: 16ch; max-width: 56ch; }
/* Several codes in one cell break between codes, never inside one. */
table.grid td.shrink, table.grid th.shrink { width: 1%; white-space: nowrap; }
/* A name column is as wide as its names, one past 16rem wrapping between words: the spare width goes to the columns beside it. */
table.grid td.name { width: 1%; white-space: nowrap; }
table.grid td.name > :first-child { display: inline-block; width: max-content; max-width: 16rem; white-space: normal; }
/* A tag standing where the name would (No patient) stays whole. */
table.grid td.name > .tag:first-child { white-space: nowrap; }
/* A grid with room to spare (panels.js spread): each column as wide as its content and an equal share of what is left.
   While its content is measured, no column keeps a width of its own. Printed, the columns size themselves. */
table.grid.measuring { width: max-content; }
table.grid.measuring :is(th, td) { width: auto !important; }
/* Then at its narrowest, each column at its longest word. A heading that may break asks only for its longest word in
   both, so its values set the column's width. */
table.grid.measuring.narrowest { width: min-content; }
table.grid.measuring th.wrap > a { display: inline-block; width: min-content; }
table.grid.spread thead th { width: var(--spread-width); }
/* Claim files listed the same way on every tab of MCEDT, Batches: the same widths, so a file reads the same in each. */
table.grid.files.aligned { table-layout: fixed; width: 100%; }
table.grid.files.aligned :is(th, td) { white-space: normal; overflow-wrap: anywhere; }
table.grid.files.aligned td.raw, table.grid.files.aligned td.code { overflow-wrap: normal; }
table.grid.files col.c-batch { width: 6%; }
table.grid.files col.c-file { width: 10%; }
table.grid.files col.c-physician { width: 13%; }
table.grid.files col.c-group { width: 6%; }
table.grid.files col.c-claims { width: 6%; }
table.grid.files col.c-billed { width: 9%; }
/* A tag is never broken, and the columns hold their widths here: the status takes the room its longest tag needs at 1280. */
table.grid.files col.c-status { width: 20%; }
table.grid.files col.c-when { width: 12%; }
table.grid.files col.c-next { width: 18%; }
table.grid.files td.next-step { white-space: normal; }
table.grid.files td.next-step form { display: inline-block; margin: 0 0 0 var(--s1); }
/* What went wrong is a sentence of several lines: its one press stands under it, at the cell's edge, not on the end of its last line. */
table.grid.files td.next-step .sentence { display: block; }
table.grid.files td.next-step .sentence ~ form, table.grid.files td.next-step .sentence ~ .button { margin: var(--s1) 0 0; }
table.grid.files td .sub { display: block; color: var(--ink-faint); font-size: var(--t-small); }
table.grid.spread td:is(.shrink, .name) { width: auto; }
table.grid:is(.measuring, .spread) td.name > :first-child { max-width: 16rem; }
@media print { table.grid.spread thead th { width: auto; } }
@media (max-width: 1420px) {
  table.grid td.name > :first-child { max-width: 10rem; }
}
/* A grid of many columns lets its names wrap where the window is too narrow for them, as any column of words does. */
table.grid.dense td.name { width: auto; white-space: normal; }
table.grid.dense td.name > :first-child { display: inline; width: auto; max-width: none; }
/* A short name there keeps to one line: a month, a person. */
table.grid.dense td.name.nowrap, table.grid.dense td.name.nowrap > :first-child { white-space: nowrap; }
table.grid td.right, table.grid th.right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A long heading over short values breaks onto a second line; the values still set the width. */
table.grid th.wrap { white-space: normal; }
table.grid td.nowrap { white-space: nowrap; }
/* A column of sentences keeps a readable width beside one that would take it all; a reason under a tag is held to a paragraph's width. */
table.grid th.roomy { width: 26%; }
table.grid td.reason { max-width: 22rem; }
/* A row's tags sit side by side where the column has room and under each other where it has not; a tag is never broken.
   While the grid is measured they stand one under another, so the column asks only for its widest tag. */
table.grid td.tags-stack { white-space: normal; }
table.grid td.tags-stack .tag { display: inline-flex; align-items: center; margin: 1px 0; }
table.grid.measuring td.tags-stack .tag { display: flex; width: fit-content; }
/* The actions at the end of a row stay on one line. */
table.grid td:has(> .button, > form .button) { white-space: nowrap; }
table.grid td:has(> .button, > form .button) > .muted { white-space: normal; }
/* A state's tag with a step's button after it: the button goes under the tag where the list has no room for both. */
table.grid td:has(> .tag ~ .button) { white-space: normal; }
table.grid td .button-row { flex-wrap: nowrap; }
table.grid td > form:has(.button) { display: inline-flex; gap: var(--s1); align-items: center; vertical-align: middle; margin: 0; }
/* A typed sentence in a column: one line, cut where it runs out of room. */
/* A short code whose meaning shows when the pointer rests on it. */
.coded[title]:not([title=""]) { cursor: help; text-decoration: underline dotted var(--ink-faint); text-underline-offset: 3px; }
/* A code with a hyphen in it (HCP-P) is one word: it never breaks at the hyphen in a narrow column. A claim type of two
   words (Third party) keeps to one line too where the window has room, so every row of a list keeps one height; at a
   laptop's width the list needs that room and the words wrap. */
.coded.whole { white-space: nowrap; }
.coded.joined { white-space: nowrap; }
@media (max-width: 1420px) { .coded.joined { white-space: normal; } }
/* An explanatory code with the first words of its meaning beside it. */
.expl { white-space: nowrap; }
/* With every word of its meaning, it wraps like a sentence. */
.expl.whole { white-space: normal; }
.expl[title] { cursor: help; }
.expl .mono { font-weight: var(--w-strong); }
.expl-words { color: var(--ink-soft); font-size: var(--t-dense); }
.expl-rest { display: none; }
/* A line's description: the words of its code, quieter than the figures and free to wrap. */
/* A cell that holds a sentence keeps a readable measure when the table is squeezed. */
table.grid td.sentence { min-width: 18rem; }
/* A note in a list: up to two lines of it, so a long one neither widens the grid nor makes a tall row. */
table.grid td.clip { max-width: 26rem; }
table.grid td.clip > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
/* A tag followed by another keeps a gap after it, so a tag that wraps under the first starts where the first does. */
table.grid td .tag:has(+ .tag) { margin-right: 3px; }
table.grid td .sub { display: block; font-size: var(--t-caption); color: var(--ink-faint); }
/* A long sub-line, an address or a file's name, is cut to one line; the whole of it is its title. */
table.grid td .sub.cut { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Narrower, as a name is, where the window is. */
@media (max-width: 1420px) { table.grid td .sub.cut { max-width: 10rem; } }

/* A short table inside a panel, no header row: a list to the panel's edges. */
table.grid.mini { font-size: var(--t-small); width: calc(100% + 2 * var(--gap)); margin: 0 calc(-1 * var(--gap)); }
/* Inside a wrap it keeps to the wrap's width, so nothing scrolls sideways. */
.table-wrap > table.grid.mini { width: 100%; margin: 0; }
table.grid.mini td { padding: 6px var(--gap); }
table.grid.mini th { padding: 6px var(--gap); }
table.grid.mini tr:first-child td { border-top: 1px solid var(--rule); }

table.grid tfoot td {
  border-top: 1px solid var(--rule-strong);
  font-weight: var(--w-strong);
  background: var(--panel);
}

/* A table somebody types into: tighter than a list, no hover lift. */
table.grid.entry td { padding: 5px var(--s1); vertical-align: top; }
table.grid.entry th { padding: 7px var(--s1); }
table.grid.entry thead th { font-weight: var(--w-text); color: var(--ink); }
table.grid.entry tbody tr:hover { background: transparent; }
table.grid.entry td:first-child, table.grid.entry th:first-child { padding-left: 9px; }
table.grid.entry td:last-child, table.grid.entry th:last-child { padding-right: 9px; }
table.grid.entry input { padding: 5px 6px; min-height: 30px; }
table.grid.entry td.money { padding-top: 11px; }
table.grid.entry tfoot td { padding: var(--s2) 9px; }
table.grid.entry td.line-number { padding-top: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
/* What is wrong with a line, under its field; a message widens its column while it is there. */
table.grid.entry td .field-error { min-width: 7rem; white-space: normal; }
table.grid.entry td.line-number.middle { padding-top: 5px; vertical-align: middle; }
table.grid.entry .remove { padding: var(--s1) 7px; margin-top: 2px; color: var(--ink-faint); box-shadow: none; }
table.grid.entry .remove:hover { color: var(--bad); border-color: var(--bad-line); }
table.grid.entry .under { font-size: var(--t-caption); color: var(--ink-faint); margin-top: 2px; white-space: normal; line-height: 1.3; }
table.grid.entry .under.warn { color: var(--warn); }

/* Sortable headings. */
table.grid th.sortable { padding: 0; }
table.grid th.sortable a { display: block; padding: var(--s2) 9px; color: inherit; text-decoration: none; }
table.grid th.sortable a:hover { color: var(--accent); background: var(--accent-wash); }
table.grid th.sortable.on a { color: var(--accent); }
/* A sortable heading with a question mark keeps the mark on its line. */
table.grid th.sortable:has(.tip) { white-space: nowrap; padding-right: 9px; }
/* A long sortable heading still breaks onto a second line; its question mark stays beside the last word. */
table.grid th.sortable.wrap:has(.tip) { white-space: normal; }
table.grid th.sortable:has(.tip) a { display: inline-block; padding-right: 0; }
table.grid th.sortable .arrow { display: inline-block; width: 12px; margin-left: 2px; font-size: var(--t-arrow); }
/* A heading not in use shows, under the pointer or focus, the way a click would sort it. */
table.grid th.sortable .last { white-space: nowrap; }
table.grid th.sortable .arrow.hint { opacity: 0; }
table.grid th.sortable a:hover .arrow.hint, table.grid th.sortable a:focus-visible .arrow.hint { opacity: 0.5; }
table.grid th.sortable.right a, table.grid th.sortable.money a { text-align: right; }

/* An empty list is one quiet line: a small icon, the words, and what to do next. Its headings show where rows follow it. */
table.grid:has(> tbody > tr:only-child > td.empty) > thead { display: none; }
.empty { padding: var(--s3) var(--s4); text-align: left; color: var(--ink-soft); font-size: var(--t-body); }
.panel.flush .empty { padding-left: var(--s5); padding-right: var(--s5); }
table.grid td.empty { border-bottom: 0; }
table.grid tbody tr:has(> td.empty):hover { background: transparent; }
.empty strong { font-weight: var(--w-strong); color: var(--ink); margin-right: var(--s2); }
.empty .why { color: var(--ink-soft); }
.empty .icon { display: inline-block; width: auto; height: 14px; margin: 0 var(--s2) 0 0; vertical-align: -2px; color: var(--ink-faint); }

/* A list stacked on a phone, or in a narrow window where its columns do not fit (panels.js decides): each row a block,
   each cell a line with its heading at the left (headings from panels.js). */
@media (max-width: 1100px) {
  table.grid.stacks, table.grid.stacks > tbody, table.grid.stacks > tfoot, table.grid.stacks > tbody > tr, table.grid.stacks > tfoot > tr { display: block; width: auto; min-width: 0; }
  table.grid.stacks > thead { display: none; }
  table.grid.stacks > tbody > tr, table.grid.stacks > tfoot > tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); }
  /* A flagged last row is a block here: it takes its colour itself, to the panel's lower corners, past its own padding. */
  :is(.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child) > table.grid.stacks > tbody:last-child > tr.wants-attention:last-child {
    background: var(--signal-wash); border-radius: 0 0 var(--r-lg) var(--r-lg);
  }
  :is(.panel.flush > .table-wrap:last-child, .panel.flush > :is(div, form):last-child > .table-wrap:last-child) > table.grid.stacks > tbody:last-child > tr.wants-attention:last-child > td { background: none; }
  /* The cell's name at the left; what it holds kept together at the right, a value and its tag or its second line,
     wrapping under itself where the line is too short, never running past the card's edge. */
  table.grid.stacks > tbody > tr > td, table.grid.stacks > tfoot > tr > td {
    display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 2px var(--s2);
    width: auto; max-width: none; padding: 2px 0; border: 0; text-align: right; white-space: normal; overflow: visible;
  }
  table.grid.stacks > tbody > tr > td > *, table.grid.stacks > tfoot > tr > td > * { max-width: 100%; }
  /* Nothing in a card runs past its edge: a line kept whole on a desktop wraps here. */
  table.grid.stacks > :is(tbody, tfoot) > tr > td :is(.nowrap, .sub, span, a, label) { white-space: normal; overflow-wrap: anywhere; }
  /* A row named by a heading cell (a kind of notice, a day) leads its card as a first cell does. */
  table.grid.stacks > tbody > tr > th { display: block; width: auto; max-width: none; padding: 0 0 var(--s1); border: 0; text-align: left; white-space: normal; font-weight: var(--w-strong); }
  /* A line typed in (the services of an intake item): each box under its column's name, the width of the card. */
  table.grid.stacks.entry > tbody > tr > td:has(> :is(input, select)) > :is(input, select) { flex: 1 1 60%; min-width: 0; }
  table.grid.stacks td[data-label]::before { content: attr(data-label); flex: 0 0 auto; margin-right: auto; padding-right: var(--s4); color: var(--ink-faint); font-family: var(--sans); font-size: var(--t-small); font-weight: var(--w-text); letter-spacing: normal; text-transform: none; text-align: left; }
  table.grid.stacks td[data-label]:is(:empty, .stack-blank) { display: none; }
  /* A sentence in a card, such as a question asked: its label above it, the whole of it read from the left. */
  table.grid.stacks > tbody > tr > td.stack-line { flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; }
  /* A row's first cell, and a total row's, leads as its heading. */
  table.grid.stacks > :is(tbody, tfoot) > tr > td[data-label]:first-child { justify-content: flex-start; font-weight: var(--w-strong); font-size: var(--t-body); padding-bottom: var(--s1); text-align: left; }
  table.grid.stacks > :is(tbody, tfoot) > tr > td[data-label]:first-child::before { content: none; }
  /* A row headed by its number alone says what the number is. */
  table.grid.stacks > tbody > tr > td[data-label="#"]:first-child { gap: 0.3em; }
  table.grid.stacks > tbody > tr > td[data-label="#"]:first-child::before { content: "Line"; color: inherit; font-size: inherit; font-weight: inherit; }
  table.grid.stacks > tbody > tr > td.empty { display: block; text-align: left; }
  /* A row that names another cell as its heading (.stack-head) leads with that cell, and its first cell is a line like the rest. */
  table.grid.stacks > tbody > tr:has(> td.stack-head) { display: flex; flex-direction: column; }
  table.grid.stacks > tbody > tr > td.stack-head { order: -1; justify-content: flex-start; font-weight: var(--w-strong); font-size: var(--t-body); padding-bottom: var(--s1); text-align: left; }
  table.grid.stacks > tbody > tr > td.stack-head::before { content: none; }
  table.grid.stacks > tbody > tr:has(> td.stack-head) > td[data-label]:first-child:not(.stack-head) { justify-content: space-between; font-weight: inherit; font-size: inherit; padding-bottom: 2px; text-align: right; }
  table.grid.stacks > tbody > tr:has(> td.stack-head) > td[data-label]:first-child:not(.stack-head)::before { content: attr(data-label); }
  /* Words cut short for a column are whole here: nothing hovers on a phone. */
  table.grid.stacks .expl { white-space: normal; }
  table.grid.stacks .expl-rest { display: inline; }
  table.grid.stacks .expl-more { display: none; }
  /* A list of threads: the dot, the subject with what it is about under it, then when and from whom. */
  table.grid.stacks.threads > tbody > tr { display: grid; grid-template-columns: 14px minmax(0, 1fr); column-gap: var(--s2); }
  table.grid.stacks.threads > tbody > tr > td { display: block; grid-column: 2; text-align: left; }
  table.grid.stacks.threads > tbody > tr > td::before { content: none; }
  table.grid.stacks.threads > tbody > tr > td.unread-mark { grid-column: 1; grid-row: 1; padding-top: var(--s1); }
  table.grid.stacks.threads > tbody > tr > td.unread-mark:empty { display: block; }
  table.grid.stacks.threads > tbody > tr > td > .sub { display: inline; }
  table.grid.stacks.threads > tbody > tr > td > a + .sub { display: block; }
  table.grid.stacks.threads > tbody > tr > td.thread-count { display: none; }
  table.grid.stacks.threads > tbody > tr > td.empty { grid-column: 1 / -1; }
}

/* Rows as cards on a phone (`row-cards`): a row's name on the first line with its sum at the right (`rc-sum`), then two
   lines of three places each (`rc-2a` to `rc-2c`, `rc-3a` to `rc-3c`), the third line smaller, and a sentence under
   them (`rc-note`). A cell says a word before its value where the view gives one (`data-says`). A sum paid in full is
   green, one paid less than billed amber. Wider, the same cells are the list's columns. */
.rc-unit { display: none; }
@media (max-width: 1100px) {
  table.grid.stacks.row-cards > tbody > tr:has(> td.stack-head) {
    display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr) minmax(0, max-content); gap: 2px var(--s3); align-items: baseline;
  }
  table.grid.stacks.row-cards > tbody > tr > td:not(.empty) { display: block; padding: 0; text-align: left; font-size: var(--t-dense); }
  table.grid.stacks.row-cards > tbody > tr > td[data-says]::before { content: attr(data-says) " "; }
  table.grid.stacks.row-cards > tbody > tr > td.stack-head { grid-area: 1 / 1 / 2 / 3; font-size: var(--t-body); }
  table.grid.stacks.row-cards > tbody > tr:not(:has(> .rc-sum)) > td.stack-head { grid-column-end: 4; }
  table.grid.stacks.row-cards > tbody > tr > td.rc-sum { grid-area: 1 / 3; text-align: right; font-size: var(--t-figure); }
  table.grid.stacks.row-cards > tbody > tr > td:is(.rc-2a, .rc-2b, .rc-2c) { color: var(--ink-soft); }
  table.grid.stacks.row-cards > tbody > tr > td.rc-2a { grid-area: 2 / 1; }
  table.grid.stacks.row-cards > tbody > tr > td.rc-2b { grid-area: 2 / 2; }
  table.grid.stacks.row-cards > tbody > tr > td.rc-2c { grid-area: 2 / 3; text-align: right; }
  table.grid.stacks.row-cards > tbody > tr > td:is(.rc-3a, .rc-3b, .rc-3c) { color: var(--ink-faint); font-size: var(--t-small); }
  table.grid.stacks.row-cards > tbody > tr > td.rc-3a { grid-area: 3 / 1; }
  table.grid.stacks.row-cards > tbody > tr > td.rc-3b { grid-area: 3 / 2; }
  table.grid.stacks.row-cards > tbody > tr > td.rc-3c { grid-area: 3 / 3; text-align: right; }
  table.grid.stacks.row-cards .rc-unit { display: inline; }
  table.grid.stacks.row-cards > tbody > tr > td.rc-note { grid-area: 4 / 1 / 5 / 4; padding-top: var(--s1); }
  table.grid.stacks.row-cards > tbody > tr > td.rc-note:not(:has(*)) { display: none; }
  /* A third line's first place may run into the second, a second line's middle place to the right edge (`rc-wide`); a
     last, small line under the sentence (`rc-foot`). */
  table.grid.stacks.row-cards > tbody > tr > td.rc-3a.rc-wide { grid-column-end: 3; }
  table.grid.stacks.row-cards > tbody > tr > td.rc-2b.rc-wide { grid-column-end: 4; }
  table.grid.stacks.row-cards > tbody > tr > td.rc-foot { grid-area: 5 / 1 / 6 / 4; color: var(--ink-faint); font-size: var(--t-small); }
  table.grid.stacks.row-cards > tbody > tr.paid-full > td.rc-sum { color: var(--good); }
  table.grid.stacks.row-cards > tbody > tr.paid-short > td:is(.rc-sum, .rc-2c) { color: var(--warn); }
}

/* Cards in a narrow window wider than a phone (panels.js marks them): a card's lines in two columns, so a name is near
   its value; the card's heading, a sentence and the box to tick take the card's width. */
table.grid.stacks.cards-wide > tbody > tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: calc(2 * var(--s5)); align-items: baseline; }
table.grid.stacks.cards-wide > tbody > tr > :is(td:first-child, td.stack-head, td.stack-line, td.empty, th) { grid-column: 1 / -1; }

/* The same for a list that is typed into: a line is a block, each box under its own heading. */
@media (max-width: 1100px) {
  table.grid.entry.stacks > tbody > tr { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s2); padding: var(--s3) var(--s3); }
  table.grid.entry.stacks > tbody > tr.js-hidden { display: none; }
  table.grid.entry.stacks > tbody > tr > td { display: block; grid-column: span 2; padding: 0; text-align: left; }
  table.grid.entry.stacks > tbody > tr > td[data-label]::before { display: block; margin-bottom: 2px; }
  table.grid.entry.stacks > tbody > tr > td.line-number { grid-column: 1 / -1; font-weight: var(--w-strong); color: var(--ink-soft); }
  table.grid.entry.stacks > tbody > tr > td.line-number::before { content: "Line "; display: inline; color: inherit; font-size: inherit; font-weight: inherit; }
  table.grid.entry.stacks > tbody > tr > td:nth-child(2) { grid-column: 1 / -1; }
  table.grid.entry.stacks > tbody > tr > td:nth-child(n+6) { grid-column: span 3; }
  table.grid.entry.stacks > tbody > tr > td :is(input, select) { width: 100%; max-width: none; }
  /* Boxes on one row stand level whatever lines their names take; the line's remove button stands at the end of its name. */
  table.grid.entry.stacks > tbody > tr { align-items: end; }
  table.grid.entry.stacks > tbody > tr:has(> td > .remove) > td.line-number { grid-column: 1 / 6; align-self: center; }
  table.grid.entry.stacks > tbody > tr > td:has(> .remove) { grid-area: 1 / 6; justify-self: end; }
}

/* === 8. Tags and messages ============================================== */

.tag {
  display: inline-block;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: var(--t-small);
  font-weight: var(--w-mid);
  line-height: 20px;
  background: var(--rule-soft);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  white-space: nowrap;
}

/* The eight states every status resolves to (src/web/state.ts), each its own wash edged by a hairline of the same
   colour, and a mark whose shape says the same; `money` is the only green, `wants` the only red. */
.tag.money   { background: var(--good-wash); color: var(--good); border-color: var(--good-line); }
.tag.waiting { background: var(--wait-wash); color: var(--wait); border-color: var(--wait-line); }
.tag.ready   { background: var(--panel); color: var(--ink); border-color: var(--rule-strong); }
.tag.todo    { background: var(--warn-wash); color: var(--warn); border-color: var(--warn-line); }
.tag.wants   { background: var(--signal-wash); color: var(--signal-deep); border-color: var(--signal-line); }
.tag.done    { background: var(--rule-soft); color: var(--ink-soft); border-color: var(--rule); }
.tag.office  { background: var(--office-wash); color: var(--office); border-color: transparent; }
.tag.idle    { background: transparent; color: var(--ink-faint); border-color: var(--rule-strong); border-style: dashed; }
/* A label of Messages: the accent wash, as a mail client colours a label. */
.tag.label   { background: var(--accent-wash); color: var(--accent-deep); border-color: var(--accent-line); }
/* Something not yet read: the accent, as the unread dot is; not a fault's red. */
.tag.fresh   { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
/* Over and done with (Written off, Void, Inactive, Cancelled): a quiet outline, the word left whole. */
.tag.dead    { background: transparent; color: var(--ink-faint); border-color: var(--rule-strong); }
/* The mark: a real icon, the same ones the bar and the pages carry. Paid and done a tick in a ring, waiting a clock, to do a flag, a fault a warning triangle, ready and draft an empty ring. */
.tag.money::before, .tag.waiting::before, .tag.ready::before, .tag.todo::before,
.tag.wants::before, .tag.done::before, .tag.idle::before, .tag.clock::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -0.5px;
  background: currentColor; -webkit-mask: var(--tag-mark) center / contain no-repeat; mask: var(--tag-mark) center / contain no-repeat;
}
.tag.money::before, .tag.done::before { --tag-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20d%3D%22M256%2048a208%20208%200%201%201%200%20416%20208%20208%200%201%201%200-416zm0%20464A256%20256%200%201%200%20256%200a256%20256%200%201%200%200%20512zM369%20209c9.4-9.4%209.4-24.6%200-33.9s-24.6-9.4-33.9%200l-111%20111-47-47c-9.4-9.4-24.6-9.4-33.9%200s-9.4%2024.6%200%2033.9l64%2064c9.4%209.4%2024.6%209.4%2033.9%200L369%20209z%22%2F%3E%3C%2Fsvg%3E"); }
.tag.waiting::before { --tag-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20d%3D%22M464%20256A208%20208%200%201%201%2048%20256a208%20208%200%201%201%20416%200zM0%20256a256%20256%200%201%200%20512%200A256%20256%200%201%200%200%20256zM232%20120l0%20136c0%208%204%2015.5%2010.7%2020l96%2064c11%207.4%2025.9%204.4%2033.3-6.7s4.4-25.9-6.7-33.3L280%20243.2%20280%20120c0-13.3-10.7-24-24-24s-24%2010.7-24%2024z%22%2F%3E%3C%2Fsvg%3E"); }
.tag.todo::before { --tag-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20d%3D%22M48%2024C48%2010.7%2037.3%200%2024%200S0%2010.7%200%2024L0%2064%200%20350.5%200%20400l0%2088c0%2013.3%2010.7%2024%2024%2024s24-10.7%2024-24l0-100%2080.3-20.1c41.1-10.3%2084.6-5.5%20122.5%2013.4c44.2%2022.1%2095.5%2024.8%20141.7%207.4l34.7-13c12.5-4.7%2020.8-16.6%2020.8-30l0-279.7c0-23-24.2-38-44.8-27.7l-9.6%204.8c-46.3%2023.2-100.8%2023.2-147.1%200c-35.1-17.6-75.4-22-113.5-12.5L48%2052l0-28zm0%2077.5l96.6-24.2c27-6.7%2055.5-3.6%2080.4%208.8c54.9%2027.4%20118.7%2029.7%20175%206.8l0%20241.8-24.4%209.1c-33.7%2012.6-71.2%2010.7-103.4-5.4c-48.2-24.1-103.3-30.1-155.6-17.1L48%20338.5l0-237z%22%2F%3E%3C%2Fsvg%3E"); }
.tag.wants::before { --tag-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20d%3D%22M256%2032c14.2%200%2027.3%207.5%2034.5%2019.8l216%20368c7.3%2012.4%207.3%2027.7%20.2%2040.1S486.3%20480%20472%20480L40%20480c-14.3%200-27.6-7.7-34.7-20.1s-7-27.8%20.2-40.1l216-368C228.7%2039.5%20241.8%2032%20256%2032zm0%20128c-13.3%200-24%2010.7-24%2024l0%20112c0%2013.3%2010.7%2024%2024%2024s24-10.7%2024-24l0-112c0-13.3-10.7-24-24-24zm32%20224a32%2032%200%201%200%20-64%200%2032%2032%200%201%200%2064%200z%22%2F%3E%3C%2Fsvg%3E"); }
.tag.ready::before, .tag.idle::before { --tag-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Ccircle cx='256' cy='256' r='200' fill='none' stroke='black' stroke-width='64'/%3E%3C/svg%3E"); }
.tag.done::before { opacity: 0.55; }
/* Hours inside the limit: a tag's box and mark with no fill, so the hourglass and the hours line up with the amber and red tags above and below. */
.tag.clock { background: transparent; }
.tag.clock::before { --tag-mark: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20384%20512%22%3E%3Cpath%20d%3D%22M32%200C14.3%200%200%2014.3%200%2032S14.3%2064%2032%2064l0%2011c0%2042.4%2016.9%2083.1%2046.9%20113.1L146.7%20256%2078.9%20323.9C48.9%20353.9%2032%20394.6%2032%20437l0%2011c-17.7%200-32%2014.3-32%2032s14.3%2032%2032%2032l32%200%20256%200%2032%200c17.7%200%2032-14.3%2032-32s-14.3-32-32-32l0-11c0-42.4-16.9-83.1-46.9-113.1L237.3%20256l67.9-67.9c30-30%2046.9-70.7%2046.9-113.1l0-11c17.7%200%2032-14.3%2032-32s-14.3-32-32-32L320%200%2064%200%2032%200zM96%2075l0-11%20192%200%200%2011c0%2019-5.6%2037.4-16%2053L112%20128c-10.3-15.6-16-34-16-53zm16%20309c3.5-5.3%207.6-10.3%2012.1-14.9L192%20301.3l67.9%2067.9c4.6%204.6%208.6%209.6%2012.1%2014.9L112%20384z%22%2F%3E%3C%2Fsvg%3E"); }

.message {
  padding: var(--gap-fields) var(--s3);
  border-radius: 5px;
  margin-bottom: var(--gap);
  border: 1px solid;
  border-left-width: 3px;
}
.message:last-child { margin-bottom: 0; }
.message.good { background: var(--good-wash); border-color: var(--good-line); border-left-color: var(--good); color: var(--good); }
.message.warn { background: var(--warn-wash); border-color: var(--warn-line); border-left-color: var(--warn); color: var(--warn); }
.message.bad  { background: var(--bad-wash); border-color: var(--bad-line); border-left-color: var(--bad); color: var(--bad); }
.message.info { background: var(--accent-wash); border-color: var(--accent-line); border-left-color: var(--accent); color: var(--accent-deep); }
/* Work going on behind the page: a turning ring before the words, and the way to look again after them. */
.message.reading { display: flex; align-items: center; gap: var(--s2); }
.message.reading .button { margin-left: var(--s2); }
.spinner { flex: none; width: 14px; height: 14px; border: 2px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) { .spinner { animation: working-turn 0.7s linear infinite; } }
/* What a list is narrowed to, with the one action on all of it at the end. */
.message.with-action { display: flex; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); flex-wrap: wrap; }
/* Finished with and not coming back: discarded, void. */
.message.dead { background: var(--raised); border-color: var(--rule); border-left-color: var(--ink-faint); color: var(--ink-soft); }
.message a { color: inherit; }
/* A band's lines, one a problem: the marks inside the band's edge. */
.message .band-lines { margin: 0; padding-left: 1.2em; }
/* A question with the box for its answer in the same band. */
.message.answer-band .field { margin: var(--s3) 0; max-width: 46rem; }

/* What is wrong on a page, under its head (_notices.ejs): two bands in view, the rest folded under one line that opens them. */
.notices { display: grid; gap: var(--s2); margin-bottom: var(--gap); }
.notices .message { margin-bottom: 0; }
.notices-more > .message { margin-top: var(--s2); }
.notices-more > summary { width: fit-content; cursor: pointer; font-size: var(--t-dense); font-weight: var(--w-strong); color: var(--accent-deep); }
.notices-more > summary:hover { text-decoration: underline; }

/* What the last action said, as a band under the page's heading: a refusal, what was done with Undo, or where the work went. */
.message.said { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s3); }
/* A save's warnings come each on a line of their own (savedWords). */
.message.said > span { white-space: pre-line; }

/* What the ministry said about a card, in its own words. */
.message.card-verdict { display: flex; flex-direction: column; gap: var(--s1); }
/* Folded to its first line on the claim form while the card is valid and current: the headline and the code, pressed to
   read the rest. */
.message.card-verdict.folds { display: block; }
.message.card-verdict.folds > summary { cursor: pointer; justify-content: flex-start; flex-wrap: nowrap; }
.message.card-verdict.folds > summary > strong { flex: 0 1 auto; min-width: 0; }
.message.card-verdict.folds > summary > .small { margin-left: auto; }
.message.card-verdict.folds[open] > summary { margin-bottom: var(--s1); }
.message.card-verdict.folds > :not(summary) + * { margin-top: var(--s1); }
.message.card-verdict .card-verdict-head { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; flex-wrap: wrap; }
.message.card-verdict p, .message.card-verdict ul { color: var(--ink); }
/* A date in the answer is never split across two lines. */
.message.card-verdict .mono { white-space: nowrap; }
.message.card-verdict .card-mismatches { padding-left: 18px; }
/* The time limited codes a check asked about: the code, then the ministry's message, ruled off from the verdict. */
.message.card-verdict .card-services { list-style: none; padding-left: 0; margin-top: var(--s2);
  border-top: 1px solid var(--rule); padding-top: var(--s2); }
.message.card-verdict .card-services li + li { margin-top: var(--s1); }
.message.card-verdict .card-services .card-service-head,
.message.card-verdict .card-services .card-service-said { display: block; }
.message.card-verdict .card-services .tag { margin-left: var(--s1); }
.message.card-verdict .card-services li.unknown { color: var(--signal-deep); }
.message.card-verdict .card-verdict-foot { color: var(--ink-faint); }
/* A validation's result in a list: the tag, then the ministry's message and instruction, each on a line of its own. */
.grid .card-said { display: block; }
/* Validate sits close under the verdict; with no verdict it keeps clear of the patient's line above. */
.card-validate { margin: var(--s2) 0 var(--s3); }
.card-verdict + .card-validate { margin-top: -6px; }
/* A health number the ministry answered for: green when the card is valid, pale red when not. */
input.card-good { border-color: var(--good); background-color: var(--good-wash); }
input.card-bad { border-color: var(--bad); background-color: var(--bad-wash); }
/* The answer under the Validate button, and the buttons it offers. */
.card-check-result, .card-next { margin-top: var(--gap-fields); }

/* === 9. Components ===================================================== */

/* A number that names a record, large beside or under its name: a patient's health card, a physician's billing number. */
.number-large { font-size: var(--t-figure); font-weight: var(--w-strong); color: var(--ink); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
/* A record's number under its page's title, with the ministry's last answer on it or a word naming it. */
.page-head .head-card { display: inline-flex; align-items: center; gap: var(--s2); align-self: center; }
.page-head .head-card .head-label { font-size: var(--t-dense); color: var(--ink-faint); }

/* A question mark beside a label, and its bubble, placed by app.js when the mark is pressed. */
.tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 5px; vertical-align: 1px;
  border: 1px solid var(--rule-strong); border-radius: 50%;
  background: var(--panel); color: var(--ink-soft);
  font-size: var(--t-caption); font-weight: var(--w-strong); line-height: 1;
  text-transform: none; letter-spacing: 0; cursor: pointer; user-select: none;
}
/* The marks are switched on from the person's menu. */
html:not(.help) .tip { display: none; }
.tip:hover, .tip.open { border-color: var(--accent); color: var(--accent-deep); }
.tip-bubble {
  position: fixed; z-index: 1000; max-width: min(300px, calc(100vw - 16px));
  padding: var(--s2) var(--s3); border-radius: var(--r);
  background: var(--ink); color: var(--panel); box-shadow: var(--float);
  font-size: var(--t-dense); font-weight: var(--w-text); line-height: 1.45;
  white-space: normal; text-align: left; pointer-events: none;
}

/* An icon from `_icon.ejs`. It takes the colour of the text it sits in. */
.icon { flex: 0 0 auto; vertical-align: -2px; }
.button .icon, .chip .icon { margin-left: -1px; opacity: 0.75; }
.button.primary .icon, .button:hover .icon { opacity: 1; }

/* The question before an action that cannot be undone (app.js): a real <dialog>. */
dialog.ask {
  width: min(440px, calc(100vw - 2 * var(--s5)));
  padding: var(--s5);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  border-top: 3px solid var(--signal);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--float);
}
dialog.ask::backdrop { background: var(--scrim); }

/* The sheet of keyboard shortcuts: groups side by side, the keys on the left of what they do. */
dialog.keys {
  width: min(900px, calc(100vw - 2 * var(--s4)));
  padding: 0; border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--panel); color: var(--ink); box-shadow: var(--float);
}
dialog.keys::backdrop { background: var(--scrim); }
.keys-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--rule); }
.keys-head h2 { margin: 0; }
.keys-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s5); padding: var(--s4) var(--s5) var(--s5); }
.keys-body dl { display: grid; grid-template-columns: minmax(11rem, max-content) 1fr; gap: var(--s2) var(--s3); margin: 0; align-items: baseline; }
.keys-body dt { white-space: nowrap; }
.keys-body dd { margin: 0; color: var(--ink-soft); font-size: var(--t-dense); }
@media (max-width: 820px) { .keys-body { grid-template-columns: minmax(0, 1fr); } }

dialog.ask .ask-question {
  font-size: var(--t-question);
  font-weight: var(--w-strong);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--s2);
  border: 0;
  padding: 0;
}
dialog.ask .ask-more { color: var(--ink-soft); margin: 0 0 var(--s5); }
dialog.ask .ask-more[hidden] { display: none; }
dialog.ask .ask-reason { display: block; margin: 0 0 var(--s5); }
dialog.ask .ask-reason[hidden] { display: none; }
dialog.ask .ask-reason input { display: block; width: 100%; margin-top: 3px; }
dialog.ask .button-row { justify-content: flex-end; }
dialog.ask .button.primary.danger, dialog.ask .button.primary.danger:hover { background: var(--bad); border-color: var(--bad); color: var(--on-accent); }
/* A question with nothing under it keeps the same room above its answers. */
dialog.ask .ask-question + .ask-more[hidden] + .button-row, dialog.ask .ask-more[hidden] + .ask-reason[hidden] + .button-row { margin-top: var(--s4); }
/* Enough room to read the question before the pointer is over the answer. */
dialog.ask .button { min-width: 96px; justify-content: center; }
/* Leaving work not saved (leaving.js): three answers on one row, or stacked on a phone with the save on top. */
dialog.ask.leave { width: min(560px, calc(100vw - 2 * var(--s5))); }
dialog.ask.leave .button-row { flex-wrap: nowrap; }
@media (max-width: 820px) {
  dialog.ask.leave .button-row { flex-direction: column-reverse; align-items: stretch; }
}
/* Billing one line on more dates: a date to add, the quick fills, the dates picked. */
dialog.repeat .repeat-pick { display: flex; gap: var(--s2); margin: var(--s3) 0 var(--s2); }
dialog.repeat .repeat-pick input { flex: 1; }
dialog.repeat .repeat-pick .button { min-width: 0; }
dialog.repeat .chips { margin-bottom: var(--s3); }
dialog.repeat .repeat-dates .chip button { padding: 0; border: 0; background: none; font: inherit; color: var(--ink-faint); cursor: pointer; }
@media (prefers-reduced-motion: no-preference) {
  dialog.ask[open] { animation: ask-in 120ms ease-out; }
  @keyframes ask-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
  }
}

/* Sections that fold behind their heading (panels.js). */
.fold-head { cursor: pointer; user-select: none; }
.fold-title { display: flex; align-items: center; gap: var(--gap-fields); }
/* A count or a help mark stays beside the words; only the chevron goes to the far end. */
.fold-title > .fold-toggle { margin-left: auto; }
/* A section taken to the whole window; its button sits at the end of the head. */
.full-toggle { margin-left: auto; flex: 0 0 auto; font-weight: var(--w-text); }
.fold-title .full-toggle + .fold-toggle { margin-left: 0; }
.panel.full { position: fixed; inset: 0; z-index: 40; margin: 0; border: 0; border-radius: 0; overflow: auto; }
.panel.full > .fold-body { display: block; }
body.has-full { overflow: hidden; }
/* Full screen, one look everywhere: the browser's own, or the element fixed to the window (`.full`). */
:fullscreen { background: var(--panel); overflow: auto; }
dialog.sheet.full { width: 100vw; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }
dialog.sheet:fullscreen { width: 100vw; height: 100dvh; max-height: none; }
.dialog-full {
  position: absolute; top: var(--s3); right: calc(var(--s3) + 36px); z-index: 2;
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; margin: 0;
  border: 0; border-radius: 50%; background: var(--raised); color: var(--accent-deep); cursor: pointer;
}
.dialog-full:hover { background: var(--accent-wash); }
.dialog-full:focus-visible { outline: none; box-shadow: var(--focus); }
.file-viewer.full { position: fixed; inset: 0; z-index: 60; border: 0; border-radius: 0; }
.table-wrap.full { position: fixed; inset: 0; z-index: 60; margin: 0; border: 0; border-radius: 0; overflow: auto; background: var(--panel); }
.table-wrap.full > table.grid > thead th { position: sticky; top: 0; }
.table-wrap { position: relative; }
.full-corner { position: sticky; left: 0; width: 100%; height: 0; z-index: 3; }
.full-corner > button { position: absolute; top: var(--s1); right: var(--s1); background: var(--panel); box-shadow: var(--primary-lift); }
.table-wrap.full > .full-corner > button { position: fixed; top: var(--s3); right: var(--s3); }
.fold-toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent;
  color: var(--ink-faint); cursor: pointer; padding: 0;
  transition: transform 0.22s ease, background 0.15s ease, color 0.15s ease;
}
.fold-head:hover .fold-toggle { background: var(--accent-wash); color: var(--accent); }
.folded .fold-toggle { transform: rotate(-90deg); }
.fold-body { display: grid; grid-template-rows: 1fr; grid-template-columns: minmax(0, 1fr); transition: grid-template-rows 0.22s ease; }
/* Clipped rather than hidden: a hidden box would be what a table's headings stick to. */
.fold-inner { min-height: 0; overflow: clip; }
.folded > .fold-body { grid-template-rows: 0fr; }
.folded > .fold-body > .fold-inner { visibility: hidden; transition: visibility 0s 0.22s; }
.panel.folded > .panel-head { border-bottom: 0; margin-bottom: 0; }
.panel.folded > .lede { margin-bottom: 0; }
fieldset.folded > legend { margin-bottom: 0; }

/* The pages of a list, under its table. */
.pager { display: flex; justify-content: flex-start; align-items: center; gap: var(--s5); padding: var(--s3) var(--s4); font-size: var(--t-dense); color: var(--ink-soft); flex-wrap: wrap; }
.pager-links { display: flex; gap: 2px; align-items: center; }
.pager-links a, .pager-links .current, .pager-links .off { display: inline-block; min-width: 26px; padding: 3px 7px; text-align: center; border-radius: var(--r); text-decoration: none; }
.pager-links a { color: var(--ink-soft); }
.pager-links a:hover { background: var(--raised); color: var(--ink); }
.pager-links .current { background: var(--accent); color: var(--on-accent); font-weight: var(--w-strong); }
.pager-links .off { color: var(--ink-faint); }
.pager-links .gap { padding: 0 2px; color: var(--ink-faint); }
/* How many rows to a page, at the far end of the pager, and the count again over the table. */
.pager-size { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
.pager-links button { min-width: 26px; padding: 3px 7px; border: 0; border-radius: var(--r); background: none; color: var(--ink-soft); font: inherit; cursor: pointer; }
.pager-links button:hover { background: var(--raised); color: var(--ink); }
.list-sum strong { color: var(--ink); }
.pager-top { padding: var(--s1) var(--s4); font-size: var(--t-small); color: var(--ink-faint); text-align: right; font-variant-numeric: tabular-nums; }
.panel.flush .pager-top { padding: var(--s1) var(--s5); }
/* A pager at the foot of a flush panel, however deep under it the list sits. */
.panel.flush .pager { padding: var(--s3) var(--s5); }
.pager-count { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.report-links a { display: grid; gap: 2px; padding: var(--s2) var(--s3); border-radius: var(--r); color: var(--ink); text-decoration: none; }
.report-links a:hover .report-name { color: var(--accent-deep); }

/* Figures: a row of small tiles, each a name over its number; a tile that links opens the list behind it. */
.figures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s2);
  margin-bottom: var(--gap);
}
.panel .figures { margin-bottom: var(--s3); }
/* One figure alone keeps a tile's width rather than a strip's. */
.figures:has(> .figure:only-child) { grid-template-columns: minmax(170px, 320px); }
.figures:last-child { margin-bottom: 0; }
/* Tiles are never a box in a box: a section of only tiles, with no heading, gives up its sheet; under a heading or among other things, the tiles become a plain ruled strip. */
.panel:has(> .figures:only-child) { padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.panel > .figures:not(:only-child) { gap: var(--s3) 0; }
.panel > .figures:not(:only-child) > .figure { padding: 0 var(--s4); border: 0; border-left: 1px solid var(--rule); border-radius: 0; background: none; }
.panel > .figures:not(:only-child) > .figure:first-child { padding-left: 0; border-left: 0; }
/* Stacked on a phone, the figures of such a strip are parted by a rule above each, not one down the left. */
@media (max-width: 820px) {
  .panel > .figures:not(:only-child) { grid-template-columns: 1fr 1fr; gap: 0 var(--s4); }
  .panel > .figures:not(:only-child) > .figure,
  .panel > .figures:not(:only-child) > .figure:first-child { padding: var(--s2) 0; border-left: 0; border-top: 1px solid var(--rule-soft); }
}
.figure {
  display: flex; flex-direction: column; min-width: 0;
  padding: var(--gap-fields) var(--s4) var(--s3);
  border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel);
  text-decoration: none; color: inherit;
}
a.figure:hover { color: inherit; border-color: var(--rule-strong); background: var(--raised); }
/* The tile the list below is narrowed to is marked as every "you are here" is: the pale accent, no heavy outline. */
.figure.current, a.figure.current:hover { background: var(--accent-wash); border-color: var(--accent-line); }
.figure.current .label { color: var(--accent-deep); font-weight: var(--w-strong); }
.figure .value { display: block; font-size: var(--t-figure); font-weight: var(--w-mid); line-height: 1.25; letter-spacing: -0.01em; color: var(--ink);
                 font-variant-numeric: tabular-nums; }
/* The label sits above the figure whatever order the markup has them in. */
.figure .label { display: block; order: -1; font-size: var(--t-dense); color: var(--ink-soft); margin-bottom: 2px; }
.figure .note { display: block; font-size: var(--t-small); color: var(--ink-faint); }
/* A date or a word in a figure keeps the face's own widths, so its hyphens are not gapped. */
.figure.word .value { font-variant-numeric: normal; }
.figure.hot .value { color: var(--signal-deep); }
.figure.calm .value { color: var(--accent-deep); }
/* On a record page the figures are one slim line under its head: each name, its figure and its note side by side,
   parted by a rule. */
.figures.slim { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) calc(2 * var(--s4) + 1px);
                /* A hairline stands between two figures on a line; the one before a figure that starts a line lies left
                   of the row's start and is cut off with it, so a line that wraps on a phone opens with its figure. */
                clip-path: inset(-6px -6px -6px -6px); }
.figures.slim > .figure { position: relative; flex-direction: row; align-items: baseline; gap: var(--s2); padding: 0; border: 0;
                          border-radius: 0; background: none; }
.figures.slim > .figure::before { content: ""; position: absolute; left: calc(-1 * var(--s4) - 1px); top: 0.2em; bottom: 0.2em; width: 1px; background: var(--rule); }
.panel > .figures.slim:not(:only-child) { gap: var(--s1) calc(2 * var(--s4) + 1px); }
.panel > .figures.slim:not(:only-child) > .figure, .panel > .figures.slim:not(:only-child) > .figure:first-child { padding: 0; border: 0; }
.figures.slim > .figure .label { margin: 0; }
.figures.slim > .figure .value { font-size: var(--t-body); font-weight: var(--w-strong); line-height: inherit; }
.figures.slim > a.figure:hover { background: none; }
.figures.slim > a.figure:hover .value { color: var(--accent-deep); text-decoration: underline; }

/* Where a claim or a monthly invoice stands, under its head: its stages in a row (the steps in a row of a batch or a fee
   load), then its money, as columns parted from the stages by a rule. */
.standing { display: flex; align-items: center; gap: var(--s4) var(--s5); flex-wrap: wrap; padding: var(--s4) var(--s5); }
.standing > .stages { flex: 1 1 560px; min-width: 0; margin: 0; }
.standing > .figures { display: flex; flex: 0 1 auto; flex-wrap: wrap; margin: 0; padding-left: var(--s5); border-left: 1px solid var(--rule); }
.standing > .figures > .figure { min-width: 110px; }
/* What a month came to, across the foot of a monthly invoice's band, under its stages. */
.standing > .figures.across { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); flex-basis: 100%;
                              padding: var(--s4) 0 0; border-left: 0; border-top: 1px solid var(--rule-soft); }
@media (max-width: 820px) {
  .standing > .figures { padding-left: 0; border-left: 0; flex-basis: 100%; }
}

/* Home's band: the month at the ministry, light on the deep accent, with the sign-in pane's glow and dotted field. */
.hero {
  position: relative; overflow: hidden;
  margin-bottom: var(--gap);
  padding: var(--s4) var(--s5) 0;
  border-radius: var(--r-lg);
  color: var(--white);
  background:
    radial-gradient(ellipse at 0% 0%, var(--glow) 0%, transparent 46%),
    radial-gradient(ellipse at 100% 0%, var(--hero-glow) 0%, transparent 55%),
    linear-gradient(160deg, var(--hero-deep) 0%, var(--hero-night) 100%);
  box-shadow: var(--lift-2);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(var(--hero-dots) 1px, transparent 1.4px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(90deg, var(--white) 0%, transparent 55%);
          mask-image: linear-gradient(90deg, var(--white) 0%, transparent 55%);
}
.hero > * { position: relative; }
.hero h2 { margin: 0 0 var(--s2); color: var(--white); }
.hero a { color: var(--white); text-decoration: none; }
.hero a:hover, .hero a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.hero a.help-link:hover, .hero a.help-link:focus-visible { background: var(--white); color: var(--hero-deep); text-decoration: none; }
/* Days left as one large number, the cycle as a line from the last cut-off to the next with today marked. */
.cycle { display: flex; align-items: center; gap: var(--s5); padding-bottom: var(--s4); }
/* The line fills its band: its marks are placed by share of its length, and its words keep their size. */
.cycle-line { flex: 1 1 auto; min-width: 0; height: 86px; margin: 0 var(--s3); overflow: visible; }
.mywork > h3 { display: flex; align-items: center; gap: var(--s2); margin: 0; color: var(--accent-deep); }
.mywork ul { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); list-style: none; margin: 0; padding: 0; }
/* Each line of My work is plainly a way in: a caret at its end, and a wash under the pointer. */
.mywork a {
  display: flex; align-items: baseline; gap: var(--s2);
  padding: 5px var(--s2); margin: 0 calc(-1 * var(--s2)); border-radius: var(--r);
  color: var(--ink); text-decoration: none;
}
.mywork a::after {
  content: ""; flex: none; align-self: center; width: 6px; height: 6px; margin-left: var(--s1);
  border-top: 1.5px solid var(--ink-faint); border-right: 1.5px solid var(--ink-faint); transform: rotate(45deg);
}
.mywork a::after { border-color: var(--accent-deep); }
.mywork .count { font-size: var(--t-figure); font-weight: var(--w-mid); font-variant-numeric: tabular-nums; color: var(--accent-deep); }
/* Needs attention's board: a row for each part of the application, its name at the left, then its tiles in five even
   columns, so a tile keeps its place from row to row and from day to day; rows parted by a hairline. */
.board-row { display: grid; grid-template-columns: 10rem minmax(0, 1fr); }
.board-row + .board-row { border-top: 1px solid var(--rule-soft); }
.board-area { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s3) var(--s3) 0;
              font-weight: var(--w-strong); color: var(--ink); text-decoration: none; }
/* Every row draws its five columns' rules, a slot with no tile too, so a short row reads as part of the board; stacked, none. */
.board > .board-row > .figures { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 0;
                                 background-image: repeating-linear-gradient(to right, var(--rule-soft) 0 1px, transparent 1px 20%); }
.board > .board-row > .figures > .figure { justify-content: center; padding: var(--s3); border: 0; border-left: 1px solid var(--rule-soft);
                                           border-radius: 0; background: none; }
.board > .board-row > .figures > a.figure:hover { background: var(--accent-wash); }
/* A count and a sum are one size here, so the tiles read as one board. */
.board .figure .value { font-size: var(--t-figure); }

@media (max-width: 1100px) {
  .board-row { grid-template-columns: 1fr; }
  .board-area { padding-bottom: 0; }
  .board > .board-row > .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); background-image: none; }
  .board > .board-row > .figures > .figure { padding-left: 0; border-left: 0; }
}
@media (max-width: 820px) {
  .board > .board-row > .figures { grid-template-columns: 1fr 1fr; }
}

/* Home's next step: the first step with work waiting for this person, and the one press that starts it. */
.your-next { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s3); padding: var(--s3) var(--s4); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: var(--r-lg); background: var(--panel); }
.your-next .next-words { display: flex; flex-direction: column; gap: 2px; }
/* MCEDT's head: the newest file from the ministry, on the line under the page's title. */
.flow-last { font-size: var(--t-small); color: var(--ink-faint); }

/* A page of steps (the monthly invoice run): each a section whose heading carries its number and its figures. */
.step-tag {
  display: inline-flex; align-items: center; margin-right: var(--s2); padding: 1px var(--s2); border-radius: var(--r-pill);
  background: var(--accent-wash); color: var(--accent-deep); font-size: var(--t-small); font-weight: var(--w-strong); vertical-align: 2px;
}
.step-figures { margin: 2px 0 0; font-size: var(--t-dense); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.step-arrow { width: 10px; height: 10px; margin: calc(-1 * var(--s1)) auto var(--s3); border-right: 2px solid var(--accent-line); border-bottom: 2px solid var(--accent-line); transform: rotate(45deg); }

/* Work by hour: a person a row, an hour a column, shaded by count, the number in the cell too. */
.hours-day { display: grid; grid-template-columns: 7rem 7rem auto 7rem auto; column-gap: var(--s3); align-items: center; justify-content: start; }
.hours-day .check { margin: 0; }
/* On a phone the day's name is a line of its own, its times and Closed under it. */
@media (max-width: 820px) {
  .hours-list { grid-template-columns: minmax(0, 1fr); }
  .hours-day { min-width: 0; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); row-gap: var(--s1); }
  .hours-day :is(.hours-name, .check) { grid-column: 1 / -1; }
  .hours-day input[type="time"] { width: 100%; min-width: 0; }
}
.hours-day .field-error { grid-column: 2 / -1; }
.hours-day input.shut { background: var(--raised); color: var(--ink-faint); }
@media (max-width: 820px) {
  .hours-day { grid-template-columns: 1fr auto 1fr auto; row-gap: var(--s1); }
}
/* Twenty-four hours beside a name: the cells give up side room so the day fits a laptop. */
table.grid.hours th, table.grid.hours td { padding-left: 6px; padding-right: 6px; }
/* An hour's heading is its number over am or pm, so twenty-four of them fit across the page. */
table.grid.hours th .half { display: block; font-size: var(--t-small); font-weight: var(--w-text); color: var(--ink-soft); }
table.grid.hours td.heat { font-variant-numeric: tabular-nums; }
/* The busier the hour, the more of the accent. The number stays in ink up to the fifth step, where it reads at 4.8 to 1 or
   better light and dark; only the full accent takes the colour drawn on it. */
table.grid.hours td.s1 { background: color-mix(in srgb, var(--accent) 8%, transparent); }
table.grid.hours td.s2 { background: color-mix(in srgb, var(--accent) 18%, transparent); }
table.grid.hours td.s3 { background: color-mix(in srgb, var(--accent) 30%, transparent); }
table.grid.hours td.s4 { background: color-mix(in srgb, var(--accent) 42%, transparent); }
table.grid.hours td.s5 { background: color-mix(in srgb, var(--accent) 52%, transparent); }
table.grid.hours td.s6 { background: var(--accent); color: var(--on-accent); }
table.grid.hours tbody tr:hover { background: transparent; }
table.grid.hours tbody tr:hover td:first-child { background: var(--accent-wash); }

/* Files kept with a record, one row each: name, kind, and a way to remove it. */
.files { list-style: none; margin: 0 0 var(--gap); padding: 0; font-size: var(--t-dense); }
.files li { display: flex; align-items: baseline; gap: var(--gap-fields);
            padding: 5px 0; border-bottom: 1px solid var(--rule); }
.files li:last-child { border-bottom: 0; }
.files li > a { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.files li > form { margin-left: auto; }
/* What a file is, chosen where it is shown; the row's other button keeps to the end. */
.files li { flex-wrap: wrap; }
.files li > form.file-role { margin-left: 0; }

/* The office's Dropbox in place on a form: the files chosen, then one folder at a time in a framed box. */
.dropbox-pick { display: grid; gap: var(--s2); }
.dropbox-pick > [data-dropbox-open] { justify-self: start; }
.dropbox-chosen { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dropbox-chosen:empty { display: none; }
.dropbox-chosen li { display: inline-flex; align-items: center; gap: var(--s2); padding: 2px 2px 2px var(--s2);
                     border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--panel); font-size: var(--t-dense);
                     max-width: 100%; overflow-wrap: anywhere; }
.dropbox-browser { border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--panel);
                   padding: var(--s2) var(--s3); max-height: 22rem; overflow-y: auto; }
.dropbox-browser[aria-busy="true"] { opacity: .6; }
/* Files are a page of a grid at a time, with a preview under a row: the window scrolls them, not the box. */
.dropbox-pick[data-dropbox="files"] .dropbox-browser { max-height: none; overflow: visible; }
.dropbox-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap;
                padding-bottom: var(--s2); margin-bottom: var(--s1); border-bottom: 1px solid var(--rule); }
.dropbox-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); font-size: var(--t-dense); }
.dropbox-crumbs span { color: var(--ink-faint); }
.dropbox-entries { list-style: none; margin: 0; padding: 0; font-size: var(--t-dense); }
.dropbox-entries li { border-bottom: 1px solid var(--rule-soft); }
.dropbox-entries li:last-child { border-bottom: 0; }
.dropbox-folder { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 32px; padding: 0 var(--s1);
                  border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.dropbox-folder:hover { background: var(--accent-wash); }
.dropbox-folder svg { color: var(--accent); flex: none; }
.dropbox-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin-bottom: var(--s2); }
.dropbox-tools .dropbox-find { display: inline-flex; gap: 6px; flex: 1 1 22rem; max-width: 30rem; }
.dropbox-tools .check, .dropbox-tools .dropbox-order { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.dropbox-tools .dropbox-order select { width: auto; }
/* The files of a folder: a grid inside the chooser's box; the file's facts under its name. */
.dropbox-grid .dropbox-name { display: block; overflow-wrap: anywhere; }
.dropbox-grid .sub { display: block; color: var(--ink-faint); font-size: var(--t-small); }
.dropbox-grid tr.unavailable .dropbox-name { color: var(--ink-faint); }
.dropbox-grid .dropbox-folder-row td { padding-block: 0; }
.dropbox-pages { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); margin-top: var(--s2); }
/* The list and the file pressed beside it, each scrolling on its own in a box of one height; one above the other on a phone. */
.dropbox-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--s3); height: min(68vh, 720px); min-height: 22rem; }
.dropbox-split > .dropbox-browser, .dropbox-split > .dropbox-pane { min-height: 0; overflow-y: auto; }
.dropbox-pick[data-dropbox="files"] .dropbox-split > .dropbox-browser { max-height: none; overflow-y: auto; }
@media (max-width: 820px) { .dropbox-split { grid-template-columns: minmax(0, 1fr); height: auto; } .dropbox-split > .dropbox-pane { max-height: none; } }
/* In the dialog the box takes the room between its heading and its foot. */
dialog.sheet .form-body:has(.dropbox-split) { display: flex; flex-direction: column; overflow: hidden; }
dialog.sheet .form-body:has(.dropbox-split) > .dropbox-field { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
dialog.sheet .dropbox-field > .dropbox-pick { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
dialog.sheet .dropbox-pick > .dropbox-split { flex: 1 1 auto; height: auto; min-height: 0; }
.dropbox-pane { border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--raised); padding: var(--s3) var(--s4); }
.dropbox-pane[aria-busy="true"] > * { opacity: .7; }
.dropbox-pane-empty { display: flex; align-items: center; gap: var(--s2); margin: var(--s4) 0; font-size: var(--t-dense); }
/* A file's name is the press that shows it; its row is marked while it is shown. */
.dropbox-grid button.dropbox-name { display: block; padding: 0; border: 0; background: none; color: var(--accent-deep); font: inherit;
                                    font-weight: var(--w-strong); text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.dropbox-grid button.dropbox-name:hover { text-decoration: underline; }
.dropbox-grid tr.unavailable button.dropbox-name { color: var(--ink-faint); }
.dropbox-grid tr[data-dropbox-row] { cursor: pointer; }
.dropbox-grid tr.current > td { background: var(--accent-wash); }
.dropbox-grid td.dropbox-state { white-space: nowrap; text-align: right; }
/* The file shown: its name and kind, where it stands with Intake, its picture, what was read, its dates. */
.dropbox-look { display: grid; gap: var(--s3); }
.dropbox-look-head h3 { margin: 0; font-size: var(--t-panel); overflow-wrap: anywhere; }
.dropbox-look-takes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: var(--t-dense); }
.dropbox-look-picture { text-align: center; }
.dropbox-look-picture img { display: block; margin: 0 auto; max-width: 100%; max-height: 22rem; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.dropbox-look .panel.reading { margin: 0; }
.dropbox-look-facts { padding-top: var(--s2); border-top: 1px solid var(--rule); }
/* New item from Dropbox and Add from Dropbox: the files across the whole form. */
.dropbox-field { display: grid; gap: var(--s1); margin-top: var(--s3); }
.dropbox-field .dropbox-browser { min-height: 18rem; max-height: none; }
/* At the foot beside Add: how many files are chosen, and what they are. */
.dropbox-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); margin-left: auto; }
.dropbox-foot .field { margin: 0; display: flex; align-items: center; gap: var(--s2); }
.dropbox-foot .field label { margin: 0; white-space: nowrap; }
.dropbox-count { font-size: var(--t-dense); color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* Found in the file (_reading.ejs): each fact ticked where it matched a record, flagged where it matched none. */
.panel.reading .panel-head { align-items: baseline; }
.reading-file { overflow: hidden; text-overflow: ellipsis; max-width: 22rem; }
.reading-note { margin: 0 0 var(--s2); }
.reading-facts { row-gap: var(--s2); }
.reading-facts dd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.found { display: inline-flex; align-items: center; gap: 6px; }
.found svg { flex: none; }
.found.ok svg { color: var(--good); }
.found.miss { color: var(--warn); }
.reading-people { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); width: 100%; }
.reading-people li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); }
.reading-people form.inline, .reading-facts form.inline { display: inline; margin: 0; }
.reading-codes { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.code-pair { white-space: nowrap; }
.reading-wait { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-dense); }

/* A file a form refused as already in Intake (_held-files.ejs): its name, whose item holds it, and that item a press away. */
.held-files { display: grid; gap: var(--s2); margin: var(--s2) 0; padding: 0; list-style: none; }
.held-files li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px var(--s3); padding: var(--s2) var(--s3);
  background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg); }
.held-files .held-file { font-weight: var(--w-strong); overflow-wrap: anywhere; }
.held-files li > .muted { grid-column: 1; }
.held-files li > .button { grid-column: 2; grid-row: 1 / span 2; }

/* Analyzing (_analyzing.ejs): a turning ring in the sea blue, centred over what is under way and its steps; in a band
   over the page where compact. Over the file, a light sweeps down the page under a pill. Still where motion is not wanted. */
.analyzing { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3); padding: var(--s5) var(--s4); text-align: center; }
.analyzing-ring { flex: none; width: 40px; height: 40px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 20%, var(--accent-mid) 55%, var(--accent) 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), var(--black) calc(100% - 3.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), var(--black) calc(100% - 3.5px)); }
.analyzing-words { display: grid; gap: 2px; }
.analyzing-title { font-size: var(--t-panel); font-weight: var(--w-strong); color: var(--ink); }
.analyzing-dots { display: inline-block; width: 1.2em; text-align: left; }
.analyzing-dots::after { content: '…'; }
.analyzing-detail { font-size: var(--t-dense); color: var(--ink-soft); }
.analyzing-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s1) var(--s4); margin: 0; padding: 0; list-style: none; font-size: var(--t-small); color: var(--ink-faint); }
.analyzing-steps li { display: inline-flex; align-items: center; gap: 6px; }
.analyzing-steps li::before { content: ''; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--rule-strong); box-sizing: border-box; }
.analyzing-steps li.done { color: var(--good); }
.analyzing-steps li.done::before { border-color: var(--good); background: var(--good); }
.analyzing-steps li.now { color: var(--accent-deep); font-weight: var(--w-strong); }
.analyzing-steps li.now::before { border-color: var(--accent); background: var(--accent-wash); }
.analyzing.compact { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; gap: var(--s2) var(--s3); margin-bottom: var(--gap); padding: var(--s2) var(--s4);
  text-align: left; background: var(--accent-wash); border: 1px solid var(--accent-line); border-radius: var(--r-lg); }
.analyzing.compact .analyzing-ring, .fv-scan-pill .analyzing-ring { width: 18px; height: 18px; -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), var(--black) calc(100% - 2.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), var(--black) calc(100% - 2.5px)); }
.analyzing.compact .analyzing-words { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s2); }
.analyzing.compact .analyzing-title { font-size: var(--t-body); }
.panel.flush .analyzing { border-bottom: 1px solid var(--rule); }
.analyzing-wait { color: var(--warn); }
.fv-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.fv-scan { position: absolute; inset: 0; overflow: hidden; pointer-events: none; display: flex; align-items: flex-start; justify-content: center; padding-top: var(--s5); }
.fv-scan-light { position: absolute; left: 0; right: 0; top: 0; height: 22%; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent-mid) 35%, transparent) 70%, var(--accent) 100%); opacity: 0.55; }
.fv-scan-pill { position: relative; display: inline-flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4); border-radius: var(--r-pill); background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--lift-2); font-size: var(--t-body); font-weight: var(--w-strong); color: var(--accent-deep); }
@media (prefers-reduced-motion: no-preference) {
  .analyzing-ring { animation: working-turn 0.9s linear infinite; }
  .analyzing-dots::after { animation: analyzing-dots 1.4s steps(4, end) infinite; content: ''; }
  .analyzing:not(.still) .analyzing-steps li.now::before { animation: analyzing-beat 1.4s ease-in-out infinite; }
  .fv-scan-light { animation: analyzing-sweep 2.6s ease-in-out infinite; }
}
@keyframes analyzing-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75%, 100% { content: '...'; } }
@keyframes analyzing-beat { 50% { box-shadow: 0 0 0 4px var(--accent-line); } }
@keyframes analyzing-sweep { 0% { transform: translateY(-100%); } 100% { transform: translateY(460%); } }
.reading-text { margin-top: var(--s3); }
.reading-text > summary { cursor: pointer; width: max-content; font-size: var(--t-dense); color: var(--accent-deep); }
.reading-text .pre { margin-top: var(--s2); max-height: 22rem; overflow-y: auto; }
.reading-text mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
[data-places-for] .read-line[data-box], [data-places-for] .spot[data-box] { cursor: pointer; border-radius: 2px; }
[data-places-for] .read-line[data-box]:hover, [data-places-for] .spot[data-box]:hover { background: var(--accent-wash); }
[data-places-for] .read-line.chosen { background: var(--accent-wash); box-shadow: inset 2px 0 0 var(--accent); }
[data-places-for] .spot.chosen { background: var(--accent-wash); box-shadow: 0 0 0 2px var(--accent-line); }
/* A fact read off a file looks the same whether it is outlined in the file shown or opens the file it came from. */
a.spot, [data-places-for] .spot[data-box] { color: inherit; text-decoration: underline dotted; text-underline-offset: 2px; }
.spot-file { margin-left: var(--s1); }
.left-out { display: grid; gap: var(--s2); }
.left-out-file { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); }
.left-out-file > span:first-child { flex: 1 1 22rem; }
.left-out-file > span:first-child > svg { margin-right: 6px; vertical-align: -2px; }
.reading-facts dd > .reading-say { flex-basis: 100%; }
.left-out-acts { display: inline-flex; flex-wrap: wrap; gap: var(--s2); }
.service-lines .line-warning { display: block; }
.service-lines .line-warning.quiet { color: var(--ink-soft); background: transparent; border-left-color: var(--rule-strong); }
.service-lines .pending-why { color: var(--warn); }
.service-lines .row-acts { display: flex; gap: var(--s2); margin-top: var(--s2); }
table.grid.service-lines > tbody > tr.line-head { background: var(--panel); }
table.grid.service-lines > tbody > tr.line-head > td { padding-bottom: var(--s1); font-size: var(--t-small); color: var(--ink-faint); }
/* A service to accept or drop is not on the item yet: tinted, with a rule down its left. */
table.grid.service-lines > tbody > tr:is(.waiting-line, .line-head) > td { background: color-mix(in srgb, var(--accent-wash) 55%, var(--panel)); }
.reading-why { margin: calc(-1 * var(--s2)) 0 var(--gap); }
/* Setting up Dropbox: numbered steps, each with its state, then what each of the page's buttons does. */
.setup-steps > ol { margin: 0; padding: 0 0 0 1.4em; display: grid; gap: var(--s3); }
.setup-steps .setup-step-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }

/* The identity strip at the top of the claim form: each cell a search box until chosen, then one line and a way to change it. */
.strip { display: grid; gap: var(--gap) var(--s5); grid-template-columns: 1fr; }
@media (min-width: 820px) { .strip { grid-template-columns: 1fr 1fr; } }
.strip .cell { min-width: 0; }
.strip .cell > h3 { margin-bottom: 5px; }
.chosen { display: flex; align-items: flex-start; gap: var(--gap-fields); min-height: var(--control); padding-top: 7px; }
.chosen .chosen-body { flex: 1; min-width: 0; }
.chosen .chosen-main { display: flex; align-items: center; gap: 6px; font-size: var(--t-panel); font-weight: var(--w-strong); line-height: 1.3; }
.chosen .chosen-sub { font-size: var(--t-small); color: var(--ink-soft); margin-top: 1px; }
.chosen .chosen-sub .tag { vertical-align: 1px; }
/* The chosen patient's health card first and large, with the ministry's last answer beside it, as their page names it. */
.chosen .chosen-card { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2); margin: 2px 0; }
.chosen .chosen-facts { display: block; }
.chosen .chosen-actions { display: flex; gap: var(--gap-fields); align-items: center; padding-top: var(--s1); white-space: nowrap; }
/* The claim form's heading says who is billing: the physician, the billing profile, and the two things done about them, in view while the claim is entered. */
/* Both halves start at the head's top: the title and the sentence under it on the left, who is billing on the right. */
.claim-head { align-items: flex-start; justify-content: flex-start; gap: var(--s2) var(--s5); }
.claim-head > div:first-child { flex: 0 0 auto; max-width: 100%; }
.claim-head > .actions { margin-left: auto; }
/* On a narrow window the two buttons go under who is billing, not beside. */
.claim-head .billing-as .chosen { padding-top: 0; align-items: center; flex-wrap: wrap; }
.claim-head .billing-as .chosen-body { flex: 1 1 280px; }
.claim-head .billing-as .chosen-main { font-size: var(--t-bar); gap: var(--s2); flex-wrap: wrap; }
.claim-head .billing-as .chosen-actions { padding-top: 0; flex-wrap: wrap; }
/* A physician with more than one billing profile: the profile is a short list on its own line, with what the ministry sees under it beside. */
.claim-head .billing-as .profile-line { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s1) var(--s2); }
/* The warning over the lines carries its own buttons. */
#master-asks .button { margin-left: var(--s2); }

/* A search box with a glass drawn in it. */
.search-box { position: relative; }
.search-box input { padding-left: 34px; }
.search-box::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -8px;
  border: 2px solid var(--ink-faint);
  border-radius: 50%;
  pointer-events: none;
}
/* The handle starts at the rim and runs clear of it, so the mark reads as a glass and not a letter. */
.search-box::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 50%;
  width: 7px;
  height: 2px;
  margin-top: 6px;
  border-radius: 1px;
  background: var(--ink-faint);
  transform: rotate(45deg);
  pointer-events: none;
}
.search-box .keep { margin-top: 5px; }
/* With the line under the box showing, the glass stays on the input and not on the middle of the two. */
.search-box:has(> .keep:not([hidden]))::before, .search-box:has(> .keep:not([hidden]))::after { top: 18px; }

/* A list that hangs under a field while somebody types (picker.js), positioned against the viewport by the script. */
.picker {
  position: fixed;
  z-index: 30;
  min-width: 420px;
  max-width: 560px;
  max-height: 288px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r);
  box-shadow: var(--float);
}
.picker-option {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: var(--gap-fields);
  align-items: baseline;
  padding: 5px 9px;
  cursor: default;
  border-bottom: 1px solid var(--rule);
}
.picker-option:last-child { border-bottom: 0; }
.picker-option.on { background: var(--accent-wash); }
.picker-code { font-variant-numeric: tabular-nums; font-weight: var(--w-strong); color: var(--accent); }
.picker-description { color: var(--ink-soft); font-size: var(--t-dense); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-fee { font-variant-numeric: tabular-nums; font-size: var(--t-dense); text-align: right; }
/* A service code's star in the list under Service code: pressed, the code is kept in Favourite codes, not chosen. */
.picker-option.with-star { grid-template-columns: 62px 1fr auto auto; }
.picker-star { padding: 0 2px; color: var(--accent); cursor: pointer; }
/* A code the ministry has stopped paying is shown, not hidden. */
.picker-ended { grid-column: 2 / -1; font-size: var(--t-caption); color: var(--warn); }
/* A payor's own code, with the payor's name under its words. */
.picker-payor { grid-column: 2 / -1; font-size: var(--t-caption); color: var(--ink-soft); }
/* A person rather than a code: the name on one line, what tells them from a namesake on the next. */
/* A row of two lines: a name or a number, and what tells it apart under it. */
.picker-option.two-line { grid-template-columns: 1fr auto; align-items: center; padding: 6px var(--gap-fields); }
.picker-option.two-line .picker-main { font-weight: var(--w-strong); }
.picker-option.two-line .picker-sub { grid-column: 1 / -1; font-size: var(--t-small); color: var(--ink-soft); margin-top: -2px; }
.picker-option.two-line .picker-side { font-size: var(--t-small); color: var(--ink-faint); }
/* A short list under a field that still takes anything typed (suggest.js). */
.picker.short { min-width: 240px; max-width: 420px; }
/* A long chooser typed into (choose.js): the field looks like the chooser it stands for, which stays in the form out of sight. */
input.choose {
  padding-right: 28px; cursor: default; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
input.choose:focus { cursor: text; }
input.choose::placeholder { color: var(--ink-soft); opacity: 1; }
/* Under a provider chosen by its number: the name of one not yet on the list. */
.provider-new { margin: var(--s2) 0 0; }
.provider-new[hidden] { display: none; }
/* Out of sight where it falls in its field, at no size: a chooser's own padding, height and the look of a disabled box do not
   reach it, so it neither shows nor widens the page. */
select.typed:not([multiple]):not([size]) { position: absolute; width: 1px; height: 1px; min-height: 0; margin: 0 0 0 -1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.picker.short .picker-option.plain { grid-template-columns: 1fr auto; }
.picker-option.current { font-weight: var(--w-strong); }
.picker-group { font-size: var(--t-caption); color: var(--ink-faint); }
/* A long menu's box to type in, at its head. */
.dropdown-menu > .menu-filter { display: block; width: calc(100% - 2 * var(--s2)); margin: var(--s2); }
.dropdown-menu > [hidden] { display: none; }
.picker.short .picker-option { grid-template-columns: 42px 1fr; }
/* A value with no code of its own -- a city -- reads as words, not as a code. */
.picker-option.plain { grid-template-columns: 1fr; }
.picker-option.plain .picker-code { font-family: inherit; font-weight: var(--w-text); color: var(--ink); }
.picker-empty { padding: var(--gap-fields) var(--s3); font-size: var(--t-dense); color: var(--ink-soft); }
.picker-empty a { margin-left: var(--s1); }

/* The time control (time-field.js): the time with a step either side, then the hours, the minutes in fives, and the usual lengths. */
.timepick {
  position: fixed;
  z-index: 30;
  width: 396px;
  max-width: calc(100vw - 16px);
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--float);
}
.timepick-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s3) var(--s2); border-bottom: 1px solid var(--rule); }
.timepick-time { min-width: 3.2em; text-align: center; font-size: var(--t-page); font-weight: var(--w-strong); font-variant-numeric: tabular-nums; }
.timepick-nudge { width: 28px; height: 28px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--panel);
                  color: var(--ink); font-weight: var(--w-strong); cursor: pointer; }
.timepick-nudge:hover { background: var(--raised); }
.timepick-said { margin-left: auto; color: var(--ink-soft); font-size: var(--t-dense); }
.timepick-cols { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s2) var(--s3) var(--s3); }
.timepick-col { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.timepick-col[data-col="length"] { grid-template-columns: repeat(4, 1fr); }
.timepick-caption { grid-column: 1 / -1; font-size: var(--t-small); color: var(--ink-faint); }
.timepick-cell {
  padding: 5px 0;
  font-size: var(--t-dense);
  font-variant-numeric: tabular-nums;
  text-align: center;
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--ink);
  cursor: pointer;
}
.timepick-col[data-col="length"] .timepick-cell { border-color: var(--rule); }
.timepick-cell:hover { background: var(--raised); border-color: var(--rule-strong); }
.timepick-cell.on, .timepick-cell.on:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: var(--w-strong); }
.timepick-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-top: 1px solid var(--rule);
  background: var(--raised);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.timepick-hint { color: var(--ink-faint); font-size: var(--t-small); }

/* A date typed or chosen (date-field.js): the month under the field, a step either side, and Today. */
.datepick {
  position: fixed; z-index: 30; width: 276px; max-width: calc(100vw - 16px);
  background: var(--panel); border: 1px solid var(--rule-strong); border-radius: var(--r-lg); box-shadow: var(--float);
}
.datepick-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); }
.datepick-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: var(--s2) var(--s3) var(--s3); }
.datepick-day { padding: 3px 0; text-align: center; font-size: var(--t-small); color: var(--ink-faint); }
.datepick-cell {
  padding: 5px 0; text-align: center; font-size: var(--t-dense); font-variant-numeric: tabular-nums;
  border: 1px solid transparent; border-radius: var(--r); color: var(--ink); cursor: pointer;
}
.datepick-cell:hover { background: var(--raised); border-color: var(--rule-strong); }
.datepick-cell.today { border-color: var(--accent-line); }
.datepick-cell.on, .datepick-cell.on:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: var(--w-strong); }
.datepick-cell.off, .datepick-cell.off:hover { background: none; border-color: transparent; color: var(--ink-faint); opacity: 0.5; cursor: default; }


/* The camera, over the page, with a box the card is held inside. */
/* The toolbar over the claim's lines: quick codes and the code lists, each kind of button in its own colour. No box of its own. */
.code-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); margin: 0 0 var(--s2); }
.code-bar .shortcut-list { flex: 1 0 100%; margin-top: 0; }
.code-bar .chip { padding: 5px var(--s3); border-radius: var(--r); font-weight: var(--w-strong); }
.code-bar .chip:hover, .code-bar .chip[aria-expanded="true"] { border-color: currentColor; }
.code-bar .chip.adds::before { color: inherit; }
.tone-quick .chip, .tone-quick .chip:hover { background: var(--accent-wash); border-color: var(--accent-line); color: var(--accent-deep); }
.tone-find .chip, .tone-find .chip:hover { background: var(--wait-wash); border-color: var(--wait-line); color: var(--wait); }
.pick-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pick-group[hidden] { display: none; }
.pick-name { margin-right: 2px; font-size: var(--t-small); font-weight: var(--w-strong); color: var(--ink-soft); white-space: nowrap; }
.chip.adds::before { content: "+"; margin-right: 5px; font-weight: var(--w-strong); color: var(--accent); }
/* A quick code's long name wraps where its chip is wider than the row, as on a phone. */
.chip.adds { white-space: normal; text-align: left; }
/* The intake item's services waiting, over the claim's lines; one added is struck through. */
.item-waiting { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
/* A service added as a line: a tick where its plus was, dimmed; never struck through, which reads as dropped. */
.item-waiting .chip.added { opacity: 0.7; }
.item-waiting .chip.adds.added::before { content: "✓"; }
.chip.opens::after {
  content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 1px 2px 7px;
  border-right: 1.5px solid var(--ink-faint); border-bottom: 1.5px solid var(--ink-faint); transform: rotate(45deg);
}
.chip.opens[aria-expanded="true"]::after { margin-bottom: -2px; transform: rotate(225deg); }
.chip[aria-expanded="true"] { background: var(--accent-wash); border-color: var(--accent); }
.code-bar .chip.opens::after { border-color: currentColor; }
.tone-quick .chip[aria-expanded="true"] { background: var(--accent-wash); border-color: var(--accent-deep); }
.tone-find .chip[aria-expanded="true"] { background: var(--wait-wash); border-color: var(--wait); }

/* The command palette: a wide box near the top of the window. */
dialog.palette { width: min(640px, calc(100vw - 2 * var(--s5))); margin-top: 12vh; padding: var(--s3); border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--panel); box-shadow: var(--float); }
dialog.palette::backdrop { background: var(--scrim); }
dialog.palette input { width: 100%; font-size: var(--t-panel); }
/* Its list is part of the box, not hung under the field, so the keys can sit below it. */
dialog.palette .picker { position: static; min-width: 0; max-width: none; max-height: 52vh; margin-top: var(--s2); border: 0; box-shadow: none; }
dialog.palette .picker-option { row-gap: 0; border-bottom: 0; border-radius: var(--r); }
dialog.palette .picker-option[data-head]::before {
  content: attr(data-head); grid-column: 1 / -1; margin: var(--s2) 0 2px; font-size: var(--t-caption); font-weight: var(--w-strong);
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint);
}
dialog.palette .picker-option.on { background: transparent; }
dialog.palette .picker-option.on .picker-main { color: var(--accent-deep); text-decoration: underline; }
.palette-keys { margin: var(--s2) 0 0; padding-top: var(--s2); border-top: 1px solid var(--rule); font-size: var(--t-small); color: var(--ink-faint); }
.palette-keys kbd { margin: 0 3px 0 var(--s2); }
.palette-keys kbd:first-child { margin-left: 0; }

/* The X in every dialog's top right corner: a disc in the accent, the cross drawn in it; it turns a quarter under the pointer. */
.dialog-x {
  position: absolute; top: var(--s3); right: var(--s3); z-index: 2;
  width: 28px; height: 28px; padding: 0; margin: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent);
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1.2), background 120ms ease;
}
.dialog-x::before, .dialog-x::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 12px; height: 2px; margin: -1px 0 0 -6px;
  background: currentColor; border-radius: 1px; transform: rotate(45deg);
}
.dialog-x::after { transform: rotate(-45deg); }
.dialog-x:hover { background: var(--accent-deep); transform: rotate(90deg) scale(1.08); }
.dialog-x:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 50%; }
@media (prefers-reduced-motion: reduce) { .dialog-x { transition: none; } .dialog-x:hover { transform: none; } }

/* A form in a dialog: head and buttons stay put, the body scrolls; scoped to `.sheet`. */
dialog.sheet {
  width: min(780px, calc(100vw - 2 * var(--s4)));
  max-height: min(880px, calc(100vh - 2 * var(--s5)));
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--float);
  /* Clipped, never scrolled: a label kept for screen readers alone far down the body reaches past the foot, and a
     dialog that could scroll was moved by the cursor going to it, its heading and Save bar out of sight. */
  overflow: clip;
}
dialog.sheet[open] { display: flex; flex-direction: column; }
/* A form that asked for the room: the composer keeps its two columns. */
dialog.sheet.wide { width: min(1100px, calc(100vw - 2 * var(--s4))); }
/* A long form with two sections abreast takes most of a wide window. */
dialog.sheet.widest { width: min(1380px, calc(100vw - 2 * var(--s4))); }
/* A form that is mostly a message is as tall as a dialog gets, whatever it holds, and the message takes the height. */
dialog.sheet.tall { height: min(880px, calc(100dvh - 2 * var(--s5))); }
dialog.sheet::backdrop { background: var(--scrim); }

/* A preview: a page or a file framed over the page, as wide and tall as the window allows. */
dialog.sheet.preview { width: min(1100px, calc(100vw - 2 * var(--s4))); height: calc(100dvh - 2 * var(--s5)); max-height: none; }
.preview-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--rule); }
.preview-head h2 { margin: 0 auto 0 0; font-size: var(--t-panel); }
dialog.preview iframe { flex: 1 1 auto; width: 100%; border: 0; }

/* The document viewer: its tools in a bar, and under it the pages, which scroll. One set of rules for the
   dialog, a page of its own and a column beside a form. A page's box is sized by the script to the picture,
   the zoom and the turn; until the picture arrives it is a letter page. */
/* Clipped, not scrollable: only the stage scrolls, so the bar can never be scrolled out of view, in full screen least of all. */
.file-viewer { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg); overflow: hidden; overflow: clip; }
main > .file-viewer { height: calc(100vh - var(--bar) - 150px); min-height: 420px; }
dialog.sheet:has(.file-viewer) { height: calc(100dvh - 2 * var(--s5)); max-height: none; }
dialog.sheet .file-viewer { flex: 1 1 auto; border: 0; border-radius: 0; }
.fv-bar { flex: 0 0 auto; display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--rule); }
.fv-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--w-strong); font-size: var(--t-dense); }
.fv-count { white-space: nowrap; }
.fv-tools { display: inline-flex; gap: var(--s1); }
.fv-end { display: inline-flex; gap: var(--s2); margin-left: auto; }
.fv-stage { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--s3); background: var(--paper); }
.fv-stage:focus-visible { outline: none; box-shadow: inset var(--ring); }
.fv-page { position: relative; container-type: size; width: 100%; aspect-ratio: 17 / 22; margin: 0 auto var(--s3); background: var(--white); box-shadow: var(--lift-2); overflow: hidden; }
.fv-page:last-child { margin-bottom: 0; }
.fv-page img { position: absolute; top: 50%; left: 50%; width: 100cqw; height: 100cqh; max-width: none; transform: translate(-50%, -50%); }
.fv-page.failed img { display: none; }
.fv-marks { position: absolute; top: 50%; left: 50%; width: 100cqw; height: 100cqh; transform: translate(-50%, -50%); pointer-events: none; }
.fv-outline { position: absolute; border: 2px solid var(--accent); border-radius: 3px; background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); pointer-events: auto; cursor: pointer; }
.fv-page.failed::after { content: "This page could not be drawn. Press Download to open the file."; position: absolute; inset: 0; display: grid; place-items: center; padding: var(--s4); text-align: center; color: var(--ink-soft); font-size: var(--t-dense); }
.fv-text { margin: 0; padding: var(--s4); background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r); white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--t-dense); }
.fv-frame { flex: 1 1 auto; width: 100%; border: 0; background: var(--white); }
.fv-none { margin: var(--s5) auto; max-width: 44ch; text-align: center; color: var(--ink-soft); }
.icon.mirrored { transform: scaleX(-1); }

/* A claim at a glance: a drawer down the right of the window, opened from the row under the pointer. */
dialog.drawer {
  width: min(520px, 100vw); max-width: 100vw; height: 100vh; max-height: 100vh;
  margin: 0 0 0 auto; padding: 0; border: 0; border-left: 1px solid var(--rule);
  background: var(--panel); color: var(--ink); box-shadow: var(--float);
}
dialog.drawer[open] { display: flex; flex-direction: column; }
dialog.drawer::backdrop { background: var(--scrim-soft); }
.peek-body table.grid.mini td, .peek-body table.grid.mini th { padding-left: 0; padding-right: var(--s3); }
/* The button is no taller than the words beside it, so a row keeps its height when the button arrives. */
.peek-open {
  margin: -2px 0 -2px 6px; padding: 2px var(--s1); border: 0; border-radius: var(--r); background: none; color: var(--ink-faint);
  line-height: 0; cursor: pointer; vertical-align: -2px; opacity: 0;
}
.peek-open svg { display: block; }
table.grid tbody tr:hover .peek-open, .peek-open:focus-visible, table.grid tbody tr:focus-within .peek-open { opacity: 1; }
.peek-open:hover { background: var(--panel); color: var(--accent-deep); }
/* The holder and the form carry the three rows between them: the form the holder holds, or the one around the scrolling body.
   A small form inside the body or the heading (a row of fields, a button) keeps its own layout. */
dialog.sheet > div:not(.preview-head), dialog.sheet > div > form, dialog.sheet > div > div:has(> .form-body, > fieldset.read-only), dialog.sheet form:has(> [data-sheet-scroll]) { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
/* A read-only fieldset around the body passes the rows through, so the body still scrolls. */
dialog.sheet :is(form, div) > fieldset.read-only { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
dialog.sheet > .preview-head { flex: 0 0 auto; }

.sheet-head {
  position: relative;
  flex: 0 0 auto;
  padding: var(--s4) var(--s5) var(--s3);
  background: var(--panel);
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
}
.sheet-head h2 { margin: 0; padding: 0; border: 0; font-size: var(--t-panel); color: var(--ink); }
.sheet-head .lede { margin: 2px 0 0; font-size: var(--t-dense); color: var(--ink-soft); }
/* A record read in the dialog: its actions sit in the head, as a page's do, with Close last. */
.sheet-head.thread-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.sheet-head.thread-head > div:first-child { min-width: 0; }
.sheet-head.thread-head .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.sheet-head.thread-head .actions form { margin: 0; }
/* Its title row as a page's: the title and its tags on one line, the line under it below them. */
.sheet-head.thread-head > div:first-child { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s2); }
.sheet-head.thread-head > div:first-child > * { margin-top: 0; margin-bottom: 0; }
.sheet-head.thread-head > div:first-child > :is(.tag, .help-link) { align-self: center; }
.sheet-head.thread-head > div:first-child > .lede { flex-basis: 100%; }
/* Every head leaves the corner to the X. */
.sheet-head, .preview-head, .keys-head, dialog.ask, dialog.camera { padding-right: calc(var(--s5) + 28px); }
/* The sheet's head leaves room for two buttons, Full screen and the X. */
.sheet-head { padding-right: calc(var(--s5) + 64px); }
/* A record's sections stand as cards on the body's raised ground, as panels do on a page. */
.sheet [data-sheet-scroll] .panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: var(--s4); }
.sheet [data-sheet-scroll] .panel + .panel { margin-top: var(--gap); }
/* Cards abreast start level, and a card that is a table keeps the table to its edges. */
.sheet [data-sheet-scroll] .cards > .panel + .panel { margin-top: 0; }
.sheet [data-sheet-scroll] .panel.flush { padding: 0; overflow: hidden; }

.sheet .form-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--gap) var(--s5);
  background: var(--raised);
}
/* The sections stand on the raised ground the way panels stand on the page. */
/* A dialog is narrow, so a long form's two columns become one; the widest dialog keeps the two. */
.sheet .form-stack { grid-template-columns: 1fr; }
@media (min-width: 1100px) {
  .sheet.widest .form-stack { grid-template-columns: 1fr 1fr; }
}
/* A form that is a panel on its own page is already inside the dialog's body. */
.sheet .panel { border: 0; box-shadow: none; background: none; padding: 0; margin: 0; }
.sheet .measure { max-width: none; }

.sheet .form-actions {
  flex: 0 0 auto;
  padding: var(--s3) var(--s5);
  border-top: 1px solid var(--rule);
  background: var(--panel);
}
/* Waiting on the server, while the button is disabled anyway: a ring turns beside its words. */
.button.working { opacity: 0.8; }
.button.working::after {
  content: ''; flex: 0 0 auto; width: 12px; height: 12px; margin-left: var(--s2); box-sizing: border-box;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
}
/* A list being read again after its filters changed. */
[data-live-region][aria-busy="true"] { opacity: 0.55; transition: opacity 120ms ease 150ms; }

/* While a dialog's form is fetched the dialog is not shown: the page says it is busy instead. */
html.sheet-waiting, html.sheet-waiting * { cursor: progress; }

@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: sheet-in 140ms cubic-bezier(0.2, 0.7, 0.3, 1); }
  .button.working::after { animation: working-turn 0.7s linear infinite; }
  @keyframes working-turn { to { transform: rotate(360deg); } }
  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(8px) scale(0.985); }
    to { opacity: 1; transform: none; }
  }
  @keyframes sheet-wait {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
  }
}

/* On a narrow screen the dialog takes the whole window. */
@media (max-width: 820px) {
  /* On a phone a dialog takes the width and starts at the top of what can be seen, never taller than it: the window's
     full height on an iPhone is measured with Safari's bars hidden, and a dialog that tall, centred, lost its X and its
     buttons under them. */
  dialog.sheet { width: 100vw; max-width: 100vw; max-height: 100vh; max-height: 100dvh; margin: 0 0 auto; border: 0; border-radius: 0; }
  .sheet-head, .sheet .form-body, .sheet .form-actions { padding-left: var(--s4); padding-right: var(--s4); }
  .sheet-head { padding-right: calc(var(--s4) + 64px); }
}

/* A claim's journey: when, what and by whom, one step a line. */
/* A record's journey, oldest first, a mark at each step shaped as a status tag's: ring entered, half disc sent, disc paid, square settled, diamond rejected. */
.journey { list-style: none; margin: 0; padding: 0; font-size: var(--t-dense); }
.journey li { position: relative; display: grid; grid-template-columns: 9.5em 1fr; column-gap: var(--s3); padding: 0 0 var(--s3) var(--s5); }
.journey li:last-child { padding-bottom: 0; }
.journey li::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: -4px; width: 1px; background: var(--rule-strong); }
.journey li:last-child::after { display: none; }
.journey li::before {
  content: ""; position: absolute; left: 2px; top: 5px; width: 9px; height: 9px; box-sizing: border-box;
  border: 2px solid var(--ink-faint); border-radius: 50%; background: var(--panel);
}
.journey li.changed::before { left: 4px; top: 7px; width: 5px; height: 5px; border-width: 1px; }
.journey li.entered::before { border-color: var(--ink-soft); }
.journey li:is(.sent, .invoiced)::before { border-color: var(--wait); background: linear-gradient(90deg, var(--wait) 50%, var(--panel) 50%); }
.journey li.paid::before { border-color: var(--good); background: var(--good); }
.journey li.settled::before { border-color: var(--good); background: var(--good); border-radius: 1px; }
.journey li.rejected::before { border-color: var(--bad); background: var(--bad); border-radius: 1px; transform: rotate(45deg); }
.journey .journey-file { grid-column: 2; justify-self: start; }

/* A file's steps in a row: the ones reached are filled, the latest is ringed, the rest are to come. */
.stages { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); font-size: var(--t-dense); }
.stages li { position: relative; padding: 26px var(--s3) 0 0; color: var(--ink-faint); }
.stages li::before { content: ""; position: absolute; left: 0; top: 0; width: 18px; height: 18px; box-sizing: border-box; border: 2px solid var(--rule-strong); border-radius: 50%; background: var(--panel) center / 10px 10px no-repeat; z-index: 1; }
.stages li::after { content: ""; position: absolute; left: 22px; right: 4px; top: 8px; height: 2px; border-radius: 1px; background: var(--rule); }
.stages li:last-child::after { display: none; }
.stages li.done { color: var(--ink); }
.stages li.done::before { border-color: var(--accent); background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='white' d='M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z'/%3E%3C/svg%3E"); }
.stages li.done:has(+ .done)::after, .stages li.done:has(+ .now)::after { background: var(--accent); }
.stages li.now::before { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
/* A step it waits at, not yet reached, is a ring of the accent, its name in ink; a step that ended it wrongly (a claim
   rejected or cancelled) is the fault's colour. */
.stages li.now { color: var(--ink); }
.stages li.now:not(.done)::before { border-color: var(--accent); }
.stages li.bad { color: var(--bad); }
.stages li.bad::before { border-color: var(--bad); background: var(--bad-wash); }
.stages .stage-name { display: block; font-weight: var(--w-strong); }
.stages .stage-when { display: block; color: var(--ink-soft); }
/* Steps that open a section need no room over them. */
.panel > .stages:first-child { margin-top: 0; }
@media (max-width: 820px) {
  .stages { grid-auto-flow: row; grid-template-columns: 1fr; gap: var(--s2); }
  .stages li { padding: 0 0 0 28px; }
  .stages li::after { display: none; }
}

/* The checks kept with a claim, the latest save's first. */
.checks-kept { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); font-size: var(--t-dense); }

/* A claim's versions, newest first, each with what changed. */
.versions { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); font-size: var(--t-dense); }
.versions ul { margin: var(--s1) 0 0; padding-left: var(--s4); }

/* Notes on a record: each thread, its replies set in, and a box to add one. */
.notes .note { padding: var(--s2) 0; border-bottom: 1px solid var(--rule-soft); }
.notes .note.reply { margin-left: var(--s5); padding-bottom: 0; border-bottom: 0; }
.notes .note-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s1); }
.notes .note-head .tag { margin-right: var(--s1); }
.notes .note-acts { display: inline-flex; gap: 2px; }
.notes .note-act { margin: 0; }
.notes .note-act .icon-button { width: 24px; height: 24px; }
/* A pinned thread stands at the top with the accent's wash behind it. */
.notes .note.pinned { margin: 0 calc(-1 * var(--s2)); padding-left: var(--s2); padding-right: var(--s2); border-radius: var(--r); background: var(--accent-wash); }
.notes .note-reply summary { cursor: pointer; font-size: var(--t-dense); color: var(--ink-soft); margin-top: var(--s1); }
.notes .note-reply form { display: grid; gap: var(--s2); margin-top: var(--s2); }
.notes .note-reply .button { justify-self: start; }

/* A form on one line inside a list of facts: a choice and its button. */
.inline-form { display: flex; align-items: center; gap: var(--s2); margin: 0; }
.inline-form select, .inline-form input.choose { width: auto; min-width: 12em; }
/* On a phone a form on one line wraps, its boxes never wider than the screen. */
@media (max-width: 820px) {
  .inline-form { flex-wrap: wrap; }
  .inline-form :is(select, input.choose, input:not([type="checkbox"], [type="radio"])) { min-width: 0; max-width: 100%; }
}

/* Who performed the service, under the billing profile. */
.performer { margin-top: var(--s2); font-size: var(--t-dense); }
.performer #performer-find { max-width: 320px; margin-top: var(--s1); }

/* The bulletin that published a code the Schedule does not hold, under the code. */
.entry .off-schedule { display: flex; align-items: center; gap: var(--s1); margin: var(--s1) 0 0; font-weight: var(--w-text); color: var(--ink-soft); white-space: nowrap; }
input.w-bulletin { width: 64px; }
input.w-teeth { width: 120px; }

/* Both sides, under a surgeon's code in a surgical section. */
.entry .both-sides { display: flex; align-items: center; gap: var(--s1); margin: var(--s1) 0 0; font-weight: var(--w-text); color: var(--ink-soft); }
.entry .both-sides input { width: auto; min-height: 0; }

/* How the patient was seen, above the lines when a code may be billed virtually. */
.modality { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s2) var(--s5); border-bottom: 1px solid var(--rule); font-size: var(--t-dense); }
.modality label { display: inline-flex; align-items: center; gap: var(--s1); margin: 0; font-size: var(--t-dense); font-weight: var(--w-text); color: var(--ink); }
.modality .field-note { margin: 0; }

/* Recent codes, favourites and the bundles chosen, opened from the chips over the lines. */
.shortcut-list { margin-top: var(--s2); border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); max-height: 60vh; overflow-y: auto; }
/* Under a line billed in units: its units, its after-hours premium and, for an anaesthetic, its extra units, each a line of the claim. */
.case-panel { display: grid; gap: var(--s2); margin: var(--s1) 0; white-space: normal; line-height: 1.4; padding: var(--s2) var(--s3); border: 1px solid var(--good-line); border-left: 3px solid var(--good); border-radius: var(--r); background: var(--good-wash); font-size: var(--t-dense); color: var(--ink); }
.case-panel[hidden] { display: none; }
.an-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); }
.an-head strong { color: var(--good); }
.an-group { display: grid; gap: 2px; }
.an-name { font-weight: var(--w-strong); }
.an-name .muted { font-weight: var(--w-text); }
.an-choice { display: flex; align-items: flex-start; gap: var(--s2); margin: 0; padding: 2px 0; white-space: normal; font-size: var(--t-dense); font-weight: var(--w-text); color: var(--ink); cursor: pointer; }
/* The entry table sizes its text boxes; a tick box under a line keeps its own size. */
table.grid.entry .an-choice input { flex: none; min-height: 0; margin: 1px 0 0; padding: 0; }
.an-choice > span { min-width: 0; }
.an-extras > summary { cursor: pointer; }
.an-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px var(--s5); margin-top: var(--s1); }
@media (max-width: 1100px) { .an-list { grid-template-columns: 1fr; } }
.shortcut-list > p { margin: 0; padding: var(--s2) var(--s3); }
.shortcut { display: flex; align-items: center; border-bottom: 1px solid var(--rule-soft); }
.shortcut:last-child { border-bottom: 0; }
.shortcut-add {
  flex: 1;
  display: grid;
  grid-template-columns: 7ch 1fr auto;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--t-dense);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.shortcut-add:hover { background: var(--accent-wash); }
.shortcut-add .money { text-align: right; }
/* A quick code in the list of every quick code: its name, then its lines; its group's heading over it; the find box at the top. */
.shortcut-add.bundle { grid-template-columns: minmax(0, 1fr) auto; }
.shortcut-head { position: sticky; top: 2.6rem; padding: var(--s2) var(--s3) var(--s1); border-bottom: 1px solid var(--rule-strong); background: var(--panel); font-size: var(--t-dense); font-weight: var(--w-strong); color: var(--ink); }
.shortcut-find { position: sticky; top: 0; z-index: 1; display: block; width: 100%; height: 2.6rem; padding: var(--s2) var(--s3); border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: var(--panel); font: inherit; font-size: var(--t-dense); }
.shortcut .star { padding: var(--s2) var(--s3); border: 0; background: none; font: inherit; color: var(--accent); cursor: pointer; }
/* The star on a claim line: the line's code kept in, or taken out of, Favourite codes; outlined until it is one. */
.line-star { padding: 0 2px; border: 0; background: none; font: inherit; line-height: 1; color: var(--accent); cursor: pointer; }
.line-star[hidden] { display: none; }
.shortcut .check { flex: 1; margin: 0; padding: var(--s2) var(--s3); }
.shortcut .muted { padding-right: var(--s3); }
/* Describe the service: the words typed, the button, then the AI's codes under each line typed, as Recent codes lists them. */
.describe { display: grid; gap: var(--s2); padding: var(--s3); }
.describe > label { font-size: var(--t-dense); font-weight: var(--w-strong); color: var(--ink); }
.describe textarea { width: 100%; max-width: 40rem; resize: vertical; }
.describe-actions { display: flex; gap: var(--s2); }
.describe .analyzing.compact { margin: 0; padding: var(--s2) 0; border: 0; background: none; }
.describe-said { margin: 0; }
.describe-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding-top: var(--s2); border-top: 1px solid var(--rule); }
.describe-head .button { margin-left: auto; }
.describe-line { border: 1px solid var(--rule-soft); border-radius: var(--r); }
.describe-words { padding: var(--s2) var(--s3) var(--s1); font-size: var(--t-dense); font-weight: var(--w-strong); color: var(--ink); }
.describe-none { margin: 0; padding: 0 var(--s3) var(--s2); }
.describe-line .shortcut { border-bottom: 0; border-top: 1px solid var(--rule-soft); }
.describe-code .sub { display: block; color: var(--ink-faint); font-size: var(--t-small); }
.describe-code.added { opacity: 0.7; cursor: default; }
.describe-code.added .money::before { content: "✓"; margin-right: var(--s1); }
/* The AI's answer is read in the page, not in a box of its own that scrolls under the form's sticky heading. */
.shortcut-list:has(> .describe) { max-height: none; overflow: visible; }
/* Ask about a code: the answer, then the Schedule's words it rests on, each with its page. */
.ask-answer { margin: 0; max-width: 72ch; }
.ask-quotes { display: grid; gap: var(--s2); max-width: 96ch; margin: 0; padding: 0; list-style: none; }
.ask-quotes li { padding: var(--s2) var(--s3); border-left: 3px solid var(--accent-line); background: var(--raised); border-radius: var(--r); }
.ask-quotes q { display: block; font-size: var(--t-dense); color: var(--ink); }
.ask-quotes .sub { display: block; color: var(--ink-faint); font-size: var(--t-small); }
.ask-code { display: grid; gap: var(--s2); }
.ask-code textarea { width: 100%; resize: vertical; }
.ask-code .ask-said { display: grid; gap: var(--s2); }
.ask-code .ask-said:empty { display: none; }
/* A rejected claim's Suggest a fix with the AI, under its rejections: what to do, the changes, the way to resubmit. */
.ai-fix { display: grid; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); }
.ai-fix[hidden] { display: none; }
.ai-fix .analyzing.compact { margin: 0; padding: 0; border: 0; background: none; }
.ai-fix .message { margin: 0; }
.ai-fix-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.ai-fix-advice { margin: 0; max-width: 72ch; }
.ai-fix-changes { display: grid; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.ai-fix-change { padding: var(--s2) var(--s3); border: 1px solid var(--rule-soft); border-left: 3px solid var(--accent-line); border-radius: var(--r); }
.ai-fix-change .sub { display: block; color: var(--ink-faint); font-size: var(--t-small); }
.ai-fix-arrow { color: var(--ink-faint); }
.ai-fix-foot { display: flex; gap: var(--s2); }
.line-ai .ai-changed, .field-note.ai-changed { color: var(--accent-deep); }

/* A modal dialog that fills the window; its own layout applies only while it is open. */
.camera {
  position: fixed; inset: 0; z-index: 40;
  width: auto; height: auto; max-width: none; max-height: none; margin: 0; border: 0;
  background: var(--camera-ground);
  padding: var(--s4);
}
.camera[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3); }
.camera::backdrop { background: transparent; }
.camera-frame { position: relative; max-width: 100%; }
.camera-frame video { display: block; max-width: min(100vw - 32px, 720px); max-height: 60vh; border-radius: var(--r-lg); background: var(--black); }
.camera-guide {
  position: absolute; left: 10%; top: 50%; width: 80%; aspect-ratio: 856 / 540; max-height: 90%;
  transform: translateY(-50%);
  border: 2px solid var(--signal); border-radius: var(--r-round); pointer-events: none;
  box-shadow: 0 0 0 9999px var(--camera-dim);
}
.camera-status { color: var(--on-accent); margin: 0; font-size: var(--t-body); }
.camera-pick { max-width: min(100vw - 32px, 720px); }

/* A ministry file shown as it arrived: fixed width, never wrapped, since the columns are the layout. */
.file-text {
  margin: 0;
  padding: var(--gap-fields) var(--s3);
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow-x: auto;
  font: var(--t-code)/1.5 var(--mono);
  white-space: pre;
  color: var(--ink);
}
/* The ministry's messages on a remittance advice, one block each. */
.file-text + .file-text { margin-top: var(--gap-fields); }
/* A communication from the ministry: a line longer than the page wraps, and a table in it keeps its columns. */
.file-text.letter { white-space: pre-wrap; overflow-wrap: break-word; font-size: var(--t-dense); max-height: 60vh; overflow-y: auto; }
/* A ministry message on its list: what it is about, the file's name under it. */
.message-about { min-width: 24ch; }
.message-about > a { display: block; font-weight: var(--w-strong); }

/* A key or a code somebody types out from the screen: large, spaced, selected whole. */
.key { font: var(--t-key) var(--mono); letter-spacing: 0.04em; user-select: all; }
.key.large { font-size: var(--t-key-large); }

kbd {
  font: var(--w-mid) var(--t-caption)/1.3 var(--sans);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-bottom-color: var(--rule-strong);
  box-shadow: inset 0 -1px 0 var(--rule-soft);
  border-radius: 5px;
  padding: 0 5px;
  color: var(--ink-faint);
}

/* The claim form's service lines, each a body of its own; the line being worked on is marked in accent. */
/* The lines sit in a card like the page's others: the same inset at each side, the same space between fields, and column headings that read as field labels. */
table.grid.entry.lines th, table.grid.entry.lines td { padding-left: 5px; padding-right: 5px; }
table.grid.entry.lines th:first-child, table.grid.entry.lines td:first-child { padding-left: var(--s5); }
table.grid.entry.lines th:last-child, table.grid.entry.lines td:last-child,
table.grid.entry.lines tr.line-notes td:last-child { padding-right: var(--s5); }
table.grid.entry.lines thead th { padding-top: var(--s4); padding-bottom: var(--s1); border-bottom: 0; box-shadow: none; }
/* A code the line leaves off that its physician usually bills with it, or an add-on the line makes payable, with a press that adds it. */
.line-offer {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3);
  margin-top: var(--s1); padding: 2px var(--s2);
  font-size: var(--t-small); color: var(--ink);
  background: var(--accent-wash); border-left: 3px solid var(--accent-line); border-radius: 0 var(--r) var(--r) 0;
}
/* The offers past the first few, a press away. */
.line-offers > button.link { margin-top: var(--s1); padding-left: var(--s2); }
/* The warnings of the whole claim the save would keep, under the lines. */
.claim-holds { padding: 0 var(--s5) var(--s4); }
.claim-holds .line-warning:first-child { margin-top: 0; }
/* What is wrong with the lines as a whole is said under them, at the section's own margin. */
.panel.flush > .field-error { padding: 0 var(--s5); margin: var(--s2) 0; }
table.grid.entry.lines td.line-said { padding-top: 6px; padding-left: var(--s3); white-space: normal; }
table.grid.entry.lines tbody.line { border-top: 1px solid var(--rule); }
table.grid.entry.lines tbody.line:first-of-type { border-top: 0; }
table.grid.entry.lines tbody.line tr,
table.grid.entry.lines tbody.line tr:hover { background: transparent; }
table.grid.entry.lines tbody.line td { border-bottom: 0; }
table.grid.entry.lines tbody.line:nth-of-type(even) { background: var(--zebra); }
table.grid.entry.lines tbody.line:focus-within { background: var(--accent-wash); }
table.grid.entry.lines tbody.line:focus-within td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.grid.entry.lines tbody.line:focus-within td.line-number { color: var(--accent); font-weight: var(--w-strong); }
table.grid.entry.lines td.amount { font-weight: var(--w-strong); color: var(--ink); }
table.grid.entry.lines tr.line-notes td { padding: 0 var(--s1) var(--s2); }
/* A refused field's words are in its cell while the line is one row across; under the line once it wraps. */
.line-refusals > .field-error { display: none; }
table.grid.entry.lines tr.line-notes:not(:has(.line-ai > *, .line-warnings > *, .line-holds > *, .line-offers > *, .line-blocks > *, .billed-note:not([hidden]), .both-sides:not([hidden]), .teeth:not([hidden]), .off-schedule:not([hidden]), .case-panel:not([hidden]))) { display: none; }
table.grid.entry.lines tfoot td.total { font-size: var(--t-body); font-weight: var(--w-strong); }
table.grid.entry.lines tfoot td.total span { margin-left: var(--s3); color: var(--accent); }
/* Where a line no longer fits across, its fields wrap and each carries its own name; nothing scrolls sideways. */
@container lines (max-width: 1040px) {
  table.grid.entry.lines, table.grid.entry.lines tbody, table.grid.entry.lines tfoot { display: block; }
  table.grid.entry.lines thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.grid.entry.lines tr.line-inputs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2) var(--s1); padding: var(--s2) 9px; }
  table.grid.entry.lines tr.line-inputs > td { display: block; padding: 0; }
  table.grid.entry.lines tr.line-inputs > td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: var(--t-small); font-weight: var(--w-text); color: var(--ink-soft); }
  table.grid.entry.lines tr.line-inputs > td.line-number { min-width: 18px; padding-bottom: 7px; }
  /* The line in hand is marked down its whole left edge, clear of its number. */
  table.grid.entry.lines tbody.line:focus-within td:first-child { box-shadow: none; }
  table.grid.entry.lines tbody.line:focus-within { box-shadow: inset 3px 0 0 var(--accent); }
  table.grid.entry.lines tr.line-inputs > td.amount { min-width: 76px; padding-bottom: 6px; text-align: right; }
  table.grid.entry.lines tr.line-inputs > td.shrink { width: auto; margin-left: auto; }
  table.grid.entry.lines tr.line-inputs > td.line-said { order: 1; flex: 1 0 100%; }
  /* Once a line's fields wrap, a refusal is said under the line, not in the field's cell, so it never widens it. */
  table.grid.entry.lines tr.line-inputs > td > .field-error { display: none; }
  table.grid.entry.lines .line-refusals > .field-error { display: block; }
  table.grid.entry.lines tr.line-notes:has(.line-refusals > *):not([hidden]) { display: block; }
  table.grid.entry.lines tr.line-inputs > td.line-said:not(:has(.code-description:not(:empty), .dx-description:not(:empty), .line-working:not(:empty))) { display: none; }
  table.grid.entry.lines tr.line-notes:not([hidden]) { display: block; }
  table.grid.entry.lines tr.line-notes > td { display: block; padding: 0 9px var(--s2); }
  table.grid.entry.lines tr.line-notes > td:first-child { display: none; }
  table.grid.entry.lines tr.line-notes > td:last-child { padding-right: 9px; }
  table.grid.entry.lines tfoot tr { display: flex; justify-content: flex-end; }
  table.grid.entry.lines tfoot td { display: block; }
}
.line-facts { display: flex; flex-wrap: wrap; gap: 2px var(--s4); font-size: var(--t-small); line-height: 1.45; color: var(--ink-soft); }
.line-facts .fact:empty,
.line-facts .dx-fact:has(.dx-description:empty) { display: none; }
.line-facts .code-description.warn { color: var(--warn); }
.line-facts .fact-label { margin-right: var(--s1); font-size: var(--t-caption); font-weight: var(--w-strong); letter-spacing: 0.04em; color: var(--ink-faint); }
.line-facts .line-working { color: var(--accent); font-variant-numeric: tabular-nums; }
.line-warning {
  margin-top: var(--s1);
  padding: 2px var(--s2);
  font-size: var(--t-small);
  color: var(--warn);
  background: var(--warn-wash);
  border-left: 3px solid var(--warn-line);
  border-radius: 0 var(--r) var(--r) 0;
}

/* What the pricing notes of a line, beside its warnings and offers: said quietly, in grey, never in the amber of a warning. */
.line-warnings .line-warning { color: var(--ink-soft); background: transparent; border-left-color: var(--rule-strong); }

/* A claim form typed and never saved, offered back: the sentence, then its two buttons. */
.kept-band { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.claim-head > :is(.kept-band, .message.said) { flex: 1 0 100%; margin: 0; }
.kept-band form.inline { display: inline; margin: 0; }

/* A warning the claim file cannot carry: the claim is left out of a build until it is put right. */
.line-warning.refused { color: var(--bad); background: var(--bad-wash); border-left-color: var(--bad); }

/* A refusal's steps on the claim page: the reason, then the buttons. */
.inline-reason { display: flex; gap: var(--s1); align-items: center; flex-wrap: wrap; }
.inline-reason input[type="text"] { width: 22rem; max-width: 100%; min-height: 0; padding: var(--s1) 6px; }

/* Money by month, drawn on the server; grid lines and ticks faint. */
.chart { margin: 0 0 var(--gap-fields); }
/* The last thing in its section adds no gap of its own under it. */
.panel > .chart:last-child { margin-bottom: 0; }
.chart svg { display: block; width: 100%; height: auto; max-height: 320px; }
.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
/* A month under the pointer is tinted, and its amounts are on the hover. */
.chart .month-hit { fill: transparent; }
.chart .month-hit:hover { fill: var(--ink); fill-opacity: 0.06; }
/* A chart's axis words are read, so they keep the caption's floor. */
.chart .tick { font-size: var(--t-caption); fill: var(--ink-faint); }
.chart .tick.marked { fill: var(--signal-deep); font-weight: var(--w-strong); }
/* A bar that opens the records behind it (_bars-one): its name takes the link colour on hover. */
.chart a.bar-link { cursor: pointer; }
.chart a.bar-link:hover .tick { fill: var(--accent); text-decoration: underline; }

/* Bars along, each beside its name and its figure (_bars-by): rows of progress bars on the largest figure, read at any
   width; the signal colour where the figure wants attention; a bar with an address opens it. */
.hbars { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr) max-content; gap: 6px var(--s3); align-items: center; font-size: var(--t-dense); }
.hbars > .hbar { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; align-items: center; color: var(--ink); text-decoration: none; }
.hbar-label { color: var(--ink-faint); text-align: right; overflow-wrap: anywhere; }
.hbar-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar-track { appearance: none; display: block; width: 100%; height: 14px; border: 0; border-radius: 2px; background: transparent; }
.hbar-track::-webkit-progress-bar { background: transparent; }
.hbar-track::-webkit-progress-value { background: var(--accent); border-radius: 2px; }
.hbar-track::-moz-progress-bar { background: var(--accent); border-radius: 2px; }
.hbar.attention .hbar-label { color: var(--signal-deep); font-weight: var(--w-strong); }
.hbar.attention .hbar-track::-webkit-progress-value { background: var(--signal); }
.hbar.attention .hbar-track::-moz-progress-bar { background: var(--signal); }
a.hbar:hover .hbar-label, a.hbar:focus-visible .hbar-label { color: var(--accent-deep); text-decoration: underline; }
/* The key sits at the top right of its chart, each square on a line with its word. */
.chart { display: flex; flex-direction: column; }
.chart .legend { order: -1; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s1) var(--gap); font-size: var(--t-small); color: var(--ink-soft); margin: 0 0 var(--s1); }
.chart .legend > span { display: inline-flex; align-items: center; white-space: nowrap; }
.chart .legend .swatch { display: inline-block; flex: none; width: 10px; height: 10px; margin-right: 5px; }
/* The figures behind the bars, folded under the legend. */
.chart-figures { margin-top: var(--s1); }
.chart-figures > summary { font-size: var(--t-dense); color: var(--ink-soft); cursor: pointer; }
.chart-figures .table-wrap { margin-top: var(--s1); }
.chart-empty { padding: var(--s5); text-align: center; color: var(--ink-faint); border: 1px dashed var(--rule-strong); border-radius: var(--r); font-size: var(--t-dense); }
.qr { display: block; width: 176px; height: 176px; border-radius: var(--r); }
.qr-ground { fill: var(--white); }
.qr-modules { fill: var(--black); }

/* Numbered steps somebody follows: an enrolment, a recovery. */
.steps { margin: 0 0 var(--s4); padding-left: 20px; }

/* The idle warning, over everything, out of the way of the work. */
.idle-warning {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  display: flex; align-items: center; gap: var(--gap);
  padding: var(--s3) var(--s4); background: var(--accent-deep); color: var(--on-accent);
  border-radius: var(--r-lg); box-shadow: var(--float-accent);
  font-size: var(--t-body);
}
.idle-warning strong { font-variant-numeric: tabular-nums; }
.idle-warning .button.primary { background: var(--panel); color: var(--accent-deep); border-color: var(--on-accent); }

/* What the office and the physician said, as a conversation: each message a card with its writer's initials on a disc
   beside it, the office's disc on the accent's wash and the physician's on the warm one, the physician's card on sand.
   One column no wider than the page: a folded message's first words are cut to fit, never pushing the thread sideways. */
.thread { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap-fields); }
.thread > li { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: var(--s3); align-items: start; }
.thread > li > .msg-disc { width: 32px; height: 32px; margin-top: var(--s1); }
.thread > li.physician > .msg-disc { background: var(--signal-wash); color: var(--signal-deep); }
.thread > li > :is(details, .msg) {
  min-width: 0; padding: var(--s1) var(--s3) var(--s2); border: 1px solid var(--rule); border-radius: 2px var(--r-lg) var(--r-lg) var(--r-lg);
  background: var(--panel);
}
.thread > li.physician > :is(details, .msg) { background: var(--row-alt); }
/* A message not yet read: its card edged in the accent until it is. */
.thread > li.unread > details { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); }
.thread .msg > .who { padding: var(--s1) 0; }
/* One message: its first line is who, when and what became of it; read and folded, the first words follow on that line. */
.thread details > summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px var(--s2); list-style: none; cursor: pointer; padding: var(--s1) 0; min-width: 0; }
.thread details > summary::-webkit-details-marker { display: none; }
.thread .who { font-size: var(--t-dense); font-weight: var(--w-strong); color: var(--ink); }
.thread .at { font-size: var(--t-small); color: var(--ink-faint); white-space: nowrap; }
.thread > li.unread .who { color: var(--ink); font-weight: var(--w-strong); }
.thread .files-count { display: inline-flex; align-items: center; gap: 3px; font-size: var(--t-caption); color: var(--ink-faint); }
/* The person a thread is assigned to, marked as the Assigned to me folder is. */
table.grid.threads td.thread-who > svg { margin-right: 3px; vertical-align: -1px; }
.thread .gist { flex: 1 1 12rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-small); color: var(--ink-faint); }
.thread details[open] > summary .gist, .thread details[open] > summary .files-count { display: none; }
.thread details:not([open]) > summary:hover .gist { color: var(--ink-soft); }
.thread p { font-size: var(--t-dense); }
.thread .delivery { margin: 0 0 var(--s1); color: var(--signal-deep); }
/* An email still to go is waiting, not refused: the colour of its Not sent yet tag. */
.thread .delivery.waiting { color: var(--wait); }
.thread form.delivery { display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: var(--s2); color: inherit; text-align: left; }
.thread + form { margin-top: var(--gap); }
.thread .addresses { margin-bottom: var(--s1); }
.thread .files { margin-top: var(--s2); }

/* Messages: a thread with something unread carries a dot and is heavy in the list; a read one is plain. */
table.grid th.unread-mark, table.grid td.unread-mark { width: 1%; padding-right: 0; }
.unread-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
/* In the Sent folders the dot says an email has not gone: still waiting, or given up. */
.unread-dot.waiting { background: var(--wait); }
.unread-dot.failed { background: var(--signal); }
/* A second line under a fact, such as the mail server's own words under the reason. */
.kv dd > .sub { display: block; }
tr.unread > td.thread-with, tr.unread > td > a, tr.unread > td > time, tr.unread > td > .when { font-weight: var(--w-strong); }
tr.unread > td > a { color: var(--ink); }
table.grid td > a + .tag { margin-left: var(--s2); }

/* The composer, and a reply: who it goes to on one row, the subject, the message the full width, then what it carries
   and when it goes on one row. No field keeps to a form's usual width. */
.compose .form-body > .field, .compose > .field { max-width: none; }
.compose-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 var(--gap-fields); }
.compose-row > .field, .compose-to > .field, .compose-to > .to { flex: 2 1 220px; min-width: 0; }
.compose-row > .compose-to { flex: 5 1 440px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 var(--gap-fields); min-width: 0; }
.compose-to > .to { flex-grow: 3; }
.compose-row[hidden], .compose-to[hidden] { display: none; }
/* The physician keeps a name's width when the addresses beside it are not shown. */
.compose-row > .field:has(#physician-search) { max-width: 26rem; }
/* What a message carries: the documents take the room, a file to add and the day it goes keep to their own. */
.compose-row.carries > .field { flex: 1 1 320px; }
.compose-row.carries > .field.when { flex: 0 0 168px; }
/* In the dialog the body is one column whose message takes the height the other rows leave. */
.sheet .compose .form-body { display: flex; flex-direction: column; }
.sheet .compose .form-body > * { flex: 0 0 auto; }
.sheet .compose .form-body > .field.fills { flex: 1 0 13em; display: flex; flex-direction: column; min-height: 13em; }
.sheet .compose .field.fills > .rich { flex: 1 1 0; }
.sheet .compose .field.fills .rich-text { min-height: 0; }

/* A message box (rich-text.js): tools over the box that is typed in, drawn as one control. Without the script it is
   the plain field alone. */
html.js .rich { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--panel); }
.rich:has(> .rich-text:focus-visible) { border-color: var(--accent); box-shadow: var(--ring); }
.rich:has(> .rich-text.invalid) { border-color: var(--bad); }
.rich-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 3px var(--s1); border-bottom: 1px solid var(--rule); border-radius: var(--r) var(--r) 0 0; background: var(--raised); }
.rich-tools button { display: inline-grid; place-items: center; width: 30px; height: 28px; padding: 0; border: 0; border-radius: var(--r); background: none; color: var(--ink-soft); cursor: pointer; }
.rich-tools button:hover { background: var(--panel); color: var(--ink); }
.rich-tools button[aria-pressed="true"] { background: var(--accent-wash); color: var(--accent-deep); }
.rich-gap { width: 1px; height: 18px; margin: 0 var(--s1); background: var(--rule); }
.rich-text { flex: 1 1 auto; min-height: calc(var(--rows, 6) * 1.5em); overflow-y: auto; padding: var(--s2) var(--s3); border-radius: 0 0 var(--r) var(--r); }
.rich-text:focus-visible { box-shadow: none; }
/* A message as it was written, in the box and wherever it is read: paragraphs, lists and links. */
.written { line-height: 1.5; overflow-wrap: anywhere; }
.written :is(p, ul, ol) { margin: 0 0 var(--s3); }
.written :is(ul, ol) { padding-left: var(--s5); }
.written ul { list-style: disc; }
.written ol { list-style: decimal; }
.written > :last-child { margin-bottom: 0; }
.chips.contacts, .chips.common-questions { margin: calc(-1 * var(--s2)) 0 var(--gap-fields); }
.chips-label { font-size: var(--t-small); color: var(--ink-faint); margin-right: var(--s1); }

/* A chip that is a choice: a document on the composer, ticked to go with the message, or one of a set, such as the
   template. The box itself is the chip, and fills it unseen, so focusing it scrolls nothing. A long label wraps. */
.chip:is(.attach, .pick) { cursor: pointer; white-space: normal; max-width: 100%; position: relative; }
.chip:is(.attach, .pick) input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
/* Files chosen on a form before it is sent: the box to choose or drop them, a button for the camera beside it, and
   the list of what was chosen under both. */
.file-picks { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.file-picks > .drop { flex: 1 1 280px; }
.file-queue { list-style: none; margin: var(--s3) 0 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r); }
.file-queue li { display: flex; align-items: baseline; gap: var(--s3); padding: var(--s2) var(--s3); }
.file-queue li + li { border-top: 1px solid var(--rule-soft); }
.file-queue .file-name { flex: 1 1 auto; min-width: 0; font-weight: var(--w-strong); overflow-wrap: anywhere; }

/* A chip that is ticked or not: a document to attach, a column to show. */
:is(.chip.attach, .chip.column) .mark { display: inline-block; width: 14px; height: 14px; border: 1px solid var(--rule-strong); border-radius: 4px; flex: none; position: relative; }
.chip:is(.attach, .pick):has(input:checked), .chip.column[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-deep); }
.chip.attach:has(input:checked) .mark, .chip.column[aria-pressed="true"] .mark { background: var(--accent); border-color: var(--accent); }
:is(.chip.attach:has(input:checked), .chip.column[aria-pressed="true"]) .mark::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.chip:is(.attach, .pick):has(input:focus-visible) { box-shadow: var(--focus); }
.chip.gone { color: var(--ink-faint); text-decoration: line-through; cursor: default; }
.chip.gone:hover { background: var(--panel); border-color: var(--rule-strong); }
.tick-list li { display: flex; align-items: baseline; gap: var(--s3); padding: var(--s2) var(--s3); font-size: var(--t-dense); }
.tick-list .check { flex: 1 1 auto; min-width: 0; margin: 0; align-items: baseline; }
.tick-list .sub { display: block; font-size: var(--t-caption); font-weight: var(--w-text); color: var(--ink-faint); }

/* The run of a batch validation shown above its list, marked in the list. */
#runs table.grid tr.current > td { background: var(--accent-wash); }
.template-parts { display: grid; gap: var(--s3); min-width: 0; }
.template-section {
  margin: 0; padding: var(--s3) var(--s4) var(--s4); border: 1px solid var(--rule); border-radius: var(--r-lg);
  background: var(--panel); box-shadow: var(--lift); scroll-margin-top: calc(var(--bar) + var(--page-head, 0px) + var(--s4));
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.template-section > legend { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s2); }
/* The section of the part pointed at on the invoice, and the one a press on the invoice opened. */
.template-section.lit { border-color: var(--accent-line); }
.template-section.called { animation: template-called 1.4s ease; }
@keyframes template-called { 0%, 40% { box-shadow: 0 0 0 3px var(--accent-line); } 100% { box-shadow: var(--lift); } }
/* A section switched off prints nothing: its words rest, still there to switch back on. */
.template-section .kv { margin: 0; }
.switch-row .check { margin: 0; }
.choice-row, .swatches { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.choice-row .check, .swatches .check { margin: 0; }
/* A long choice's words wrap on a phone. */
@media (max-width: 820px) { .choice-row .check { white-space: normal; } }
.swatch { width: 16px; height: 16px; border-radius: 50%; background: var(--swatch, var(--accent-deep)); box-shadow: var(--swatch-edge); }
.template-column > .field { flex: 1 1 auto; margin-bottom: 0; }
/* A box that takes merge fields has its menu at the end of its label's line. */
.template-field { position: relative; }
.merge-menu { position: absolute; top: -4px; right: 0; }
.merge-menu > summary { list-style: none; min-height: 26px; padding: 0 var(--s2); font-size: var(--t-caption); }
.merge-menu > summary::-webkit-details-marker { display: none; }
.merge-menu .dropdown-menu { right: 0; left: auto; width: min(420px, 80vw); max-height: 340px; overflow-y: auto; }
.merge-menu .dropdown-menu button { display: grid; grid-template-columns: 9.5em 1fr; gap: var(--s2); align-items: baseline; }
.merge-menu .dropdown-menu button .mono { font-weight: var(--w-strong); color: var(--accent-deep); }
/* The invoice: drawn at its paper's width and scaled to the column (document-template.js). */
.template-preview { display: grid; gap: var(--s2); min-width: 0; }
.template-preview-bar label { margin: 0; }
.template-sheet {
  position: relative; overflow: hidden; justify-self: center; max-width: 100%;
  width: calc(var(--sheet-w, 816px) * var(--sheet-scale, 0.6)); height: calc(var(--sheet-h, 1056px) * var(--sheet-scale, 0.6));
  border-radius: 2px; background: var(--panel); box-shadow: var(--sheet);
}
.template-preview { order: -1; }
@media (min-width: 1100px) {
  .template-preview { order: 0; position: sticky; top: calc(var(--bar) + var(--page-head, 0px) + var(--s3)); max-height: calc(100vh - var(--bar) - var(--page-head, 0px) - 96px); overflow-y: auto; overscroll-behavior: contain; }
}

/* === 10. Pages ========================================================== */

/* What serves one page only, grouped by the page it serves: a page moved onto the kit loses its group. */

/* --- kit/index.ejs --- */
/* Each block's samples, ruled off from the block's words and from one another. */
.kit-sample { margin-top: var(--s4); padding-top: var(--s4); border-top: 1px dashed var(--rule-strong); }
.panel.flush > .kit-sample { margin-top: 0; padding: var(--s4); }
.kit-sample > .page-head:last-child, .kit-sample > .notices:last-child { margin-bottom: 0; }

/* --- admin/reference-row.ejs --- */
.reference-row fieldset:has(input[name="withdrawn"][value="1"]:checked) .row-values { opacity: 0.45; pointer-events: none; }

/* --- admin/reference-row-read.ejs --- */
.reference-row .row-facts dd.pre { white-space: pre-line; }
.reference-row .row-facts .apart { margin-top: var(--s3); }
.reference-row .row-facts .office-value { color: var(--office); font-weight: var(--w-strong); }
.reference-row .row-facts .field-note { margin-top: 2px; }

/* --- users/edit.ejs --- */
/* The roles two to a row, across the whole form, so a new person's form fits its dialog without scrolling. */
.form-body > .field:has(> .choice-cards) { max-width: none; }
.choice-card input { margin-top: 3px; }
.choice-card-name { font-weight: var(--w-strong); }
.choice-card-says, .choice-card-count { color: var(--ink-faint); font-size: var(--t-small); }
.choice-card-count { white-space: nowrap; }


/* --- claims/show.ejs --- */
/* What sits last in the markup and belongs first on the page: the facts of a record. */
.columns.side-first > :last-child { order: -1; }
/* A claim paid in full on one remittance: the one line under its items. */
.paid-line { display: flex; align-items: center; gap: var(--s2); margin: calc(var(--gap) * -0.5) 0 var(--gap); color: var(--good); font-size: var(--t-dense); }
.checks-kept .released { display: block; color: var(--ink-soft); }
/* The warnings the claim's last save kept, one a line, under its page heading. */
.claim-warning-list { display: grid; gap: var(--s1); margin: 0; padding: 0; list-style: none; }
.claim-warning-list > .line-warning { margin-top: 0; }

/* --- portal/edit.ejs --- */
@media (min-width: 1100px) {
  :is(main, .sheet.widest) .form-stack.second-wider { grid-template-columns: minmax(0, 1fr) 560px; }
}
/* Dictate: over a note's box at its bottom right, or an icon beside a line's box; red while it records. The note's
   words stop short of the button. */
.dictate-over { position: relative; display: flex; flex-direction: column; }
.dictate-over > .dictate { position: absolute; right: 6px; bottom: 6px; }
.dictate-over:has(> .dictate:not([hidden])) > textarea { padding-bottom: 40px; }
.with-dictate { display: flex; align-items: center; gap: var(--s1); }
.with-dictate > input { flex: 1 1 auto; min-width: 0; }
/* The estimated total of a form's lines, at the far end of the row under them. */
.button-row .estimate-total { margin-left: auto; }

/* --- claims/new.ejs --- */
@media (max-width: 820px) {
  .form-foot .foot-end { flex-basis: 100%; margin-left: 0; justify-content: flex-start; }
}
.claim-head .billing-as { flex: 1 1 380px; min-width: 0; }
.claim-head .billing-as .chosen-main .tag svg { margin-right: 3px; vertical-align: -1px; }
.claim-head .billing-as .search-box { max-width: 520px; }
.claim-head .billing-as .profile-pick { display: flex; align-items: center; gap: var(--s2); min-width: 0; margin: 0; color: var(--ink); white-space: nowrap; }
.claim-head .billing-as .profile-pick select { flex: 0 1 auto; width: auto; min-width: 0; text-overflow: ellipsis; }
.modality-title { font-weight: var(--w-strong); color: var(--ink); }
.lines-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-fields); padding: var(--s2) var(--s5) var(--s4); }
/* The room is the lines' own, not the window's: with the paperwork beside the form the lines have less of it. */
.lines-wrap { container: lines / inline-size; }
/* The claim form's other fields: the note beside the options. */
.claim-details { display: grid; grid-template-columns: 1fr; gap: 0 var(--s5); }
@media (min-width: 820px) { .claim-details { grid-template-columns: 3fr 2fr; }
}

/* --- portal/list.ejs --- */
@media (max-width: 1100px) {
  table.grid.stacks > tbody > tr > td.stack-line > span { display: block; -webkit-line-clamp: none; line-clamp: none; overflow: visible; }
}

/* --- claims/list.ejs --- */
.message.with-action form { flex: none; }
/* What a list comes to, in one line at its top left, on the row the count takes at the right. */
.list-sum { float: left; display: flex; flex-wrap: wrap; gap: 0 var(--s4); max-width: 100%; margin: 0; padding: var(--s1) var(--s5); font-size: var(--t-small); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.list-sum ~ .table-wrap, .list-sum ~ form > .table-wrap { clear: both; }

/* --- portal/show.ejs --- */
.message.answer-band label { color: var(--ink); }
.message.answer-band .field-note { color: var(--ink-soft); }
/* More files for an item already sent, under the list of what it has. */
.files + .add-files { margin-top: var(--s4); }
.add-files .button-row { margin-top: var(--s3); }

/* --- reports/index.ejs --- */
/* The Reports page: a card for each group of reports, each report its name over one line on what it holds. */
.report-panel { padding: var(--s4) var(--s3) var(--s3); }
/* Every group of reports in one row on a desk's window, none left alone on a second. */
.cards.report-groups { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cards > .report-panel > .card-head { margin-bottom: var(--s2); padding: 0 var(--s3); }
.report-links { list-style: none; margin: 0; padding: 0; }
.report-links a:hover, .report-links a:focus-visible { background: var(--accent-wash); }
.report-name { font-size: var(--t-body); font-weight: var(--w-strong); color: var(--accent); }
.report-what { font-size: var(--t-small); color: var(--ink-faint); line-height: 1.4; }
/* What the person pinned runs across the page above the groups. */
.report-panel.pinned .report-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: var(--gap); }

/* --- admin/audit.ejs --- */
/* A state said in words under a strip of figures. */
.trail-state { margin: var(--s2) 0 0; }

/* --- home.ejs --- */
.hero a.help-link { border-color: var(--hero-track); background: transparent; color: var(--white); }
.cycle-left { flex: none; display: flex; flex-direction: column; max-width: 300px; line-height: 1.15; }
.cycle-days { font-family: var(--display); font-size: var(--t-hero); font-weight: var(--w-strong); line-height: 1; letter-spacing: -0.03em;
              font-variant-numeric: tabular-nums; color: var(--white); }
.cycle-unit { margin-top: var(--s2); font-size: var(--t-body); line-height: 1.35; color: var(--on-hero-soft); }
.cycle-note { margin-top: var(--s1); font-size: var(--t-small); line-height: 1.35; color: var(--gold); }
.cycle-when { display: none; margin-top: var(--s1); font-size: var(--t-body); font-weight: var(--w-strong); color: var(--white); }
.cycle-line svg { overflow: visible; }
.cycle-track { stroke: var(--hero-track); stroke-width: 2; stroke-linecap: round; }
.cycle-ahead { stroke: var(--gold); stroke-width: 4; stroke-linecap: round; }
.cycle-today { fill: var(--white); stroke: var(--hero-deep); stroke-width: 3; }
.cycle-cutoff { fill: var(--signal); stroke: var(--white); stroke-width: 2; }
.cycle-date { font-size: var(--t-body); font-weight: var(--w-strong); fill: var(--white); }
.cycle-what, .cycle-end { font-size: var(--t-small); fill: var(--on-hero-soft); }
.cycle-now { font-size: var(--t-body); font-weight: var(--w-strong); fill: var(--gold); }
/* Under the line, the cycle's three figures as the kit's ruled strip, in the band's colours on a darker foot. */
.hero > .figures {
  grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3) 0;
  margin: 0 calc(-1 * var(--s5)); padding: var(--s3) var(--s5);
  border-top: 1px solid var(--hero-rule); background: var(--hero-foot);
}
.hero > .figures > .figure { padding: 0 var(--s5); border: 0; border-left: 1px solid var(--hero-rule); border-radius: 0; background: none; }
.hero > .figures > .figure:first-child { padding-left: 0; border-left: 0; }
.hero .figure :is(.label, .note) { color: var(--on-hero-soft); }
.hero .figure .value { color: var(--white); }
.hero a.figure:hover { text-decoration: none; }
.hero a.figure:hover .value { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 820px) {
  .cycle-line { display: none; }
  .cycle-when { display: block; }
  .hero > .figures { grid-template-columns: 1fr; }
  .hero > .figures > .figure { padding-left: 0; border-left: 0; }
}
/* The person's own work: a quiet band across the top of the work list, edged by a hairline, its lines side by side. */
.mywork {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: var(--s2) var(--s5);
  margin-bottom: var(--s4); padding: var(--s3) var(--s4);
  border: 1px solid var(--rule); border-radius: var(--r-lg); background: var(--raised);
}
.mywork a:hover { background: var(--accent-wash); }
.mywork a:hover .what { text-decoration: underline; text-underline-offset: 2px; }
.pile-none { margin: 0; color: var(--ink-faint); }
@media (max-width: 820px) { .mywork { grid-template-columns: 1fr; }
}
.your-next .next-label { font-size: var(--t-small); font-weight: var(--w-strong); color: var(--accent-deep); text-transform: uppercase; letter-spacing: 0.04em; }
.your-next .next-what { font-size: var(--t-panel); font-weight: var(--w-strong); color: var(--ink); }

/* --- physicians/_location-fields.ejs: a location's office hours, in its form --- */
/* Office hours: a row a day, two times at the width a time needs, and a Closed tick. */
.hours-list { display: grid; gap: var(--s2); }
@media (max-width: 820px) {
  .hours-day .hours-name { grid-column: 1 / -1; font-weight: var(--w-strong); }
}

/* --- claims/to-recover.ejs --- */
/* To recover: a claim's codes, then what the ministry said of them, wrapping within a column no wider than a sentence. */
table.grid td.code-reason { min-width: 9rem; max-width: 22rem; }
/* Two lines of the ministry's words at most; the rest on the claim, and in full when the mouse rests on them. */
table.grid td.code-reason > .sub { margin-top: 2px; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }

/* --- intake/show.ejs --- */
.service-lines .waiting-title { margin-right: var(--s3); }
/* The AI's mark under a service; the line of a file the AI suggested several codes for, once over them. */
.service-lines .ai-mark { margin-top: var(--s1); }
table.grid.service-lines > tbody > tr.line-head .ai-mark { margin: 0 var(--s1); }
table.grid.service-lines > tbody > tr.waiting-line.on-line > td:nth-child(2) { padding-left: var(--s5); }
table.grid.service-lines > tbody > tr:is(.waiting-line, .line-head) > td:first-child { box-shadow: inset 3px 0 0 var(--accent-line); }

/* --- admin/dropbox.ejs --- */
.setup-steps > ol > li { padding-left: var(--s1); }
.setup-steps > ol > li::marker { font-weight: var(--w-strong); color: var(--ink-soft); }
.setup-steps > ol p { margin: var(--s1) 0 0; max-width: 72ch; }

/* --- claims/peek.ejs --- */
.peek-body { flex: 1 1 auto; overflow-y: auto; padding: var(--s4) var(--s5); }
.peek-body table.grid.mini { width: 100%; margin: var(--s4) 0 0; }
.peek-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--rule); background: var(--raised); }

/* --- users/backup-codes.ejs --- */
.key-list { columns: 2; font: var(--t-key-list) var(--mono); letter-spacing: 0.04em; list-style: none; padding: 0; margin: var(--s2) 0 0; user-select: all; }

/* --- users/two-factor-setup.ejs --- */
.key-uri { font-family: var(--mono); font-size: var(--t-small); word-break: break-all; user-select: all; }
/* The setup code for an authenticator app: always black on white, for the camera. */
.qr-setup { display: flex; gap: var(--s4); align-items: flex-start; flex-wrap: wrap; margin-bottom: var(--s4); }

/* --- messages/compose.ejs --- */
/* More documents to tick, behind their button under the chips: a tick a row, the list scrolling in its box once it is long. */
.more-documents { margin-top: var(--s3); }
.more-documents[open] > summary { margin-bottom: var(--s2); }
.more-documents > .tick-list { margin-top: var(--s2); }
.tick-list { list-style: none; margin: 0; padding: 0; max-height: 232px; overflow-y: auto; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.tick-list li + li { border-top: 1px solid var(--rule-soft); }
.tick-list .check label { overflow-wrap: anywhere; }

/* --- admin/document-template.ejs --- */
/* The document template editor: the parts at the left as a stack of cards, the invoice they print at the right,
   in view while the parts scroll. Under 1100 the invoice comes first and the parts under it. */
.template-layout { display: grid; gap: var(--gap); align-items: start; grid-template-columns: minmax(0, 1fr); }
.template-section > legend .legend-title { flex: 1 1 auto; }
.template-section > legend .legend-switch { margin: 0; font-weight: var(--w-text); }
/* The boxes dim and not the section, so a menu opened in it is not held under the sections that follow. */
.template-section:has(> legend .legend-switch .switch:not(:checked)) .template-section-body :is(.field, .switch-row, .template-columns, .field-note, .merge-menu > summary) { opacity: 0.5; }
.switch-row { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-bottom: var(--s3); }
/* The table's columns: the switch, then the heading printed over the column, labelled with what it holds. */
.template-columns { display: grid; gap: var(--s2); margin: var(--s1) 0 var(--s3); padding: var(--s3); border-radius: var(--r); background: var(--raised); }
.template-columns-head { display: flex; gap: var(--s3); font-size: var(--t-caption); color: var(--ink-faint); }
.template-columns-head span:first-child { flex: 0 0 36px; }
.template-column { display: flex; align-items: flex-end; gap: var(--s3); }
.template-column > .switch { margin-bottom: 10px; }
.template-preview-bar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-height: var(--control); }
.template-preview-bar select { flex: 1 1 220px; width: auto; max-width: 360px; }
.template-status { margin-left: auto; }
.template-status:empty { display: none; }
.template-fit { display: none; margin-left: auto; }
.template-status:not(:empty) + .template-fit { margin-left: 0; }
.template-sheet iframe { display: block; width: var(--sheet-w, 816px); height: var(--sheet-h, 1056px); border: 0; transform: scale(var(--sheet-scale, 0.6)); transform-origin: 0 0; }
.template-sheet iframe.drawing { position: absolute; top: 0; left: 0; visibility: hidden; }
.template-hint { margin: 0; }
@media (min-width: 1100px) {
  .template-layout { grid-template-columns: minmax(380px, 5fr) minmax(0, 6fr); }
}
@media (min-width: 1100px) {
  .template-fit { display: inline-flex; }
}

/* --- sign-in.ejs (and its partials) --- */

/* The signed-out pages: two panes, the name on the accent at the left and the form on a card at the right. */
body:has(main.unauthenticated) {
  background:
    radial-gradient(ellipse at 100% 0%, var(--accent-wash) 0%, transparent 46%),
    radial-gradient(ellipse at 70% 100%, var(--accent-wash) 0%, transparent 40%),
    var(--paper);
}
main.unauthenticated {
  max-width: none; min-height: 100vh; margin: 0 0 0 44%; padding: var(--s5);
  display: flex; align-items: center; justify-content: center;
}
/* The form sits on a white card that lifts off the ground. */
.sign-in {
  width: 100%; max-width: 420px; padding: 44px 40px 32px;
  background: var(--panel); border: 1px solid var(--rule-soft); border-radius: var(--r-lg);
  box-shadow: var(--float);
}
/* The pane runs from the deep accent to its night: a sea-green glow at the top, a fine dotted field, and two soft rings at the foot. */
.sign-in-head {
  position: fixed; left: 0; top: 0; bottom: 0; width: 44%;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: var(--s5);
  padding: 0 7vw;
  color: var(--on-accent);
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 108%, var(--sign-in-ring) 0 26%, transparent 26.2%),
    radial-gradient(circle at 88% 108%, var(--sign-in-ring-far) 0 46%, transparent 46.2%),
    radial-gradient(ellipse at 0% 0%, var(--glow) 0%, transparent 52%),
    radial-gradient(ellipse at 100% 38%, var(--sign-in-bright) 0%, transparent 58%),
    linear-gradient(165deg, var(--accent-deep) 0%, var(--accent-night) 100%);
}
/* Below the band on a copy that holds sample data. */
body:has(.sample-band) .sign-in-head { top: var(--sample-band); }
body:has(.sample-band) main.unauthenticated { min-height: calc(100vh - var(--sample-band)); }
/* The dotted field fades out toward the foot. */
.sign-in-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(var(--sign-in-dots) 1px, transparent 1.4px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, var(--white) 0%, transparent 62%);
          mask-image: linear-gradient(180deg, var(--white) 0%, transparent 62%);
}
.sign-in-head > * { position: relative; }
.sign-in-brand { display: flex; align-items: center; gap: var(--s4); }
/* The mark has colours of its own, so it sits on a white tile. */
.sign-in-mark {
  display: block; width: 60px; height: 60px; padding: var(--s2);
  background: var(--white); border-radius: var(--r-lg); box-shadow: var(--float);
}
/* The office's own logo on the same tile, its own shape kept. */
.sign-in-mark.office { width: auto; height: 60px; max-width: 216px; object-fit: contain; }
/* The name in the display face, close set, with the second word spaced out beneath it. */
.sign-in-word { display: flex; flex-direction: column; font-family: var(--display); font-size: var(--t-money); font-weight: var(--w-strong);
                line-height: 1; letter-spacing: -0.025em; }
.sign-in-word small { margin-top: var(--s2); font-size: var(--t-dense); font-weight: var(--w-text);
                      letter-spacing: 0.34em; text-transform: uppercase; opacity: 0.8; }
/* One line of what the office does, over a short gold rule. */
.sign-in-line { max-width: 15em; margin: var(--s4) 0 0; padding-top: var(--s5);
                font-family: var(--display); font-size: var(--t-sign-in-line); font-weight: var(--w-light); line-height: 1.3; letter-spacing: -0.01em;
                background: linear-gradient(var(--gold), var(--gold)) left top / 48px 2px no-repeat; }
.sign-in-foot { position: absolute; left: 7vw; bottom: var(--s5); margin: 0; font-size: var(--t-small); opacity: 0.6; }
@media (max-width: 820px) {
  main.unauthenticated { margin: 0; min-height: 0; padding: 148px var(--s4) var(--s5); align-items: flex-start; }
  .sign-in { padding: var(--s5) var(--s5) var(--s4); }
  /* The band with the name scrolls away with the page: a phone held sideways is too short for it to stay over the form. */
  .sign-in-head { position: absolute; right: 0; bottom: auto; width: auto; height: 124px; justify-content: center; padding: 0 var(--s5); }
  .sign-in-mark { width: 48px; height: 48px; }
  .sign-in-mark.office { width: auto; height: 48px; max-width: 180px; }
  .sign-in-word { font-size: var(--t-page); }
  .sign-in-word small { margin-top: var(--s1); font-size: var(--t-caption); letter-spacing: 0.26em; }
  .sign-in-line, .sign-in-foot { display: none; }
}
.sign-in h1 { font-family: var(--display); font-size: var(--t-sign-in); font-weight: var(--w-strong); letter-spacing: -0.02em; margin-bottom: var(--s5); }
.sign-in .lede { color: var(--ink-soft); margin: -16px 0 var(--s5); }
.sign-in .field { margin-bottom: var(--s4); }
.sign-in label { font-size: var(--t-dense); font-weight: var(--w-strong); color: var(--ink-soft); margin-bottom: var(--s1); }
/* A field rests on the raised ground and turns white where the cursor is. The two grounds weigh nothing, so a field that
   must be filled in is on the sand here as everywhere, and a refused one on the pale red. */
.sign-in input { min-height: 46px; padding: var(--s2) var(--s3); font-size: var(--t-bar);
                 border-color: var(--rule); border-radius: var(--r-lg); transition: border-color 120ms, background 120ms, box-shadow 120ms; }
:where(.sign-in) input { background: var(--raised); }
:where(.sign-in) input:where(:focus) { background: var(--panel); }
.sign-in input:hover { border-color: var(--rule-strong); }
.sign-in input:focus { border-color: var(--accent); }
.sign-in .button { width: 100%; justify-content: center; margin-top: var(--s2); min-height: 46px; font-size: var(--t-bar);
                   border-radius: var(--r-lg); }
.sign-in .button.primary { box-shadow: var(--primary-lift); transition: transform 120ms, box-shadow 120ms; }
.sign-in .button.primary:hover { transform: translateY(-1px); }
.sign-in .button-row { flex-direction: column; align-items: stretch; }
/* The ways in other than a password, at the foot of the form. */
.sign-in-links {
  display: flex;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
  flex-wrap: wrap;
  margin-top: var(--s5);
  font-size: var(--t-dense);
}
.sign-in-links a { color: var(--accent-deep); text-decoration: none; }
.sign-in-links a:hover { text-decoration: underline; }
/* A signed-out page that is read, not filled in, takes a wider card. */
.sign-in.wide { max-width: 520px; }
/* Who the page is for, under a rule at the foot of the card. */
.sign-in-note { display: flex; align-items: center; gap: var(--s2); margin: var(--s5) 0 0; padding-top: var(--s4);
                border-top: 1px solid var(--rule-soft); font-size: var(--t-small); color: var(--ink-faint); }
.sign-in-note svg { flex: none; }
.sign-in-note a { color: var(--accent-deep); white-space: nowrap; }

/* === 11. Utilities ===================================================== */
/* Single-purpose classes, used in place of a style attribute. */

.muted { color: var(--ink-faint); }
/* A number or a code set in the text face. Its digits keep their own widths: the face's even-width digits widen the
   hyphen too, which would gap a date or a health number (2026 - 10 - 30); only amounts and counts take them. */
.mono { font-variant-numeric: normal; }
/* The coding face: a health number, a ministry file's name, a record as the ministry sent it. */
.raw, table.grid td.raw, input.raw, textarea.raw { font-family: var(--mono); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; margin: 0; }
.flat { margin: 0; }
.small { font-size: var(--t-small); }
.lede.small { font-size: var(--t-small); }
.tabular { font-variant-numeric: tabular-nums; }
.upper { text-transform: uppercase; }
.inline { display: inline; }
/* A line of advice between a flush section's heading and its table. */
/* A folding panel holds its note inside the fold, so the rule reaches it there too. */
.panel.flush .panel-note { margin: 0; padding: var(--s2) var(--s4); }
ul.plain { margin: 0; padding-left: 18px; font-size: var(--t-dense); }
ul.plain li { margin-bottom: 3px; }

/* Vertical spacing, from the scale. */
.mt-1 { margin-top: var(--s2); }
.mt-2 { margin-top: var(--s3); }
.mt-3 { margin-top: var(--gap); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--s2); }
.mb-2 { margin-bottom: var(--s3); }
.mb-3 { margin-bottom: var(--gap); }

/* How wide a short form or a notice may grow; a long record form is a `.form-stack` instead. */
.measure { max-width: 640px; }

/* === 12. Print ========================================================= */

@media print {
  main > .page-head, main > form > .page-head, main > div:has(> fieldset.read-only) > .page-head { position: static; }
  /* What a list is narrowed by is not printed as boxes: the chips under it say what is applied. */
  .masthead, .section-nav, .page-head .actions, .button, .tabs, .filter-row, .form-foot,
  .dropdown, .pager, .fold-toggle, .full-toggle, .chart-figures > summary,
  form.narrowing .finder { display: none; }
  .folded > .fold-body { grid-template-rows: 1fr; }
  .folded > .fold-body > .fold-inner { visibility: visible; }
  body { background: var(--white); }
  .panel, .table-wrap { box-shadow: none; border-color: var(--rule-strong); }
  /* A panel's heading on paper: dark ink, a rule under it and a bar at its left. */
  .panel > .panel-head,
  .panel.flush > .panel-head,
  .panel.attention > .panel-head {
    background: none;
    color: var(--ink);
    margin: 0 0 var(--gap-fields);
    padding: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--rule);
  }
  .panel > .panel-head h2,
  .panel.attention > .panel-head h2 {
    color: var(--ink);
    border-left: 3px solid var(--rule-strong);
    padding-left: var(--s2);
  }
  .panel > .panel-head .lede, .panel.attention > .panel-head .lede { color: var(--ink-soft); }
  /* A form's sheet prints without its frame. */
  main.kind-form > :is(form, div:has(> fieldset.read-only)) { border: 0; box-shadow: none; max-width: none; }
  main.kind-form > div:has(> fieldset.read-only) > .page-head,
  main.kind-form > form > .page-head { background: none; border-bottom: 1px solid var(--rule); padding: 0 0 var(--s2); }
  main.kind-form > form > .page-head h1 { color: var(--ink); }
  main.kind-form > form > .page-head .lede { color: var(--ink-soft); }
  main.kind-form > :is(form, div) > fieldset.read-only > .form-body,
  main.kind-form > form > .form-body { background: none; padding: 0; }
  /* A dialog is not printed. */
  dialog.sheet { display: none; }
}

/* What the page is looking at, in a word, ahead of every title: the same slot on every page and in every dialog. */
.page-word { display: inline-block; vertical-align: middle; margin-right: var(--s3); padding: 0;
  font-size: var(--t-caption); font-weight: var(--w-strong); letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-faint); background: none; line-height: 1.5; }
/* In a page's title the row's gap sets the pill apart from the words after it; the pill never breaks, the title moves under it. */
h1 .page-word { margin-right: 0; white-space: nowrap; }
@media (max-width: 820px) { h1 .page-word.alone { white-space: normal; } }
/* A title that is only its word: the word is the title, in the title's size and case. */
h1 .page-word.alone { font-size: var(--t-page); letter-spacing: -0.02em; text-transform: none; color: var(--ink); line-height: 1.25; }
.sheet-head .page-word { font-size: var(--t-small); }

/* The check-digit mark of a health number as it is typed: inside the box at its right end. It takes no room of its
   own, so the field keeps its height and the fields and buttons beside it stay level. */
.hn-mark {
  display: block; height: 0; line-height: 0; margin: 0; position: relative; top: calc(var(--control) / -2);
  padding-right: var(--s2); text-align: right; font-weight: var(--w-strong);
}
.hn-mark[data-state="good"] { color: var(--good); }
.hn-mark[data-state="bad"] { color: var(--bad); }

/* An identifier that copies when clicked. */
.copyable { cursor: copy; }
.copyable.just-copied { background: var(--accent-wash); border-radius: 3px; }

/* What a box takes, said by an icon at its end: a calendar in a date box, an envelope in an email box. */
input[type="email"], input[data-date-field="on"] { padding-right: 30px; background-repeat: no-repeat; background-position: calc(100% - 9px) 50%; background-size: 13px 13px; }
input[type="email"] { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20fill%3D%22%236c6684%22%20d%3D%22M48%2064C21.5%2064%200%2085.5%200%20112c0%2015.1%207.1%2029.3%2019.2%2038.4L236.8%20313.6c11.4%208.5%2027%208.5%2038.4%200L492.8%20150.4c12.1-9.1%2019.2-23.3%2019.2-38.4c0-26.5-21.5-48-48-48L48%2064zM0%20176L0%20384c0%2035.3%2028.7%2064%2064%2064l384%200c35.3%200%2064-28.7%2064-64l0-208L294.4%20339.2c-22.8%2017.1-54%2017.1-76.8%200L0%20176z%22%2F%3E%3C%2Fsvg%3E"); }
input[data-date-field="on"] { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20fill%3D%22%236c6684%22%20d%3D%22M128%200c17.7%200%2032%2014.3%2032%2032l0%2032%20128%200%200-32c0-17.7%2014.3-32%2032-32s32%2014.3%2032%2032l0%2032%2048%200c26.5%200%2048%2021.5%2048%2048l0%2048L0%20160l0-48C0%2085.5%2021.5%2064%2048%2064l48%200%200-32c0-17.7%2014.3-32%2032-32zM0%20192l448%200%200%20272c0%2026.5-21.5%2048-48%2048L48%20512c-26.5%200-48-21.5-48-48L0%20192zm80%2064c-8.8%200-16%207.2-16%2016l0%2096c0%208.8%207.2%2016%2016%2016l96%200c8.8%200%2016-7.2%2016-16l0-96c0-8.8-7.2-16-16-16l-96%200z%22%2F%3E%3C%2Fsvg%3E"); }

/* The section's icon on the bar and in the page word. */
.sections a .bar-icon { opacity: 0.75; }
.sections a.current .bar-icon { opacity: 1; }
.masthead.tight .sections .bar-icon { display: none; }
.page-word .icon { margin-right: 6px; vertical-align: -1px; opacity: 0.85; }
/* Standing as the title, the word's mark grows with it and takes the accent. */
h1 .page-word.alone .icon { width: 0.75em; height: 0.75em; margin-right: 8px; vertical-align: -0.05em; color: var(--accent); opacity: 1; }

/* Messages, the desk: the folders, the rows of the chosen folder and the open thread. On a window wider than 1420 the
   three sit side by side, the thread read at the right; narrower, the folders run across the top of the rows and a
   thread opens in the dialog over them. One set of markup; the width alone decides. */
.mail-desk { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.mail-desk > * { min-width: 0; }
.mail-folders { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.folder-list { list-style: none; margin: 0; padding: 0; display: contents; }
.folder-group { display: none; }
.folder {
  display: inline-flex; align-items: center; gap: var(--s2); padding: 5px 10px; border-radius: var(--r-pill);
  color: var(--ink-soft); font-size: var(--t-dense); text-decoration: none; white-space: nowrap; max-width: 100%;
}
.folder svg { width: 14px; height: 14px; flex: none; opacity: 0.75; }
.folder .folder-name { overflow: hidden; text-overflow: ellipsis; }
.folder:hover { background: var(--raised); color: var(--ink); }
/* The folder open is a soft pill, as the bar marks the section a person is in. */
.folder.current { background: var(--accent-wash); color: var(--accent-deep); font-weight: var(--w-strong); }
.folder.current svg { opacity: 1; }
.folder .count { margin-left: auto; }
.folder .count.unread { background: var(--accent-wash); color: var(--accent-deep); }
.folder .count.wants { background: var(--signal-wash); color: var(--signal-deep); }
.folder.current .count { background: var(--accent); color: var(--on-accent); }
/* The thread is read in the dialog until the window has room for the pane. */
.mail-read { display: none; }
@media (min-width: 1420px) {
  .mail-desk { grid-template-columns: 232px minmax(0, 5fr) minmax(0, 6fr); }
  /* The folders and the open thread keep their place while the rows scroll, clear of the page's sticky heading. */
  .mail-folders, .mail-read { position: sticky; top: calc(var(--bar) + var(--page-head, 92px) + 2px); }
  .mail-folders { display: block; max-height: calc(100vh - var(--bar) - var(--page-head, 92px) - 74px); overflow-y: auto; padding-right: var(--s1); }
  .folder-list { display: block; }
  .folder-list + .folder-list, .folder-group { margin-top: var(--s4); }
  .folder-group { display: block; margin: var(--s4) 0 var(--s1); padding: 0 10px; font-size: var(--t-caption); font-weight: var(--w-strong); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-faint); }
  .folder { display: flex; width: 100%; box-sizing: border-box; border-radius: var(--r); padding: 6px 10px; }
  .folder-list > li + li { margin-top: 1px; }
  .mail-read {
    display: flex; flex-direction: column; overflow: clip;
    height: calc(100vh - var(--bar) - var(--page-head, 92px) - 74px);
    background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg);
  }
  /* The thread, or the composer, is drawn in the pane as it is in the dialog: its head stays put and its body scrolls. */
  .mail-read > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
  .mail-read .sheet-head { padding-right: var(--s5); }
  .mail-read .form-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--gap) var(--s5); background: var(--raised); }
  .mail-read [data-sheet-scroll] .panel { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: var(--s4); }
  .mail-read [data-sheet-scroll] .panel + .panel { margin-top: var(--gap); }
  .mail-read .form-actions { flex: 0 0 auto; padding: var(--s3) var(--s5); border-top: 1px solid var(--rule); background: var(--panel); }
  .mail-read .compose .form-body > .field, .mail-read .compose > .field { max-width: none; }
  /* A choice beside its button takes the pane's whole width, the button under it: a thread's subject is long. */
  .mail-read [data-sheet-scroll] .field-row > .field.wide { flex-basis: 100%; max-width: none; }
  /* The row being read is marked among the rows. */
  .mail-rows table.grid > tbody > tr.reading { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
}
/* The search and the choices in the page's heading, beside New message: no rule under them, labels read by the screen reader alone. */
.page-head .actions .filter-row { border: 0; margin: 0; padding: 0; gap: var(--s2); flex-wrap: nowrap; }
.page-head .actions .filter-row form.filters { padding-bottom: 0; flex-wrap: nowrap; gap: var(--s2); }
.page-head .actions .filter-row label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-head .actions .filter-row .field { margin: 0; }
.page-head .actions .filter-row #q { width: 16em; }
@media (max-width: 820px) {
  .page-head .actions .filter-row, .page-head .actions .filter-row form.filters { flex-wrap: wrap; }
  .page-head .actions .filter-row #q { width: 100%; }
}
/* Without the reading pane the desk is the folders and the rows alone, and a thread opens in the dialog at every width. */
.reading-pane-choice { display: none; }
@media (min-width: 1420px) {
  .mail-desk.no-pane { grid-template-columns: 232px minmax(0, 1fr); }
  .reading-pane-choice { display: block; }
  .reading-pane-choice :is(.check, .check label) { margin: 0; font-size: var(--t-dense); color: var(--ink-soft); white-space: nowrap; }
}
/* An address field as chips: the addresses as chips with an x, the box typed into at the end, one border round all of it. */
.chip-box { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1); min-height: var(--control); padding: 3px 6px; border: 1px solid var(--rule-strong); border-radius: var(--r); background: var(--panel); cursor: text; }
.chip-box:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.chip-box.invalid { border-color: var(--signal); }
.chip-box .chip.address { cursor: default; padding-right: var(--s1); }
.chip-box .chip.address.doubtful { border-color: var(--signal-line); color: var(--signal-deep); }
.chip-x { border: 0; background: none; padding: 0 3px; font: inherit; line-height: 1; color: var(--ink-faint); cursor: pointer; border-radius: 50%; }
.chip-x:hover { color: var(--signal); background: var(--signal-wash); }
.chip-box input[type="text"].chip-typing, .chip-box input[type="text"].chip-typing:focus { flex: 1 1 10em; min-width: 8em; border: 0; outline: 0; background: none; padding: 2px var(--s1); font: inherit; height: auto; min-height: 0; box-shadow: none; }
/* The chips under the search that narrow a folder, over the rows; one in use is marked and carries an x. */
/* On the search's row in the heading, level with its box. */
.mail-chips { align-self: flex-end; margin-bottom: 5px; }
.mail-chips a.chip { text-decoration: none; }
.mail-chips .chip.on .chip-x { color: inherit; opacity: 0.8; margin-left: 2px; }
.mail-chips .dropdown > summary.chip { list-style: none; }
.mail-chips .dropdown > summary.chip::-webkit-details-marker { display: none; }
.mail-chips .dropdown-menu { max-height: 60vh; overflow-y: auto; }
.mail-chips .dropdown-menu .count { margin-left: var(--s2); background: var(--accent-wash); color: var(--accent-deep); }
/* The template as a row of chips over the composer; the one in use is marked. */
.template-choice .chips { margin-bottom: var(--s1); }
/* A thread with the record it is about: the conversation and the reply, the record's card beside them where the
   pane or the dialog is wide enough, under them where it is not, the line under the title naming the record meanwhile.
   The box itself decides, not the window. */
.thread-box { container-type: inline-size; }
.thread-with-card { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; }
.thread-with-card > * { min-width: 0; }
@container (min-width: 760px) {
  .thread-with-card:not(.alone) { grid-template-columns: minmax(0, 1fr) 260px; }
  .thread-with-card .record-card { position: sticky; top: 0; }
}
.record-card .panel-head h2 { font-size: var(--t-small); text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); }
.record-card-name { margin: 0 0 var(--s3); font-weight: var(--w-strong); }
/* The card is narrow: each fact's name stands over its value, so an address stays whole. */
.record-card .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
.record-card .kv dd { margin-bottom: var(--s2); overflow-wrap: anywhere; }
.record-card-files { margin: var(--s4) 0 var(--s1); font-size: var(--t-small); }
.record-card-list { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s1); font-size: var(--t-dense); color: var(--ink-soft); }
.record-card-list li { display: flex; align-items: center; gap: var(--s2); }
.record-card-list svg { flex: none; width: 12px; height: 12px; opacity: 0.7; }
/* Nothing open yet: the kit's empty line, in the middle of the pane. */
.mail-read > .empty { margin: auto; padding: var(--s5); text-align: center; }
/* While the thread is on its way. */
.mail-read.loading { position: relative; }
.mail-read.loading::after { content: ''; position: absolute; inset: 0 auto auto 0; height: 2px; width: 40%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) { .mail-read.loading::after { animation: sheet-wait 1.1s ease-in-out infinite; } }
/* Each row starts with the initials of who it is with, on a disc; the unread dot sits on the disc's corner. */
.mail-rows td.unread-mark { padding-right: var(--s2); }
.mail-rows .who-mark { position: relative; display: inline-block; line-height: 0; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-wash); color: var(--accent-deep); font-size: var(--t-caption); font-weight: var(--w-strong); letter-spacing: 0.02em;
  vertical-align: middle; user-select: none;
}
.avatar.payor { background: var(--wait-wash); color: var(--wait); }
.avatar.plain { background: var(--raised); color: var(--ink-soft); }
/* A person a piece of work is with, in a list: the disc smaller, then the name, which wraps between its words beside it;
   nobody is a quiet disc with a dash, never a ring a person could take for a box to tick. */
.avatar.small { flex: 0 0 auto; width: 24px; height: 24px; font-size: var(--t-caption); letter-spacing: 0; }
.avatar.unheld { background: var(--raised); color: var(--ink-faint); }
/* The dash sits on its row's line as a disc of initials does. */
.avatar.unheld::before { content: "\2013"; }
/* In a list's name column, over the column's own rule for its first child (a grid of many columns sets it inline). */
.person, table.grid td.name > .person:first-child { display: inline-flex; align-items: center; gap: 6px; }
.person.nobody { color: var(--ink-faint); }
/* A person's name in a grid keeps to one line; on a laptop it may break, as a column of names gives way last. */
@media (min-width: 1420px) { table.grid .person-name { white-space: nowrap; } }
/* At a laptop's width a list has no room to spare for the disc: the name alone, as before. */
@media (max-width: 1420px) { table.grid td.name > .person > .avatar { display: none; } }
.mail-rows .who-mark .unread-dot { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border: 2px solid var(--panel); box-sizing: content-box; }
/* The rows sit under the day they were last written on. */
.mail-rows table.grid > tbody > tr.day-group > td { padding: var(--s3) var(--s3) 3px; border-bottom: 0; background: var(--panel); font-size: var(--t-caption); font-weight: var(--w-strong); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }
.mail-rows table.grid > tbody > tr.day-group:hover > td { background: var(--panel); }
/* The last message's first words under the subject, one line, faded; who wrote them first. */
/* Clamped to one line with ordinary wrapping, so the words never widen the table past its box. */
.mail-rows .snippet { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; white-space: normal; font-size: var(--t-small); font-weight: var(--w-text); color: var(--ink-faint); }
.mail-rows .snippet-who { color: var(--ink-soft); }
/* A row with something unread sits on the palest sea blue; the hover and the open thread outrank it. */
.mail-rows table.grid > tbody > tr.unread { background: var(--unread-wash); }
.mail-rows table.grid > tbody > tr:hover:not(.day-group):not(.reading) { background: var(--raised); }
.mail-rows table.grid > tbody > tr.unread:hover:not(.reading) { background: var(--accent-wash); }
.mail-rows table.grid > tbody > tr:not(.day-group) { transition: background 0.12s ease; }
/* The rows as a mail client draws them, wherever they have a third of the window or less: in the desk, and on a phone. */
@media (min-width: 1420px), (max-width: 820px) {
  /* Each row a block: the dot, then who and when on one line, the subject with its tags and what it is about on the next, and who answers it under that. */
  .mail-rows table.grid.threads, .mail-rows table.grid.threads > tbody { display: block; width: auto; min-width: 0; }
  .mail-rows table.grid.threads > thead { display: none; }
  .mail-rows table.grid.threads > tbody > tr { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; column-gap: var(--s2); padding: 7px var(--s3); border-bottom: 1px solid var(--rule); line-height: 1.3; font-size: var(--t-dense); }
  .mail-rows table.grid.threads > tbody > tr.day-group { display: block; padding: 0; border-bottom: 0; }
  .mail-rows table.grid.threads > tbody > tr.day-group > td { padding-left: var(--s3); }
  .mail-rows table.grid.threads > tbody > tr > td { display: block; width: auto; max-width: none; padding: 0; border: 0; text-align: left; white-space: normal; overflow: visible; }
  .mail-rows table.grid.threads > tbody > tr > td.unread-mark { grid-column: 1; grid-row: 1 / 4; padding-top: 3px; }
  .mail-rows table.grid.threads > tbody > tr > td.thread-with { grid-column: 2; grid-row: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mail-rows table.grid.threads > tbody > tr > td.thread-with > .sub { display: inline; margin-left: var(--s2); }
  .mail-rows table.grid.threads > tbody > tr > td.thread-when { grid-column: 3; grid-row: 1; font-size: var(--t-small); color: var(--ink-faint); }
  .mail-rows table.grid.threads > tbody > tr > td.thread-when > .sub { display: none; }
  .mail-rows table.grid.threads > tbody > tr > td.thread-subject { grid-column: 2; grid-row: 2; }
  .mail-rows table.grid.threads > tbody > tr > td.thread-subject > .sub { display: inline-block; max-width: 100%; margin-left: var(--s2); white-space: normal; }
  .mail-rows table.grid.threads > tbody > tr > td.thread-count { display: none; }
  /* Who answers it sits under the date, cut short rather than pushing the subject over; the row is two lines. */
  .mail-rows table.grid.threads > tbody > tr > td.thread-who { grid-column: 3; grid-row: 2; justify-self: end; max-width: 10em; overflow: hidden; text-overflow: ellipsis; font-size: var(--t-small); color: var(--ink-faint); white-space: nowrap; align-self: end; }
  .mail-rows table.grid.threads > tbody > tr > td.thread-who:empty { display: none; }
  .mail-rows table.grid.threads > tbody > tr > td.thread-when { justify-self: end; }
  .mail-rows table.grid.threads > tbody > tr:not(:has(> td.thread-who:not(:empty))) > td.thread-subject { grid-column: 2 / 4; }
  .mail-rows table.grid.threads > tbody > tr > td.thread-subject > .sub.line { display: block; margin-left: 0; }
  .mail-rows table.grid.threads > tbody > tr > td.empty { grid-column: 1 / -1; }
  /* A folded cell's subject link reads as the row's heading. */
  .mail-rows table.grid.threads > tbody > tr > td.thread-subject > a { color: var(--ink); text-decoration: none; }
  .mail-rows table.grid.threads > tbody > tr:hover > td.thread-subject > a { text-decoration: underline; }
}
/* Full screen outranks a dialog's own width and height, whichever it asked for. */
dialog.sheet.full, dialog.sheet.full.wide, dialog.sheet.full.widest, dialog.sheet.full.tall, dialog.sheet.full.preview { width: 100vw; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; }

/* Teams: each team a column of people, its leader first; a card is dragged onto another column. */
.team-board { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.team-board > .team-column { margin-bottom: 0; min-width: 0; }
.team-column.unplaced { background: var(--raised); }
.team-people { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); min-height: 48px; border-radius: var(--r); }
.team-card { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); }
.team-card.leader { border-color: var(--accent); background: var(--accent-wash); }
.team-card.none { justify-content: center; border-style: dashed; background: transparent; }
.team-card.disabled .team-card-who a { color: var(--ink-faint); }
.team-card[draggable="true"] { cursor: grab; }
.team-card.dragging { opacity: 0.5; }
.team-card-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.team-card-who .sub { font-size: var(--t-small); color: var(--ink-faint); }
.team-people.drop-here { outline: 2px dashed var(--accent); outline-offset: 4px; }
.team-rename { display: grid; gap: var(--s1); padding: var(--s2) var(--s3); }
/* A heading row inside a grid: the rows under it are one group, such as a team on Team activity. */
table.grid > tbody > tr.group-head > th { padding: var(--s3) var(--s3) var(--s1); border-bottom: 1px solid var(--rule-strong); background: var(--panel); text-align: left; font-weight: var(--w-strong); color: var(--ink); }
/* A yes in a grid of permissions against roles: a mark in the middle of its column; a no is left empty. */
table.grid th.center, table.grid td.center { text-align: center; }
.held-mark { color: var(--accent-deep); }
table.grid > tbody > tr.group-head > th .sub { display: inline; margin-left: var(--s2); font-weight: var(--w-text); color: var(--ink-faint); }
/* Audit history: each record a save changed, and each field before and after. */
@media (max-width: 1100px) {
  table.grid.stacks.history-grid > tbody > tr > td:not(:first-child) { display: block; text-align: left; }
  table.grid.stacks.history-grid > tbody > tr > td:not(:first-child)::before { content: none; }
  table.grid.stacks.history-grid > tbody > tr > td[data-label="Changes"] { padding-top: var(--s2); }
}
table.grid.history-grid > tbody > tr > td { vertical-align: top; }
.history-change + .history-change { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--rule-soft); }
.history-what { margin: 0 0 var(--s1); }
/* A field's name takes at most under half the width and wraps, so a long rule's name never pushes the dialog sideways. */
.history-fields { grid-template-columns: fit-content(45%) minmax(0, 1fr); }
.history-fields dt { white-space: normal; }
.history-fields dd { overflow-wrap: anywhere; }
.history-was { color: var(--ink-faint); }
.history-to { color: var(--ink-faint); padding: 0 var(--s1); }
