/* internal/webui/static/theme.css
   Brand palette: X8, built on the A5 palette (cyan accent, slate neutrals,
   green success, red danger), shared with thrum.team. Source of truth:
   pro.thrum.team src/styles/tokens.css @ 64f5990 (token table there lists the
   measured WCAG ratios and the retired-for-text colours). Values below are
   copied from that file; do not invent off-palette colours. Same theme
   mechanism: dark = bare :root, light = html[data-theme="light"].
   Token -> palette: ground=bg, surface=panel, surface-2=surface-alt (unused now), ink=text,
   ink-secondary=text-secondary, ink-muted=text-muted, heading=heading,
   rule=border, link/link-hover=link/link-hover, accent=accent (bright accent:
   borders, icons, decor fills only, NOT text; also the 1px border-strong of
   outline buttons and form controls, which must meet 3:1), accent-fill/-hover/
   on-accent=button-bg/-hover-bg/-text, accent-tint=accent-tint (hover fill,
   info alert fill), focus-ring=focus-ring, success/danger=green/red (text,
   icons, alert border), success-low/-high and danger-low/-high=green/red
   -low (alert fill) and -high (text on -low), code-bg/code-inline-bg,
   selection-bg/-text. Never use accent-bright or neutral-ui. In dark the
   palette collapses surface-alt = panel = code-bg, so hover/zebra/inset
   states use accent-tint and ground/surface alternation, not surface-2.
   Fonts are self-hosted OFL variable woff2 files under /static/fonts/
   (licenses alongside); no third-party font requests. Bricolage Grotesque =
   display/headings, Hanken Grotesk = body, JetBrains Mono = code. System
   stacks remain as fallbacks.
   CSP is style-src 'self': no style="" attributes anywhere in templates; use
   classes defined here (e.g. .hp for the support-form honeypot). */

@font-face { font-family: "Bricolage Grotesque"; src: url("/static/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Hanken Grotesk"; src: url("/static/fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

:root {
  --ground: #0a0e1a;
  --surface: #0f172a;
  --surface-2: #0f172a;
  --ink: #e2e8f0;
  --ink-secondary: #cbd5e1;
  --ink-muted: #94a3b8;
  --heading: #f8fafc;
  --rule: #133146;
  --link: #38bdf8;
  --link-hover: #7dd3fc;
  --accent: #0891b2;
  --accent-fill: #38bdf8;
  --accent-fill-hover: #7dd3fc;
  --on-accent: #0a0e1a;
  --focus-ring: #38bdf8;
  --accent-tint: #133146;
  --code-bg: #0f172a;
  --code-inline-bg: #0f2030;
  --selection-bg: #0c4a6e;
  --selection-text: #f8fafc;
  --success: #10b981;
  --success-low: #0b2829;
  --success-high: #6ee7b7;
  --danger: #ef4444;
  --danger-low: #2c1620;
  --danger-high: #fca5a5;
  --shadow: 0 0 20px rgba(56, 189, 248, .1);

  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --radius: 8px;
  --radius-sm: 5px;
  --measure: 66ch;

  /* legacy names still referenced by older rules/templates */
  --text-muted: var(--ink-muted);
  --text-secondary: var(--ink-secondary);
  --border: var(--rule);
}
html[data-theme="light"] {
  --ground: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #e9eef4;
  --ink: #0f172a;
  --ink-secondary: #334155;
  --ink-muted: #475569;
  --heading: #0f172a;
  --rule: #cbd5e1;
  --link: #0e7490;
  --link-hover: #155e75;
  --accent: #0891b2;
  --accent-fill: #0e7490;
  --accent-fill-hover: #155e75;
  --on-accent: #ffffff;
  --focus-ring: #0e7490;
  --accent-tint: #e6f1f6;
  --code-bg: #f8fafc;
  --code-inline-bg: #e6f1f6;
  --selection-bg: #bae6fd;
  --selection-text: #0f172a;
  --success: #047857;
  --success-low: #d1fae5;
  --success-high: #065f46;
  --danger: #b91c1c;
  --danger-low: #fee2e2;
  --danger-high: #991b1b;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main.container { flex: 1; width: 100%; }
.container { max-width: 68rem; margin: 0 auto; padding: var(--s6) var(--s5); }

/* ---- type ---- */
h1, h2, h3 { color: var(--heading); font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 var(--s4); }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); }
h2 { font-size: 1.375rem; margin-top: 0; }
p { margin: 0 0 var(--s4); max-width: var(--measure); }
code, pre { font-family: var(--font-mono); font-size: .9em; }
code { background: var(--code-inline-bg); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: .1em .4em; overflow-wrap: anywhere; }
.text-muted { color: var(--ink-muted); }
a { color: var(--link); text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

::selection { background: var(--selection-bg); color: var(--selection-text); }

/* ---- focus: always visible ---- */
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* ---- buttons ---- */
.btn, .btn-primary, .btn-ghost, .btn-outline, .btn-destructive, .theme-toggle {
  font-family: var(--font-sans);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.2;
  display: inline-block;
  padding: .65em 1.2em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-fill-hover); color: var(--on-accent); }
.btn-outline { background: transparent; color: var(--link); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent-tint); color: var(--link-hover); border-color: var(--link); }
.btn-ghost { background: transparent; color: var(--link); padding-left: .7em; padding-right: .7em; }
.btn-ghost:hover { background: var(--accent-tint); color: var(--link-hover); }
.btn-destructive { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-destructive:hover { background: var(--danger); color: var(--ground); }
.theme-toggle { background: transparent; color: var(--link); border-color: var(--accent); padding: .45em .7em; font-size: .8125rem; }
.theme-toggle:hover { background: var(--accent-tint); color: var(--link-hover); border-color: var(--link); }
.inline-form { display: inline; margin: 0; }
.hidden { display: none; }

/* ---- nav ---- */
nav.panel {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2);
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
}
nav.panel .brand {
  margin-right: auto; padding: var(--s1) 0;
  font-size: 1.375rem; font-weight: 800; letter-spacing: -.03em;
  display: inline-flex; align-items: center; gap: .5em;
  color: var(--heading); text-decoration: none;
  font-family: var(--font-display);
}
nav.panel .brand img { display: block; flex: none; }
nav.panel a:not(.brand) { font-size: .9375rem; }
nav.panel .btn-primary { margin-left: var(--s2); }

/* admin menu: registry-driven <details>; the open list is an overlay */
nav.panel details.admin-menu { position: relative; }
nav.panel details.admin-menu summary { cursor: pointer; padding: .65em .7em; border-radius: var(--radius-sm); font-weight: 600; font-size: .9375rem; list-style: none; }
nav.panel details.admin-menu summary::-webkit-details-marker { display: none; }
nav.panel details.admin-menu summary { color: var(--link); }
nav.panel details.admin-menu summary::after { content: " \25BE"; color: var(--ink-muted); }
nav.panel details.admin-menu summary:hover { background: var(--accent-tint); color: var(--link-hover); }
nav.panel details.admin-menu[open] > .admin-menu-list {
  display: flex; flex-direction: column;
  position: absolute; left: 0; z-index: 10; min-width: 13rem;
  padding: var(--s2);
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  white-space: nowrap;
}
nav.panel details.admin-menu .admin-menu-list a { color: var(--link); text-decoration: none; padding: .45em .7em; border-radius: var(--radius-sm); }
nav.panel details.admin-menu .admin-menu-list a:hover { background: var(--accent-tint); color: var(--link-hover); }
nav.panel.panel-admin { border-bottom-color: var(--accent); }

/* ---- banner ---- */
/* info/notice strip: cyan -low fill (accent-tint), -high text (link-hover), base border */
.banner { padding: var(--s3) var(--s5); background: var(--accent-tint); color: var(--link-hover); border-bottom: 1px solid var(--accent); font-size: .9375rem; }
.banner a { color: inherit; }

/* ---- panels ---- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s5); margin: 0 0 var(--s5); box-shadow: var(--shadow); }
.panel > :last-child { margin-bottom: 0; }

/* ---- forms ---- */
label { display: flex; flex-direction: column; gap: var(--s1); font-weight: 600; font-size: .9375rem; color: var(--ink-muted); margin: 0 0 var(--s4); }
input, select, textarea {
  font-family: var(--font-sans); font-size: 1rem; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius-sm);
  padding: .6em .75em; width: 100%; min-height: 2.75rem;
}
/* on a panel card or table the field is the page colour, so it reads as inset */
:is(.panel, .table-wrap, table) :is(input, select, textarea) { background: var(--ground); }
textarea { resize: vertical; min-height: 8rem; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-muted); opacity: 1; }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; min-height: 0; height: 1.15rem; accent-color: var(--accent); flex: none; margin: .2em 0 0; }
label.checkbox-label, label:has(> input[type="checkbox"]) { display: block; position: relative; padding-left: 2rem; font-weight: 400; }
label.checkbox-label > input[type="checkbox"], label:has(> input[type="checkbox"]) > input[type="checkbox"] { position: absolute; left: 0; top: .2em; margin: 0; }
form.panel, form.form-card { max-width: 30rem; }
form.panel > button, form.panel > .btn-primary { width: 100%; }
form.panel > .btn-outline { width: auto; margin-top: .75rem; }
.hp { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- disabled ---- */
button:disabled, input:disabled, select:disabled, textarea:disabled, .btn-primary[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--accent-fill); color: var(--on-accent); }
.btn-outline:disabled:hover, .btn-ghost:disabled:hover { background: transparent; color: var(--link); }
.btn-outline:disabled:hover { border-color: var(--accent); }
.btn-destructive:disabled:hover { background: transparent; color: var(--danger); }

/* ---- badges / notices ---- */
.badge { display: inline-block; padding: .15em .6em; border-radius: 999px; font-size: .8125rem; font-weight: 600; line-height: 1.5; border: 1px solid var(--rule); color: var(--ink); background: var(--surface); text-decoration: none; }
a.badge { border-color: var(--accent); }
a.badge:hover { border-color: var(--link); background: var(--accent-tint); color: var(--ink); }
/* non-interactive tier/status/domain label: cyan tint, link text, border-strong border */
.badge-tier { background: var(--accent-tint); border-color: var(--accent); color: var(--link); }
/* selected filter chip (active state): same as the primary button */
.badge-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
/* alerts: hue -low fill, hue -high text, hue base border (never muted text on -low) */
.badge-success { color: var(--success-high); border-color: var(--success); background: var(--success-low); }
.badge-destructive { color: var(--danger-high); border-color: var(--danger); background: var(--danger-low); }
.badge a { color: inherit; }
/* long message badges (errors/notices) wrap like a callout */
p.badge { display: block; border-left-width: 4px; max-width: var(--measure); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); font-weight: 500; font-size: .9375rem; margin-bottom: var(--s4); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s3) 0; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 0 0 var(--s4); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table-wrap table { margin: 0; }
main > table { border: 1px solid var(--rule); background: var(--surface); }
th, td { padding: var(--s3) var(--s4); text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); }
th { background: var(--surface); color: var(--ink); font-weight: 700; }
tr:last-child > td, tr:last-child > th { border-bottom: 0; }
tbody th { background: transparent; }
tbody tr:nth-child(even) { background: var(--ground); }
tbody tr:hover { background: var(--accent-tint); }
td form { margin: 0; }
td textarea { min-height: 4rem; }

/* ---- status dots ---- */
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--ink-muted); }

/* ---- landing ---- */
.landing { padding: var(--s7) 0 var(--s6); }
.landing h1 { font-size: clamp(2.25rem, 1.2rem + 4.5vw, 4.25rem); max-width: 14ch; letter-spacing: -.035em; line-height: 1.04; margin-bottom: var(--s5); }
.landing .lede { font-size: 1.1875rem; max-width: 40rem; color: var(--ink-muted); margin-bottom: var(--s6); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); align-items: center; }
.hero-cta { font-size: 1.0625rem; padding: .8em 1.6em; }
.hum { display: flex; align-items: flex-end; justify-content: space-between; height: 4.5rem; margin: var(--s7) 0 var(--s6); border-bottom: 1px solid var(--rule); }
.hum span { flex: none; width: 4px; height: 100%; background: var(--accent); border-radius: 2px 2px 0 0; transform-origin: bottom; transform: scaleY(.3); opacity: .85; animation: hum 3.2s ease-in-out infinite; }
.hum span:nth-child(7n+1) { animation-delay: -.2s; }
.hum span:nth-child(7n+2) { animation-delay: -.9s; }
.hum span:nth-child(7n+3) { animation-delay: -1.5s; }
.hum span:nth-child(7n+4) { animation-delay: -2.1s; }
.hum span:nth-child(7n+5) { animation-delay: -2.6s; }
.hum span:nth-child(7n+6) { animation-delay: -.5s; }
.hum span:nth-child(3n) { opacity: .5; }
.hum span:nth-child(5n) { opacity: .3; }
@keyframes hum { 0%, 100% { transform: scaleY(.22); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
  .hum span { animation: none; }
  .hum span:nth-child(7n+1) { transform: scaleY(.5); }
  .hum span:nth-child(7n+2) { transform: scaleY(.9); }
  .hum span:nth-child(7n+3) { transform: scaleY(.35); }
  .hum span:nth-child(7n+4) { transform: scaleY(.7); }
  .hum span:nth-child(7n+5) { transform: scaleY(.25); }
  .hum span:nth-child(7n+6) { transform: scaleY(.6); }
  .hum span:nth-child(7n) { transform: scaleY(.45); }
}
.landing-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--s5); }
.landing-links h2 { font-size: 1.125rem; margin-bottom: var(--s2); }
.landing-links p { color: var(--ink-muted); font-size: .9375rem; }

/* ---- pricing ---- */
.pricing-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--s6); align-items: start; max-width: none; }
.price-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--s4); }
.price-option { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s4); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s5); background: var(--ground); }
.price-option .price { margin: 0; }
.price-option-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.price-option .plan-selected { margin: 0; font-size: .8125rem; font-weight: 600; color: var(--link-hover); }
.price-option .btn-primary { width: 100%; }
.price-option form { margin: 0; }
.price-amount { font-size: 1.75rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.feature-list { list-style: none; margin: 0 0 var(--s4); padding: 0; }
.feature-list li { padding: var(--s1) 0 var(--s1) 1.6em; position: relative; }
.feature-list li::before { content: ""; position: absolute; left: .15em; top: .62em; width: .55em; height: .3em; border-left: 2px solid var(--success); border-bottom: 2px solid var(--success); transform: rotate(-45deg); }
.plan-table td:nth-child(4) { color: var(--ink-muted); font-size: .875rem; }

/* ---- activate, account helpers ---- */
.page-narrow { max-width: 34rem; }
.stat-row { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s6); }
.stat-row p { margin: 0; }

/* ---- legal document ---- */
.legal-document-content { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: var(--s5); font-size: .875rem; line-height: 1.6; max-width: 80ch; }

/* ---- footer ---- */
footer.container { width: 100%; padding-top: var(--s5); padding-bottom: var(--s5); border-top: 1px solid var(--rule); margin-top: var(--s6); }
footer p { margin: 0; max-width: none; font-size: .9375rem; }
footer a { color: var(--link); }
footer a:hover { color: var(--link-hover); }

/* ---- small screens ---- */
@media (max-width: 720px) {
  .container { padding: var(--s5) var(--s4); }
  nav.panel { padding: var(--s3) var(--s4); }
  nav.panel .btn-primary { margin-left: 0; }
  nav.panel { position: relative; }
  nav.panel details.admin-menu { position: static; }
  nav.panel details.admin-menu[open] > .admin-menu-list { left: var(--s4); right: var(--s4); min-width: 0; white-space: normal; }
  .landing { padding-top: var(--s5); }
  .pricing-panel { grid-template-columns: minmax(0, 1fr); gap: var(--s5); }
  .hum { height: 3rem; }
  .hum span:nth-child(n+31) { display: none; }
  th, td { padding: var(--s2) var(--s3); }
}

/* Rendered markdown legal documents (legal.RenderMarkdown output). */
.legal-doc { max-width: 70ch; line-height: 1.65; overflow-wrap: anywhere; }
.legal-doc h1, .legal-doc h2, .legal-doc h3, .legal-doc h4 { color: var(--heading); }
.legal-doc h1 { font-size: 1.75rem; line-height: 1.25; margin: var(--s5) 0 var(--s4); }
.legal-doc h2 { font-size: 1.375rem; line-height: 1.3; margin: var(--s5) 0 var(--s3); }
.legal-doc h3 { font-size: 1.125rem; line-height: 1.35; margin: var(--s4) 0 var(--s3); }
.legal-doc h4 { font-size: 1rem; line-height: 1.4; margin: var(--s4) 0 var(--s2); }
.legal-doc p, .legal-doc ul, .legal-doc ol { margin: 0 0 var(--s4); }
.legal-doc ul, .legal-doc ol { padding-left: 1.5em; }
.legal-doc li { margin: 0 0 var(--s2); }
.legal-doc blockquote { margin: 0 0 var(--s4); padding: var(--s2) var(--s4); border-left: 3px solid var(--accent); color: var(--ink); background: var(--accent-tint); }
.legal-doc code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875em; background: var(--code-inline-bg); padding: .1em .3em; border-radius: 3px; }
.legal-doc pre { overflow-x: auto; padding: var(--s3) var(--s4); background: var(--code-bg); border: 1px solid var(--rule); border-radius: var(--radius); }
.legal-doc pre code { background: none; border: 0; padding: 0; }
.legal-doc hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s5) 0; }
.legal-doc .table-wrap { max-width: 100%; }
.legal-doc th, .legal-doc td { border: 1px solid var(--rule); }

/* ---- account area phase 1 (lic-mnpp): plan card, remove link, phone layout ---- */
.plan-card .plan-line { font-size: 1.0625rem; }
.remove-link { font-size: .875rem; font-weight: 400; color: var(--ink-muted); text-decoration: underline; }
.remove-link:hover { color: var(--link-hover); }
/* batch 2 B4: the Remove link sat a few px below the row text (its button padding). */
.machine-table .remove-link { padding-top: 0; padding-bottom: 0; line-height: inherit; vertical-align: baseline; border-color: transparent; }
.machine-table td { vertical-align: baseline; }
/* batch 2 W11: smaller coupon box. */
.coupon-box { padding: var(--s2) var(--s3); margin-top: var(--s4); display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--s2); }
.coupon-box h3 { font-size: .9375rem; font-weight: 600; margin: 0 0 var(--s1, .25rem); flex: 0 0 100%; }
/* Batch 3 item 12: the input and the Apply button share one height. The global input
   min-height (2.75rem) otherwise made the field 44px against a 32px button. */
.coupon-box input[type="text"] { width: 12rem; max-width: 100%; padding: .3em .5em; font-size: .875rem; box-sizing: border-box; line-height: 1.2; height: 2.25rem; min-height: 2.25rem; }
.coupon-box .btn-outline { padding: .3em .8em; font-size: .875rem; box-sizing: border-box; line-height: 1.2; align-self: stretch; height: 2.25rem; min-height: 2.25rem; }
/* form.panel > .btn-outline adds a top margin for the Cancel button on /activate; the coupon
   Apply button sits in the same row as its input and must not inherit it (specificity 0,3,1 beats 0,2,1). */
form.panel.coupon-box > .btn-outline { margin-top: 0; }
/* trial-survey: Send and Skip side by side, wrapping when the card is narrow. */
.survey-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }

@media (max-width: 480px) {
  /* lic-h6pk: profile name field and coupon heading go full width on phones. */
  .profile-form .profile-row input[type="text"], .profile-form .profile-row input[type="password"] { max-width: none; flex-basis: 100%; }
  .account-footer form.coupon-box h3 { flex: 0 0 100%; }
  .table-wrap:has(.machine-table) { overflow-x: visible; border: 0; background: transparent; }
  .machine-table, .machine-table tbody, .machine-table tr, .machine-table td { display: block; width: 100%; }
  .machine-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .machine-table tr { margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
  .machine-table td { display: flex; justify-content: space-between; gap: var(--s3); padding: .35em 0; border: 0; text-align: right; overflow-wrap: anywhere; }
  .machine-table td::before { content: attr(data-label); flex: none; color: var(--ink-muted); text-align: left; }
  .machine-table td[data-label=""]::before { content: none; }
  .machine-table td[data-label="Status"] { align-items: center; justify-content: flex-start; }
  .machine-table td[data-label="Status"]::before { margin-right: auto; }
  .machine-table td[data-label="Status"] .status-dot { flex: none; }
  .machine-table td.cell-empty { display: none; }
  /* Plans table on /pricing: one card per feature instead of a crushed 4-column table. */
  .table-wrap:has(.plan-table) { overflow-x: visible; border: 0; background: transparent; }
  .plan-table, .plan-table tbody, .plan-table tr, .plan-table th, .plan-table td { display: block; width: 100%; }
  .plan-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .plan-table tr { margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
  .plan-table th, .plan-table td { padding: .35em 0; border: 0; text-align: left; overflow-wrap: anywhere; }
  .plan-table td::before { content: attr(data-label) ": "; font-weight: 600; color: var(--ink-muted); }
}

/* B3 (batch 2): the /activate code check stays on one line, never wrapping
   inside the code element (it is shortened first4...last4, so it fits at 375px). */
.code-check { overflow-wrap: break-word; } /* the label may wrap; the code chip below never splits and never forces a sideways scroll */
.code-check code { white-space: nowrap; overflow-wrap: normal; word-break: normal; }

/* Batch 3 item 12: the CLI hint chip stays on one line (the sentence wraps before it, never inside it);
   Apply matches its input's height; a small gap between Register and the theme toggle on phones. */
.machine-id-chip { white-space: nowrap; overflow-wrap: normal; word-break: normal; }
/* lic-h6pk: at 320px the one-line chip overflowed; below 400px it may wrap anywhere. */
@media (max-width: 400px) {
  .machine-id-chip { white-space: normal; overflow-wrap: anywhere; }
}

/* Batch 3 item 7: caption above a legal document ("Version 1.3"). */
.legal-version { margin: 0 0 var(--s2); font-size: .875rem; }

/* Batch 4a item 2: the trial line, "Start your free trial" and the price boxes are ONE grid
   item (.pricing-buy) in the price column, so the line sits directly above the boxes at every
   width. As separate grid children they landed in the first row, ~270px above the boxes. */
.pricing-buy { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.pricing-buy > p { margin: 0; }

/* Batch 4a item 1: the header Docs link is hidden up to 620px (the footer still has Docs).
   Measured with Docs visible, the full-size nav wraps to two or three rows at every width from
   481px up to 595px signed out and 592px signed in, and fits on one row from 596px; 620px keeps
   about 25px of slack. Leon's rule: one row, Docs in the footer on narrow screens. */
@media (max-width: 620px) {
  nav.panel .nav-docs { display: none; }
}

/* Batch 4a (nav fix): the compact header (smaller links, tighter padding, no brand text) applies up to
   540px, not 480px. Between 481px and 530px the full-size nav wrapped to two rows even with Docs
   hidden. Only the NAV rules live here; tables and cards stay on the 480px block. */
@media (max-width: 540px) {
  nav.panel { flex-wrap: nowrap; gap: 0; padding: var(--s2) var(--s3); }
  nav.panel .brand-name { display: none; }
  nav.panel a:not(.brand), nav.panel .btn-ghost, nav.panel .theme-toggle { font-size: .875rem; padding-left: .45em; padding-right: .45em; }
  nav.panel .inline-form { margin: 0; }
  nav.panel a:not(.brand), nav.panel .btn-ghost, nav.panel .btn-primary { white-space: nowrap; }
  nav.panel .btn-primary { padding-left: .6em; padding-right: .6em; }
  /* Batch 3 item 12: a gap between Register and the theme toggle. */
  nav.panel .btn-primary + .theme-toggle { margin-left: .4em; }
}

/* ---- account area phase 2 (lic-h6pk): cards, profile form, footer line ---- */
.profile-form label { display: block; font-weight: 600; margin: 0 0 var(--s1, .25rem); }
.profile-row { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: stretch; margin: 0 0 var(--s3); }
.profile-row input[type="text"], .profile-row input[type="password"] { flex: 1 1 14rem; min-width: 0; max-width: 24rem; box-sizing: border-box; }
.signon-list { margin: 0 0 var(--s3); padding-left: var(--s5); }
.qr-box { margin: 0 0 var(--s3); }
.qr-box .qr { display: block; max-width: 100%; height: auto; }
#profile-card h3 { font-size: 1rem; margin: var(--s4) 0 var(--s2); }
/* The coupon and legal lines are a small footer, not a card: the coupon form drops its panel look. */
.account-footer { font-size: .875rem; margin-top: var(--s5); }
.account-footer p { margin: 0 0 var(--s2); }
.account-footer .coupon-box { background: transparent; border: 0; box-shadow: none; padding: 0; margin: var(--s2) 0 0; align-items: center; }
.account-footer .coupon-box h3 { flex: 0 0 auto; margin: 0; font-weight: 400; font-size: .875rem; }
