/* Lunomi portal. Taste Skill "framed sheet" app style: one tinted L-frame (sidebar + top bar) and the work on a
   white sheet inset 8px, hairline edges, no shadows. Brand: Tiffany blue on white and black, flat colour only, as on
   the home page. The blue (--brand) goes on the mark, data (chart bars, credit runway), the selected nav item and the
   sign-in ground; a deep teal (--accent) carries accent text and focus, because the blue is too pale for text.
   Grid: canvas padding 24, one gap of 24 both ways; two-up rows = 2 × 1fr + 24; main rows = 2fr + 1fr + 24.
   Type scale: 12 / 14 / 16 / 22 (title) / 26 (KPI) / 32 (the one answer figure). Weights 400 / 500 / 600. */

@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/ibm-plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/ibm-plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("fonts/ibm-plex-mono-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ground: #f2f5f5;  --surface: #ffffff;  --raised: #f5f8f8;  --active: #dcf2ef;
  --border: #e2e8e7;  --rule: #edf1f0;     --control: #c8d1d0;  --control-hover: #a7b2b0;
  --text: #111414;    --muted: #59625f;    --faint: #687270;
  --primary: #111414; --primary-hover: #2b3231; --on-primary: #ffffff;
  --accent: #0a6b64;  --accent-soft: #e6f6f4; --focus-ring: rgba(10, 107, 100, .2);
  --brand: #81d8d0;   --brand-hover: #6ccdc4; --on-brand: #0b2b28; --on-brand-muted: #22504b;
  --auth-ground: #81d8d0; --auth-ink: #0b2b28; --auth-muted: #22504b; --auth-moon: #0b2b28; --auth-card-line: transparent;
  --positive: #1e7b4f; --negative: #c4242a;
  --pill-pos-bg: #dcfae5; --pill-pos-ink: #04250e;
  --pill-neg-bg: #ffedea; --pill-neg-ink: #831c1e; --pill-neg-line: #f8cfc8;
  --pill-warn-bg: #fffbeb; --pill-warn-ink: #92400e; --pill-warn-line: #fde68a;
  --pill-neutral-bg: #e8ebf0; --pill-neutral-ink: #353a42;
  --grid: #e6ecec; --track: #e3ebea;
  --radius-sheet: 10px; --radius-card: 8px; --radius-control: 6px; --radius-chip: 4px;
  --gap: 24px; --pad: 24px; --control-h: 34px; --field-h: 40px;
  --font: "Plex", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Plex Mono", "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ease: 120ms ease;
  color-scheme: light;
}
/* dark, when chosen with the switch (theme.js sets data-theme; "System" follows the device) */
:root[data-theme="dark"] {
  --ground: #0b0d0d;  --surface: #111515;  --raised: #171c1c;  --active: #12302d;
  --border: #232a29;  --rule: #1b2121;     --control: #37413f;  --control-hover: #505b59;
  --text: #eef3f2;    --muted: #a0aba9;    --faint: #8a9593;
  --primary: #eef3f2; --primary-hover: #cfd8d6; --on-primary: #0b0d0d;
  --accent: #81d8d0;  --accent-soft: #12302d; --focus-ring: rgba(129, 216, 208, .3);
  --auth-ground: #0b0d0d; --auth-ink: #eef3f2; --auth-muted: #a0aba9; --auth-moon: #81d8d0; --auth-card-line: #232a29;
  --positive: #4cc286; --negative: #f07178;
  --pill-pos-bg: #14291d; --pill-pos-ink: #5fd196;
  --pill-neg-bg: #2c1a1d; --pill-neg-ink: #f58a90; --pill-neg-line: #4a2529;
  --pill-warn-bg: #2b2414; --pill-warn-ink: #e8b04a; --pill-warn-line: #4a3c17;
  --pill-neutral-bg: #252a30; --pill-neutral-ink: #d4d8de;
  --grid: #1f2626; --track: #1f2626;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--ground); color: var(--text); font: 14px/20px var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 2px; text-decoration-thickness: 1px; }
code, .mono { font-family: var(--mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
h1 { font-size: 22px; line-height: 28px; font-weight: 600; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 16px; line-height: 22px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; line-height: 20px; font-weight: 600; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
.skip { position: absolute; left: 8px; top: -48px; z-index: 10; padding: 8px 12px; border-radius: var(--radius-control); background: var(--primary); color: var(--on-primary); text-decoration: none; }
.skip:focus { top: 8px; }

/* ---------- mark ---------- */
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 13px; line-height: 22px; letter-spacing: 0.18em; text-transform: uppercase; }
.mark svg { width: 22px; height: 22px; flex: none; }
.mark .moon { fill: var(--brand); }
.mark .ring { fill: none; stroke: var(--text); stroke-width: 1.5; opacity: .9; }

/* ---------- shell: frame + sheet ---------- */
.frame { display: grid; grid-template-columns: 228px minmax(0, 1fr); grid-template-rows: 48px minmax(0, 1fr); min-height: 100vh; }
.side { grid-row: 1 / 3; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 13px 12px 16px; }
.side .mark { padding: 0 10px; margin-bottom: 25px; align-self: flex-start; }
.nav { display: grid; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: 6px; text-decoration: none; color: var(--muted); transition: background-color var(--ease), color var(--ease); }
.nav a svg { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { color: var(--text); background: var(--raised); }
.nav a.on { background: var(--active); color: var(--text); font-weight: 500; }
.nav a.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 2px 2px 0; background: var(--brand); }
.nav-label { font-size: 12px; line-height: 16px; color: var(--faint); padding: 24px 10px 8px; }
.side .foot { margin-top: auto; display: grid; gap: 8px; padding: 12px 10px 0; }
.side .foot .who { display: grid; min-width: 0; }
.side .foot .who b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .foot .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .foot form .btn.text { margin-left: -6px; }
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 16px 0 8px; min-width: 0; }
.topbar .scope { margin-right: auto; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.topbar .scope b { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.topbar .scope .sep { color: var(--control); }
.topbar .api { color: var(--muted); gap: 8px; font-weight: 400; }
.topbar .api code { color: var(--text); font-size: 12px; }
.sheet { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); margin: 0 8px 8px 0; min-width: 0; }
.canvas { padding: 28px var(--pad) 48px; display: grid; gap: var(--gap); max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 6px; max-width: 68ch; }
.num .sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }   /* the invoiced amount under what was credited */
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.phone-bar { display: none; }

/* ---------- panels ---------- */
.card { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); min-width: 0; }
.card > header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 18px 20px 0; }
.card > header .meta { color: var(--muted); font-size: 12px; line-height: 16px; }
.card > header a.meta { color: var(--text); font-size: 13px; font-weight: 500; text-decoration: none; }
.card > header a.meta:hover { text-decoration: underline; }
.card > header h2 code { font-size: 14px; font-weight: 500; }
.card > header + .table-wrap { margin-top: 8px; }
.card .body { padding: 16px 20px 20px; }
.card.fill { display: flex; flex-direction: column; }
.card.fill > .body { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.card.fill > .body > .push { margin-top: auto; }
.row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.row-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--gap); align-items: stretch; }

/* KPI strip: one container split by hairlines, label above value. */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-card); }
.strip.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.strip.n5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.strip > div { padding: 16px 20px 18px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.strip > div + div { border-left: 1px solid var(--border); }
.strip .k { color: var(--muted); font-size: 13px; line-height: 18px; }
.strip .v { font-size: 26px; line-height: 32px; font-weight: 400; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.strip .v.lead { font-size: 32px; line-height: 38px; letter-spacing: -0.015em; }
.strip .v.neg { color: var(--negative); }
.strip .v small { font-size: 15px; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.strip .s { color: var(--muted); font-size: 12px; line-height: 16px; margin-top: 2px; }

/* Signature element: credit runway, a track as long as the credit bought; what is left is filled in the hue. */
.runway { display: grid; gap: 10px; }
.runway .finding { font-size: 16px; line-height: 22px; }
.runway svg { width: 100%; height: 8px; display: block; border-radius: 4px; }
.runway .track { fill: var(--track); }
.runway .left { fill: var(--brand); }
.runway .ends { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
.runway .ends b { color: var(--text); font-weight: 500; }

/* ---------- chart (server-drawn SVG) ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .base { stroke: var(--control); stroke-width: 1; shape-rendering: crispEdges; }
.chart .bar { fill: var(--brand); }
.chart .bar:hover { fill: var(--brand-hover); }
.chart text { fill: var(--muted); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart.phone { display: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; line-height: 16px; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { height: 46px; padding: 0 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
td.num, th.num { text-align: right; }
td.act { text-align: right; width: 1%; }
td code { font-size: 12.5px; }
td .when { color: var(--muted); margin-right: 4px; }
td .pill { vertical-align: 1px; margin-left: 6px; }
td .pill:first-child { margin-left: 0; }
table.prose td { white-space: normal; height: auto; padding-top: 13px; padding-bottom: 13px; vertical-align: top; }
table.prose td:first-child { white-space: nowrap; }
.dash { color: var(--faint); }
.ph { display: none; }
.setting .empty { margin: 0; }
.empty { margin: 8px 20px 20px; padding: 12px 14px; border: 1px dashed var(--control); border-radius: 8px; color: var(--muted); }
.empty a { color: var(--text); font-weight: 500; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap; flex: none; }
.pill.pos { background: var(--pill-pos-bg); color: var(--pill-pos-ink); }
.pill.neg { background: var(--pill-neg-bg); color: var(--pill-neg-ink); }
.pill.warn { background: var(--pill-warn-bg); color: var(--pill-warn-ink); box-shadow: inset 0 0 0 1px var(--pill-warn-line); }
.pill.neutral { background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }

/* ---------- forms and buttons ---------- */
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; }
.field label { font-weight: 500; }
.field label .muted { font-weight: 400; }
.field .label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field .label-row a { font-size: 13px; color: var(--muted); text-decoration: none; }
.field .label-row a:hover { color: var(--text); text-decoration: underline; }
.field .hint { color: var(--muted); font-size: 12px; line-height: 16px; margin-top: -2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 20px; }
.check input { margin-top: 3px; accent-color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number] {
  height: var(--field-h); padding: 0 12px; border: 1px solid var(--control); border-radius: 8px; background: var(--surface); color: var(--text);
  font: 14px var(--font); width: 100%; min-width: 0; transition: border-color var(--ease), box-shadow var(--ease); }
input::placeholder { color: var(--faint); opacity: 1; }
input:hover { border-color: var(--control-hover); }
input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
input:user-invalid { border-color: var(--negative); }
input:user-invalid:focus-visible { box-shadow: 0 0 0 3px var(--pill-neg-line); }
input:disabled { background: var(--raised); color: var(--muted); }
input[type=number] { font-variant-numeric: tabular-nums; }
input.code { font: 500 22px var(--mono); letter-spacing: 0.3em; text-indent: 0.3em; text-align: center; height: 52px; }
.narrow { max-width: 400px; }
form.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.inline-form .field { min-width: 180px; flex: 1 1 180px; }
.inline-form .field.grow { flex: 2 1 240px; }
.inline-form .field.short { flex: 0 1 240px; }
.inline-form > .btn { height: var(--field-h); margin-top: 28px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-h); padding: 0 14px; border-radius: var(--radius-control);
  font: 500 14px/20px var(--font); cursor: pointer; text-decoration: none; border: 1px solid var(--control); background: var(--surface); color: var(--text); white-space: nowrap;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease); }
.btn:hover { background: var(--raised); border-color: var(--control-hover); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.brand { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.brand:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.block { width: 100%; height: var(--field-h); }
.btn.text { border-color: transparent; background: transparent; padding: 0 6px; color: var(--muted); }
.btn.text:hover { color: var(--text); background: var(--raised); }
.btn.small { font-size: 13px; height: 30px; }
.btn.danger { color: var(--negative); border-color: var(--border); height: 28px; padding: 0 10px; font-size: 13px; }
.btn.danger:hover { background: var(--pill-neg-bg); border-color: var(--pill-neg-line); }
.btn.danger.big-danger { height: 36px; padding: 0 14px; font-size: 14px; }
.legal-note { font-size: 13px; }

/* ---------- the payment page ---------- */
.pay-picker { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 0; }
.pay-picker[hidden], .pay-method[hidden] { display: none; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.pay-method { display: grid; gap: 12px; justify-items: start; align-content: start; }
.pay-warn { max-width: 44ch; padding: 8px 10px; font-size: 13.5px; border-radius: var(--radius-control);
  background: var(--pill-warn-bg); color: var(--pill-warn-ink); box-shadow: inset 0 0 0 1px var(--pill-warn-line); }
.pay-method h3 { display: flex; gap: 10px; align-items: baseline; font-size: 16px; }
.pay-method .qr { width: 208px; height: 208px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 6px; }
.pay-amount { font-size: 15px; }
.pay-amount .num { font-size: 20px; font-weight: 600; }
.pay-dest { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.pay-dest code { overflow-wrap: anywhere; font-size: 12.5px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); }
.consequences { margin: 0; padding-left: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
form.inline { display: inline; }

/* ---------- messages: notice (status), info, error; inside the page, never a full-screen banner ---------- */
.notice, .error, .info { padding: 10px 14px; border-radius: 8px; line-height: 20px; border: 1px solid transparent; }
.notice { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.info { background: var(--raised); border-color: var(--border); }
.error { background: var(--pill-neg-bg); color: var(--pill-neg-ink); border-color: var(--pill-neg-line); }
.notice a, .error a, .info a { color: inherit; font-weight: 500; }

/* ---------- code blocks ---------- */
.code { position: relative; }
.code pre { margin: 0; padding: 14px 84px 14px 16px; background: var(--raised); border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; font: 13px/20px var(--mono); tab-size: 2; }
.code pre .k { color: var(--accent); }
.code .copy { position: absolute; top: 8px; right: 8px; height: 28px; min-width: 64px; font-size: 12px; padding: 0 10px; background: var(--surface); }
.code .copy.done { color: var(--positive); }
.code.one pre { padding-top: 10px; padding-bottom: 10px; }
.code.one .copy { top: 50%; margin-top: -14px; }
.newkey { border-color: var(--accent); }
.newkey pre { font-size: 14px; word-break: break-all; white-space: pre-wrap; }

/* ---------- docs ---------- */
.toc { display: flex; flex-wrap: wrap; gap: 6px; }
.toc a { text-decoration: none; height: 30px; display: inline-flex; align-items: center; padding: 0 12px; background: var(--raised); border-radius: 999px; color: var(--muted); transition: background-color var(--ease), color var(--ease); }
.toc a:hover { color: var(--text); background: var(--active); }
.doc-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.doc-section h3 { margin-top: 8px; }
.doc-section h3:first-child { margin-top: 0; }
.doc-section .field > .key, .kv dt { color: var(--muted); }
[id] { scroll-margin-top: 16px; }

/* ---------- settings rows ---------- */
.setting { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 32px; padding: 28px 0; border-top: 1px solid var(--border); }
.setting:first-of-type { border-top: 0; padding-top: 4px; }
.setting:last-of-type { padding-bottom: 4px; }
.setting .desc { color: var(--muted); margin-top: 4px; max-width: 38ch; }
.setting .table-wrap { margin-top: -8px; }
.setting th:first-child, .setting td:first-child { padding-left: 0; }
.setting th:last-child, .setting td:last-child { padding-right: 0; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px 32px; margin: 0; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; background: var(--auth-ground); color: var(--auth-ink); }
.auth .panel > .mark .ring { stroke: var(--auth-ink); }
.auth .panel > .mark .moon { fill: var(--auth-moon); }
.auth .panel .card { color: var(--text); border-color: var(--auth-card-line); }
:root[data-theme="dark"] .auth .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); } .auth .btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.auth .panel { width: min(400px, 100%); display: grid; gap: 24px; }
.auth .panel > .mark { justify-self: start; }
.auth .panel .card { padding: 28px; display: grid; gap: 20px; }
.auth .lede { color: var(--muted); margin-top: 6px; }
.auth .lede b { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.auth .card > a.small { justify-self: start; color: var(--muted); }
.auth .card > a.small:hover { color: var(--text); }
.auth .card > form + form { margin-top: -8px; }
.auth .card > form + form .btn.text { margin-left: -6px; }
.auth .alt { text-align: center; color: var(--auth-muted); }
.auth .alt a { color: var(--auth-ink); font-weight: 600; }
.btn.google .g { flex: none; }
.auth .or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; line-height: 16px; }
.auth .or::before, .auth .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth .legal { color: var(--auth-muted); font-size: 12px; line-height: 16px; text-align: center; }
.limits-note { color: var(--muted); font-size: 13px; line-height: 20px; margin-top: 12px; max-width: 80ch; }

/* ---------- questions (docs) ---------- */
.qa { display: grid; }
.qa details { border-top: 1px solid var(--rule); }
.qa details:first-child { border-top: 0; }
.qa summary { list-style: none; cursor: pointer; position: relative; padding: 12px 28px 12px 0; font-weight: 500; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary::after { content: "+"; position: absolute; right: 0; top: 12px; color: var(--muted); }
.qa details[open] summary::after { content: "\2212"; }
.qa details p { padding: 0 0 14px; color: var(--muted); max-width: 72ch; }

/* ---------- theme switch ---------- */
.theme { display: grid; gap: 6px; }
.theme-label { font-size: 12px; line-height: 16px; color: var(--faint); }
.theme-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); justify-self: start; }
.theme-switch button { height: 28px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font: 500 12.5px/1 var(--font); cursor: pointer; }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--active); color: var(--text); }
.side .theme { padding: 16px 10px 4px; }
.phone-bar .theme { padding: 4px 10px 12px; }

/* ---------- tablet and phone ---------- */
@media (max-width: 900px) {
  .frame { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .side, .topbar { display: none; }
  .phone-bar { display: block; padding: 0 16px; position: sticky; top: 0; z-index: 5; background: var(--ground); }
  .phone-bar summary { list-style: none; display: flex; align-items: center; justify-content: space-between; height: 52px; cursor: pointer; }
  .phone-bar summary::-webkit-details-marker { display: none; }
  .phone-bar .menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-right: -11px; }
  .phone-bar .menu-icon { width: 22px; height: 22px; stroke: var(--text); fill: none; stroke-width: 1.6; stroke-linecap: round; }
  .phone-bar .menu-icon .x { display: none; }
  .phone-bar[open] .menu-icon .bars { display: none; }
  .phone-bar[open] .menu-icon .x { display: inline; }
  .phone-bar[open] { padding-bottom: 16px; border-bottom: 1px solid var(--border); max-height: 100vh; overflow-y: auto; }
  .phone-bar .who { color: var(--muted); padding: 4px 10px 8px; font-size: 12px; line-height: 16px; }
  .phone-bar .nav { padding: 4px 0 12px; }
  .phone-bar .nav a { height: 44px; }
  .sheet { margin: 0; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
  .canvas { padding: 20px 16px 40px; gap: 20px; }
  .row-2, .row-main { grid-template-columns: minmax(0, 1fr); }
  .strip, .strip.n3, .strip.n5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip > div:nth-child(odd) { border-left: 0; }
  .strip > div:nth-child(n+3) { border-top: 1px solid var(--border); }
  .strip.n3 > div:last-child, .strip.n5 > div:last-child { grid-column: 1 / -1; }
  .strip > div { padding: 14px 16px 16px; }
  .strip .v { font-size: 22px; line-height: 28px; }
  .strip .v.lead { font-size: 28px; line-height: 34px; }
  .setting { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 24px 0; }
  .card > header { padding: 16px 16px 0; }
  .card .body { padding: 14px 16px 16px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .empty { margin: 8px 16px 16px; }
  .btn { height: 40px; }
  .btn.danger { height: 32px; }
  .code .copy { height: 32px; }
  .code.one .copy { margin-top: -16px; }
}
@media (max-width: 640px) {
  .chart.wide { display: none; }
  .chart.phone { display: block; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1 1 0; }
  .inline-form > .btn { margin-top: 0; width: 100%; }
  .inline-form .field.short { flex: 1 1 180px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .code:not(.one) pre { padding: 50px 16px 14px; }
  .auth { padding: 24px 16px; place-items: start center; }
  .auth .panel .card { padding: 24px 20px; }
  .kv dd + dt { margin-top: 10px; }
  /* Tables become lists of two-line rows: the identity and key figure on line 1, the other fields in grey on line 2. */
  table.list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.list tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
  table.list tbody tr:last-child { border-bottom: 0; }
  table.list td { display: block; height: auto; padding: 0; border: 0; white-space: nowrap; }
  table.list td.id { order: 1; flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
  table.list td.id .when { font-weight: 400; }
  table.list td.lead { order: 2; text-align: right; }
  table.list tr::after { content: ""; order: 3; flex-basis: 100%; height: 4px; }
  table.list td.meta { order: 4; color: var(--muted); font-size: 13px; line-height: 20px; }
  table.list td.meta + td.meta::before { content: "· "; color: var(--faint); }
  table.list td[data-label]::after { content: " " attr(data-label); }
  table.list td.act { order: 5; margin-left: auto; width: auto; }
  table.list .ph { display: inline; }
  table.list .dk { display: none; }
  table.list .btn.danger { height: 24px; padding: 0 2px; border: 0; background: none; }
  table.list .btn.small { height: 32px; }
  table.list td.meta .dash { color: inherit; }
  .setting table.list tr { padding-left: 0; padding-right: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .btn:active { transform: none; } }
