/* The v0.2 components (ADR-0031): one block per component, on the tokens in
   tokens.css and presets/*.css and nothing else. No colour is stated here, so the
   contrast tests read the token files alone; test_stylesheet_lint.py holds this
   file to that, to the spacing and type scales, and holds utilities.css to layout.
   With the token files, utilities.css and the generated /style/data.css, this is
   the whole of the styling: one vocabulary, and nothing outranking it.

   The sections are numbered as in the design system's reference stylesheet. Its
   first, what a preset may change besides colour, is in the token files. */
  /* ---- 2. Base ------------------------------------------------------------ */
  * { box-sizing: border-box; }
  [hidden] { display: none !important; }
  body { margin: 0; background: var(--surface); color: var(--text);
    font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
  /* The browser draws a select's list, a checkbox, a date picker and the scrollbars
     itself, in the scheme it is told: the system's, or the one the reader chose. */
  :root { color-scheme: light dark; }
  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"] { color-scheme: dark; }
  /* A control lays out in the browser's own face and at its own line-height, about
     1.15, unless told otherwise; side by side, a submit button stood shorter than a
     link drawn as one. */
  button, input, select, textarea { font-family: inherit; line-height: inherit; }
  ::file-selector-button { font-family: inherit; line-height: inherit; }
  /* A picker is as wide as its widest option, and the options can be whole item
     names, wider than a phone. The chosen line still fits. */
  select { max-width: 100%; }
  /* Some browsers carry the page's text colour into a select's popup and leave its
     ground the system's light, which in the dark is pale on white. */
  option, optgroup { background: var(--surface-raised); color: var(--text); }
  a { color: var(--accent); }
  /* A link found in what somebody wrote -- a note, a summary, a spec value; anything
     the `linked` filter has been through -- is one unbreakable word to a browser, and
     a long one would push a column or a card wider than the phone it is read on. */
  a.url { overflow-wrap: anywhere; }
  h1, h2, h3, h4 { overflow-wrap: anywhere; margin: 0; }
  .muted { color: var(--text-muted); }
  /* The three type roles, by family token so a preset's pairing reaches them. */
  .figure, .title, .prose { font-family: var(--font-display); }
  .heading, .label, .hint, .micro { font-family: var(--font-ui); }
  .stat, .data, .tag { font-family: var(--font-data); }
  .title { font-size: 26px; line-height: 1.2; font-weight: 600; }
  /* Typed into a textarea in paragraphs, and read back in them: pre-line keeps the
     newlines somebody typed, as .lines does for a note. */
  .prose { font-size: 16px; line-height: 1.6; white-space: pre-line; }
  .heading { font-size: 18px; line-height: 1.4; font-weight: 600; }
  .tag { font-size: 12px; }
  .hint { font-size: 12px; color: var(--text-muted); }
  /* However wide the page, what somebody wrote stops at about seventy characters, and so
     does a box they type into, so a summary is written at the width it is read at. In em,
     so a 12px hint gets the same count as 16px prose; max-width does nothing to an inline
     .hint, which is already inside a line of something else. */
  .prose, .lead, .hint, .banner > span, #cookienote p { max-width: var(--measure); }
  .page :is(.input, .select) { max-width: var(--measure); }
  @media (max-width: 560px) { .title { font-size: 22px; } }
  .num, td.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
  .break { overflow-wrap: anywhere; }

  /* One ring for everything that takes focus. Never removed, only restyled. */
  :focus-visible { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-w); }
  /* Off the page until it has focus, rather than display: none, which would take it
     out of the tab order and leave the keyboard where it started. It sits above the
     banner once it appears, because that is what it is skipping. */
  .skip { position: absolute; left: -9999px; top: 0; z-index: 60; }
  .skip:focus { left: var(--space-3); top: var(--space-3); padding: var(--space-3) var(--space-4);
    color: var(--text); background: var(--surface-raised); border: 2px solid var(--accent);
    border-radius: var(--radius-sm); }
  /* The jump gives <main> focus, and a ring drawn round the whole page says nothing
     useful. The skip link itself is what the eye should follow. The one suppression
     the suite allows (test_keyboard_and_motion). */
  main:focus { outline: none; }
  /* Anything that moves stops when asked to, including what is added next. The one
     scroll that asks for motion in a script reads the preference itself: a behavior
     passed to scrollTo outranks scroll-behavior. */
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }

  /* ---- 3. Button ---------------------------------------------------------- */
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
    min-height: var(--control-h); padding: 0 var(--space-4); white-space: nowrap; cursor: pointer;
    font-size: 14px; text-decoration: none; color: var(--text); background: var(--surface-sunken);
    border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-sm); }
  .btn:hover { background: var(--surface-hover); }
  .btn:active { background: var(--surface-hover); transform: translateY(1px); }
  .btn.primary { background: var(--accent-fill); color: var(--on-accent); border-color: var(--accent-fill); }
  .btn.primary:hover { background: var(--accent-fill); color: var(--on-accent);
    box-shadow: inset 0 0 0 2px var(--on-accent); }
  .btn.danger { color: var(--danger); border-color: var(--danger-line); background: var(--surface-raised); }
  .btn.danger:hover { background: var(--danger-wash); color: var(--danger); }
  .btn.sm { min-height: 28px; padding: 0 var(--space-3); font-size: 13px; }
  .btn.icon { width: var(--control-h); padding: 0; }
  .btn.icon.sm { width: 28px; }
  .btn svg { width: 16px; height: 16px; display: block; flex: none; }
  .btn.on { border-color: var(--accent); color: var(--accent); }
  .btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; color: var(--text-muted);
    background: var(--surface); border-style: dashed; }
  @media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } }
  /* Where a box stands beside buttons, the row is one height. The note bar, the upload
     row, the toolbars and the photograph actions still carry v0.1 boxes, which padded out
     to 35px beside 28px buttons; both now take the control height. */
  :is(.notebar, .fileform, .toolbar, .photo-actions form) .btn { min-height: var(--control-h); }
  :is(.notebar, .fileform, .toolbar, .photo-actions form) input:not([type=checkbox], [type=radio], [type=file]),
  :is(.notebar, .fileform, .toolbar, .photo-actions form) select:not(.select) {
    height: var(--control-h); padding-block: 0; box-sizing: border-box; }

  /* ---- 4. Form controls --------------------------------------------------- */
  .field { display: block; margin-top: var(--space-5); }
  .field > label, .field > .lbl { display: block; margin-bottom: var(--space-2); font-size: 13px;
    font-weight: 500; color: var(--text-muted); }
  .input, .select { width: 100%; min-height: var(--control-h); padding: 0 var(--space-3);
    font-family: var(--font-data); font-size: 14px; color: var(--text); background: var(--surface-raised);
    border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-sm); }
  /* What is typed is data and stays monospaced; what is chosen from a list is the
     interface's own vocabulary ("All categories", "Faulty"), and so is a search box. */
  .select, .input.search { font-family: var(--font-ui); }
  textarea.input { min-height: 72px; padding: var(--space-3); }
  .input::placeholder { color: var(--text-muted); opacity: 1; }
  .input:hover, .select:hover { border-color: var(--text-muted); }
  .check { display: inline-flex; align-items: center; gap: var(--space-3); font-size: 14px; }
  .check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-fill); }
  /* min-width: 0, because a fieldset's default minimum is its widest child: the drives table
     inside one would widen the fieldset - and on a phone the page - instead of scrolling. */
  .fieldset { min-width: 0; margin: var(--space-5) 0 0; padding: var(--space-3) var(--space-5) var(--space-5);
    border: var(--border-w) solid var(--line); border-radius: var(--radius-md); }
  .fieldset > legend { padding: 0 var(--space-3); font-size: 13px; font-weight: 500; color: var(--text-muted); }
  .formgrid { display: grid; gap: 0 var(--space-5);
    grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
  /* Pinned by the environment: readable, plainly not editable, and says why once
     at the foot of the form rather than on every row. */
  .input:disabled, .select:disabled, .is-pinned .input, .is-pinned .select {
    background: var(--surface-sunken); color: var(--text-muted); border-style: dashed; cursor: not-allowed; }
  @media (pointer: coarse) {
    input, select, textarea { font-size: 16px; }
    .btn, .input, .select { font-size: 16px; min-height: var(--tap); }
    .formsections a { display: inline-flex; align-items: center; min-height: var(--tap); }
    nav.tabs a { display: inline-flex; align-items: center; min-height: var(--tap); }
    .btn.sm { font-size: 16px; min-height: 36px; }
    /* An icon button is square, so its width goes up with its height: 44px, and
       36px for the small ones on a photograph, a history line and a part's card. */
    .btn.icon { width: var(--tap); }
    .btn.icon.sm { width: 36px; }
    .check input, .tickbox input[type=checkbox] { width: 22px; height: 22px; }
    .viewswitch a { font-size: 16px; min-height: calc(36px - 2 * var(--border-w)); }
    .logviews a { display: inline-flex; align-items: center; font-size: 16px; min-height: var(--tap); }
    /* Take photo runs the width of the panel, under the thumb; the tile beside it reads
       Choose photos. */
    .takephoto { flex-basis: 100%; }
    .on-fine { display: none; }
    :is(.notebar, .fileform, .toolbar, .photo-actions form) .btn { min-height: var(--tap); }
    :is(.notebar, .fileform, .toolbar, .photo-actions form) input:not([type=checkbox], [type=radio], [type=file]),
    :is(.notebar, .fileform, .toolbar, .photo-actions form) select:not(.select) { height: var(--tap); }
  }

  /* ---- 5. Chip ------------------------------------------------------------ */
  .chip { display: inline-block; padding: 1px var(--space-3); font-size: 12px; white-space: nowrap;
    color: var(--text); background: var(--surface-sunken); border-radius: var(--radius-pill); }
  .chip.ok { background: var(--success-wash); }
  .chip.warn { background: var(--warning-wash); }
  .chip.bad { background: var(--danger-wash); }
  .chip.quiet { background: none; color: var(--text-muted); box-shadow: inset 0 0 0 1px var(--line); }
  a.chip { text-decoration: underline; color: var(--accent); }

  /* ---- 6. Panel ----------------------------------------------------------- */
  .panel { margin-top: var(--space-5); overflow: hidden; background: var(--surface-raised);
    border: var(--border-w) solid var(--line); border-radius: var(--radius-lg); }
  .panel > header { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3);
    padding: 6px var(--space-4); background: var(--band); color: var(--band-text);
    /* Room kept for the flash, so a long title wraps before it and never runs underneath. */
    padding-right: calc(var(--space-4) + var(--flash-w) + var(--flash-inset)); }
  /* The flash is the preset's paint on an upright box, slanted. The browser smooths the box's
     edges but not the gradient's, so the preset blends each band into the next over a pixel:
     a hard stop on a slant is drawn as a staircase. */
  .panel > header::after { content: ""; position: absolute; top: 0; bottom: 0; right: var(--flash-inset);
    width: var(--flash-w); background: var(--flash); transform: skewX(-25deg); pointer-events: none; }
  .panel > header h3 { font-size: 14px; font-weight: 600; }
  .panel > header .meta { font-family: var(--font-data); font-size: 12px; color: var(--band-muted); }
  .panel > header .grow { flex: 1; }
  /* A control on the band (Shuffle) is ringed in the band's own ink: --focus is chosen
     for the page's ground and can all but vanish on a dark band, and the band's text is
     held to 4.5:1 against it in every preset -- the lightbox's answer to its scrim. */
  .panel > header :focus-visible { outline-color: var(--band-text); }
  .panel > .pbody { padding: var(--space-4); }
  .panel > .pbody > :first-child { margin-top: 0; }
  .panel > .pbody > :last-child { margin-bottom: 0; }

  /* ---- 7. Key-value list -------------------------------------------------- */
  .kv { margin: 0; }
  .kv > div { display: flex; gap: var(--space-4); padding: 6px 0; border-top: 1px solid var(--line); }
  .kv > div:first-child { border-top: 0; padding-top: 0; }
  .kv > div:last-child { padding-bottom: 0; }
  .kv dt { flex: 0 0 132px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
  .kv dd { margin: 0; min-width: 0; font-family: var(--font-data); overflow-wrap: anywhere; }
  @media (max-width: 400px) { .kv dt { flex-basis: 104px; } }
  /* The history's column is as wide as the stamp in it -- a date for a visitor, a
     date and a time for the owner -- rather than the label width of the other lists,
     which on a phone is width the entries were wrapping for. */
  .kv.log dt { flex-basis: 10.5ch; white-space: nowrap; font-variant-numeric: tabular-nums; }
  /* The entry takes the rest of its row, so its line's right-hand end -- where the
     camera and delete buttons stand -- is the same column on every entry. Left to fit
     its words, as a flex item is, it put the buttons straight after them. */
  .kv.log dd { flex: 1 1 0%; }
  .kv.log.timed dt { flex-basis: 16.5ch; }
  /* A note is written in lines, and a table cell or a list value does not show them.
     It is what somebody wrote rather than something recorded, so it is in the
     summary's face and not the data face of the values above it. */
  .kv dd.lines { white-space: pre-line; font-family: var(--font-display); }
  /* What happened takes the slack, so an entry's camera and delete stand together at
     the right of its line. */
  .logline { display: flex; align-items: center; gap: var(--space-3); }
  .logmsg { flex: 1; min-width: 0; white-space: pre-line; }
  .logadd { flex: none; }
  /* An entry's own photographs, smaller than the gallery's: a picture the size of the
     sentence beside it would have the log read by its pictures. */
  .logshots { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-3) 0 var(--space-1); }
  .logshots img { width: 120px; height: 88px; object-fit: cover;
    border: var(--border-w) solid var(--line); border-radius: var(--radius-sm); }
  /* When it came and how long it has stayed: a sentence over the panel, not a row of
     the list under it. */
  .ptimeline { margin: 0 0 var(--space-4); }
  /* Notes, Changes and All: links, the one open marked by its weight and a rule under
     it, not by colour alone. Quieter than the tab strip, being a view of one panel. */
  .logviews { display: flex; flex-wrap: wrap; gap: var(--space-4); margin: 0 0 var(--space-4); font-size: 13px; }
  .logviews a { color: var(--text); text-decoration: none; padding-bottom: 2px; }
  .logviews a:hover { text-decoration: underline; }
  .logviews a[aria-current="page"] { font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
  .logmore { margin: var(--space-4) 0 0; }
  /* On a phone the stamp beside each entry left the words two to a line. Above it,
     the entry has the width of the screen; its line is still a row, so the buttons
     keep their column at its right-hand end. */
  @media (max-width: 560px) {
    .kv.log > div { flex-direction: column; gap: var(--space-1); }
    .kv.log dt, .kv.log.timed dt { flex-basis: auto; }
    .kv.log dd { flex: none; }
  }

  /* Tiles or a table on the gallery: two links drawn as one control, the one in force
     pressed in -- a ground and weight, not colour alone. And the table's rows: a small
     picture beside the tag and the name, cropped to the card's 4:3. */
  .viewswitch { display: inline-flex; border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-sm);
    overflow: hidden; }
  /* A small button's height, edge included, so it stands level with the buttons it sits among. */
  .viewswitch a { display: inline-flex; align-items: center; padding: 0 var(--space-3); color: var(--text);
    text-decoration: none; font-size: 13px; min-height: calc(28px - 2 * var(--border-w)); }
  .viewswitch a + a { border-left: var(--border-w) solid var(--line-strong); }
  .viewswitch a[aria-current="page"] { background: var(--surface-sunken); font-weight: 600; }
  .gallerytable .rowthumb { display: block; width: 48px; height: 36px; object-fit: cover; border-radius: var(--radius-xs); }
  .gallerytable .rowthumb.ph { object-fit: contain; }
  .gallerytable th.thumbcell, .gallerytable td.thumbcell { width: 48px; }

  /* ---- 8. Card (gallery tile) --------------------------------------------- */
  .grid { display: grid; gap: var(--space-5);
    grid-template-columns: repeat(auto-fill, minmax(min(192px, 100%), 1fr)); }
  /* Two across on a phone rather than one: a gallery is for scanning. */
  @media (max-width: 560px) { .grid { gap: var(--space-4);
    grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); } }
  .card { display: block; overflow: hidden; text-decoration: none; color: var(--text);
    background: var(--surface-raised); border: var(--border-w) solid var(--line); border-radius: var(--radius-lg); }
  .card:hover { border-color: var(--accent); }
  .card .thumb { aspect-ratio: var(--thumb-ratio); display: flex; align-items: center; justify-content: center;
    position: relative; background: var(--surface-sunken); }
  .card .thumb > img { display: block; width: 100%; height: 100%; object-fit: cover; }
  /* The stand-in drawings are files with their own grey stroke, not the inline
     drawing the card was designed with, so they keep 0.1's fade rather than
     taking a colour from the tokens. */
  .card .thumb > img.ph { width: 46%; height: 46%; object-fit: contain; opacity: .55; }
  .card .thumb svg { width: 46%; opacity: .7; fill: none; stroke: var(--text-muted); stroke-width: 2; }
  /* Blocks, said out loud: the card is a link, so its parts are spans, and a span's
     padding does not reach a block inside it - the name hung out to the card's edge. */
  .card .body { display: block; padding: var(--space-3) var(--space-4) var(--space-4); }
  .card .aid { display: block; font-family: var(--font-data); font-size: 12px; color: var(--text-muted); }
  .card .nm { display: block; margin: var(--space-1) 0 var(--space-3); font-size: 14px; line-height: 1.3; }
  .card .chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
  /* Disposed: the photograph fades, the words do not - dimming the whole card, as
     v0.1 does, takes text-muted under 4.5:1. The chip says it in a word. */
  .card.is-disposed .thumb > * { opacity: .35; }

  /* ---- 9. Table ----------------------------------------------------------- */
  .table { width: 100%; border-collapse: collapse; }
  .table th, .table td { padding: 6px var(--space-3); text-align: left; vertical-align: top;
    border-top: 1px solid var(--line); overflow-wrap: break-word; }
  .table th { font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
  .table td.tight, .table th.tight { white-space: nowrap; }
  /* The one column that is a sentence takes the slack, so the short ones sit at the
     edge rather than each being handed a share of the spare width. */
  .table td.wide { width: 100%; }
  .table tr:first-child > * { border-top: 0; }
  /* More than three columns: either it stacks... */
  @media (max-width: 560px) {
    .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: auto; }
    .table.stack tr:first-child { display: none; }
    .table.stack tr { padding: var(--space-3) 0; border-top: 1px solid var(--line); }
    .table.stack td { padding: 1px 0; border: 0; }
    .table.stack td:empty { display: none; }
    .table.stack td[data-label]::before { content: attr(data-label) " "; font-size: 12px; color: var(--text-muted); }
    /* A row whose values are short -- a status, a count, a date -- runs them on one
       line under the first cell rather than giving each a line of its own. */
    .table.stack.runon td + td:not(:empty) { display: inline-block; margin-right: var(--space-4); }
    .table.stack td[data-label]::before { font-family: var(--font-ui); }
  }
  /* A table too wide for a tablet stacks from 820px instead: the owner's files list,
     six columns with a box to type in, which scrolled the page sideways at any width
     a phone or a small tablet has. The same rules as above, from the wider point. */
  @media (max-width: 820px) {
    .table.stack.early, .table.stack.early tbody, .table.stack.early tr, .table.stack.early td { display: block; width: auto; }
    .table.stack.early tr:first-child { display: none; }
    .table.stack.early tr { padding: var(--space-3) 0; border-top: 1px solid var(--line); }
    .table.stack.early td { padding: 1px 0; border: 0; }
    .table.stack.early td:empty { display: none; }
    .table.stack.early td[data-label]::before { content: attr(data-label) " "; font-family: var(--font-ui); font-size: 12px; color: var(--text-muted); }
    /* Size, added, the tick and delete are one short line about the file rather
       than four lines under it; each control is in a form, and a form is a block. */
    .table.stack.early td.tight, .table.stack.early td.act { display: inline-block; margin: var(--space-2) var(--space-4) 0 0; vertical-align: middle; }
    .table.stack.early td.tight form, .table.stack.early td.act form { display: inline-flex; align-items: center; gap: var(--space-2); }
  }
  /* ...or it scrolls inside its own box. */
  .hscroll { overflow-x: auto; }
  .hscroll > .table { min-width: 760px; }
  .hscroll > .table td { padding-left: 0; }
  .hscroll > .table th:first-child, .hscroll > .table td:first-child { width: 64px; }
  .hscroll > .table td + td { padding-left: var(--space-3); }

  /* ---- 10. Banner --------------------------------------------------------- */
  .banner { display: flex; gap: var(--space-3); align-items: baseline; margin: var(--space-4) 0;
    padding: var(--space-3) var(--space-4); color: var(--text); background: var(--surface-sunken);
    border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-md); }
  .banner > b { flex: none; font-weight: 600; }
  .banner.warning { background: var(--warning-wash); border-color: var(--warning); }
  .banner.warning > b { color: var(--warning); }
  .banner.danger { background: var(--danger-wash); border-color: var(--danger-line); }
  .banner.danger > b { color: var(--danger); }
  .banner.success { background: var(--success-wash); border-color: var(--success); }
  .banner.success > b { color: var(--success); }
  /* A notice that floats over the page rather than sitting in it, at the foot of the
     window. The one saying the record has changed is a pill in the middle; the
     cookie notice is a bar the width of the page, which is a notice and not a gate:
     nothing is stored until the reader chooses something, so there is nothing to
     hold them up for. The pill stands above the bar for the one page that shows both. */
  .toast { position: fixed; z-index: 70; bottom: var(--space-4); left: 50%; transform: translateX(-50%);
    align-items: center; margin: 0; padding: 6px var(--space-3) 6px var(--space-4); font-size: 13px;
    background: var(--surface-raised); border-radius: var(--radius-pill); box-shadow: var(--shadow-pop); }
  .toast > .btn { flex: none; }
  #cookienote { z-index: 60; left: 0; right: 0; bottom: 0; transform: none; flex-wrap: wrap;
    justify-content: center; border-width: 1px 0 0; border-radius: 0; box-shadow: none; }
  #cookienote p { margin: 0; font-size: 12px; color: var(--text-muted); }
  #cookienote p b { color: var(--text); }
  /* On a wide screen the notice is the only thing fixed over the page, and a control
     tabbed to below the fold must not be scrolled to where it is covering. */
  /* How much of the foot of the window the fixed chrome covers: the notice alone on a
     wide screen, the tab bar on a phone, and the notice standing on the bar there --
     five lines on a 320px screen. Dimensions of those things, not steps of spacing. */
  :root { --notice-clear: 88px; --tabbar-clear: 60px; --notice-clear-phone: 240px; }
  html:has(#cookienote) { scroll-padding-bottom: var(--notice-clear); }
  html:has(#cookienote) body { padding-bottom: var(--notice-clear); }

  /* ---- 11. Menu / popover ------------------------------------------------- */
  .menupop { min-width: 180px; padding: var(--space-2); background: var(--surface-raised);
    border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); }
  .menupop a, .menupop button { display: block; width: 100%; padding: 6px var(--space-3); text-align: left;
    font-size: 14px; color: var(--text); background: none; border: 0; border-radius: var(--radius-sm);
    text-decoration: none; cursor: pointer; }
  .menupop a:hover, .menupop button:hover { background: var(--surface-hover); }
  .menupop hr { margin: var(--space-2) 0; border: 0; border-top: 1px solid var(--line); }
  .menupop form { margin: 0; }
  .menupop a, .menupop button { white-space: nowrap; }
  /* A menu that opens without a script, because <details> already does; app.js only
     closes it, on Escape and on a click landing anywhere else. */
  .menu { position: relative; }
  .menu > summary { list-style: none; }
  .menu > summary::-webkit-details-marker { display: none; }
  .menu > summary::marker { content: ""; }
  .menu > .menupop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 950; }
  /* The banner's sections, held in its menu for the widths where the banner has put
     its own away (13, below). */
  .menupop .fold { display: none; }

  /* ---- 12. Stat tile and ranked bar --------------------------------------- */
  .stattile { padding: var(--space-4); background: var(--surface-raised);
    border: var(--border-w) solid var(--line); border-radius: var(--radius-md); }
  .stattile .k { font-size: 13px; color: var(--text-muted); }
  .stattile .v { font-family: var(--font-data); font-size: 22px; font-weight: 600; line-height: 1.3; }
  .stattile .n { font-size: 12px; color: var(--text-muted); }
  .bars { display: grid; grid-template-columns: max-content 1fr max-content; gap: 6px var(--space-4); align-items: center;
    font-size: 13px; }
  .bars .track { height: 12px; background: var(--accent-track); border-radius: var(--radius-xs); overflow: hidden; }
  .bars .fill { display: block; height: 100%; background: var(--accent-fill); border-radius: var(--radius-xs); }
  .bars .n { font-family: var(--font-data); text-align: right; color: var(--text-muted); }

  /* ---- 13. Site header, stripe, tab bar ----------------------------------- */
  /* One row at every width, as navigation.md draws it. Wrapping let each item keep its
     own width, which with the sections showing came to 1041px, so below that the menu
     dropped to a second row at the left and opened off the edge. Short of room now, the
     search box narrows first, to a floor it is still usable at, and then the name is cut
     short rather than the logo.

     The order is the box's shrink outweighing the name's a thousand to one, not the name's
     being token-small. It was 0.001 once, and a browser hands out only that fraction of
     the shortfall when the items still shrinking add up to less than one: with the box at
     its floor the name was the only one, so it gave up a thousandth of what was needed and
     the rest ran off the edge, a 390px phone's page drawn 406px wide. */
  .site-header { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--space-3) var(--space-5);
    padding: var(--space-4) var(--frame-inset); border-bottom: var(--border-w) solid var(--line); }
  .site-header .brand { display: inline-flex; align-items: center; gap: var(--space-3); font-weight: 600;
    color: var(--text); text-decoration: none; min-width: 0; flex-shrink: 1; }
  .site-header .brand span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .site-header .mark { width: 34px; height: 28px; background: var(--surface-sunken);
    border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-xs); }
  .site-header nav { display: flex; gap: var(--space-5); }
  .site-header nav a { text-decoration: none; }
  .site-header nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
  .site-header .grow { flex: 1; }
  .site-header .search { width: 100%; }
  /* Sized by height: the logo is not square, and height is what the banner's other
     items are measured against. An installation's own logo keeps its proportions. */
  .site-header .brand img { display: block; width: auto; height: 34px; flex: none; }
  .site-header .searchwrap { display: flex; flex: 0 1000 230px; min-width: 160px; }
  .site-header .menu > summary { min-height: var(--control-h); }
  /* The no-login notice stands under the banner, inside its gutters. */
  /* A tablet, or a narrow window: the sections leave the banner for the top of its
     menu, so the banner stays one row rather than wrapping the search box onto a
     second. At 1000px and not 900 since Locations made them six: the sixth is about
     80px of banner, and at 900 that would have come out of the collection's name. */
  @media (max-width: 1000px) {
    .site-header nav { display: none; }
    .menupop .fold { display: block; }
    .menupop hr.fold { display: block; }
  }
  /* A phone: the banner is the mark, the name and the search box, and everything else
     moves to the tab bar, Scan with it -- into the thumb's reach. The name stays
     because nowhere else on a phone's page says whose collection a scanned label has
     opened. It stays on one line, clipped with an ellipsis, so a long name costs its
     own end rather than a second row of banner.

     Room is given up in an order. The search box goes first, from all the row the name
     leaves it down to what shows "Search anything..." whole at a phone's 16px -- 163px
     in Chromium and WebKit, which keep room for the clear button -- and only then the
     name. That floor is never more than half the row: at 320px the two share it
     evenly, the name getting as much as the box at the cost of the placeholder's last
     few pixels, and on a screen narrower still it cannot hold the banner open. */
  @media (max-width: 620px) {
    .site-header { flex-wrap: nowrap; padding: var(--space-3) var(--frame-inset); }
    .site-header .grow { display: none; }
    .site-header .brand { min-width: 0; }
    .site-header .brand img { flex: none; }
    .site-header .brand span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
    .site-header .hdr-new { display: none; }
    .site-header .hdr-more { display: none; }
    .site-header .hdr-scan { display: none; }
    .site-header .searchwrap { flex: 1 1 0; min-width: min(168px, 50%); }
    .site-header .search { width: 100%; }
    /* The suggestions hang from the banner rather than from the box, and span it:
       380px from the box's edge was wider than the room either side of it, and a
       thumb takes a row more surely the wider it is. */
    .site-header { position: relative; }
    .site-header .searchwrap { position: static; }
    .site-header .suggest { top: calc(100% + var(--space-1)); left: var(--space-2); right: var(--space-2);
      width: auto; max-width: none; }
  }
  .stripe { position: relative; height: var(--stripe-h); background: var(--stripe-image); }
  /* The banner's flash stands directly above the panels' flashes: the page's right edge is
     the inset the page is padded by (utilities.css, worked out once for the page under it,
     wide or reading), plus a panel's border, and the flash sits --flash-inset in from there,
     as it does in each panel - less the 8px a 25-degree slant moves the top of a panel's
     flash, so the diagonal reads as carrying on upward into the banner. It is slanted as
     theirs are: one flash, drawn one way, where an upright one read as four flat blocks
     above a row of bars. */
  .stripe::after { content: ""; position: absolute; top: 0; bottom: 0; width: var(--flash-w); background: var(--flash);
    right: calc(var(--page-inset) + var(--border-w) + var(--flash-inset) - 8px);
    transform: skewX(-25deg); }
  /* On the navigation's ground, as the side rail is (13a): on a panel's it was a white
     bar under a grey page in three looks. Its rule sets it off from a page of its colour. */
  .tabbar { display: none; background: var(--surface-nav); border-top: var(--border-w) solid var(--line); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--space-1); min-height: 52px; padding: 0; font-size: 11px; font-weight: 500; color: var(--text-muted);
    background: none; border: 0; text-decoration: none; cursor: pointer; }
  /* Where you are, and the sheet while it is open: colour and weight together. */
  .tabbar [aria-current="page"], .tabbar .on { color: var(--accent); font-weight: 600; }
  .tabbar svg { width: 21px; height: 21px; display: block; }
  /* Only on a phone, and there across the bottom, where the thumb is. Before it the
     banner on a 390px screen wrapped to four rows, and Scan -- the one control a
     phone is really here for, used while holding the thing -- was the last of them. */
  @media (max-width: 620px) {
    .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: flex;
      padding-bottom: env(safe-area-inset-bottom, 0px); }
    /* Room under the last card for the bar that would otherwise sit on it. */
    body { padding-bottom: calc(var(--tabbar-clear) + env(safe-area-inset-bottom, 0px)); }
    /* That holds the last card off the bar and says nothing about where a scroll
       stops: tabbing to a control below the fold scrolls it to the viewport's edge,
       which is where the bar is, so the control arrived behind it -- twenty stops on
       an item page. The scroll container has to be told separately. */
    html { scroll-padding-bottom: calc(var(--tabbar-clear) + var(--space-4) + env(safe-area-inset-bottom, 0px)); }
    /* The cookie notice stands on the bar and is taller than it: five lines on a
       320px screen. It is in the markup only while showing, so the room comes back
       when it goes, and room under the page too, since at the foot of a short page
       there is nothing left to scroll. */
    #cookienote { bottom: calc(var(--tabbar-clear) + env(safe-area-inset-bottom, 0px)); }
    html:has(#cookienote) { scroll-padding-bottom: calc(var(--notice-clear-phone) + env(safe-area-inset-bottom, 0px)); }
    html:has(#cookienote) body { padding-bottom: calc(var(--notice-clear-phone) + env(safe-area-inset-bottom, 0px)); }
  }

  /* ---- 13a. Side rail -----------------------------------------------------
     An installation preference: the Navigation setting puts `side` on the shell the
     rail and the page stand in. Applies at 1100px and wider only - below that the
     rail is not drawn and the banner carries the sections, as it does for an
     installation that chose Top. The rail spends the empty margin beside the
     column, never the column. Same <nav>, laid down not across. */
  .shell { display: block; }
  .rail { display: none; }
  @media (min-width: 1100px) {
    .shell.side { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100vh; }
    /* Held to the window's height, so on a short one it scrolls itself: the owner's,
       open, is taller than a 1366x768 laptop leaves, and what spilt below the edge
       would stay there until the page beside it ran out. Down only: a scrollbar that
       takes room leaves the folded rail's icons wider than what is left. The rail is
       chrome, not a panel, so it stands on the navigation's ground rather than
       surface-raised: that is a panel's white in Rubber Key, Ninety-five and Phosphor
       light, and there the rail takes the page's colour, set off by its rule. */
    .shell.side > .rail { display: flex; flex-direction: column; gap: var(--space-2); position: sticky; top: 0;
      height: 100vh; overflow-x: hidden; overflow-y: auto; padding: var(--space-5) var(--space-4);
      background: var(--surface-nav); border-right: var(--border-w) solid var(--line); }
    /* The cookie notice is fixed over the foot of the window, which is where the rail's foot
       sits, until it is answered. Room at the rail's bottom lifts Log out and Collapse above
       it, and the rail scrolls to reach them; the same :has gives it back when the notice goes. */
    html:has(#cookienote) .shell.side > .rail {
      padding-bottom: calc(var(--notice-clear) + var(--space-5));
      scroll-padding-bottom: var(--notice-clear); }
    /* With the rail beside it the banner holds only the search, leading: the one thing
       wanted from every page in the same place whichever layout is chosen. Brand,
       sections, Scan, + New and the menu live in the rail. Scan stands with the places
       there, as it does in the phone's bar, rather than alone at the banner's far end. */
    .shell.side .site-header nav, .shell.side .site-header .brand, .shell.side .site-header .grow,
    .shell.side .site-header .hdr-scan,
    .shell.side .site-header .hdr-new, .shell.side .site-header .hdr-more { display: none; }
    .shell.side .site-header .searchwrap { flex: 0 1 520px; }
    .shell.side .site-header .search { width: 100%; }
  }
  .rail .brand { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); font-weight: 600;
    color: var(--text); text-decoration: none; }
  .rail .brand .mark { width: 34px; height: 28px; flex: none; background: var(--surface-sunken);
    border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-xs); }
  /* The installation's own logo, which is an image rather than the design's
     placeholder box: sized by height as the banner's is, so a mark of any
     proportion keeps it. */
  .rail .brand img.mark { display: block; width: auto; background: none; border: 0; }
  .rail a.item, .rail button.item { display: flex; align-items: center; gap: var(--space-3); min-height: var(--control-h);
    padding: 0 var(--space-3); font-size: 14px; color: var(--text); background: none; border: 0;
    border-radius: var(--radius-sm); text-decoration: none; text-align: left; cursor: pointer; }
  .rail .item:hover { background: var(--surface-hover); }
  /* Current: a bar, a weight and a ground - three tellings, none of them hue alone. */
  .rail .item[aria-current="page"] { font-weight: 600; background: var(--surface-sunken);
    box-shadow: inset 3px 0 0 var(--accent); }
  .rail .item svg { width: 16px; height: 16px; flex: none; color: var(--text-muted); }
  .rail nav { display: flex; flex-direction: column; gap: var(--space-1); }
  /* flex: none, or a rail too short for its contents takes this pixel first. */
  .rail .sep { flex: none; height: 1px; margin: var(--space-3) 0; background: var(--line); }
  .rail .foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-2); }
  .rail .item .n { margin-left: auto; font-family: var(--font-data); font-size: 12px; color: var(--text-muted); }
  .rail .cap { margin: var(--space-4) var(--space-3) var(--space-1); font-size: 12px; color: var(--text-muted); }
  .rail .item.recent { min-height: 28px; font-size: 13px; }
  .rail .item.recent .tag { flex: none; color: var(--text-muted); }
  .rail .item.recent .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* On a row under the pointer everything is `text`, as in the search suggestions (14h):
     text-muted on surface-hover is a pair the design never uses, and the count and the
     tag fell under 4.5:1 on it. After the muted rules, since `.recent .tag` is as
     specific as this and would otherwise win by coming later. */
  .rail .item:hover svg, .rail .item:hover .n, .rail .item:hover .tag { color: var(--text); }
  /* Collapsed: a class on the same shell, set by a plain link that stores the choice
     in a cookie, so it works with no script. Icons only; every item keeps its name in
     aria-label and title. */
  @media (min-width: 1100px) { .shell.side.collapsed { grid-template-columns: 60px minmax(0, 1fr); } }
  .rail.collapsed { padding-left: var(--space-3); padding-right: var(--space-3); align-items: center; }
  .rail.collapsed .brand span:not(.mark), .rail.collapsed .item span, .rail.collapsed .cap,
  .rail.collapsed .recent, .rail.collapsed .item .n { display: none; }
  .rail.collapsed .item { width: var(--control-h); padding: 0; justify-content: center; }
  .rail.collapsed .item svg { width: 18px; height: 18px; color: inherit; }
  .rail.collapsed .item[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--accent); color: var(--accent); }

  /* ---- 13d. The item page's two columns ------------------------------------
     Content and photographs side by side above 860px, one column below. */
  /* Four parts, in this order in the source: the head (name, actions, tag, banners,
     summary), the photographs, the panels, and the rest of the side column (label,
     disposal, QR). Side by side, the head spans the page and both columns start level,
     the photographs beside Details; in one column the source order is the page's --
     summary, photograph, details, then the owner's tools -- so the Tab key and the eye
     agree at every width, with no `order` to draw a panel where the Tab key does not
     go. */
  .itemcols { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr;
    grid-template-areas: "head head" "body photos" "body side"; gap: 0 var(--space-6); align-items: start; }
  .itemcols > .itemhead { grid-area: head; }
  .itemcols > .itemphotos { grid-area: photos; }
  .itemcols > .itembody { grid-area: body; }
  .itemcols > .itemside { grid-area: side; }
  /* The Status panel (MANUAL §16): the three answers down the panel, Why and When on a
     row of their own under them, and Save last. The fieldset is there for the answers'
     name and is drawn as nothing. */
  .statusform { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); }
  .statusform > fieldset { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0;
    margin: 0; padding: 0; border: 0; }
  .statusform > .addrow { align-self: stretch; margin: 0; }
  @media (max-width: 860px) { .itemcols { display: block; } }
  /* Tabbed, in one column, the photographs come with Details alone: the other tabs
     open on what they are for, rather than under a screen of pictures already seen
     where the label's scan landed (MANUAL §4, "One page or tabs"). */
  @media (max-width: 860px) { .itemcols.tabbed:not(.on-details) > .itemphotos { display: none; } }
  /* The tabs end the head and the panels start under them, as the Details band would. */
  .itemhead > nav.itemtabs { margin-bottom: var(--space-4); }
  /* The count stands apart from its word by a gap rather than a space: a touchscreen
     draws each tab as a flex row (above), which drops the space between the two. */
  nav.itemtabs a { display: inline-flex; align-items: baseline; gap: var(--space-2); }
  nav.itemtabs .meta { color: var(--text-muted); font-weight: 400; }
  /* The photograph in a 4:3 frame the width of the panel -- the gallery card's shape --
     on a shaded ground. A photograph of another shape is shown whole inside it rather
     than cropped, because the large one is for seeing all of the thing. The frame and
     not the photograph sets the height, so the panels under it stay where they are
     from one item to the next (MANUAL §10, "In the panel"). */
  .photo-main { display: block; width: 100%; height: auto; aspect-ratio: var(--thumb-ratio); object-fit: contain;
    background: var(--surface-sunken); border: var(--border-w) solid var(--line); border-radius: var(--radius-md); }
  /* Nobody has photographed it: the same frame, so a page does not change shape
     according to whether anyone has been round with a camera, holding the drawing the
     item's gallery card wears at the card's size. */
  .nophoto { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3);
    aspect-ratio: var(--thumb-ratio);
    background: var(--surface-sunken); border: var(--border-w) solid var(--line); border-radius: var(--radius-md); }
  .nophoto img.ph { width: 46%; height: auto; object-fit: contain; opacity: .55; }
  .nophoto .hint { margin: 0; }
  .photo-primary { position: relative; }
  /* The rest of the photographs under the first, two across down to the narrowest
     column and more where the panel has the page's width. */
  .thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(110px, 100%), 1fr));
    gap: var(--space-4); margin: var(--space-3) 0; }
  .thumb-item { position: relative; }
  .thumbs img { display: block; width: 100%; height: auto; aspect-ratio: var(--thumb-ratio); object-fit: cover;
    border: var(--border-w) solid var(--line); border-radius: var(--radius-md); }
  img.zoomable { cursor: zoom-in; }
  /* "Not this exact unit": a reference photograph is marked where it sits, over the
     picture, so it is drawn on the scrim as the lightbox's controls are. */
  .ref-badge { position: absolute; top: 6px; left: 6px; pointer-events: none; padding: var(--space-1) var(--space-3);
    font-size: 11px; line-height: 1; color: var(--on-scrim); background: var(--scrim); border-radius: var(--radius-pill); }
  .ref-badge.icon { display: inline-flex; padding: var(--space-1); border-radius: var(--radius-sm); }
  .ref-badge.icon img { display: block; width: 18px; height: 18px; object-fit: contain; border-radius: var(--radius-xs); }
  /* A column of controls under a location's photographs, where a box stands over its
     button. */
  .photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3);
    margin-top: var(--space-4); max-width: 320px; }
  .photo-actions form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: 0; }
  .photo-actions .hint { margin: 0; }
  /* A file input sits invisible over its own label, so the button says what it does
     in the site's words rather than the browser's, and is still a real input: it
     takes the keyboard, opens the picker and works with no script. The ring it would
     draw round itself is drawn round the button. */
  .filebtn { position: relative; overflow: hidden; }
  .filebtn input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
  .filebtn:has(input:focus-visible) { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-w); }
  /* The panel's pickers hide their input instead (.sr-only), and the ring that would
     be drawn round its pixel is drawn round what you press. */
  :is(.addtile, .takephoto):has(input:focus-visible) { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-w); }
  form.sending .filebtn { pointer-events: none; opacity: .55; }
  .newphotos { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
  .newphotos .hint { margin: 0; }
  /* The paragraph at the top runs as wide as the Details under it, rather than the
     seventy-character measure, so the head and the body share an edge: the details
     column's share of the two, less the gap between them. One column, the panels'
     width. */
  @media (min-width: 861px) { .itemhead .prose { max-width: calc((100% - var(--space-6)) * 1.9 / 2.9); } }
  @media (max-width: 860px) { .itemhead .prose { max-width: none; } }
  /* A project's and a location's name with, for the owner, its actions: on one line,
     the actions at its end; under the name on a phone, before the summary, rather
     than off the edge. A machine's and a part's are in the row above the name. */
  .titleline { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3) var(--space-5); }
  .titleline > .title { flex: 1 1 auto; min-width: 0; margin: 0; }
  .itemacts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
  @media (max-width: 560px) { .titleline > .itemacts { flex-basis: 100%; } }
  /* What is on a label, in order: a row to a detail, its tick and its name, then its
     up and down at the far end, where a thumb finds them in the same place on every
     row (MANUAL §13, "What's on it"). */
  .orderlist { display: grid; gap: var(--space-2); max-width: var(--measure); margin: 0 0 var(--space-3);
    padding: 0; list-style: none; }
  .orderlist > li { display: flex; align-items: center; gap: var(--space-2); }
  .orderlist > li > label { flex: 1; min-width: 0; }
  /* The small label as it will print, over the buttons that print it (MANUAL §13).
     A picture of a sticker, so it keeps the sticker's own white in either theme,
     with a hairline round it to say where the sticker ends. No wider than its own
     dots or the column, and the height its markup states, so the panel keeps its
     shape while the picture is on its way. */
  .lblpic { display: block; max-width: 100%; height: auto; margin-bottom: var(--space-3);
    border: var(--border-w) solid var(--line); border-radius: var(--radius-xs); }
  /* Each label's picture beside the settings that make it (MANUAL §13, "Seeing it as
     you set it up"). First in the group's own order, so a phone has it at the top
     with nothing moved; where there is room, a column of its own to the right of the
     settings, held in view while the list under them is worked down. Half the
     width: the settings ask for no more than a measure, and a 6x4 label shown
     narrower than that cannot be read. */
  .lblset { display: grid; gap: var(--space-4); }
  .lblprev > figure { margin: 0; }
  .lblprev figcaption { font-size: 12px; color: var(--text-muted); }
  @media (min-width: 900px) {
    .lblset { grid-template-columns: minmax(0, 1fr) minmax(18rem, 1fr); gap: var(--space-6);
      align-items: start; }
    .lblset > .lblprev { grid-column: 2; grid-row: 1; position: sticky; top: var(--space-4); }
    .lblset > .lblrows { grid-column: 1; grid-row: 1; }
  }
  .cell { padding: var(--space-3) var(--space-4); background: var(--surface-raised);
    border: var(--border-w) solid var(--line); border-radius: var(--radius-md); }
  .cell .k { font-size: 12px; color: var(--text-muted); }
  .cell .v { font-family: var(--font-data); font-size: 16px; font-weight: 600; }
  /* auto-fit: two chip cards share the panel rather than leave a third of it empty. */
  .cardgrid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr)); }
  /* A file's date and time are one fact; they wrap together on a phone or not at all. */
  .fwhen { white-space: nowrap; }
  .veil { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; background: var(--scrim); }
  .veil > .sheet { width: 100%; max-height: 82vh; overflow-y: auto;
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px)); }

  /* ---- 13c. Item cards: a list of things inside a panel ------------------- */
  .itemcards { display: flex; flex-direction: column; gap: var(--space-4); }
  .itemcard { overflow: hidden; padding-bottom: var(--space-4); background: var(--surface-raised);
    border: var(--border-w) solid var(--line); border-radius: var(--radius-lg); }
  .itemcard > header { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
    padding: var(--space-2) var(--space-4); margin-bottom: var(--space-3); background: var(--surface-sunken); }
  .itemcard > header .tag { color: var(--text-muted); }
  .itemcard .cardmain { display: flex; align-items: flex-start; gap: var(--space-4); margin: 0 var(--space-4); }
  /* What is done to the card -- Take out -- at its right, level with its middle, as a
     file's row and a history line end in their buttons. */
  .itemcard .cardact { flex: none; align-self: center; }
  .itemcard h4 { font-size: 14px; font-weight: 600; }
  .cardthumb { position: relative; overflow: hidden; flex: none; width: 92px; aspect-ratio: var(--thumb-ratio); display: flex; align-items: center; justify-content: center;
    background: var(--surface-sunken); border: 1px solid var(--line); border-radius: var(--radius-md); }
  .cardthumb svg { width: 50%; fill: none; stroke: var(--text-muted); stroke-width: 2; }
  .cardthumb > img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .cardthumb > img.ph { width: 46%; height: 46%; object-fit: contain; opacity: .55; }
  .cardthumb .ref-badge { top: 3px; left: 3px; padding: var(--space-1) var(--space-2); font-size: 9px; }
  .cardthumb .ref-badge.icon { padding: var(--space-1); }
  .cardthumb .ref-badge.icon img { width: 12px; height: 12px; }
  dl.specs { display: grid; gap: var(--space-1) var(--space-5); margin: var(--space-3) 0 0;
    grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
  dl.specs > div { display: flex; align-items: baseline; gap: var(--space-3); min-width: 0; }
  dl.specs dt { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
  dl.specs dd { margin: 0; min-width: 0; font-family: var(--font-data); font-size: 13px; overflow-wrap: break-word; }
  .panel > .itemcards { gap: 0; }
  .panel > .itemcards > .itemcard { border: 0; border-radius: 0; box-shadow: none; }
  .panel > .itemcards > .itemcard + .itemcard { border-top: 1px solid var(--line); }
  /* What is mounted on a card, under the card and set in (ADR-0036): a drive on its
     controller is in the machine's list, and visibly on the card it is on. */
  .itemcards > .mounted { margin-left: var(--space-6); border-left: var(--border-w) solid var(--line); }
  .panel > .itemcards > .mounted { border-top: 1px solid var(--line); }
  .mounted > .itemcards { gap: 0; }
  .mounted > .itemcards > .itemcard { border: 0; border-radius: 0; box-shadow: none; }
  .mounted > .itemcards > .itemcard + .itemcard { border-top: 1px solid var(--line); }

  /* ---- 13b. Search results, scan, confirm -------------------------------- */
  .results { display: flex; flex-direction: column; }
  .result { display: flex; gap: var(--space-4); align-items: center; padding: var(--space-3) 0; border-top: 1px solid var(--line);
    color: var(--text); text-decoration: none; }
  .result:first-child { border-top: 0; }
  .result .th { width: 72px; flex: none; aspect-ratio: var(--thumb-ratio); background: var(--surface-sunken); border-radius: var(--radius-sm); }
  .result .tag, .result .nm, .result .sub { display: block; }
  .result .nm { font-size: 14px; }
  .result .th > img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
  .result .th > img.ph { object-fit: contain; padding: var(--space-2); }
  .result .sub { font-size: 12px; color: var(--text-muted); }
  .result mark { color: var(--text); background: var(--warning-wash); }
  .scanbox { position: relative; aspect-ratio: 1; background: var(--scrim); color: var(--on-scrim);
    display: flex; align-items: flex-end; justify-content: center; padding: var(--space-5); border-radius: var(--radius-lg); overflow: hidden; }
  .scanbox .reticle { position: absolute; inset: 18%; border: 2px solid var(--on-scrim); border-radius: var(--radius-md); }
  .scanbox .lb-hint { position: relative; color: var(--on-scrim-muted); font-size: 13px; }
  /* Scanning a label, from the banner's Scan: the whole screen, as the full-size view
     takes it, because aiming a camera on a phone wants all of it; above that view, so
     the two never argue about which is in front. The frame is an aiming guide, not the
     edge of what is read, and has a dark line either side of the light one, because a
     label is mostly white and a white frame over one is a frame nobody can see. */
  .scanner { position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: var(--space-5); padding: var(--space-5); color: var(--on-scrim); background: var(--scrim); }
  .scanner .scan-stage { position: relative; width: min(92vw, 420px); aspect-ratio: 1; overflow: hidden;
    background: var(--scrim); border-radius: var(--radius-lg); }
  .scanner video { display: block; width: 100%; height: 100%; object-fit: cover; }
  .scanner .scan-frame { position: absolute; inset: 12%; pointer-events: none; border: 2px solid var(--on-scrim);
    border-radius: var(--radius-md); box-shadow: 0 0 0 1px var(--scrim), inset 0 0 0 1px var(--scrim); }
  .scanner .scan-note { max-width: 34em; margin: 0; text-align: center; font-size: 14px; line-height: 1.45; color: var(--on-scrim); }
  /* A page that asks one question: the delete confirmation and the board detach.
     Narrow, because the decision is the whole page and a long measure invites
     skimming what has to be read; the banner carries the tone, and the two buttons
     stand together at the foot, where the answer is given. */
  .confirm { max-width: 520px; margin: var(--space-7) auto; }
  .confirm > .tag { margin: var(--space-2) 0 0; color: var(--text-muted); }
  .confirm > p { margin: var(--space-4) 0 0; }
  /* What will go, counted. A list and not a sentence: each count is read on its
     own, and a phone has to break them somewhere. */
  .confirm .going { margin: var(--space-4) 0 0; padding-left: var(--space-6); }
  .confirm .going li { margin: var(--space-2) 0; }
  /* The URL that has to be pasted back. On a line of its own and selectable whole,
     which is the difference between a double-click taking the URL and taking a
     word, and breakable anywhere, because nobody reads one as a word. */
  .confirm .url { margin: 0 0 var(--space-2); }
  .confirm .url code { user-select: all; overflow-wrap: anywhere; }
  .errorpage { max-width: 520px; margin: var(--space-7) auto; text-align: center; }
  .errorpage .figure { color: var(--text-muted); }
  /* A job: the tick, its words, then what it is about, when it was done and the drop.
     The words take the room, so the rest sits at the right and wraps under them on a
     phone rather than squeezing them to a word a line. */
  .tasks { list-style: none; margin: 0; padding: 0; }
  .tasks li { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
  .tasks li:first-child { border-top: 0; }
  .tasks li > span:first-of-type { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; }
  .tasks li .tag { color: var(--text-muted); }
  /* What the job is about, when it was done and the drop wrap as one group, so a phone
     puts them on a line of their own under the words rather than stranding the drop. */
  .tasks li > .acts { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
  .tasks li.done > span:first-of-type, .tasks.quiet li > span:first-of-type { color: var(--text-muted); }
  .tasks li.done > span:first-of-type { text-decoration: line-through; }
  .tasks form { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
  .tasks input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-fill); }
  @media (pointer: coarse) { .tasks input[type=checkbox] { width: 22px; height: 22px; } }
  .tasks .about .select { width: auto; max-width: 16em; }
  /* A row of boxes and the button that sends them: the add forms under a panel's list.
     Each box asks for a share of the row and wraps to the next line before it is too
     narrow to type in. */
  .addrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
  .addrow > .input, .addrow > .select { flex: 1 1 160px; width: auto; min-width: 0; }
  .addrow > .input.wide { flex: 3 1 240px; }
  .addrow > .input.short { flex: 0 1 130px; }
  /* In a table cell the row sits under what it edits, closer than under a list. */
  .table .addrow { margin-top: var(--space-2); }
  .table .chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }
  /* One thing a file is attached to and the button that takes it off again: one
     item, wrapping together, so the button is never left under a chip it no longer
     looks like it belongs to. */
  .attached { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0 var(--space-3) var(--space-1) 0; }
  .addrow > textarea.input { flex: 1 1 100%; }
  /* The same row with each box's name written above it: the buttons sit on the line
     the boxes do, and a box takes the room the row gives it -- the measure is for
     prose, and a box cut to it left the panel's right half empty. */
  .addrow.labelled { align-items: flex-end; }
  .addrow > .field { flex: 1 1 200px; min-width: 0; margin: 0; }
  .addrow > .field.wide { flex-basis: 100%; }
  .addrow > .field.short { flex: 0 1 170px; }
  .addrow > .field > :is(.input, .select) { max-width: none; }
  /* The history's note row is above the entries it adds to, and apart from them. */
  .addrow + .logviews { margin-top: var(--space-5); }
  .models { columns: 3 320px; column-gap: var(--space-6); }
  .models section { break-inside: avoid; margin-bottom: var(--space-5); }
  .models h2 { font-size: 14px; font-weight: 600; margin-bottom: var(--space-2); }
  .models .m { display: flex; gap: var(--space-4); padding: 3px 0; border-top: 1px solid var(--line); font-size: 13px; }
  .models .m > :first-child { flex: 1; min-width: 0; }
  .models .m .y, .models .m .c { font-family: var(--font-data); color: var(--text-muted); }
  .models .m .c { flex: 0 0 150px; }
  /* A model the register holds one of: the name set heavier and the count after
     it. Weight, not colour, because the page is read in both themes and by people
     who cannot tell two inks apart. */
  .models .m.have > :first-child { font-weight: 600; }
  .models .m .n { font-family: var(--font-data); font-weight: 400; color: var(--text-muted); }

  /* ---- 14. Empty state, toolbar, pager ------------------------------------ */
  .empty { padding: var(--space-7) var(--space-4); text-align: center; color: var(--text-muted); }
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: var(--space-4) 0; }
  .toolbar > *, .toolbar form { min-width: 0; max-width: 100%; }
  .toolbar .select { width: auto; }
  /* Two menus, one row, on a phone: which category and in what order are one
     sentence, and a row each spent two lines of the screen saying it. */
  @media (max-width: 620px) { .toolbar .select { flex: 1 1 140px; } }
  .pager { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }
  .pager .where { font-family: var(--font-data); font-size: 13px; color: var(--text-muted); }


  /* ---- 14b. Item nav (the control row) ------------------------------------ */
  /* The way back at the left, the owner's actions at the right; on a phone the row
     wraps in source order, the way back first. Every control in it is a small button,
     so the row is one height (36px under a coarse pointer). */
  .ctlrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
  .ctlrow > .itemnav { display: flex; align-items: center; margin-right: auto; min-width: 0; }
  /* A file's name can be long, and a way back named for it is not worth a second line. */
  .itemnav [data-wayback] { max-width: 100%; }
  .itemnav [data-wayback-name] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ---- 14c. Bottom sheet -------------------------------------------------- */
  .sheet { background: var(--surface-raised); border: var(--border-w) solid var(--line-strong); border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--space-3) var(--space-3) var(--space-4);
    box-shadow: var(--shadow-pop); }
  /* Sized as a target and drawn as a grip: the bar is the middle of a box a thumb can
     hit, which is what it is actually aiming at. */
  .sheet .grip { display: block; min-height: 22px; margin-bottom: var(--space-2); cursor: pointer; }
  .sheet .grip::before { content: ""; display: block; width: 36px; height: 4px; margin: 0 auto;
    background: var(--line-strong); border-radius: var(--radius-pill); }
  .sheet form { margin: 0; }
  .sheet [aria-current="page"] { font-weight: 600; }
  .sheet a, .sheet button { display: flex; align-items: center; gap: var(--space-4); width: 100%; min-height: var(--tap);
    padding: 0 var(--space-4); font-size: 16px; text-align: left; color: var(--text); background: none; border: 0;
    border-radius: var(--radius-sm); text-decoration: none; }
  .sheet a:hover, .sheet button:hover { background: var(--surface-hover); }
  .sheet svg { width: 20px; height: 20px; flex: none; color: var(--text-muted); }
  .sheet hr { margin: var(--space-3) 0; border: 0; border-top: 1px solid var(--line); }

  /* ---- 14d. Lightbox chrome ----------------------------------------------- */
  /* touch-action: none across the whole overlay, not only the photo: a flick that
     starts on the dark above or below the photo is still a flick, and left to itself
     the phone would scroll the page underneath with it. A <dialog> opened modal, so
     the browser's own box for one -- its margin, padding, edge and size limits -- is
     put away: the view is the whole window, the photograph centred in it and the bar
     under it. Its backdrop is clear, because the dialog draws the scrim itself and
     fades it on the trip home into the thumbnail. */
  .lb { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0;
    padding: 0; border: 0; background: var(--scrim); color: var(--on-scrim); touch-action: none;
    --lb-h: 82vh; --lb-w: 92vw; }
  .lb:has(.lb-tools) { --lb-h: 76vh; }
  .lb[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3); }
  .lb::backdrop { background: transparent; }
  /* The stage is the whole of the window the photo may use, not the photo's own box,
     so the zoom is free to spend the bands either side of a tall photo. The overlay
     does its own pinch: left to itself the browser would zoom the whole page. */
  .lb .lb-stage { position: relative; width: var(--lb-w); height: var(--lb-h); touch-action: none; }
  /* Zoom and pan ride on this wrapper's transform from the stage's top-left corner,
     so the pan bounds and the crop maths measure against one untransformed box. Its
     background is the thumbnail's own copy, stretched to the size the photo is about
     to be, so the photo grows out of the thumbnail on the way in. */
  .lb .lb-fit { position: absolute; left: 0; top: 0; line-height: 0; transform-origin: 0 0; will-change: transform;
    border-radius: var(--radius-md); background-size: 100% 100%; background-repeat: no-repeat; }
  .lb img { display: block; width: auto; height: auto; max-width: var(--lb-w); max-height: var(--lb-h);
    border-radius: var(--radius-md); cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
  .lb .lb-stage.zoomed { overflow: hidden; cursor: grab; }
  .lb .lb-stage.zoomed img { cursor: grab; }
  .lb .lb-stage.zoomed.panning, .lb .lb-stage.zoomed.panning img { cursor: grabbing; }
  .lb .lb-stage.cropping, .lb .lb-stage.cropping img { cursor: crosshair; }
  /* Close and the arrows stand over the stage, which spans nearly the whole window
     and would otherwise swallow their clicks. They fade with the backdrop: a photo on
     its way home to its thumbnail is uncovering the page it belongs to, and controls
     standing over that page belong to nothing. --chrome is written by the script. */
  .lb .lb-close, .lb .lb-nav { position: absolute; z-index: 2; padding: 0 var(--space-4); font-size: 30px;
    line-height: 1.3; color: var(--on-scrim); background: none; border: 1px solid var(--on-scrim-muted);
    border-radius: var(--radius-md); cursor: pointer; user-select: none; opacity: var(--chrome, 1); }
  .lb .lb-close:hover, .lb .lb-nav:hover { box-shadow: inset 0 0 0 1px var(--on-scrim); }
  .lb .lb-nav { top: 50%; transform: translateY(-50%); padding: var(--space-2) var(--space-5); font-size: 38px; }
  .lb .lb-close { top: 3vh; right: 3vw; }
  .lb .lb-prev { left: 3vw; } .lb .lb-next { right: 3vw; }
  .lb .lb-hint { font-size: 12px; color: var(--on-scrim-muted); }
  .lb .lb-count { font-family: var(--font-data); font-size: 12px; color: var(--on-scrim-muted); }
  /* Under the photograph: the count, for everybody, and the owner's tools joining it.
     The tools wrap onto a second row rather than shrink, Delete last. They fade with
     the scrim, as the controls over the photograph do. */
  .lb .lb-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-3);
    max-width: 94vw; opacity: var(--chrome, 1); }
  .lb .lb-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-3); }
  .lb .lb-group, .lb .lb-tools form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0; }
  .lb .lb-hint { margin: 0; }
  /* Apply crop is the one primary on the scrim: a heavier edge and weight rather than
     a fill, since an accent fill reads differently in every preset and the scrim is
     the same dark in all of them. */
  .lb .btn.primary { background: none; color: var(--on-scrim); border: 2px solid var(--on-scrim); font-weight: 600; }
  /* On the scrim a button is drawn in the scrim's own colours, whatever the page's
     mode: the lightbox is dark in both. Fill and text in one rule. */
  :is(.lb, .scanner) .btn { background: none; color: var(--on-scrim); border-color: var(--on-scrim-muted); }
  :is(.lb, .scanner) .btn:hover { background: none; box-shadow: inset 0 0 0 1px var(--on-scrim); }
  .lb .btn.danger { background: none; color: var(--on-scrim-danger); border-color: var(--on-scrim-danger); }
  .lb .btn.on { color: var(--on-scrim); border-color: var(--on-scrim); box-shadow: inset 0 0 0 1px var(--on-scrim); }
  :is(.lb, .scanner) :focus-visible { outline-color: var(--on-scrim); }

  /* ---- 14e. Bezel swatch and the yellowing ladder -------------------------
     The colours are data, not theme: real plastic. In the product each is a class
     written into the server-built stylesheet; here the preview states them. The
     edge is line-strong so white on white and black on black are still swatches. */
  .bezel { display: inline-block; width: 32px; height: 21px; flex: none; vertical-align: middle;
    border: 1px solid var(--line-strong); border-radius: var(--radius-xs); }
  .bezel.sm { width: 22px; height: 15px; }
  .bezel.none { background: repeating-linear-gradient(45deg, var(--surface-raised) 0 3px, var(--line-strong) 3px 4px); }
  .ladder { display: inline-flex; gap: 3px; }
  .ladder .bezel.is-chosen { outline: var(--focus-w) solid var(--accent); outline-offset: 1px; }

  /* ---- 14f. Login, settings, page headings -------------------------------- */
  .loginbox { max-width: 360px; margin: var(--space-7) auto; }
  .pagehead { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-4); }
  .pagehead .count { font-size: 13px; color: var(--text-muted); }
  /* A heading inside a panel, over the list it names: closer to what follows than to
     what went before. */
  .subhead { margin: var(--space-4) 0 var(--space-1); }
  .figure { font-size: 54px; line-height: 1.1; font-weight: 600; }
  .statgrid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
  .twocol { display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fill, minmax(min(400px, 100%), 1fr)); }
  /* The numbers page. The sentence under the figure is in the prose face, but not
     `.prose`: that keeps the line breaks it was written with, and this one is written
     across the lines of a template. Every figure is a link, and the links are quiet --
     the ink around them until hovered -- so the page reads as numbers rather than as
     a page of links. */
  .lead { font-family: var(--font-display); font-size: 16px; line-height: 1.6; }
  .lead .n { font-weight: 600; }
  .numbers .sub { margin: 0 0 var(--space-3); font-size: 13px; color: var(--text-muted); }
  .numbers .figure a, .numbers .muted a, .numbers .lead a, .bars a { color: inherit; text-decoration: none; }
  .numbers .figure a:hover, .numbers .muted a:hover, .numbers .lead a:hover, .bars a:hover {
    color: var(--accent); text-decoration: underline; }
  a.stattile { display: block; color: var(--text); text-decoration: none; }
  a.stattile:hover { border-color: var(--accent); }
  /* The one project drawn for today: its things' photographs, then what it is and what
     is left on it, beside them where there is room and under them where there is not. */
  .today > .pbody { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-4); }
  .today .shots { display: flex; gap: var(--space-3); }
  .today .shots > .cardthumb { width: 120px; }
  .today .what { flex: 1 1 260px; min-width: 0; }
  .today h4 { font-size: 16px; }
  .today h4 a { font-family: var(--font-display); }
  .today .todo { list-style: none; margin: 0; padding: 0; font-size: 14px; }
  .today .todo li::before { content: "\25CB  "; color: var(--text-muted); }
  .today .todo li.more::before { content: none; }
  @media (max-width: 560px) { .today .shots > .cardthumb { width: 96px; } }

  /* One row of tabs across Settings and the account pages: links to pages of their own.
     The one you are on is bold with the accent line the folded rail uses -- weight as
     well as colour, never colour alone -- and the row wraps rather than scrolling, so no
     tab is ever off the edge of a phone. */
  nav.tabs { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); margin: var(--space-3) 0 var(--space-5);
    border-bottom: 1px solid var(--line); }
  nav.tabs a { padding: var(--space-2) 0; color: var(--text); text-decoration: none; }
  nav.tabs a[aria-current="page"] { font-weight: 600; box-shadow: inset 0 -3px 0 var(--accent); }

  /* A long form's sections, listed at its top: a wrapping row of links, the words of a
     section with something to fix in the danger colour beside its name. Scrolled to, a
     section stops a little below the top of the window rather than hard against it. */
  .formsections ul { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); margin: var(--space-3) 0 0;
    padding: 0; list-style: none; font-size: 13px; }
  .formsections .tofix { color: var(--danger); font-weight: 600; }
  .editform .fieldset[id] { scroll-margin-top: var(--space-5); }

  /* ---- 14g. Form errors ----------------------------------------------------
     The one place explanation is printed under a control rather than put in a title:
     a person cannot act on an error they can only find by hovering. Every pair here is
     already in the matrix - danger on the surfaces, text and danger on danger-wash. */
  .field.is-invalid > label, .field.is-invalid > .lbl { color: var(--danger); }
  .field.is-invalid .input, .field.is-invalid .select {
    border-color: var(--danger-line); box-shadow: inset 0 0 0 1px var(--danger-line); }
  .field .err { display: flex; align-items: flex-start; gap: var(--space-2); margin-top: var(--space-2);
    font-size: 13px; line-height: 1.4; color: var(--danger); }
  .field .err::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px;
    margin-top: 1px; font-size: 11px; font-weight: 700; color: var(--danger); border: 1.5px solid currentColor; border-radius: 50%; }
  .errsum { margin: var(--space-4) 0 var(--space-5); padding: var(--space-4) var(--space-5); color: var(--text);
    background: var(--danger-wash); border: var(--border-w) solid var(--danger-line); border-radius: var(--radius-md); }
  .errsum h2 { font-size: 14px; font-weight: 600; color: var(--danger); }
  .errsum ul { margin: var(--space-2) 0 0; padding-left: var(--space-5); }
  .errsum li + li { margin-top: var(--space-1); }
  .errsum a { color: var(--text); }

  /* ---- 14h. Search suggestions ---------------------------------------------
     The combobox under the banner's search: a listbox of the first few matches, then the
     way to all of them. One highlight for pointer and arrow keys. On the highlighted row
     everything is `text`, because only text on surface-hover is in the matrix. */
  .searchwrap { position: relative; }
  .suggest { position: absolute; top: calc(100% + var(--space-2)); left: 0; z-index: 20; width: max(100%, 380px);
    max-width: calc(100vw - 2 * var(--space-4)); padding: var(--space-2); background: var(--surface-raised);
    border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); }
  .suggest .sg { display: flex; align-items: center; gap: var(--space-3); padding: 6px var(--space-3);
    border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
  .suggest .sg[aria-selected="true"] { background: var(--surface-hover); }
  .suggest .sg[aria-selected="true"] .tag, .suggest .sg[aria-selected="true"] .sub { color: var(--text); }
  .suggest .sg .th { flex: none; width: 44px; aspect-ratio: var(--thumb-ratio); background: var(--surface-sunken);
    border-radius: var(--radius-xs); }
  .suggest .sg .t { min-width: 0; flex: 1; }
  /* The thumbnail app.js draws in each row: a photograph, or the category's
     placeholder drawing, sized as the card's thumbnail is. */
  .suggest .sg img { flex: none; width: 44px; aspect-ratio: var(--thumb-ratio); object-fit: cover;
    background: var(--surface-sunken); border-radius: var(--radius-xs); }
  .suggest .sg img.ph { object-fit: contain; padding: var(--space-1); }
  .combo { position: relative; }
  .itemlist { margin: var(--space-3) 0 0; padding: 0; list-style: none; }
  .itemlist > li + li { margin-top: var(--space-2); }
  .suggest .sg .nm { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .suggest .sg .tag { color: var(--text-muted); margin-right: var(--space-2); }
  .suggest .sg .sub { display: block; font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .suggest mark { color: var(--text); background: var(--warning-wash); border-radius: 2px; }
  /* The way to every result: a row of its own, lit by the same marker as the rest,
     and in `text` when lit for the same reason they are. */
  .suggest .all { display: flex; align-items: center; margin: var(--space-2) 0 0; padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-sm) var(--radius-sm); font-size: 13px;
    color: var(--accent); text-decoration: none; }
  .suggest .all[aria-selected="true"] { background: var(--surface-hover); color: var(--text); }
  .suggest .none { padding: var(--space-3); font-size: 13px; color: var(--text-muted); }
  /* Under the catalogue's models, where only they matched: the words take the last
     row's place, ruled off as it is. */
  .suggest .sg + .none { margin-top: var(--space-2); padding: var(--space-2) var(--space-3);
    border-top: 1px solid var(--line); }
  @media (pointer: coarse) { .suggest .sg, .suggest .all { min-height: var(--tap); } }

  /* ---- 14i. Photo upload ---------------------------------------------------
     Picking is the whole gesture: the upload starts at once. The picker is the next cell
     of the thumbnails, and a row per photograph while it goes says where it is in a word
     as well as a bar. */
  .addtile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--space-2); aspect-ratio: var(--thumb-ratio); padding: var(--space-3); text-align: center; cursor: pointer;
    font-size: 13px; font-weight: 500; color: var(--accent);
    border: var(--border-w) dashed var(--line-strong); border-radius: var(--radius-md); }
  .addtile svg { width: 24px; height: 24px; }
  /* Everything on a hovered thing is `text`: accent ink on the hover ground is not a
     pair the design uses. A drop is outlined in accent as well. */
  .addtile:hover, .addtile.is-over { color: var(--text); background: var(--surface-hover); border-color: var(--accent); }
  .addtile.is-over { border-style: solid; }
  /* Take photo, Upload for a browser with no script, and Fetch from reference, in one
     row. The upload form's own box steps aside so its buttons share the row. */
  .photoadd { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
  .photoadd form { display: contents; }
  /* Which picker a pointer is given: a touchscreen is where the camera is. A desktop
     browser ignores `capture` and would open a file chooser called Take photo. */
  @media not all and (pointer: coarse) { .takephoto, .on-coarse { display: none; } }
  .uploads { list-style: none; margin: var(--space-4) 0 0; padding: 0; }
  .uploads:empty { margin: 0; }
  .up { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center;
    padding: var(--space-3) 0; border-top: 1px solid var(--line); }
  .up:first-child { border-top: 0; }
  .up .th { display: block; width: 56px; aspect-ratio: var(--thumb-ratio); background: var(--surface-sunken); border-radius: var(--radius-xs); }
  .up .nm { display: block; font-family: var(--font-data); font-size: 13px; overflow-wrap: anywhere; }
  .up .st { display: block; margin-top: var(--space-1); font-size: 12px; color: var(--text-muted); }
  .up .meter { display: block; height: 6px; margin-top: var(--space-2); overflow: hidden;
    background: var(--accent-track); border-radius: var(--radius-pill); }
  .up .meter > i { display: block; width: 0; height: 100%; background: var(--accent-fill); }
  .up .pc { font-variant-numeric: tabular-nums; }
  .up.is-done .st { color: var(--success); }
  .up.is-failed .st { color: var(--danger); }
  /* The code a phone adds a photograph by, at the foot of the panel, drawn as a label.
     The SVG paints its own light quiet zone, so its edge is clipped to the corners
     rather than given a ground of its own. One column, it would open every item with
     a code of the page already open. */
  .qrlabel { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-5); padding: var(--space-3);
    border: var(--border-w) dashed var(--line-strong); border-radius: var(--radius-xs); background: var(--surface-raised); }
  .qrlabel .qr { flex: none; line-height: 0; overflow: hidden;
    border: var(--border-w) solid var(--line); border-radius: var(--radius-xs); }
  .qrlabel .qr svg { display: block; width: 96px; height: 96px; }
  .qrlabel .t { min-width: 0; margin: 0; font-family: var(--font-data); font-size: 12px; line-height: 1.3; }
  .qrlabel .t b { display: block; font-size: 14px; }
  @media (max-width: 860px) { .qrlabel { display: none; } }

  /* ---- 14j. The lightbox as editor ----------------------------------------
     Crop: a box dragged over the photograph, everything outside it under the scrim, a
     handle at each corner with a 24px target, and a third-lines grid to square things up.
     Tuned: the one-press fix is marked, and undoing it is offered in its place. */
  /* The scrim outside the box is a shadow as wide as the window; the photograph's box
     cuts it off at the photograph's edge, which is where what is dimmed ends. */
  .lb .lb-stage.cropping .lb-fit { overflow: hidden; }
  .cropbox { position: absolute; box-sizing: border-box; cursor: move; border: 2px solid var(--on-scrim); box-shadow: 0 0 0 100vmax var(--scrim);
    background-image: linear-gradient(90deg, transparent calc(33.333% - 0.5px), var(--on-scrim-muted) calc(33.333% - 0.5px) calc(33.333% + 0.5px), transparent calc(33.333% + 0.5px) calc(66.666% - 0.5px), var(--on-scrim-muted) calc(66.666% - 0.5px) calc(66.666% + 0.5px), transparent calc(66.666% + 0.5px)),
      linear-gradient(180deg, transparent calc(33.333% - 0.5px), var(--on-scrim-muted) calc(33.333% - 0.5px) calc(33.333% + 0.5px), transparent calc(33.333% + 0.5px) calc(66.666% - 0.5px), var(--on-scrim-muted) calc(66.666% - 0.5px) calc(66.666% + 0.5px), transparent calc(66.666% + 0.5px)); }
  .cropbox .h { position: absolute; width: 24px; height: 24px; display: grid; place-items: center; transform: translate(-50%, -50%); cursor: nwse-resize; }
  .cropbox .h::after { content: ""; width: 12px; height: 12px; background: var(--on-scrim); border: 1px solid var(--scrim); }
  .cropbox .h.nw { left: 0; top: 0; } .cropbox .h.ne { left: 100%; top: 0; cursor: nesw-resize; }
  .cropbox .h.sw { left: 0; top: 100%; cursor: nesw-resize; } .cropbox .h.se { left: 100%; top: 100%; }
  .cropbox:focus-visible { outline: var(--focus-w) solid var(--on-scrim); outline-offset: var(--space-2); }
  .lb .tuned { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 12px; color: var(--on-scrim);
    padding: var(--space-1) var(--space-3); border: 1px solid var(--on-scrim-muted); border-radius: var(--radius-pill); }
  .lb .lb-sep { width: 1px; align-self: stretch; background: var(--on-scrim-muted); opacity: .5; }
  /* On a phone Apply crop and Cancel are two wide buttons at the foot, with how to
     crop above them; the photograph runs edge to edge; and the toolbar's groups are
     parted by the rows they wrap onto, so the rules between them, which would hang
     at the ends of lines, go. */
  @media (max-width: 560px) {
    .lb .lb-cropacts .btn { flex: 1 1 0; }
    .lb .lb-cropacts { width: 100%; }
    .lb .lb-cropacts .lb-hint { flex-basis: 100%; text-align: center; }
    .lb { --lb-w: 100vw; }
    .lb .lb-sep { display: none; }
  }

  /* ---- 14k. First run ------------------------------------------------------ */
  .firstrun { max-width: 640px; }
  .firstrun .steps { list-style: none; margin: var(--space-5) 0 0; padding: 0; counter-reset: step; }
  .firstrun .steps li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--space-4); align-items: center;
    padding: var(--space-4) 0; border-top: 1px solid var(--line); counter-increment: step; }
  .firstrun .steps li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px;
    font-family: var(--font-data); font-weight: 600; color: var(--text); background: var(--surface-sunken);
    border: 1px solid var(--line-strong); border-radius: 50%; }
  .firstrun .steps li.done::before { content: "\2713"; color: var(--success); border-color: var(--success); background: var(--success-wash); }
  .firstrun .steps li.done .t b { text-decoration: line-through; color: var(--text-muted); }
  .firstrun .steps .t b { display: block; font-weight: 600; }
  .firstrun .steps .t span { font-size: 13px; color: var(--text-muted); }
  @media (max-width: 560px) { .firstrun .steps li { grid-template-columns: 32px minmax(0, 1fr); }
    .firstrun .steps li > .btn { grid-column: 2; justify-self: start; } }

  /* ---- 14i. The edit forms -------------------------------------------------
     Long, dense and filled in with one hand at the bench (EditForm, PartForm,
     ProjectForm). A line under a field says what goes in it and is printed rather
     than put in a title, because a phone has nothing to hover. */
  .field > .hint { margin-top: var(--space-2); }
  .fieldset > .hint { margin-top: var(--space-3); }
  /* A question with a few short answers: the answers side by side, wrapping. The
     box beside "custom" and the socket tick sit under them. */
  .checks { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); }
  .checks + .input, .field > .check.socketed { margin-top: var(--space-3); }
  /* How many of each: the name, and a box sized for a count rather than a column. */
  .countgrid { display: grid; gap: var(--space-3) var(--space-5);
    grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
  .countgrid .count { display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3); font-size: 13px; }
  .countgrid .count > .input { width: 72px; flex: none; }
  /* The drives table stays a table and scrolls in its own box (the reflow rule): a
     drive is read across its row, and squeezed to the page each box would show two
     characters of a model and none of the bezel. */
  .hscroll > .table.drives { min-width: 900px; }
  .table.drives td { padding-top: var(--space-2); padding-bottom: var(--space-2); }
  /* Widths by what a column holds -- a menu of kinds, a capacity, a make and model --
     sized so the table fits a desktop's form (918px inside the fieldset) and only
     scrolls on a narrower screen. */
  .table.drives th:nth-child(2), .table.drives th:nth-child(3) { width: 104px; }
  .table.drives th:nth-child(4), .table.drives th:nth-child(5) { width: 80px; }
  .table.drives th:nth-child(6) { width: 64px; }
  .table.drives th:nth-child(7) { width: 130px; }
  /* In a drive row the bezel stacks -- ladder, shade, yellowing -- because side by
     side they want more width than the row has left. */
  /* A bezel's two menus and the ladder that shows them. They wrap rather than shrink,
     because two half-width menus name nothing useful; "Heavily yellowed" is the
     widest word either holds, and a menu that clips its own longest option is a
     menu you have to open to read. */
  .bezel-cell { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
  .bezel-cell > .select { width: auto; min-width: 0; flex: 1 1 112px; }
  .bezel-cell > .select[data-bezel="yellowing"] { flex-basis: 160px; }
  /* The chart: shades down, stages across, each head with its line on what it
     looks like. */
  .colourchart { margin-top: var(--space-4); }
  .colourchart > summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
  .colourchart > .hint { margin: var(--space-3) 0; }
  .hscroll > .table.bezelchart { min-width: 880px; }
  .hscroll > .table.bezelchart th:first-child { width: 190px; }
  .table.bezelchart th { white-space: normal; }
  .table.bezelchart th > .hint { display: block; font-weight: 400; }
  .table.bezelchart td { vertical-align: middle; }
  /* Save and Cancel, stuck to the foot of the viewport so the primary action is
     under the thumb however long the form is; on a phone, on top of the tab bar.
     A control tabbed to near the foot would otherwise scroll to the viewport's edge
     and arrive behind the bar, so the scroll stops short of it (as for the tab bar). */
  :root { --actbar-clear: 64px; }
  .actbar { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: var(--space-3);
    margin-top: var(--space-5); padding: var(--space-4) 0; background: var(--surface);
    border-top: 1px solid var(--line); }
  html:has(.actbar) { scroll-padding-bottom: calc(var(--actbar-clear) + var(--space-4)); }
  /* While the cookie notice is up it holds the foot of the screen, and the bar stands
     on it rather than behind it; the notice's own clearance already counts the tab
     bar on a phone. */
  html:has(#cookienote) .actbar { bottom: var(--notice-clear); }
  html:has(#cookienote):has(.actbar) { scroll-padding-bottom: calc(var(--notice-clear) + var(--actbar-clear)); }
  @media (max-width: 620px) {
    .actbar { bottom: calc(var(--tabbar-clear) + env(safe-area-inset-bottom, 0px)); }
    html:has(.actbar) { scroll-padding-bottom: calc(var(--tabbar-clear) + var(--actbar-clear) + var(--space-4) + env(safe-area-inset-bottom, 0px)); }
    html:has(#cookienote) .actbar { bottom: calc(var(--notice-clear-phone) + env(safe-area-inset-bottom, 0px)); }
    html:has(#cookienote):has(.actbar) { scroll-padding-bottom: calc(var(--notice-clear-phone) + var(--actbar-clear) + env(safe-area-inset-bottom, 0px)); }
  }

  /* ---- 15. Preset picker (settings > Appearance) -------------------------- */
  /* Radios, so it posts with no script, is one tab stop, and arrow keys move the
     choice. The input is visually hidden, not display:none, so it keeps focus. */
  .swatches { display: grid; gap: var(--space-4); margin: var(--space-5) 0 0; padding: 0; border: 0;
    grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); }
  .swatches > legend { padding: 0; margin-bottom: var(--space-2); font-size: 13px; font-weight: 500; color: var(--text-muted); }
  .swatch-opt { position: relative; display: block; cursor: pointer; }
  .swatch-opt input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
  /* A column filling its grid cell, with the name at the foot: "Big Box Beige" takes
     two lines where the others take one, and a face that sized to its own name would
     leave the two beside it short and the row ragged. */
  .swatch-opt .face { display: flex; flex-direction: column; height: 100%; overflow: hidden;
    border: var(--border-w) solid var(--line-strong);
    border-radius: var(--radius-md); background: var(--surface-raised); }
  .swatch-opt .name { display: flex; justify-content: space-between; gap: var(--space-3);
    margin-top: auto; padding: var(--space-2) var(--space-3); font-size: 13px; color: var(--text); }
  .swatch-opt .name i { font-style: normal; color: var(--text-muted); visibility: hidden; }
  .swatch-opt input:checked + .face { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
  .swatch-opt input:checked + .face .name i { visibility: visible; color: var(--accent); }
  .swatch-opt input:focus-visible + .face { outline: var(--focus-w) solid var(--focus); outline-offset: var(--focus-w); }
  .swatch-opt input:disabled + .face { opacity: .55; border-style: dashed; }
  /* The miniature: a page cut in half, light on the left and dark on the right,
     each half drawn with that preset's own tokens by scoping data-theme to it. */
  .mini { display: grid; grid-template-columns: 1fr 1fr; height: 72px; }
  .mini > span { display: flex; flex-direction: column; gap: 5px; padding: var(--space-3); background: var(--surface); }
  .mini .b { height: 9px; background: var(--band); }
  .mini .t { height: 3px; width: 80%; background: var(--text); }
  .mini .m { height: 3px; width: 55%; background: var(--text-muted); }
  .mini .a { height: 11px; width: 26px; margin-top: auto; background: var(--accent-fill); border-radius: var(--radius-xs); }
  /* The accent picker: the same radio pattern, smaller faces. Each face is a real
     primary button and a real link drawn in that accent, for the preset in force,
     so what the owner sees is what they will get, already adjusted to pass. */
  .swatches.accents { grid-template-columns: repeat(auto-fill, minmax(min(104px, 100%), 1fr)); gap: var(--space-3); }
  .accents .face { padding: var(--space-3); }
  .accents .demo { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-2); }
  .accents .demo .dot { width: 22px; height: 22px; flex: none; background: var(--accent-fill); border-radius: var(--radius-xs); }
  .accents .demo .lnk { font-size: 13px; color: var(--accent); text-decoration: underline; }
  .accents .name { padding: 0; }

  /* The letters a Ports box takes, printed under it (#98): a pair to a cell so a
     letter never wraps away from what it stands for, and the letter in the text
     colour so the eye finds it first. */
  .portkey { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); }
  .portkey span { white-space: nowrap; }
  .portkey b { color: var(--text); }

  /* ---- The files pages (ADR-0028) ------------------------------------------
     The list, a file's own page and an item's Files panel. The design system has no
     card for these yet, so they are the pages ADR-0028 shaped, put onto the
     components and tokens rather than drawn again. */
  /* A list of files: a row each, and never a table. The row is a grid of four -- the
     drawing of what it is, its name and what it is linked to, how big and how old,
     and the download -- and on a phone the third drops under the second, so nothing
     is squeezed and nothing scrolls sideways. */
  .filerows { list-style: none; margin: 0; padding: 0; }
  .filerow { position: relative; display: grid; align-items: center; column-gap: var(--space-4);
    grid-template-columns: 44px minmax(0, 1fr) auto auto; grid-template-areas: "icon text meta dl";
    padding: var(--space-3) 0; border-top: 1px solid var(--line); }
  .filerow:first-child { border-top: 0; }
  .panel > .filerows > .filerow { padding: var(--space-3) var(--space-4); }
  .filerow > .fileicon { grid-area: icon; }
  .filerow > .filetext { grid-area: text; min-width: 0; }
  .filerow > .fmeta { grid-area: meta; }
  .filerow > .btn { grid-area: dl; }
  /* The Public switch (ADR-0042), for an account that can change files: a column of
     its own before the download, and only where it is drawn, so a visitor's row has
     no empty track and gap held open for it. */
  .filerow:has(> .pubswitch) { grid-template-columns: 44px minmax(0, 1fr) auto auto auto;
    grid-template-areas: "icon text meta pub dl"; }
  .filerow > .pubswitch { grid-area: pub; position: relative; z-index: 1; }
  @media (max-width: 640px) {
    .filerow { column-gap: var(--space-3); grid-template-columns: 40px minmax(0, 1fr) auto;
      grid-template-areas: "icon text dl" "icon meta dl"; }
    .filerow > .fmeta { text-align: left; white-space: normal; }
    .filerow:has(> .pubswitch) { grid-template-columns: 40px minmax(0, 1fr) auto auto;
      grid-template-areas: "icon text pub dl" "icon meta pub dl"; }
  }
  /* The name is the way to the file's page, stretched over the whole row so the row
     can be tapped anywhere; what else on the row is a link or a title of its own
     sits above the stretch. In the data face, because a filename is recorded rather
     than written, and it breaks anywhere, because nobody reads one as a word and the
     longest on the page must not decide how narrow the list can be. */
  .fname { font-family: var(--font-data); font-weight: 600; color: var(--text); text-decoration: none;
    overflow-wrap: anywhere; }
  .fname::after { content: ""; position: absolute; inset: 0; }
  .fname:hover { text-decoration: underline; }
  .filerow .chip, .filerow > .btn, .filerow .fnote a { position: relative; z-index: 1; }
  .fnote { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
  .fmeta { font-family: var(--font-data); font-size: 12px; color: var(--text-muted); white-space: nowrap;
    text-align: right; font-variant-numeric: tabular-nums; }
  /* What a file is linked to, a chip each. A long name wraps inside its chip rather
     than holding the row open, so the corners are a card's and not a pill's. */
  .filechips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }
  .filechips .chip { white-space: normal; overflow-wrap: anywhere; border-radius: var(--radius-sm); }
  /* What a file is, drawn in the muted text colour so every look draws it, with the
     extension under it. */
  .fileicon { display: inline-grid; justify-items: center; align-content: center; gap: var(--space-1);
    width: 44px; color: var(--text-muted); }
  .fileicon .fileart { display: block; width: 30px; height: 30px; }
  .fileext { font-family: var(--font-data); font-size: 9px; font-weight: 600; letter-spacing: .07em; line-height: 1; }
  .fileicon.big { flex: none; width: 72px; }
  .fileicon.big .fileart { width: 60px; height: 60px; }
  .fileicon.big .fileext { font-size: 11px; }
  /* The list's own search, at the end of the heading's row and on a row of its own on
     a phone. The box asks for a width rather than demanding one. */
  .filesearch { display: flex; flex: 0 1 320px; align-items: center; gap: var(--space-3); margin-left: auto; }
  .filesearch > .input { flex: 1 1 160px; width: auto; min-width: 0; }
  @media (max-width: 640px) { .filesearch { flex-basis: 100%; margin-left: 0; } }
  /* The row of ways to narrow the list. The one you are on is told by weight and by
     ground, and the ground is surface-sunken, which every colour written on it is
     held to in every look. It was the band a panel's title sits on, with `text` on
     it: a pair no look is held to, and 1.06:1 in one of them. */
  .filefilters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-4); }
  .filefilters a { display: inline-flex; align-items: center; padding: var(--space-1) var(--space-4);
    font-size: 13px; color: var(--text); text-decoration: none; white-space: nowrap;
    border: var(--border-w) solid var(--line-strong); border-radius: var(--radius-pill); }
  .filefilters a span { margin-left: var(--space-2); font-family: var(--font-data); color: var(--text-muted); }
  .filefilters a[aria-current="page"] { font-weight: 600; color: var(--text); background: var(--surface-sunken); }
  /* Under the pointer everything on the ground is `text`: only that is tested on
     surface-hover. */
  .filefilters a:hover { background: var(--surface-hover); }
  .filefilters a:hover span { color: var(--text); }
  @media (pointer: coarse) { .filefilters a { min-height: 36px; } }
  /* A file's own page: the drawing beside its name, then the panels that change it.
     The name is the page's heading, set in the data face for the reason the list's
     is. */
  .filehero { display: flex; align-items: flex-start; gap: var(--space-5); margin: 0 0 var(--space-4); }
  .filehero-text { min-width: 0; }
  .filehero-text p { margin: var(--space-1) 0 0; }
  .filehero h1 { font-family: var(--font-data); overflow-wrap: anywhere; }
  /* What a file is linked to, a line each, and the button that takes it off. */
  .linkrows { list-style: none; margin: 0; padding: 0; }
  .linkrows li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
    padding: 6px var(--space-4); border-top: 1px solid var(--line); overflow-wrap: anywhere; }
  .linkrows li:first-child { border-top: 0; }
  .linkrows form { margin: 0 0 0 auto; }
  /* What follows a panel's list -- the link box under what a file is linked to; what
     an item's other units have, and the upload, under its files -- is a different
     thing and says so with a rule. */
  .panel > .linkrows + .pbody, .panel > .filerows + .pbody, .panel > .fileoffer {
    border-top: 1px solid var(--line); }
  /* What an item's siblings have that it has not: offered, and only offered. */
  .offerrows { list-style: none; margin: var(--space-2) 0 0; padding: 0; }
  .offerrows li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3);
    padding: var(--space-1) 0; overflow-wrap: anywhere; }
  .offerrows form { margin: 0; }

  /* ---- A text file read as a page (ADR-0035) ------------------------------ */
  /* The file's name, its size and the download, above what it says. */
  .docbar { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2) var(--space-4);
    margin: 0 0 var(--space-5); }
  .docbar h1 { font-family: var(--font-data); overflow-wrap: anywhere; }
  .docbar .btn { margin-left: auto; }
  /* Markdown, set as the register sets what somebody wrote: the prose face at 16px,
     a line stopping at the measure, headings in the interface face. A table and a
     block of code may run the column's width, since neither is read as a line of
     prose, and each scrolls in a box of its own beyond that. The file's top heading
     arrives as an h2 (textfiles), so the sizes run from there. */
  .doc { font-family: var(--font-display); font-size: 16px; line-height: 1.6; overflow-wrap: break-word; }
  .doc :is(p, ul, ol, blockquote, h2, h3, h4, h5, h6) { max-width: var(--measure); }
  .doc :is(p, ul, ol, blockquote, pre, hr, .doctable) { margin: 0 0 var(--space-5); }
  .doc :is(h2, h3, h4, h5, h6) { margin: var(--space-6) 0 var(--space-3); font-family: var(--font-ui);
    font-weight: 600; line-height: 1.3; }
  .doc > :first-child { margin-top: 0; }
  .doc h2 { font-size: 26px; }
  .doc h3 { font-size: 20px; }
  .doc h4 { font-size: 18px; }
  .doc :is(h5, h6) { font-size: 16px; }
  .doc :is(ul, ol) { padding-left: var(--space-6); }
  .doc li > :is(ul, ol) { margin: var(--space-2) 0 0; }
  .doc blockquote { padding-left: var(--space-5); color: var(--text-muted);
    border-left: var(--border-w) solid var(--line-strong); }
  .doc hr { border: 0; border-top: var(--border-w) solid var(--line); }
  /* A URL is not read as a word, so it may break anywhere rather than hold the
     column open (accessibility-standards). */
  .doc a { overflow-wrap: anywhere; }
  .doc code { padding: 0 var(--space-1); font-family: var(--font-data); font-size: 0.875em;
    color: var(--text); background: var(--surface-sunken); border-radius: var(--radius-xs); }
  .doc pre { padding: var(--space-4); overflow-x: auto; font-family: var(--font-data); font-size: 13px;
    line-height: 1.5; color: var(--text); background: var(--surface-sunken); border-radius: var(--radius-sm); }
  .doc pre code { padding: 0; font-size: inherit; background: none; }
  /* A table is the site's table component (9), sized to what is in it rather than
     spread across the column, in the interface face the site's tables are set in,
     with the alignment the file asked for. */
  .doctable { overflow-x: auto; }
  .doc .table { width: auto; font-family: var(--font-ui); font-size: 14px; line-height: 1.4; }
  .doc .table .al-center { text-align: center; }
  .doc .table .al-right { text-align: right; }
  /* A plain text file, as typed: no wrapping, since its layout is often what it is
     saying, and lines set close enough that box drawing joins up, as it did on the
     screen it was written for. */
  .textfile { margin: 0; padding: var(--space-4); overflow-x: auto; font-family: var(--font-data);
    font-size: 13px; line-height: 1.2; white-space: pre; color: var(--text); background: var(--surface-raised);
    border: var(--border-w) solid var(--line); border-radius: var(--radius-sm); }
  /* Text that draws with box-drawing characters (textfiles.drawn). The register's
     fixed-width face has none, so the browser would draw the lines in another face
     and the letters in this one, and the two are not the same width: a box's
     corners miss by a character on Windows, where Consolas is the face it finds.
     The reader's own fixed-width face has both, at one width. */
  .textfile.drawn, .doc .drawn, .doc .drawn code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace; }

  /* ---- The account pages (ADR-0032) --------------------------------------- */
  /* Where you are signed in: a line to a browser, so a plain list rather than a
     table of three columns that would only ever be read across. */
  .signins { list-style: none; margin: 0 0 var(--space-3); padding: 0; }
  .signins .session { padding: var(--space-2) 0; border-bottom: 1px solid var(--line); }
  /* A new API token, shown once. Forty-odd characters with nowhere to break would
     set the width of the page on a phone (accessibility-standards). */
  code.token { overflow-wrap: anywhere; user-select: all; }

  /* ---- Where things are kept (ADR-0034) ----------------------------------- */
  /* The path to a location at the top of its page, each step a link. */
  .pathnav { margin: 0 0 var(--space-4); font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
  .pathnav .sep { color: var(--text-muted); }
  /* An item's Location row: the path, then what the location says about finding it
     -- its photograph, small, beside its notes. */
  .wherenote { display: flex; align-items: flex-start; gap: var(--space-3); margin-top: var(--space-2); }
  .wherephoto { flex: 0 0 auto; width: 96px; aspect-ratio: var(--thumb-ratio); object-fit: cover;
    border-radius: var(--radius-sm); }
  /* The locations inside one, a line each with what it holds. */
  .placelist { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
  .placelist li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .placelist li:last-child { border-bottom: 0; }
  /* Every location (MANUAL §14): the same lines, with the locations inside each one
     stepped in under it behind a rule, so a long branch still reads as one. */
  .placetree ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 var(--space-5);
    border-left: 1px solid var(--line); }

  /* ---- The audit -------------------------------------------------------------
     A phone in one hand and a scanner in the other: the prompt and the answer large
     enough to be read across a room, and the controls the site's own -- the scans
     come from a trigger, not from thumbs on the screen. The colours are the ones
     the chips and banners already wear -- words on the success and danger washes
     -- so the tones are pairs every look is held to, and the words and the icon say
     it as well as the colour does. */
  .storagestart, .storageprompt { margin: 0 0 var(--space-4); }
  .storagestart .row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
  .storagestart .prompt, .storageprompt .prompt { margin: 0 0 var(--space-3); font-size: 30px;
    font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
  .storageprompt .step { margin: 0; color: var(--text-muted); }
  .storageprompt .prompt { margin: 0; }
  .storageprompt .hint { margin: var(--space-1) 0 var(--space-3); }
  .storagepanel { display: flex; align-items: center; gap: var(--space-5); margin: 0 0 var(--space-3);
    padding: var(--space-5) var(--space-6); border-radius: var(--radius-lg);
    color: var(--text); background: var(--surface-sunken); border: var(--border-w) solid var(--line); }
  .storagepanel p { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
  .storagepanel .head { display: block; font-size: 26px; }
  .storagepanel .ic { flex: 0 0 auto; font-size: 54px; line-height: 1; }
  .storagepanel.tone-ok, .storagepanel.tone-moved { background: var(--success-wash); border-color: var(--success); }
  .storagepanel.tone-ok .ic, .storagepanel.tone-moved .ic { color: var(--success); }
  .storagepanel.tone-refused { background: var(--danger-wash); border-color: var(--danger-line); }
  .storagepanel.tone-refused .ic { color: var(--danger); }
  /* Each answer is flashed, for somebody who has not asked for less motion. */
  @media (prefers-reduced-motion: no-preference) {
    .storagepanel.fresh { animation: storageflash 0.4s ease-out; }
  }
  @keyframes storageflash { from { transform: scale(1.02); } to { transform: none; } }
  .scanform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); margin: var(--space-4) 0; }
  .scanform label { flex: 1 0 100%; font-weight: 600; }
  .scanform .input { flex: 1 1 200px; font-family: var(--font-data); }
  .storagecontrols { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: 0 0 var(--space-5); }
  .storagecontrols form { margin: 0; }
  .scanlist { list-style: none; margin: 0; padding: 0; }
  .scanline { display: flex; align-items: center; gap: var(--space-3); padding: 6px 0;
    border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
  .scanline .ic { flex: 0 0 auto; width: 1.4em; text-align: center; font-weight: 700; }
  .scanline.tone-ok .ic, .scanline.tone-moved .ic { color: var(--success); }
  .scanline.tone-refused .ic { color: var(--danger); }
  .scanline .say { flex: 1 1 auto; min-width: 0; }
  .scanline.is-undone .say { color: var(--text-muted); }
  .scanline form { margin: 0; }
  /* A round's report: a location to a panel, and what was found in it, what moved
     in and what was not scanned, each a list under its own heading. */
  .reportpart h4 { margin: var(--space-4) 0 var(--space-2); }
  .reportpart:first-child h4 { margin-top: 0; }
  .reportpart ul { margin: 0; padding-left: var(--space-6); }
  .reportpart li { padding: var(--space-1) 0; overflow-wrap: anywhere; }
