/* Almagest's look (ADR 0026), the hub's and the window's. tests/test_look.py parses the tokens
   and checks every pair put together against WCAG: keep one "--name: #rrggbb;" each. */
:root {
  color-scheme: light dark;
  --bg: #f6f4ef;          /* paper: the page */
  --panel: #fdfcf9;       /* sheet: fields, cards, blocks, the side panel, the status block */
  --text: #1d1c1a;        /* ink: all body text */
  --muted: #5d584f;       /* pencil: dates, places, hints, counts */
  --line: #e0dbd0;        /* hairline between entries and around sheets: decorative only */
  --rule: #857e72;        /* borders you must see: fields, quiet buttons, tabs, kind tiles */
  --accent: #21487a;      /* archive blue: links, primary buttons, what is picked */
  --accent-hover: #183a64;
  --accent-text: #ffffff; /* words on accent */
  --accent-soft: #e4eaf2; /* picked facet, chips, info messages */
  --ok: #2a6a3c;          /* kept, backed up, connected, up to date, "You said so" */
  --ok-bg: #e3eee0;
  --warn: #7a5200;        /* needs attention, not kept yet, offline, "couldn't tell" */
  --warn-bg: #f6ead0;
  --bad: #a32a1f;         /* errors, refusals, destructive buttons */
  --bad-bg: #f7e2dd;
  --unsure: #634894;      /* "thinks so", the "?", review, the Needs review dot */
  --unsure-bg: #ece6f4;
  --dim-bg: #ebe7de;      /* quiet fills, hover, meter track, command blocks */
  --bar: #6380aa;         /* bars and meters (judges' fix of #6a87b0) */
  --mark: #d9e3f0;        /* search highlight; never the warning colour */
  --focus: #1f5fd1;       /* the focus ring */
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --hit: 36px;            /* compact rows with a mouse; 44px on touch, below */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513; --panel: #1f1d1a; --text: #ece8e0; --muted: #aaa498; --line: #34312c;
    --rule: #7d776b; --accent: #9fbbe6; --accent-hover: #bcd0f0; --accent-text: #11161d;
    --accent-soft: #1f2a3a; --ok: #8fcf9e; --ok-bg: #17281b; --warn: #e6c070; --warn-bg: #2e2513;
    --bad: #f2a093; --bad-bg: #38201b; --unsure: #c4b0ec; --unsure-bg: #2a2338;
    --dim-bg: #282621; --bar: #5f7cad; --mark: #2e3d55; --focus: #8db4ff;
  }
}
@media (pointer: coarse) { :root { --hit: 44px; } }

/* Source Serif 4 (OFL.txt beside it): for what comes from files, and headings. Relative: the one
   file works on the hub and in the window. */
@font-face {
  font-family: "Source Serif 4";
  src: url(source-serif-4.woff2) format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

/* == Base == */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/25px var(--sans); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 12px; font-family: var(--serif); font-weight: 600; color: var(--text); }
h1 { font-size: 30px; line-height: 36px; letter-spacing: -.01em; }
h2 { font-size: 22px; line-height: 28px; }
h3, caption.title { font: 600 18px/26px var(--serif); }
p, ul, ol { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Inside a scrolling or squared group the ring goes inward, where nothing clips it; on a filled
   (current, pressed) cell it is paper-coloured, which stands out on the ink. */
:is(.ws, .nav, nav.views, .seg) :focus-visible { outline-offset: -5px; }
:is(.ws a[aria-current="page"], .seg button[aria-pressed="true"]):focus-visible { outline-color: var(--bg); }
bdi { overflow-wrap: anywhere; } /* a name without spaces must not widen a phone's page */
mark { background: var(--mark); color: var(--text); font-weight: 600; padding: 0 2px; border-radius: 2px; }
code, pre, kbd, .cmd { font-family: var(--mono); }
code { font-size: .94em; overflow-wrap: anywhere; }
.small, .meta, .place, .hint { font-size: 14px; line-height: 20px; color: var(--muted); }
.lead { color: var(--muted); margin: 0 0 16px; }
.kicker {
  margin: 0; font: 600 13px/16px var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.num, .n, .date { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic, .cm {
  width: 20px; height: 20px; flex: none; vertical-align: middle; fill: none;
  stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.cm { width: 14px; height: 14px; }
.mark { width: 28px; height: 28px; flex: none; color: var(--accent); }

/* == Header and nav (_header.html) == */
.top { background: var(--bg); border-bottom: 1px solid var(--line); }
.top-in {
  display: grid; max-width: 1304px; margin: 0 auto; padding: 6px 32px 0; column-gap: 24px;
  grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  grid-template-areas: "brand ws acct" "nav nav nav" "lim lim lim";
}
.brand {
  grid-area: brand; display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--text); text-decoration: none;
}
a.brand:hover { color: var(--text); }
.brand .word { font: 600 22px/1 var(--serif); }
.ws {
  grid-area: ws; justify-self: start; display: flex; min-width: 0; max-width: 100%;
  overflow-x: auto; border: 1px solid var(--rule); border-radius: 6px;
}
.ws a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; white-space: nowrap;
  color: var(--muted); font-weight: 500; font-size: 15px; text-decoration: none;
}
.ws a + a { border-left: 1px solid var(--rule); }
.ws a:hover { background: var(--dim-bg); color: var(--text); }
.ws a[aria-current="page"] { background: var(--text); color: var(--bg); font-weight: 600; }
.nav { grid-area: nav; display: flex; column-gap: 28px; align-self: end; min-width: 0; }
.nav a {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; margin-bottom: -1px;
  white-space: nowrap; color: var(--muted); font-weight: 500; font-size: 15px;
  text-decoration: none; border-bottom: 2px solid transparent;
}
.nav a:hover { color: var(--text); border-bottom-color: var(--rule); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--unsure); flex: none; }
.acct { grid-area: acct; position: relative; justify-self: end; }
.acct > summary {
  list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 0 12px; border-radius: 6px; color: var(--text); font-weight: 500;
}
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary::after {
  content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.6px 1.6px 0;
  transform: translateY(-2px) rotate(45deg);
}
.acct[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.acct > summary:hover { background: var(--dim-bg); }
.acct .menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; min-width: 220px; padding: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
}
.acct .menu form { margin: 0; }
.acct .menu a, .acct .menu button {
  display: flex; align-items: center; width: 100%; min-height: var(--hit); padding: 0 12px;
  border: 0; border-radius: 6px; background: none; color: var(--text); font: 500 15px/20px var(--sans);
  text-decoration: none; justify-content: flex-start;
}
.acct .menu a:hover, .acct .menu button:hover { background: var(--dim-bg); color: var(--text); }
.top .limited { grid-area: lim; margin: 8px 0; }
@media (min-width: 1200px) {
  .top-in {
    grid-template-columns: auto auto minmax(0, 1fr) auto; min-height: 56px; padding-top: 4px;
    grid-template-areas: "brand ws nav acct" "lim lim lim lim";
  }
}

/* == Layout shells == */
main { display: block; max-width: 1304px; margin: 0 auto; padding: 24px 32px 96px; }
section + section { margin-top: 48px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 24px; }
main.outside { max-width: 624px; padding-top: 8vh; }
main.outside > .brand { display: flex; justify-content: center; gap: 12px; margin: 0 0 32px; }
main.outside > .brand .mark { width: 40px; height: 40px; }
main.outside > .brand .word { font-size: 28px; }

/* == Buttons == */
button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 0 18px; border: 1px solid transparent; border-radius: 6px; background: var(--accent);
  color: var(--accent-text); font: 600 15px/20px var(--sans); text-decoration: none;
  white-space: nowrap; cursor: pointer;
}
button:hover, a.button:hover { background: var(--accent-hover); color: var(--accent-text); }
button:active, a.button:active { transform: translateY(1px); }
button .ic, a.button .ic { width: 18px; height: 18px; }
button.quiet, a.button.quiet { background: transparent; color: var(--text); border-color: var(--rule); }
button.quiet:hover, a.button.quiet:hover { background: var(--dim-bg); color: var(--text); border-color: var(--text); }
button.link {
  min-height: 44px; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 500;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
button.link:hover { background: none; color: var(--accent-hover); text-decoration-thickness: 2px; }
button.danger, a.button.danger { background: var(--bad); color: var(--bg); }
button.danger:hover, a.button.danger:hover { background: var(--bad); color: var(--bg); text-decoration: underline; text-underline-offset: 3px; }
button.quiet.danger, a.button.quiet.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
button.quiet.danger:hover, a.button.quiet.danger:hover { background: var(--bad-bg); color: var(--bad); text-decoration: none; }
button.link.danger, button.link.danger:hover { background: none; color: var(--bad); }
.big, a.button.big { min-height: 52px; padding: 0 28px; font-size: 17px; }
button[disabled], button[disabled]:hover {
  background: var(--dim-bg); color: var(--muted); border-color: transparent; cursor: not-allowed;
  transform: none; text-decoration: none;
}
/* Google's own button: their colours, never ours */
button.google, button.google:hover { background: #ffffff; color: #1f1f1f; border-color: #747775; gap: 10px; }
@media (prefers-color-scheme: dark) {
  button.google, button.google:hover { background: #131314; color: #e3e3e3; border-color: #8e918f; }
}
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg > form { display: flex; margin: 0; }
.seg > * + * { border-left: 1px solid var(--rule); }
.seg button {
  min-height: 44px; min-width: 56px; padding: 0 16px; border: 0; border-radius: 0;
  background: transparent; color: var(--text); font-weight: 500;
}
.seg button:hover { background: var(--dim-bg); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 600; }

/* == Fields == */
label { display: block; margin: 16px 0; font: 600 15px/20px var(--sans); color: var(--text); }
input[type=text], input[type=search], input[type=password], input[type=number], input[type=url],
input[type=email], select, textarea {
  min-height: 44px; max-width: 100%; padding: 9px 12px; border: 1px solid var(--rule);
  border-radius: 6px; background: var(--panel); color: var(--text); font: 400 16px/24px var(--sans);
}
label > input:not([type=checkbox], [type=radio], [type=hidden]), label > select, label > textarea {
  display: block; width: 100%; margin-top: 6px;
}
:is(input, select, textarea):hover { border-color: var(--text); }
:is(input, select, textarea):focus-visible { outline-offset: 1px; border-color: var(--focus); }
::placeholder { color: var(--muted); opacity: 1; }
textarea { width: 100%; min-height: 6em; font: 14px/1.5 var(--mono); }
input[type=file] { max-width: 100%; min-height: 44px; font: inherit; color: var(--muted); }
input[type=file]::file-selector-button {
  min-height: 44px; margin-right: 12px; padding: 0 18px; border: 1px solid var(--rule); border-radius: 6px;
  background: transparent; color: var(--text); font: 600 15px/20px var(--sans); cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--dim-bg); border-color: var(--text); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.hint { display: block; margin-top: 6px; font-weight: 400; }
.err { display: block; margin-top: 6px; font: 600 14px/20px var(--sans); color: var(--bad); }
[aria-invalid="true"], [aria-invalid="true"]:hover { border: 2px solid var(--bad); }
label.tick { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; margin: 0; padding: 10px 0; font-weight: 400; cursor: pointer; }
fieldset { min-width: 0; margin: 16px 0; padding: 0; border: 0; }
legend { float: none; padding: 0; font: 600 15px/20px var(--sans); }
form.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0; }
form.inline input[type=text], form.inline input[type=search], form.inline > label { flex: 1 1 280px; min-width: 0; }
form.inline > label { margin: 0; }
summary {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 0; list-style: none;
  line-height: 24px; font-weight: 600; cursor: pointer;
}
summary::-webkit-details-marker { display: none; }
summary::before { /* points right when closed, down when open */
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px; border: solid currentColor;
  border-width: 0 1.6px 1.6px 0; transform: rotate(-45deg);
}
details[open] > summary::before { transform: rotate(45deg); }
.acct > summary::before { content: none; }

/* == Messages, badges, who said it == */
.flash {
  margin: 0 0 16px; padding: 12px 16px; border-radius: 6px; border-left: 4px solid var(--ok);
  background: var(--ok-bg); color: var(--text); overflow-wrap: anywhere;
}
.flash.error { background: var(--bad-bg); border-left-color: var(--bad); }
.flash.warning { background: var(--warn-bg); border-left-color: var(--warn); }
.flash.info { background: var(--accent-soft); border-left-color: var(--accent); }
.flash.quiet {
  padding: 8px 12px; background: transparent; border: 1px solid var(--line); border-left: 4px solid var(--rule);
  font-size: 14px; line-height: 20px;
}
.flash:has(> .act) {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; padding-block: 2px;
}
.flash:has(> .act) > :not(.act) { padding-block: 10px; } /* the words; the action is 44 tall */
.flash .act { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 8px;
  border-radius: 3px; background: var(--dim-bg); color: var(--muted); font: 600 13px/16px var(--sans);
  white-space: nowrap; vertical-align: middle;
}
/* The Devices pages' raw values in the class map here, so their markup stays. */
.badge:is(.ok, .done, .suggest) { background: var(--ok-bg); color: var(--ok); }
.badge:is(.info, .queued, .running) { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge:is(.bad, .failed) { background: var(--bad-bg); color: var(--bad); }
.badge:is(.unsure, .review, .mixed) { background: var(--unsure-bg); color: var(--unsure); }
.badge:is(.dim, .skip) { background: var(--dim-bg); color: var(--muted); }
.who { display: inline-flex; align-items: center; gap: 6px; font: 600 14px/20px var(--sans); }
.who.sure { color: var(--accent); }
.who.thinks { color: var(--unsure); }
.who.couldnt { color: var(--warn); }
.who.you { color: var(--ok); }
.who.rule, .who.agent { color: var(--muted); }
.who.agent { padding: 2px 8px; border: 1px dashed var(--rule); border-radius: 3px; }
a.unsure { color: var(--unsure); text-decoration: underline dashed var(--unsure); text-decoration-thickness: 1px; text-underline-offset: 4px; }
a.unsure:hover { color: var(--unsure); text-decoration-thickness: 2px; }

/* == Tables, cards, lists, codes == */
table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 22px; }
caption { text-align: left; }
caption.title { padding-bottom: 12px; }
th { text-align: left; }
thead th {
  padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: bottom;
  font: 600 13px/16px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
td, tbody th { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th[scope="row"] { font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.dim td { color: var(--muted); }
.scroll { overflow-x: auto; margin-inline: -5px; padding-inline: 5px; } /* room for a ring */
.scroll > table:not(.stack) :is(bdi, code) { overflow-wrap: normal; } /* it scrolls instead */
.scroll > table.stack th[scope="row"] bdi { overflow-wrap: break-word; } /* a path breaks only if it must, never to a narrow column: the table scrolls, not the page */
:is(.scroll, table) + p { margin-top: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 24px; }
.cards.choices { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.card {
  display: block; padding: 20px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); text-decoration: none;
}
.card > b { display: block; font: 600 30px/36px var(--serif); font-variant-numeric: tabular-nums lining-nums; }
.card > span { display: block; font-size: 14px; line-height: 20px; color: var(--muted); }
a.card { padding: 24px; border-color: var(--rule); border-radius: 10px; }
a.card > b { margin-bottom: 4px; font-size: 18px; line-height: 26px; color: var(--accent); }
a.card:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.card.off { border: 1px dashed var(--rule); border-radius: 10px; padding: 24px; color: var(--muted); }
.card.off > b { font-size: 18px; line-height: 26px; color: var(--muted); }
.card.choice h3 { margin-top: 0; }
.item {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px;
  min-height: 44px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.item form { margin: 0; }
/* a sentence that quotes a folder: "Clients/lantern_tools/2024" has nowhere to break */
.item > span, label.tick > span, .rtable caption .q { overflow-wrap: anywhere; min-width: 0; }
ol.steps, details.howto ol { padding-left: 24px; }
ol.steps li { margin-bottom: 8px; }
details.howto { margin: 12px 0; }
.activity { list-style: none; padding: 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.activity li { padding: 4px 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.ask { margin: 12px 0; }
pre {
  margin: 0 0 12px; padding: 14px 16px; background: var(--dim-bg); border: 1px solid var(--line);
  border-radius: 6px; font: 500 15px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
  user-select: all; -webkit-user-select: all; /* one click takes the whole command */
}
pre code { font-size: inherit; }
pre.text, pre.kit { user-select: text; -webkit-user-select: text; }
.code {
  margin: 12px 0; font: 600 40px/48px var(--mono); letter-spacing: .14em; overflow-wrap: anywhere;
  user-select: all; -webkit-user-select: all;
}
.meter { display: block; width: 100%; height: 8px; }
.meter .track { fill: var(--dim-bg); }
.meter .fill { fill: var(--bar); }
.depth-1 { padding-left: 26px; }
.depth-2 { padding-left: 40px; }
.depth-3 { padding-left: 54px; }
.depth-4 { padding-left: 68px; }
.depth-5 { padding-left: 82px; }
.depth-6 { padding-left: 96px; }

/* == The status light (the window's home; the top of Devices and backup) == */
.status {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px 20px; align-items: start;
  margin: 0 0 24px; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
}
.status .light { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.6; color: var(--accent); }
.status.ok .light { color: var(--ok); }
.status.off .light { color: var(--muted); }
.status.warn .light { color: var(--warn); }
.said { margin: 0 0 4px; font: 600 26px/32px var(--serif); overflow-wrap: anywhere; }
.detail { margin: 0; color: var(--muted); }
.status .next {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line);
}
.status .next p { margin: 0; color: var(--muted); }

/* == The folder checklist == */
.checklist { margin: 0 0 24px; }
.frow {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) 76px 92px; column-gap: 16px;
  align-items: start; margin: 0; padding: 16px 12px; border-bottom: 1px solid var(--line);
  font-weight: 400; cursor: pointer;
}
label.frow:hover { background: var(--dim-bg); }
.frow.head {
  padding-block: 10px; border-bottom-color: var(--rule); cursor: default;
  font: 600 13px/16px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.frow input { margin-top: 3px; }
.fbody { display: block; min-width: 0; }
.frow .path { font: 600 16px/24px var(--sans); overflow-wrap: anywhere; }
.fwhat, .fwhy { display: block; margin-top: 2px; font-size: 14px; line-height: 20px; color: var(--muted); }

/* == Files (B2) == */
.title-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 0 0 12px; }
.title-row h1 { margin: 0; }
.crumbs { margin: 0 0 12px; font-size: 15px; overflow-wrap: anywhere; }
form.search { position: relative; display: flex; gap: 8px; max-width: 880px; margin: 0 0 12px; }
form.search > .ic { position: absolute; left: 14px; top: 14px; color: var(--muted); pointer-events: none; }
form.search input[type=search] { flex: 1; min-width: 0; min-height: 48px; padding-left: 44px; font-size: 17px; }
form.search button { flex: none; min-height: 48px; }
nav.views { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
nav.views .kicker { margin-right: 4px; }
a.view {
  display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 14px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 6px;
  color: var(--text); font-weight: 500; font-size: 15px; text-decoration: none;
}
a.view:hover { color: var(--text); background: var(--dim-bg); border-color: var(--text); }
a.view[aria-current="page"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
/* One column in the page's order (narrow, panel, results): a grid's empty rows would add gaps. */
.files-body { display: flex; flex-direction: column; gap: 24px; }
.files-body > .narrow-down { grid-area: narrow; }
.files-body > .side-panel { grid-area: panel; }
.files-body > .results { grid-area: results; min-width: 0; }
details.narrow-down { margin: 0; }
.fgroup + .fgroup { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.fgroup .kicker { margin: 0 0 4px; }
a.facet {
  display: flex; align-items: center; gap: 8px; min-height: var(--hit); padding: 0 10px;
  border-radius: 6px; color: var(--text); font-size: 15px; line-height: 20px; text-decoration: none;
}
a.facet::before { /* a check on what is picked, so picked isn't colour alone */
  content: ""; flex: none; width: 6px; height: 11px; margin: -3px 3px 0 2px;
  border: solid transparent; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
a.facet:hover { color: var(--text); background: var(--dim-bg); }
a.facet .n { margin-left: auto; font-size: 14px; color: var(--muted); }
a.facet.on { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
a.facet.on::before { border-color: currentColor; }
a.facet.on .n { color: var(--accent); }
.found-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 44px;
  border-bottom: 1px solid var(--rule);
}
.found-row > * { margin: 0; }
.found-row .found { font: 400 16px/25px var(--sans); } /* the results' h2, in body type */
.found-row + .hit { border-top: 0; }
.picked { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
a.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--hit); padding: 0 12px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600;
  font-size: 15px; text-decoration: none;
}
a.chip:hover { background: var(--accent); color: var(--accent-text); }
a.clear { display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 4px; }
.found-row .sort { display: flex; gap: 4px; margin-left: auto; font-size: 15px; }
.sort a, .sort b {
  display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 10px;
  border-bottom: 2px solid transparent;
}
.sort a { color: var(--muted); text-decoration: none; }
.sort a:hover { color: var(--text); }
.sort b { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.similar { display: flex; align-items: center; gap: 12px; margin: 32px 0 0; }
.similar::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.hit {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 0 16px; padding: 16px 0;
  border-top: 1px solid var(--line);
}
.kind {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 48px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 3px; color: var(--muted);
}
.kind .ic { width: 22px; height: 22px; }
.gone .kind, .kind.gone { border-style: dashed; background: transparent; } /* the dashed tile: gone */
.hit .main { min-width: 0; }
.hit:has(.fname a[aria-current]) { /* the file open beside the results */
  margin-inline: -12px; padding-inline: 12px; border-radius: 6px; border-top-color: transparent;
  background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent);
}
.hit:has(.fname a[aria-current]) + .hit { border-top-color: transparent; }
.fname a[aria-current] { color: var(--accent); }
.fname { margin: 0; font: 600 17px/24px var(--serif); overflow-wrap: anywhere; }
.fname a { color: var(--text); text-decoration: none; }
.fname a:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; }
.meta { margin: 2px 0 0; }
.place { display: flex; align-items: flex-start; gap: 6px; margin: 2px 0 0; overflow-wrap: anywhere; }
.place .ic { width: 16px; height: 16px; margin-top: 2px; }
.place a { color: inherit; }
.place a.dev { color: var(--text); font-weight: 600; } /* bold device */
.quote { max-width: 68ch; margin: 8px 0 0; font: 400 15px/24px var(--serif); }
.quote.small { font-family: var(--sans); font-size: 14px; line-height: 20px; }
.hit .small { margin: 4px 0 0; }
.state { margin: 4px 0 0; font-size: 15px; line-height: 22px; color: var(--text); }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.date { font-size: 14px; line-height: 20px; color: var(--muted); white-space: nowrap; }
.side a.button { min-height: var(--hit); padding: 0 12px; }
.paging { display: flex; justify-content: flex-end; gap: 12px; margin: 24px 0 0; }
details.save { margin: 48px 0 0; padding-top: 4px; border-top: 1px solid var(--rule); }
ul.browse { list-style: none; padding: 0; }
ul.browse li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.browse b { margin-right: 8px; }
ul.folders { display: flex; flex-wrap: wrap; gap: 4px 24px; list-style: none; padding: 0; margin: 0 0 24px; }
ul.folders a { display: inline-flex; align-items: center; gap: 8px; min-height: var(--hit); }
ul.folders .ic { color: var(--muted); }
.file-head { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; align-items: start; }
h1.fname { font-size: 30px; line-height: 36px; letter-spacing: -.01em; }
h2.fname { font-size: 22px; line-height: 28px; }
.file-head ~ h2, .file-head ~ h3 { margin-top: 32px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
ul.places { list-style: none; padding: 0; }
ul.places .place { padding: 8px 0; border-bottom: 1px solid var(--line); }
.facts { font-size: 14px; line-height: 20px; color: var(--muted); }
pre.text { max-width: 68ch; max-height: 36em; overflow-y: auto; background: var(--panel); font: 400 15px/24px var(--serif); }
.side-panel {
  position: relative; min-width: 0; padding: 20px 24px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px;
  scrollbar-width: thin; scrollbar-color: var(--rule) transparent;
}
.side-panel .file-head { padding-right: 40px; }
.side-panel .close {
  position: absolute; top: 8px; right: 8px; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 6px; color: var(--text); font-size: 24px; text-decoration: none;
}
.side-panel .close:hover { color: var(--text); background: var(--dim-bg); }
/* The panel is about a phone's width: its versions stack there at any width (as table.stack
   does on a phone). */
.side-panel table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.side-panel table.stack, .side-panel table.stack :is(tbody, tr, td, tbody th) { display: block; }
.side-panel table.stack tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
.side-panel table.stack :is(td, tbody th) { padding: 2px 0; border: 0; text-align: left; }
.side-panel table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
/* Above the results (under 1200 px: a narrow window, a tablet) the panel stays in view. The row a
   name's #h<id> jumps to, and whatever takes focus in the results, lands under it instead of
   hiding beneath it; the panel's own links have none, so focus in the panel never scrolls. */
@media (max-width: 1199px) {
  .side-panel { position: sticky; top: 0; z-index: 1; max-height: 50vh; overflow-y: auto; }
  .with-panel .results :is(.hit, a, button, input, select, summary) { scroll-margin-top: calc(50vh + 16px); }
}
@media (min-width: 900px) {
  /* Narrow down is closed for everyone, so a narrow page reaches the results first. Here it is a
     column: its rows always shown, its summary a title. */
  details.narrow-down::details-content { content-visibility: visible; }
  details.narrow-down > summary { cursor: default; pointer-events: none; }
  details.narrow-down > summary::before { content: none; }
  .files-body:has(> .narrow-down) {
    display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px 32px; align-items: start;
    grid-template-areas: "narrow results";
  }
  .files-body:has(> .narrow-down):has(> .side-panel) { grid-template-areas: "narrow panel" "narrow results"; }
}
@media (min-width: 1200px) {
  .files-body:has(> .side-panel) {
    display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px 32px; align-items: start;
    grid-template-areas: "results panel";
  }
  .files-body:has(> .narrow-down):has(> .side-panel) {
    grid-template-columns: 220px minmax(0, 1fr) 380px; grid-template-areas: "narrow results panel";
  }
  .side-panel { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  main.with-panel { padding-bottom: 16px; } /* so its top stays on screen at the last rows */
}

/* == Hub pages (B3) == */
/* What the pages' style="margin-top: ..." did, on the scale */
.after, form.after { margin-top: 12px; }
section > * + :is(h2, h3) { margin-top: 32px; }
section + .cards { margin-top: 32px; }
.cards + section { margin-top: 48px; }
p.item { margin: 0; }
/* Devices and backup: New workspace at the top right; a phone asking to connect */
details.new-ws { width: fit-content; max-width: 100%; margin: 0 0 8px auto; }
details.new-ws > form { margin: 0 0 12px; }
.flash > form.inline { align-items: center; }
.flash > form + form { margin-top: 8px; }
tr.dim th { color: var(--muted); }
th.meter-col { width: 40%; }
.checklist > p { margin: 0; padding: 16px 12px; border-bottom: 1px solid var(--line); }
/* The bucket form: only the chosen kind's fields show (no script: :has() reads the radios) */
form.bucket .field { display: none; }
form.bucket:has(#type-s3:checked) .s3, form.bucket:has(#type-b2:checked) .b2,
form.bucket:has(#type-sftp:checked) .sftp { display: block; }
pre.kit { font-size: 14px; font-weight: 400; }
/* Outside pages: the sign-in buttons one under the other */
main.outside section > :is(form, button) { margin: 0 0 12px; }

/* == The window (B4) == */
.app main { max-width: 824px; padding: 24px 32px 64px; }
.app .top-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 24px; max-width: 824px; min-height: 56px; padding-top: 0; }
.app .top-in .lead { margin: 0; text-align: right; }
.app .status { min-height: 152px; } /* a reload never moves what is under it */
/* Its pages are flat: a heading starts the next block */
.app main > :not(.vh) + h2 { margin-top: 48px; }
.app main > h1:not(.vh) + h2 { margin-top: 32px; }
.app .path { font-weight: 600; }
.app ul.paths .path { font-weight: 400; overflow-wrap: anywhere; }
.app form.inline > .row { flex-basis: 100%; margin: 4px 0 0; } /* Or look in: under the field */
.app ul.plain { list-style: none; margin: 0; padding: 0; }
.app .uploads { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.app .uploads > form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; }
.app .links { display: flex; flex-wrap: wrap; gap: 0 24px; margin: 24px 0 0; }
.app .links a, .app footer a { display: inline-flex; align-items: center; min-height: 44px; }
.app .activity { color: var(--text); font-size: 15px; line-height: 22px; }
.app .activity li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.app .activity .date { line-height: 22px; }
.app footer { margin-top: 48px; padding-top: 4px; border-top: 1px solid var(--line); }
.app footer p { margin: 0; }

/* == M4: organizations, types, what a file is (ADR 0024) == */
.counts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 32px; font-size: 15px; }
form.signs { max-width: 640px; }
form.signs textarea { min-height: 5em; font: 400 16px/24px var(--sans); } /* names, not code */
details.remove { margin-top: 48px; }
details.remove p { max-width: 68ch; }
p.named { margin: 0 0 12px; }
section.about { margin: 24px 0 0; }
.about-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.about-row > form { margin: 0; }
.about-row > details { min-width: 0; }
.about-row > details[open] { flex-basis: 100%; } /* the form on a line of its own */
.about-row > details > form { margin: 0 0 8px; }
.about-row > form.proposed { flex-basis: 100%; } /* an agent's, under the line it would change */
.about-row select { flex: 1 1 240px; min-width: 0; } /* a long name never widens a phone's page */
@media (pointer: coarse) {
  .counts a, .about-row > a, .hit .meta a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* == M4: Needs review, Rules (ADR 0024) == */
.nav > a { flex: none; } /* five links: on a phone the row scrolls, a link never shrinks */
.key { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin: 0 0 16px; }
details.toc { margin: 0 0 16px; }
details.toc ul { margin: 0; padding-left: 24px; }
section#held, section#names, section#first, section#right, section#couldnt, section#none,
section#agents { margin: 32px 0 0; }
.block {
  margin: 0 0 16px; padding: 24px 28px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px;
}
.block > h3 { margin: 0 0 8px; }
.rtable caption { padding: 0 0 8px; }
.rtable caption .q { display: block; font: 600 18px/26px var(--serif); }
.rtable select { width: 100%; min-width: 12em; }
.rtable td.where { font-size: 14px; line-height: 20px; color: var(--muted); overflow-wrap: anywhere; }
.rtable td.why { overflow-wrap: anywhere; } /* a sender's address has nowhere to break */
p.helper { margin: 8px 0 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.ticks { margin: 12px 0 0; }
.ticks > fieldset { margin: 0 0 0 32px; } /* a folder's radios, under the tick's words */
.block .actions { margin: 24px 0 0; }
.block .actions > form { margin: 0; }
.block .actions form.inline { flex: 1 1 320px; }
ul.names, ul.sorted { margin: 0 0 8px; padding-left: 20px; }
ul.sorted form { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; margin: 0; }
.lately { margin: 0 0 16px; }
p.empty {
  margin: 24px 0; padding: 40px; border: 1px dashed var(--rule); border-radius: 10px;
  text-align: center; font: 400 18px/26px var(--serif);
}
@media (max-width: 699px) {
  .rtable caption { display: block; } /* the stacked table's question: the block's full width */
  .rtable td:empty { display: none; } /* no "Why:" with nothing after it */
  .block { padding: 20px 16px; }
  .rtable select { min-width: 0; }
  p.empty { padding: 32px 16px; }
}
@media (pointer: coarse) {
  ul.names a, .key > a, .rtable th[scope="row"] > a { display: inline-flex; align-items: center; min-height: 44px; }
  /* its name is a flex item now: the link keeps within its cell, and the name may shrink there */
  .rtable th[scope="row"] > a { max-width: 100%; }
  .rtable th[scope="row"] > a > bdi { min-width: 0; }
}

/* == Phones == */
@media (max-width: 699px) {
  h1 { font-size: 24px; line-height: 30px; }
  h2 { font-size: 20px; line-height: 26px; }
  .card > b { font-size: 26px; line-height: 32px; }
  pre, code.cmd, .cmd { font-size: 14px; line-height: 22px; }
  .code { font-size: 30px; line-height: 36px; }
  main, .app main { padding: 16px 16px 64px; }
  .top-in { padding: 4px 16px 0; column-gap: 12px; }
  .top .brand .word, table.stack thead { /* the .vh rules: the link keeps its name */
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  /* The nav and the views: one row each, scrolling sideways only, with a visible scrollbar */
  .nav, nav.views {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    scrollbar-width: thin; scrollbar-color: var(--rule) transparent; /* visible: more links */
  }
  .nav { margin-top: 4px; column-gap: 22px; }
  :is(.nav, nav.views)::-webkit-scrollbar { height: 6px; }
  :is(.nav, nav.views)::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
  .nav a { min-height: 44px; margin-bottom: 0; } /* inside its row: no 1 px over the border */
  nav.views > * { flex: none; } /* a chip keeps its words whole; the row scrolls */
  h1.fname { font-size: 24px; line-height: 30px; }
  .hit { grid-template-columns: 32px minmax(0, 1fr); gap: 0 12px; }
  .hit .kind { width: 32px; height: 40px; }
  .hit .kind .ic { width: 20px; height: 20px; }
  .side { grid-column: 2; flex-direction: row; align-items: center; justify-content: space-between; margin-top: 12px; }
  .found-row .sort { margin-left: 0; }
  table.stack, table.stack tbody, table.stack tr, table.stack td, table.stack tbody th { display: block; }
  table.stack tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.stack td, table.stack tbody th { padding: 2px 0; border: 0; text-align: left; }
  table.stack td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .frow { grid-template-columns: 24px minmax(0, 1fr); row-gap: 2px; }
  .frow.head { display: none; }
  .frow .num { grid-column: 2; text-align: left; font-size: 14px; color: var(--muted); }
  .frow .num[data-label]::before { content: attr(data-label) ": " / ""; }
  .status { grid-template-columns: 32px minmax(0, 1fr); gap: 8px 16px; padding: 20px 16px; }
  .status .light { width: 32px; height: 32px; }
  .said { font-size: 22px; line-height: 28px; }
}

/* == Touch: a finger's height (44 px) for every link that isn't inside a sentence == */
@media (pointer: coarse) {
  .top .brand, .nav a { min-width: 44px; justify-content: center; }
  .fname a, .place a, .crumbs a, ul.browse li > a, p.item > a, a.alone,
  :is(.after, .actions, .row, td) > a:not(.button) {
    display: inline-flex; align-items: center; min-width: 44px; min-height: 44px;
  }
  .place .ic { margin-top: 14px; } /* in the middle of the place line's first row */
  .flash > a.alone { margin-block: -10px; } /* the flash keeps its height */
  textarea { font-size: 16px; } /* iOS zooms into a field under 16 px */
}

/* == Windows contrast themes: the current tab keeps a mark besides its weight == */
@media (forced-colors: active) {
  .ws a[aria-current="page"] { text-decoration: underline 2px; text-underline-offset: 4px; }
}

/* == Print (the recovery kit) == */
@media print {
  body { background: #ffffff; color: #000000; }
  .top, .flash, .noprint, .lead { display: none !important; }
  main { max-width: none; padding: 0; }
  .panel, .card, pre { background: none; border: 0; padding: 0; }
}
