/* Modula Racks - Xoro Archive. Plain, light, readable. System fonts only; nothing is loaded from elsewhere.
   Order of this file: colours, basics, top bar, controls, boxes, home page, results page, record page,
   Data files, Manage access, sign-in, phone width, print.

   COLOURS come from the company's badge: a blue disc with a white "m" and a black "R".
     --brand       #00AEEF  the badge's blue. For SURFACES and MARKS: primary buttons, the line under the
                            header, the stripe on a card, a dot. Text on it is --brand-ink (8.1 : 1).
                            NEVER white text on it (2.5 : 1) and never --brand as the colour of text.
     --brand-ink   #030404  the badge's black.
     --accent      #006E9C  the same hue, dark enough for links and small text: 5.7 : 1 on white,
                            5.1 : 1 on the page background and on --accent-soft.
     --accent-dark #00506F  a link under the pointer.
     --accent-soft #E3F6FD  a light tint of the blue, for a marked area. */

:root {
  --brand: #00AEEF;
  --brand-hover: #0099D6;
  --brand-ink: #030404;
  --ink: #14191f;
  --muted: #566173;
  --faint: #8d97a6;
  --line: #d7dde6;
  --line-soft: #e9edf2;
  --paper: #ffffff;
  --page: #f2f4f8;
  --tint: #f7f9fc;
  --accent: #006E9C;
  --accent-dark: #00506F;
  --accent-soft: #E3F6FD;
  --ok-bg: #e4f4e9;
  --ok-ink: #17603a;
  --wait-bg: #fff1cf;
  --wait-ink: #6b4e00;
  --stop-bg: #f3e3e3;
  --stop-ink: #7d2626;
  --error-bg: #fdecec;
  --error-ink: #9b1c1c;
  --note-bg: #fff6d6;
  --note-ink: #5c4a00;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 34, 51, 0.06);
}

* { box-sizing: border-box; }

html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  overflow-wrap: break-word;
}

[hidden] { display: none !important; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { color: var(--accent-dark); }

h1 { font-size: 1.7rem; line-height: 1.2; margin: 0 0 0.8rem; letter-spacing: -0.01em; color: var(--brand-ink); }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 0.6rem; }
h3 { font-size: 0.95rem; margin: 1rem 0 0.2rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
p { margin: 0 0 0.8rem; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--paper); padding: 0.5rem 1rem; }
.skip-link:focus { left: 0; z-index: 10; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- top bar ---------- */

/* White, with the badge in its own colours and a line of the brand's blue underneath. */
.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3rem 1rem;
  padding: 0.45rem 1.2rem; background: var(--paper); border-bottom: 4px solid var(--brand);
}
.brand { display: flex; align-items: center; gap: 0.65rem; color: var(--brand-ink); text-decoration: none; padding: 0.15rem 0; }
.brand:hover { color: var(--brand-ink); }
.brand-logo { width: 2.35rem; height: 2.35rem; flex: none; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; margin: 0; }
.brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.01em; color: var(--brand-ink); }
.brand-product { font-size: 0.82rem; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.1rem; }
.nav a { padding: 0.6rem 0.1rem; font-weight: 600; }
/* the page that is open: its name in black on a stroke of the brand's blue */
.nav a[aria-current="page"] { color: var(--brand-ink); text-decoration: none; box-shadow: inset 0 -4px 0 var(--brand); }
.nav .who { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }

main { display: block; max-width: 1120px; margin: 0 auto; padding: 1.2rem 1.2rem 4rem; outline: none; }
.view.narrow { max-width: 34rem; margin: 1.5rem auto 0; }

/* ---------- controls: large enough to hit with a thumb ---------- */

button, input, select {
  font: inherit; color: inherit; min-height: 2.75rem; border-radius: var(--radius);
}
input, select {
  padding: 0.5rem 0.7rem; border: 1px solid #b4bdca; background: var(--paper); width: 100%;
}
input[type="checkbox"] { width: 1.3rem; height: 1.3rem; min-height: 0; flex: none; margin: 0 0.5rem 0 0; accent-color: var(--accent); }
button {
  padding: 0.5rem 1.1rem; border: 1px solid #b4bdca; background: var(--paper); cursor: pointer; font-weight: 600;
}
button:hover { background: #eef2f7; }
button:disabled { opacity: 0.45; cursor: default; }
button:disabled:hover { background: var(--paper); }
/* the brand's blue with BLACK words; the darker edge is what sets the button off from a white page */
button.primary { background: var(--brand); border-color: var(--accent); color: var(--brand-ink); }
button.primary:hover { background: var(--brand-hover); }
button.primary:disabled:hover { background: var(--brand); }
button.plain { background: transparent; border-color: var(--line); color: var(--accent); }
button.plain:hover { background: var(--accent-soft); }
button.small { padding: 0.3rem 0.8rem; font-size: 0.9rem; min-height: 2.4rem; }
button.big { font-size: 1.1rem; padding: 0.6rem 1.6rem; min-height: 3.2rem; }
button.danger { color: var(--error-ink); border-color: #e2b4b4; }
button.wide { width: 100%; }
/* where the keyboard is: a ring in the dark shade of the blue (the light one would not show on white) */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h2:focus { outline: none; }

/* ---------- boxes and small pieces ---------- */

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin: 0 0 1rem;
}
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; margin-bottom: 0.6rem; }
.card-head h2 { margin: 0; }
.card-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.notice { padding: 0.7rem 0.9rem; border-radius: var(--radius); background: #eaeff6; }
.notice.error { background: var(--error-bg); color: var(--error-ink); }
.notice.ok { background: var(--ok-bg); color: var(--ok-ink); }

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.empty { padding: 1.5rem 0; color: var(--muted); }
.subtitle { font-size: 1.1rem; color: var(--muted); margin-top: -0.3rem; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.2rem; margin: 0 0 0.3rem; }
.back { display: inline-block; padding: 0.55rem 0; font-weight: 600; text-decoration: none; }
.back:hover { text-decoration: underline; }
.part-of { padding: 0.55rem 0; }
.tag {
  display: inline-block; margin-left: 0.4rem; padding: 0 0.5rem; border-radius: 999px;
  background: #e8edf4; color: var(--muted); font-size: 0.78rem; font-weight: 600; white-space: nowrap;
}
.pill {
  display: inline-block; padding: 0.08rem 0.65rem; border-radius: 999px; font-size: 0.85rem; font-weight: 600;
  background: #e8edf4; color: #34425a; max-width: 100%;
}
.pill.done { background: var(--ok-bg); color: var(--ok-ink); }
.pill.waiting { background: var(--wait-bg); color: var(--wait-ink); }
.pill.stopped { background: var(--stop-bg); color: var(--stop-ink); }
.currency { color: var(--muted); font-weight: 400; font-size: 0.85em; }
.check { display: flex; align-items: center; min-height: 2.75rem; cursor: pointer; width: fit-content; max-width: 100%; }

/* ---------- search box (home and results) ---------- */

.search-form { margin-bottom: 1rem; }
.search-row { display: flex; gap: 0.5rem; }
.search-row input { flex: 1; min-width: 0; }
.search-box { font-size: 1.1rem; }
.search-box.big { font-size: 1.25rem; min-height: 3.2rem; padding: 0.6rem 1rem; border-width: 2px; border-color: #8fa2bb; }
.search-box.big:focus { border-color: var(--accent); }
.hint { color: var(--muted); margin: 0.6rem 0 0; }

/* ---------- home page ---------- */

.home { max-width: 60rem; margin: 0 auto; }
.hero { padding: 1.6rem 0 0.6rem; }
.hero h1 { font-size: 2rem; }
.kinds-block { margin-top: 1.4rem; }
.kinds-block h2 { color: var(--muted); font-weight: 600; }
.kinds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.8rem; }
.kind-card {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "title go" "count go"; align-items: center;
  gap: 0 0.8rem; min-height: 5rem; padding: 0.9rem 1.1rem; text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--brand);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.kind-card:hover, .kind-card:focus-visible {
  border-color: var(--accent); border-left-color: var(--brand); background: var(--accent-soft); color: var(--ink);
}
.kind-title { grid-area: title; font-size: 1.2rem; font-weight: 700; color: var(--brand-ink); }
.kind-count { grid-area: count; color: var(--muted); font-variant-numeric: tabular-nums; }
.kind-go { grid-area: go; font-size: 1.8rem; line-height: 1; color: var(--accent); }
.all-link { margin: 0.9rem 0 0; }
.all-link a { display: inline-block; padding: 0.5rem 0; font-weight: 600; }
.archive-note {
  margin: 1.8rem 0 0; padding: 0.8rem 1rem; border-radius: var(--radius); background: var(--note-bg);
  color: var(--note-ink); border: 1px solid #ecdca0;
}

/* ---------- results page ---------- */

.filter-box > summary { display: none; }       /* wide screens: the filters are simply there */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 0.6rem; align-items: end;
  margin-top: 0.8rem;
}
.field { display: block; min-width: 0; }
.field-label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.15rem; }
.field.inline { display: flex; align-items: center; gap: 0.5rem; }
.field.inline .field-label { margin: 0; white-space: nowrap; }
.field.inline select { width: auto; }

.results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.results-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.count { margin: 0; font-size: 1.05rem; }
.csv-note { display: block; margin: 0 0 0.5rem; }
.csv-note:empty { display: none; }
/* "2 customers match – they are listed first. Show only customers" */
.lead-hint { margin: 0 0 0.6rem; padding: 0.45rem 0.8rem; border-radius: var(--radius); background: var(--accent-soft); }
.lead-hint a { display: inline-block; padding: 0.25rem 0; font-weight: 600; white-space: nowrap; }

.empty-state { background: var(--paper); border: 1px dashed #b4bdca; border-radius: var(--radius); padding: 1.6rem 1.4rem; }
.empty-state h2 { font-size: 1.3rem; }
.empty-state .tips { margin: 0 0 1rem; padding-left: 1.2rem; color: var(--muted); }
.empty-state .actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1.5rem; margin-top: 1rem; }
.pager-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.pager-where { padding: 0 0.5rem; font-weight: 600; white-space: nowrap; }
.pager-jump { display: flex; align-items: center; gap: 0.5rem; }
.pager-jump label { display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; color: var(--muted); }
.pager-jump input { width: 6rem; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.card .table-wrap { border-color: var(--line-soft); }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th, table.grid td { padding: 0.6rem 0.8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
table.grid th { font-size: 0.82rem; font-weight: 600; color: var(--muted); white-space: nowrap; background: var(--tint); border-bottom-color: var(--line); }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--tint); }
td.actions { white-space: nowrap; }
td.actions button { margin: 0 0.3rem 0.3rem 0; }

.results-table .c-number { font-weight: 600; white-space: nowrap; }
.results-table .c-number a { display: inline-block; padding: 0.2rem 0; }
.results-table .c-date, .results-table .c-kind { white-space: nowrap; color: var(--muted); }
.results-table .c-name { min-width: 10rem; overflow-wrap: anywhere; }

/* "Contains RACK-100 — Roof rack ...": which of a record's lines the search found it by */
.contains { display: block; margin-top: 0.15rem; font-size: 0.88rem; color: var(--muted); overflow-wrap: anywhere; }
.contains:empty { display: none; }
.contains strong { color: var(--ink); font-weight: 600; }

.nested-wrap { border-color: var(--line-soft); }
table.nested { font-size: 0.9rem; }
table.nested th, table.nested td { padding: 0.35rem 0.6rem; }

/* ---------- record page: the top ---------- */

.record-head { padding: 1.3rem 1.4rem; border-top: 4px solid var(--brand); }
.record-head h1 { margin-bottom: 1rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.7rem; }
.record-head h1 .kind { font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.record-head h1 .number { font-size: 2rem; overflow-wrap: anywhere; }

dl.headline { display: flex; flex-wrap: wrap; gap: 1rem 2.6rem; margin: 0; }
dl.headline .cell { min-width: 0; flex: 0 1 auto; }
dl.headline dt { font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
dl.headline dd { margin: 0.1rem 0 0; font-size: 1.2rem; font-weight: 600; overflow-wrap: anywhere; }
dl.headline .who { flex: 1 1 16rem; }
dl.headline .money dd { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
dl.headline .state dd { font-size: 1rem; }
dl.headline .state .pill { font-size: 1rem; padding: 0.15rem 0.8rem; }

dl.facts { margin: 0; }
dl.facts.key { margin-top: 1.1rem; padding-top: 0.6rem; border-top: 1px solid var(--line-soft); }
.line-note { margin: 0.9rem 0 0; }
.head-links { margin: 0.9rem 0 0; font-size: 0.95rem; }
.head-links a { display: inline-block; padding: 0.35rem 0; }
.head-links .dot { color: var(--faint); }

.jump { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1rem; }
.jump-label { color: var(--muted); font-size: 0.9rem; margin-right: 0.2rem; }
.jump button { border-radius: 999px; background: var(--paper); padding: 0.3rem 1rem; }

.related { margin: 0; padding-left: 1.1rem; }
.related li { padding: 0.2rem 0; }
.related a { font-weight: 600; }

/* ---------- record page: fields ---------- */

/* One field = one label and its value. Several fields sit side by side when there is room. */
dl.facts:not(.nested) { display: grid; grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); gap: 0 2rem; }
.fact { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: 0.8rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.fact.wide { grid-column: 1 / -1; }
.fact dt { color: var(--muted); }
.fact dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; min-width: 0; }
.fact.is-empty dd { color: var(--faint); }
dl.facts.key .fact dd { font-weight: 600; }

dl.nested { display: grid; grid-template-columns: minmax(7rem, 12rem) 1fr; gap: 0.25rem 1rem; font-size: 0.92rem; margin: 0; white-space: normal; }
dl.nested dt { color: var(--muted); }
dl.nested dd { margin: 0; overflow-wrap: anywhere; }
.plain-list { margin: 0; padding-left: 1.1rem; white-space: normal; }

.groups { margin-top: 0.4rem; }
.group { border-top: 1px solid var(--line); }
.group:last-child { border-bottom: 1px solid var(--line); }
.group > summary {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.8rem; min-height: 3rem; padding: 0.4rem 0.2rem;
  cursor: pointer; list-style-position: inside;
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: "▸"; color: var(--accent); width: 1rem; flex: none; font-size: 1.1rem; }
.group[open] > summary::before { content: "▾"; }
.group > summary:hover { background: var(--tint); }
.group-title { font-weight: 700; font-size: 1.05rem; }
.group-count { color: var(--muted); font-size: 0.88rem; }
.group[open] > summary { border-bottom: 1px solid var(--line-soft); }
.group .part { padding: 0 0.2rem 0.6rem; }
.group .part h3 { margin-top: 0.9rem; }

/* Empty fields are in the page and hidden until "Show empty fields" is ticked. */
.groups.hide-empty .is-empty,
.groups.hide-empty .all-empty,
.groups.hide-empty .when-empty-shown { display: none; }

.details-count { margin-bottom: 0.2rem; }
.source-note { margin-top: 0.9rem; }

/* ---------- record page: files, lines, history ---------- */

.file-link { font-weight: 600; overflow-wrap: anywhere; }
.file-details { display: block; }
table.files .c-file { min-width: 14rem; }
table.files td:not(.c-file) { white-space: nowrap; }

table.grid.lines th { white-space: normal; vertical-align: bottom; }
table.grid.lines th, table.grid.lines td { padding-left: 0.5rem; padding-right: 0.5rem; }
table.lines td { overflow-wrap: anywhere; }
table.lines td:not(.num):not(.c-more) { min-width: 5.5rem; }
table.grid.lines td.c-main:not(.num) { min-width: 12rem; }
table.grid.lines .c-more { text-align: right; white-space: nowrap; width: 1%; padding-left: 0.2rem; }
table.lines .c-more button { padding-left: 0.6rem; padding-right: 0.6rem; }
/* a line that holds what was searched for */
table.grid.lines tr.line.match > td { background: #fff8dc; }
table.grid.lines tr.line.match > td:first-child { box-shadow: inset 4px 0 0 #e0a800; }
.match-tag { display: table; background: #ffe9a3; color: #5c4a00; margin: 0.25rem 0 0; }
.found-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; background: #fff8dc; border: 1px solid #ecdca0; margin: 0 0 1rem; }
.match-count { margin: 0 0 0.5rem; }
tr.line-detail > td { background: var(--tint); padding: 0.8rem 1rem 1rem; }
.line-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 1.5rem; }
.line-open { font-weight: 600; padding: 0.5rem 0; }
.show-rest { margin-top: 0.8rem; }

.timeline { list-style: none; margin: 0 0 0.6rem; padding: 0; }
.entry { position: relative; padding: 0.1rem 0 1rem 1.5rem; border-left: 2px solid var(--line); margin-left: 0.4rem; }
.entry:last-child { padding-bottom: 0.2rem; }
.entry::before {
  content: ""; position: absolute; left: -0.45rem; top: 0.45rem; width: 0.7rem; height: 0.7rem; border-radius: 50%;
  background: var(--brand); border: 2px solid var(--paper);
}
.entry.activity::before { background: #b4bdca; }
.entry-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.8rem; }
.entry-head .when { font-weight: 600; }
.entry-head .who { color: var(--muted); }
.entry-head .tag { margin-left: 0; }
.entry-body { margin: 0.25rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry.activity .entry-body { color: var(--muted); }

/* ---------- Data files ---------- */

.files-intro { max-width: 52rem; }
.files-filter { margin-top: 1.1rem; }
.files-filter .field { max-width: 30rem; }
.files-count { margin: 0.6rem 0 0; font-size: 1rem; color: var(--muted); }
.files-count button { margin-left: 0.4rem; }
.files-section > p { max-width: 52rem; }
table.grid.data-files th, table.grid.data-files td { padding-left: 0.6rem; padding-right: 0.6rem; }
table.data-files .c-file { width: 25%; min-width: 11rem; }
table.data-files .file-title { font-weight: 600; overflow-wrap: anywhere; }
table.data-files .file-details { overflow-wrap: anywhere; }
table.data-files .c-what { min-width: 13rem; }
table.data-files .file-actions { white-space: nowrap; width: 1%; }
table.data-files .file-actions a {            /* one above the other: the table stays inside the page */
  display: block; padding: 0.3rem 0.9rem; margin: 0 0 0.35rem; border: 1px solid var(--line); text-align: center;
  border-radius: 999px; font-weight: 600; text-decoration: none; background: var(--paper);
}
table.data-files .file-actions a:hover { background: var(--accent-soft); }
table.data-files .file-actions a.file-open { background: var(--brand); border-color: var(--accent); color: var(--brand-ink); }
table.data-files .file-actions a.file-open:hover { background: var(--brand-hover); }
.tag.here { background: var(--accent-soft); color: var(--accent-dark); }
a.tag.here { text-decoration: none; }
a.tag.here:hover { text-decoration: underline; }

/* Six columns need about 1000px. Below that each file is a block of its own: the name, what it is,
   its numbers on one line, and two buttons a thumb can hit - on a tablet as on a phone. */
@media (max-width: 1000px) {
  table.data-files thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.data-files, table.data-files tbody, table.data-files tr, table.data-files td { display: block; width: 100%; }
  table.data-files tr { padding: 0.7rem 0; border-bottom: 1px solid var(--line-soft); }
  table.data-files tr:last-child { border-bottom: 0; }
  table.grid.data-files td { border: 0; padding: 0.15rem 0.9rem; text-align: left; white-space: normal; }
  table.data-files td[data-label]:not([data-label=""])::before { content: attr(data-label) ": "; color: var(--muted); font-size: 0.85rem; }
  table.data-files td:empty { display: none; }
  table.data-files .c-file { width: 100%; min-width: 0; font-size: 1.05rem; }
  table.data-files .c-what { min-width: 0; }
  table.grid.data-files td.num { display: inline-block; width: auto; padding-right: 0.2rem; }
  table.grid.data-files td.num:empty { display: none; }
  table.grid.data-files .file-actions { width: 100%; white-space: normal; padding-top: 0.5rem; }
  table.data-files .file-actions a { display: inline-block; margin: 0 0.5rem 0.2rem 0; padding: 0.55rem 1.2rem; }
  table.data-files .file-title { display: block; }
  table.data-files .tag.here { margin: 0.2rem 0 0.1rem; }
}

/* ---------- Manage access ---------- */

.add-form input[type="email"], .add-form input[type="text"] { max-width: 26rem; }
.add-form .search-row { margin-bottom: 0.3rem; }
td[data-label="Added on"] { white-space: nowrap; }
table.domains .c-domain { font-weight: 600; overflow-wrap: anywhere; }
.domain-list { margin-bottom: 0.8rem; }
.domain-form h3 { margin-top: 0.6rem; }
.domain-form p { margin: 0.4rem 0 0; }

/* ---------- sign-in ---------- */

/* whose archive this is, before anything else: the badge and the two names, large */
.signin-brand { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.4rem; }
.signin-logo { width: 4.25rem; height: 4.25rem; flex: none; display: block; }
.signin-brand .brand-name { font-size: 1.75rem; }
.signin-brand .brand-product { font-size: 1.05rem; }
.view.narrow .card input + button { margin-top: 0.6rem; }
.view.narrow .card button + p { margin-top: 0.6rem; }
.who-can { margin-top: 1rem; }

/* ---------- phone width: nothing scrolls sideways; tables become stacked cards ---------- */

@media (max-width: 720px) {
  html { font-size: 16px; }
  main { padding: 0.8rem 0.75rem 3rem; }
  /* two rows: the name with "Sign out" beside it, then the pages (three of them for an admin) */
  .top { position: relative; padding: 0.3rem 0.75rem 0.3rem; gap: 0 1rem; }
  .brand { min-height: 2.75rem; padding: 0 6.5rem 0 0; }
  .brand-logo { width: 2.2rem; height: 2.2rem; }
  .signin-logo { width: 3.6rem; height: 3.6rem; }
  .signin-brand .brand-name { font-size: 1.5rem; }
  .nav { width: 100%; justify-content: flex-start; gap: 0 1.5rem; }
  .nav .who { display: none; }       /* the address the person signed in with: left out where room is short */
  .nav button { position: absolute; top: 0.3rem; right: 0.75rem; margin: 0; padding: 0.3rem 0.9rem; }
  .card { padding: 0.9rem 0.9rem; }
  h1 { font-size: 1.45rem; }
  .hero { padding-top: 0.8rem; }
  .hero h1 { font-size: 1.6rem; }

  .search-row { flex-wrap: wrap; }
  .search-row button { width: 100%; }
  .filter-box > summary {
    display: flex; align-items: center; min-height: 2.75rem; margin-top: 0.4rem; cursor: pointer;
    font-weight: 600; color: var(--accent);
  }
  .filter-box > summary::-webkit-details-marker { display: none; }
  .filter-box > summary::before { content: "▸"; width: 1.1rem; flex: none; }
  .filter-box[open] > summary::before { content: "▾"; }
  .filters { grid-template-columns: 1fr 1fr; margin-top: 0.2rem; }
  .kinds { grid-template-columns: 1fr; }
  .results-tools { width: 100%; justify-content: space-between; }

  .pager { justify-content: center; }
  .pager-steps { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .pager-where { grid-column: 1 / -1; grid-row: 1; text-align: center; padding: 0.3rem 0; }
  .pager-steps .edge { grid-row: 3; }
  button.small { min-height: 2.75rem; }

  /* results: each row is a small card - number and amount on top, then the name, then date and status */
  .results-table, .results-table tbody { display: block; width: 100%; }
  .results-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .results-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 0.8rem; padding: 0.75rem 0.9rem;
    grid-template-areas: "number amount" "name name" "date status" "kind kind"; border-bottom: 1px solid var(--line-soft);
  }
  .results-table tr:last-child { border-bottom: 0; }
  table.grid.results-table td { display: block; padding: 0; border: 0; text-align: left; min-width: 0; white-space: normal; }
  .results-table .c-number { grid-area: number; font-size: 1.05rem; overflow-wrap: anywhere; }
  .results-table .c-amount { grid-area: amount; text-align: right; font-weight: 600; white-space: nowrap; }
  .results-table .c-name { grid-area: name; }
  .results-table .c-date { grid-area: date; }
  .results-table .c-status { grid-area: status; justify-self: end; }
  .results-table .c-kind { grid-area: kind; font-size: 0.85rem; }
  .results-table td:empty { display: none; }

  /* other tables: one row = one block, each cell on its own line with its column name in front */
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft); }
  table.stack tr:last-child { border-bottom: 0; }
  table.grid.stack td { border: 0; padding: 0.15rem 0.9rem; text-align: left; white-space: normal; }
  table.stack td[data-label]:not([data-label=""])::before {
    content: attr(data-label) ": "; color: var(--muted); font-size: 0.85rem;
  }
  table.stack td:empty { display: none; }
  table.stack tr.line-detail { padding: 0; }
  table.grid.stack tr.line-detail > td { padding: 0.8rem 0.9rem 1rem; }
  table.grid.stack.lines .c-more { width: 100%; text-align: left; padding: 0.4rem 0.9rem 0; }
  table.files .c-file { min-width: 0; font-size: 1.02rem; }
  .add-form input[type="email"], .add-form input[type="text"] { max-width: none; }

  .record-head { padding: 1rem 0.9rem; }
  .record-head h1 .number { font-size: 1.6rem; }
  dl.headline { gap: 0.8rem 1.8rem; }
  dl.headline .who { flex-basis: 100%; }
  dl.headline .money dd { font-size: 1.3rem; }
  .jump button { padding: 0.3rem 0.8rem; }

  dl.facts:not(.nested) { grid-template-columns: 1fr; }
  .fact { grid-template-columns: 1fr; gap: 0; padding: 0.45rem 0; }
  .fact dt { font-size: 0.85rem; }
  dl.nested { grid-template-columns: 1fr; gap: 0; }
  dl.nested dt { margin-top: 0.3rem; font-size: 0.85rem; }
  .card-head { align-items: flex-start; }
}

@media print {
  .top, .search-form, .pager, .crumbs, .jump, .head-links, button, .check { display: none; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
