/* The dashboard's styles (docs/designs/0002-dashboard-ui). Colors are tokens, each defined once for both themes.
   Blocks lay themselves out by the width of the area they are in. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f4f6f8, #11161b);
  --surface: light-dark(#ffffff, #1a2129);
  --soft: light-dark(#eaeef2, #222b35);
  --fg: light-dark(#17202a, #e7ecf1);
  --muted: light-dark(#52606d, #a0adba);
  --line: light-dark(#d3dae1, #33404d);
  --accent: light-dark(#1c5f94, #86bdea);
  --accent-fg: light-dark(#ffffff, #0d1a26);
  --accent-soft: light-dark(#e1edf7, #1f3345);
  --focus: light-dark(#1c5f94, #86bdea);
  --ok: light-dark(#1d6b3a, #86d19c);
  --ok-bg: light-dark(#e0f2e6, #17301f);
  --warn: light-dark(#7d5200, #e9bd6b);
  --warn-bg: light-dark(#fbeed2, #352810);
  --err: light-dark(#a3271f, #f39a90);
  --err-bg: light-dark(#fbe4e1, #3d1c19);
  --shade: rgb(10 16 22 / 0.5);
  --shadow: 0 1px 2px light-dark(rgb(16 30 44 / 0.08), rgb(0 0 0 / 0.4));
  --lift: 0 8px 30px rgb(0 0 0 / 0.22);
  --qr-ground: #fff;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 12px;
  --header-h: 58px;
  --sidebar-w: 248px;
  --tap: 40px;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--body); }
a { color: var(--accent); }
p { margin: 0 0 12px; overflow-wrap: anywhere; }
h1 { margin: 0; font-size: 24px; line-height: 1.25; text-wrap: balance; overflow-wrap: anywhere; }
h2 { margin: 24px 0 8px; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
h3 { margin: 24px 0 8px; font-size: 15px; }
ul, ol { margin: 0 0 12px; padding-left: 20px; }
code, pre, .mono { font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
pre { margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--soft); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
pre span { display: inline-block; max-width: 100%; }
kbd { font: 12px var(--body); padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--soft); color: var(--muted); }
svg.i { width: 20px; height: 20px; fill: currentColor; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
main:focus, [tabindex="-1"]:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 8px; z-index: 50; padding: 10px 14px; background: var(--surface); border-radius: var(--radius-sm); }

/* buttons and fields */
button, .btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); min-width: var(--tap); padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--fg); cursor: pointer; text-decoration: none; transition: background 0.15s ease, border-color 0.15s ease; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.danger { color: var(--err); border-color: var(--err); }
.ghost { border-color: transparent; background: transparent; padding: 0 9px; }
button:disabled { color: var(--muted); background: var(--soft); border-color: var(--line); cursor: default; }
@media (hover: hover) {
  button:not(:disabled):hover, .btn:hover { background: var(--soft); }
  .primary:not(:disabled):hover { background: color-mix(in srgb, var(--accent) 86%, var(--fg)); }
  .danger:not(:disabled):hover { background: var(--err-bg); }
  tr:has(td.t a):hover, a.row:hover { background: var(--soft); }
}
input, select, textarea { font: inherit; width: 100%; min-width: 0; min-height: var(--tap); padding: 6px 10px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
input[type="checkbox"] { width: 20px; min-height: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
textarea { font: 13px/1.5 var(--mono); padding: 10px 12px; resize: vertical; }
fieldset { margin: 0 0 14px; padding: 0; border: 0; min-width: 0; }
.field { margin: 0 0 18px; max-width: 460px; }
.field label, .field .label { display: block; font-weight: 600; }
.field .hint { margin: 2px 0 6px; font-size: 14px; }
.field.check { margin-bottom: 4px; }
.field.check label { display: flex; align-items: center; gap: 10px; min-height: var(--tap); font-weight: 400; }
.field.bad input, .field.bad select { border-color: var(--err); box-shadow: 0 0 0 1px var(--err); }
.field.good input, .field.good select { border-color: var(--ok); }
.field.settled .ok { margin: 2px 0 0; }
.field-error { margin: 6px 0 0; color: var(--err); font-size: 14px; font-weight: 600; }
.secret-row { display: flex; gap: 8px; }
.optional { color: var(--muted); font-weight: 400; }
.fields { display: grid; gap: 0 20px; align-items: start; }
.problems { margin: 0 0 18px; padding: 12px 16px; border: 1px solid var(--err); border-radius: var(--radius); background: var(--err-bg); color: var(--err); }
.problems p { margin: 0 0 4px; font-weight: 600; }
.problems p:last-child { margin: 0; }
.problems ul { margin: 0; }
.problems a { color: inherit; display: inline-block; padding: 3px 0; }
.hint { color: var(--muted); }
.ok { color: var(--ok); }
.good-news { margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius); background: var(--ok-bg); color: var(--ok); }
.error { color: inherit; }

/* header */
.head { position: sticky; top: 0; z-index: 10; height: calc(var(--header-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) max(18px, env(safe-area-inset-right, 0px)) 0 max(18px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-height: var(--tap); color: var(--fg); font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: -0.01em; }
.brand svg { width: 32px; height: 32px; flex: none; }
.head .brand { width: calc(var(--sidebar-w) - 30px); min-width: var(--tap); flex: none; }
.search { flex: 1; max-width: 560px; justify-content: flex-start; color: var(--muted); background: var(--bg); }
.search .long { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search kbd { margin-left: auto; white-space: nowrap; }
.menu-btn { display: none; position: relative; }
.count { position: absolute; top: 1px; right: -1px; min-width: 18px; padding: 0 5px; font-size: 11.5px; line-height: 18px; font-weight: 700; text-align: center; border-radius: 9px; background: var(--err); color: var(--surface); }
.menu { margin-left: auto; position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.pill { border-radius: 22px; padding: 0 10px 0 6px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 12; width: 268px; padding: 6px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--lift); animation: rise 0.15s ease; }
.menu-body .id { margin: 0 0 4px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); }
.menu-body .id small { display: block; color: var(--muted); font-size: 14px; }
.mi { width: 100%; display: flex; justify-content: flex-start; align-items: center; gap: 10px; min-height: var(--tap); padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--fg); text-decoration: none; }
.mi kbd { margin-left: auto; }
@media (hover: hover) { .mi:hover { background: var(--soft); } }
.theme { padding: 4px 12px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.theme > span { font-size: 12px; font-weight: 500; color: var(--muted); }
.theme > div { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 4px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.theme button { border: 0; border-radius: 0; padding: 0; }
.theme button[aria-pressed="true"], .theme button[aria-pressed="true"]:hover { background: var(--accent); color: var(--accent-fg); }

/* sidebar */
.body { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.side { position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); align-self: start; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h) - env(safe-area-inset-top, 0px)); overflow: auto; padding: 12px 10px 12px max(10px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 2px; background: var(--soft); border-right: 1px solid var(--line); }
.side > a { flex: none; display: flex; align-items: center; gap: 10px; height: var(--tap); padding: 0 12px; border-radius: var(--radius-sm); color: var(--fg); text-decoration: none; transition: background 0.15s ease; }
.side > a > span:not(.n) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side > a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
@media (hover: hover) { .side > a:not([aria-current]):hover { background: color-mix(in srgb, var(--soft) 55%, var(--line)); } }
.side .n { margin-left: auto; padding: 0 7px; font-size: 12px; font-weight: 600; border-radius: 10px; background: var(--err-bg); color: var(--err); }
.side h3 { margin: 14px 12px 4px; font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.side .foot { margin: auto 0 0; padding: 12px 12px 4px; font-size: 12px; color: var(--muted); }
.side .shut, .scrim { display: none; }

/* page */
.main { container: main / inline-size; min-width: 0; padding: 28px max(32px, env(safe-area-inset-right, 0px)) calc(64px + env(safe-area-inset-bottom, 0px)) 32px; }
.cap { max-width: 1680px; margin: 0 auto; }
.read { max-width: 820px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-bottom: 20px; }
.page-head > div { flex: 1 1 260px; min-width: 0; }
.lede { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.card { min-width: 0; margin: 0 0 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > h2:first-child, .bar h2 { margin: 0 0 8px; font-size: 16px; }
.card > :last-child { margin-bottom: 0; }
.stack, .cols { display: grid; gap: 14px; align-content: start; min-width: 0; margin: 0 0 14px; }
.stack > *, .cols > * { min-width: 0; margin: 0; }
.cols > .stack { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 14px; }
.stat { padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.stat > span { display: block; font-size: 12px; color: var(--muted); }
.stat b { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 12px; font-size: 13px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge svg.i { width: 15px; height: 15px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.acc { background: var(--accent-soft); color: var(--accent); }
.banner { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 14px; padding: 12px 16px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn); }
.banner.critical { background: var(--err-bg); color: var(--err); }
.banner a { color: inherit; font-weight: 600; display: inline-block; padding: 3px 0; }
.kv { display: grid; grid-template-columns: minmax(96px, 150px) minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); overflow-wrap: anywhere; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv pre { margin: 0; }
.empty { text-align: center; padding: 28px 18px; color: var(--muted); margin: 0; }
.steps { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; counter-reset: step; margin: 0 0 20px; padding: 0; color: var(--muted); }
.steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); font-size: 13px; background: var(--surface); }
.steps [aria-current] { color: var(--fg); font-weight: 600; }
.steps [aria-current]::before { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.steps .done::before { background: var(--ok-bg); border-color: var(--ok-bg); color: var(--ok); }
.choices { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); margin: 0 0 14px; padding: 0; list-style: none; }
.choices a { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center; height: 100%; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: inherit; text-decoration: none; transition: background 0.15s ease; }
.choices svg { color: var(--accent); }
.choices small { grid-column: 2; color: var(--muted); font-size: 14px; }
@media (hover: hover) { .choices a:hover, a.stat:hover { background: var(--soft); } }

/* lists */
.list { container: list / inline-size; padding: 0; overflow: clip; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 18px; }
.bar h2 { margin: 0; }
.bar > .btn { margin-left: auto; }
.bar > .find + .btn { margin-left: 0; }
.find { position: relative; display: flex; gap: 8px; flex: 1 1 220px; max-width: 360px; margin: 0 0 0 auto; }
.find svg { position: absolute; left: 10px; top: 50%; margin-top: -10px; color: var(--muted); }
.find input { padding-left: 38px; }
.find[data-live] button { display: none; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; padding: 8px 14px; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); background: var(--soft); font-weight: 600; }
td { padding: 8px 14px; border-top: 1px solid var(--line); vertical-align: middle; overflow-wrap: break-word; }
th:first-child, td:first-child { padding-left: 18px; }
tr { position: relative; }
td.t { overflow-wrap: anywhere; min-width: 8rem; }
td.t b, td.t a { font-weight: 600; }
td.t a { display: inline-flex; align-items: center; min-height: 36px; }
td.t a::after { content: ""; position: absolute; inset: 0; }
td.act { text-align: right; }
td.act > * { position: relative; z-index: 1; }
td.num { font-variant-numeric: tabular-nums; }
.x { display: none; }
.rows { margin: 0; padding: 0; list-style: none; }
a.row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 18px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; transition: background 0.15s ease; }
a.row > span:first-child { flex: 1; min-width: 0; }
a.row b { font-weight: 600; overflow-wrap: anywhere; }
a.row small { display: block; color: var(--muted); font-size: 14px; }

/* charts, output, keys */
.vitals { display: grid; gap: 18px; }
.chart p { display: flex; align-items: baseline; gap: 8px; margin: 0 0 4px; }
.chart p b { margin-left: auto; font-variant-numeric: tabular-nums; }
.chart svg { display: block; width: 100%; height: 64px; color: var(--accent); }
.chart small { color: var(--muted); font-size: 13px; }
.output { max-height: 70vh; overflow: auto; }
.output.error { border-left: 3px solid var(--err); }
.diff .add { background: var(--ok-bg); color: var(--ok); display: block; }
.diff .del { background: var(--err-bg); color: var(--err); display: block; }
.diff .same { display: block; }
.key { display: grid; gap: 16px; }
.key .code { display: grid; gap: 8px; justify-items: start; }
.key svg.qr { width: 200px; height: 200px; max-width: 100%; border-radius: var(--radius-sm); background: var(--qr-ground); }
.key-text { display: grid; gap: 8px; align-content: start; min-width: 0; }
.key-text label { font-weight: 600; }
.key-text input { font-family: var(--mono); }
.key details summary { display: flex; align-items: center; min-height: var(--tap); cursor: pointer; color: var(--accent); }
code.recovery { display: block; padding: 14px; border-radius: var(--radius-sm); background: var(--soft); font-size: 15px; letter-spacing: 0.03em; }
.phone-only, .phone-only-block { display: none; }
.details { overflow: clip; }

/* pages of their own: sign-in, step-up, first run */
.alone { max-width: 460px; margin: 0 auto; padding: calc(28px + env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) 56px max(20px, env(safe-area-inset-left, 0px)); }
.alone.wide { max-width: 1080px; }
.alone .brand { margin-bottom: 16px; }
.alone h1 { margin-bottom: 12px; }
.first-run { display: grid; gap: 14px; align-items: start; }
.first-run .card { margin: 0; }
.first-run form { display: grid; gap: 14px; min-width: 0; }
.first-run .problems { margin: 0; }
.go { display: flex; flex-wrap: wrap; gap: 8px; }

/* dialogs: drawn open by the hub; the script makes them modal */
dialog { padding: 0; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--lift); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: clip; }
dialog.small { width: min(420px, calc(100vw - 32px)); }
dialog.large { width: min(760px, calc(100vw - 32px)); }
dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; animation: rise 0.18s ease; }
dialog[open]:not(:modal) { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 30; box-shadow: 0 0 0 100vmax var(--shade); }
dialog::backdrop { background: var(--shade); animation: fade 0.18s ease; }
dialog > form:not(.d-f) { display: contents; }
.d-h { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--line); }
.d-h h2 { margin: 0; font-size: 17px; flex: 1; }
.d-b { padding: 18px; overflow: auto; overscroll-behavior: contain; }
.d-b > :last-child { margin-bottom: 0; }
.d-b .field { max-width: none; }
.d-f { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); margin: 0; }
.zone { margin: 20px -18px -18px; padding: 16px 18px; border-top: 1px solid var(--line); }
.zone h3 { margin: 0 0 4px; font-size: 15px; }
.zone p { margin: 0 0 10px; color: var(--muted); }
.update-notice { position: fixed; z-index: 40; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; width: max-content; max-width: calc(100vw - 32px); display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--lift); animation: rise 0.2s ease; }
.update-notice p { margin: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(-100%); } }
/* what a shortcut opens or closes doesn't animate */
html[data-instant] *, html[data-instant] *::backdrop { animation: none !important; transition: none !important; }

/* wider areas: columns, and more of each list */
@container main (min-width: 520px) { .vitals { grid-template-columns: 1fr 1fr; } }
@container main (min-width: 660px) { .pair { grid-template-columns: 1fr 1fr; } }
@container main (min-width: 660px) and (max-width: 1079.9px) { .attend > .stack, .facts > .stack:first-child { grid-template-columns: 1fr 1fr; } }
@container main (min-width: 1080px) {
  .attend { grid-template-columns: 380px minmax(0, 1fr); }
  .facts { grid-template-columns: 360px minmax(0, 1fr); }
  .sided { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}
@container list (min-width: 960px) { .x { display: table-cell; } }
@container main (min-width: 1400px) { .vitals { grid-template-columns: repeat(4, 1fr); } .trio { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 641px) { .key { grid-template-columns: 200px minmax(0, 1fr); } .d-b .fields.two, .first-run .fields.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .first-run { grid-template-columns: minmax(0, 1fr) 300px; } }

/* a list too narrow for its columns: a card per row, each value labeled */
@container list (max-width: 740px) {
  .bar { padding: 12px 16px; }
  .find { flex-basis: 100%; max-width: none; margin: 0; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px; padding: 10px 16px; border-top: 1px solid var(--line); }
  tr::after { content: ""; order: 2; flex: 0 0 100%; height: 0; }
  td, td:first-child { display: block; padding: 0; border: 0; overflow-wrap: anywhere; }
  td.t { flex: 1 1 0; min-width: 45%; }
  td.t a { min-height: 32px; }
  td.state, td.act { margin-left: auto; order: 1; }
  td[data-label] { order: 3; font-size: 14px; }
  td[data-label]::before { content: attr(data-label) " "; color: var(--muted); }
  td.x { display: none; }
}

/* icons only */
@media (min-width: 861px) and (max-width: 1180px) {
  .body { grid-template-columns: 64px minmax(0, 1fr); }
  .head .brand { width: auto; }
  .side { padding: 12px 8px; }
  .side > a { justify-content: center; padding: 0; position: relative; }
  .side > a > span:not(.n), .side .foot { display: none; }
  .side h3 { height: 1px; margin: 8px; background: var(--line); font-size: 0; }
  .side .n { position: absolute; top: 2px; right: 2px; margin: 0; padding: 0 5px; font-size: 11px; }
  .main { padding: 24px 24px 56px; }
}
/* drawer */
@media (max-width: 860px) {
  .body { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .head { gap: 6px; padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
  .head .brand { width: auto; justify-content: center; }
  .head .brand span, .pill .name, .search .long, .search kbd { display: none; }
  .search { flex: none; margin-left: auto; padding: 0 11px; background: transparent; border-color: transparent; color: var(--fg); }
  .menu { margin-left: 0; }
  .side { position: fixed; z-index: 21; top: 0; left: 0; width: min(320px, 90vw); height: 100vh; height: 100dvh; padding-top: calc(12px + env(safe-area-inset-top, 0px)); display: none; background: var(--surface); }
  .side:target { display: flex; animation: slide 0.2s ease; }
  .side .shut { display: flex; justify-content: space-between; align-items: center; padding: 0 0 8px 12px; }
  body:has(.side:target) .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: var(--shade); }
  body:has(.side:target) { overflow: hidden; }
  .main { padding: 20px 24px calc(56px + env(safe-area-inset-bottom, 0px)); }
}
/* phone */
@media (max-width: 640px) {
  :root { --tap: 44px; }
  body { font-size: 16px; }
  input, select { font-size: 16px; }
  textarea { font-size: 16px; }
  h1 { font-size: 22px; }
  .main { padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(48px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
  .page-head { margin-bottom: 16px; }
  .page-head > .btn, .page-head > form, .page-head > form > button { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 10px 12px; }
  .card { padding: 14px 16px; }
  .card.list { padding: 0; }
  a.row { padding: 10px 16px; }
  .kv { gap: 6px 12px; grid-template-columns: minmax(108px, 34%) minmax(0, 1fr); }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions form, .actions form > button { width: 100%; display: flex; }
  .actions > :only-child { grid-column: 1 / -1; }
  .card > button, .card > .btn { width: 100%; }
  .phone-only { display: flex; }
  .phone-only-block { display: block; }
  .desk-only { display: none !important; }
  .key { grid-template-columns: minmax(0, 1fr); }
  .guide { display: none; }
  .alone { padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 0; }
  .go { position: sticky; bottom: 0; z-index: 5; margin: 0 -16px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); }
  .go > * { flex: 1 1 100%; }
  dialog, dialog.small, dialog.large { width: calc(100vw - 20px); max-width: none; max-height: calc(100dvh - 20px); margin-bottom: 10px; }
  .d-b { padding: 16px; }
  .d-f { display: grid; grid-template-columns: 1fr 1fr; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .d-f > :only-child { grid-column: 1 / -1; }
  .zone { margin: 20px -16px -16px; padding: 16px; }
  .zone .btn, .zone button { width: 100%; }
  .update-notice { left: 10px; right: 10px; translate: none; width: auto; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, *::backdrop { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
