/* Brume Console — sprout 1.1.0 (~/code/brume/ui-designs/designs/sprout/DESIGN.md).
   Token names are the contract's, exactly. Literal colours live on :root only. */

@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500 800; font-display: swap; src: url(fonts/bricolage-grotesque-latin-wght.woff2) format('woff2'); }
@font-face { font-family: 'DM Sans'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/dm-sans-latin-wght.woff2) format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/dm-mono-latin-400.woff2) format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/dm-mono-latin-500.woff2) format('woff2'); }

/* §2 colours, light */
:root {
  color-scheme: light;
  --bg: #f6fbf7; --surface: #ffffff; --surface-2: #f0f6f2; --hover: #ebf3ee;
  --border: #e2ebe5; --border-strong: #84968c;
  --text: #10221a; --text-2: #4a5d53; --text-3: #5d6f66;
  --primary: #0e2a1d; --on-primary: #ffffff;
  --brand: #22a35a; --brand-ink: #137a40; --brand-tint: #dcf5e5;
  --danger: #d4343a; --danger-ink: #c0262d; --danger-tint: #ffeceb; --on-danger: #ffffff;
  --warning: #b97f00; --warning-ink: #8f5f00; --warning-tint: #fff4d6;
  --info: #3b82f6; --info-ink: #1d5fd6; --info-tint: #e7f0ff;
  --neutral-tint: #edf2ef; --sun: #f5c542;
  --chrome: #f6fbf7; --chrome-ink: #3d5047; --chrome-head: #5f7168; --chrome-title: #10221a;
  --chrome-hover: #e9f3ec; --chrome-active: #ffffff; --chrome-active-ink: #10221a; --chrome-border: #e2ebe5;
  --topbar: transparent; --topbar-ink: #10221a; --topbar-border: transparent;
  --code-bg: #10221a; --code-ink: #e3f3e9;
  --shadow-c: rgb(16 34 26 / .08);

  /* §3 type */
  --display: 'Bricolage Grotesque', 'DM Sans', system-ui, sans-serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;
  --fs-title: 32px; --fw-title: 700; --track-title: -0.035em;
  --eb-case: none; --eb-size: 13px; --eb-track: 0; --eb-font: var(--sans); --eb-weight: 600;

  /* §4 shape, size, elevation */
  --r-ctl: 999px; --r-input: 14px; --r-card: 20px; --r-badge: 999px; --r-nav: 12px;
  --h-ctl: 40px; --h-sm: 32px; --row: 56px; --pad: 20px; --gap: 28px;
  --top-h: 60px; --side-w: 236px;
  --card-shadow: 0 1px 2px var(--shadow-c), 0 10px 24px -14px var(--shadow-c);
  --pop-shadow: 0 24px 60px -12px var(--shadow-c), 0 2px 6px var(--shadow-c);
  --btn-shadow: none;
  --h-field: 36px; --r-field: 12px; --form-gap: 10px; --form-w: 560px; --sheet-w: 520px;
  --fog-brand: 22%; --fog-info: 16%; --fog-mist: 32%; --fog-stratum: rgb(255 255 255 / .75); --fog-texture: .55;
}

/* §2 colours, dark: by the system unless light was picked, and when dark was picked */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1410; --surface: #111d17; --surface-2: #15231c; --hover: #192a21;
    --border: #1f3128; --border-strong: #5b7366;
    --text: #eaf5ee; --text-2: #b4c9bd; --text-3: #8ba596;
    --primary: #eaf5ee; --on-primary: #0b1410;
    --brand: #3fd17a; --brand-ink: #7ee2a6; --brand-tint: #10301f;
    --danger: #ff6b6b; --danger-ink: #ff9b9b; --danger-tint: #3a1313; --on-danger: #2a0404;
    --warning: #f7c04a; --warning-ink: #f7cf74; --warning-tint: #36290b;
    --info: #6aa6ff; --info-ink: #9cc3ff; --info-tint: #10244a;
    --neutral-tint: #1a2a21; --sun: #e9b949;
    --chrome: #0b1410; --chrome-ink: #b4c9bd; --chrome-head: #6f8a7b; --chrome-title: #eaf5ee;
    --chrome-hover: #13221a; --chrome-active: #1a2e23; --chrome-active-ink: #eaf5ee; --chrome-border: #16251d;
    --topbar-ink: #eaf5ee;
    --code-bg: #060d0a; --code-ink: #e3f3e9;
    --shadow-c: rgb(0 0 0 / .5);
    --fog-brand: 20%; --fog-info: 14%; --fog-mist: 12%; --fog-stratum: rgb(200 220 235 / .1); --fog-texture: .16;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1410; --surface: #111d17; --surface-2: #15231c; --hover: #192a21;
  --border: #1f3128; --border-strong: #5b7366;
  --text: #eaf5ee; --text-2: #b4c9bd; --text-3: #8ba596;
  --primary: #eaf5ee; --on-primary: #0b1410;
  --brand: #3fd17a; --brand-ink: #7ee2a6; --brand-tint: #10301f;
  --danger: #ff6b6b; --danger-ink: #ff9b9b; --danger-tint: #3a1313; --on-danger: #2a0404;
  --warning: #f7c04a; --warning-ink: #f7cf74; --warning-tint: #36290b;
  --info: #6aa6ff; --info-ink: #9cc3ff; --info-tint: #10244a;
  --neutral-tint: #1a2a21; --sun: #e9b949;
  --chrome: #0b1410; --chrome-ink: #b4c9bd; --chrome-head: #6f8a7b; --chrome-title: #eaf5ee;
  --chrome-hover: #13221a; --chrome-active: #1a2e23; --chrome-active-ink: #eaf5ee; --chrome-border: #16251d;
  --topbar-ink: #eaf5ee;
  --code-bg: #060d0a; --code-ink: #e3f3e9;
  --shadow-c: rgb(0 0 0 / .5);
  --fog-brand: 20%; --fog-info: 14%; --fog-mist: 12%; --fog-stratum: rgb(200 220 235 / .1); --fog-texture: .16;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  --primary-hover: color-mix(in srgb, var(--primary) 84%, var(--bg));
  --focus: color-mix(in srgb, var(--brand) 28%, transparent);
  --form-scrim: color-mix(in srgb, var(--bg) 45%, transparent);
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--sans);
}
a { color: inherit; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; }
code, .mono, kbd { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
/* Author rules like .btn's display would otherwise beat the UA's [hidden]. */
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Type roles */
.title { font: var(--fw-title) var(--fs-title)/1.2 var(--display); letter-spacing: var(--track-title); text-wrap: balance; }
.sub { color: var(--text-2); margin-top: 4px; }
.t-section { font: 650 16px var(--display); }
.t-card { font: 700 15px var(--display); }
.t-small { font-size: 12.5px; color: var(--text-3); }
.t-num { font: 700 26px var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.eyebrow, .flabel { font: var(--eb-weight) var(--eb-size) var(--eb-font); text-transform: var(--eb-case); letter-spacing: var(--eb-track); color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }

/* §5 shell */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
/* A viewer's role changes nothing: its pages show no forms (the server refuses them anyway). */
.shell.viewer .main form[method="post"]:not(.keep), .shell.viewer .main details:has(form[method="post"]) { display: none; }
.side { background: var(--chrome); padding: 12px 10px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100vh; }
.brandrow { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; }
a.brandrow { text-decoration: none; }
.brandrow .logo { width: 30px; height: 30px; flex: none; }
.brandrow b { display: block; font: 720 15px var(--display); color: var(--chrome-title); }
.brandrow span { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--chrome-head); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-nav); color: var(--chrome-ink); text-decoration: none; font-size: 13.5px; font-weight: 550; transition: background-color .12s; }
.nav a:hover { background: var(--chrome-hover); }
.nav a[aria-current="page"] { background: var(--chrome-active); color: var(--chrome-active-ink); font-weight: 650; box-shadow: 0 1px 2px var(--shadow-c), 0 0 0 1px var(--border); }
.nav-h { margin: 12px 10px 4px; font-size: 12px; font-weight: 500; color: var(--chrome-head); }
.me { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; border-top: 1px solid var(--chrome-border); }
.me div { min-width: 0; flex: 1; }
.me b { display: block; font-size: 13px; color: var(--chrome-title); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { display: block; font-size: 12px; color: var(--chrome-head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The early-access card, above the signed-in user: one way to tell us. */
.side-card { display: flex; flex-direction: column; gap: 8px; margin: 0 2px; padding: 12px; border-radius: var(--r-card); border: 1px solid color-mix(in srgb, var(--info) 35%, transparent); background: var(--info-tint); }
.side-card p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--info-ink); }
.side-card .side-card-h { display: flex; align-items: center; gap: 8px; font: var(--eb-weight) var(--eb-size) var(--eb-font); text-transform: var(--eb-case); letter-spacing: var(--eb-track); }
.side-card .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.btn-block { width: 100%; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 11px; font-weight: 700; background: var(--brand-tint); color: var(--brand-ink); }
.main { min-width: 0; display: flex; flex-direction: column;
  background:
    radial-gradient(38% 260px at 88% 0, color-mix(in srgb, var(--info) 20%, transparent), transparent 70%),
    radial-gradient(34% 240px at 62% 0, color-mix(in srgb, var(--brand) 24%, transparent), transparent 70%),
    radial-gradient(26% 220px at 100% 120px, color-mix(in srgb, var(--sun) 26%, transparent), transparent 70%);
  background-repeat: no-repeat; }
.topbar { height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 var(--gap); background: var(--topbar); color: var(--topbar-ink); border-bottom: 1px solid var(--topbar-border); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-size: 13.5px; }
.crumbs a { opacity: .7; text-decoration: none; }
.crumbs a:hover { opacity: 1; text-decoration: underline; }
.crumbs > span { opacity: .4; }
.crumbs b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-tools { display: flex; align-items: center; gap: 6px; }
.top-tools form { display: contents; }
.topbar .menu-btn { display: none; }
.content { padding: var(--gap); padding-top: 4px; display: flex; flex-direction: column; gap: calc(var(--gap) * .7); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.readable { max-width: 70ch; }

/* Public pages: sign in, password, application */
.public { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.public .topbar { justify-content: space-between; }
.public-body { display: grid; place-items: start center; padding: 24px 16px 48px; }
.public-card { width: min(100%, 440px); display: flex; flex-direction: column; gap: 16px; }
.public-card.wide { width: min(100%, 620px); }
.sim-page { max-width: 620px; }
.public-card .panel { padding: 24px; }
.public-links { font-size: 13px; color: var(--text-2); text-align: center; }
.legal-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.legal-foot { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 14px var(--gap) 18px; font-size: 12.5px; color: var(--text-3); }
.legal-foot a { color: inherit; }
.legal-foot a:hover { color: var(--text-2); }
/* Sign-in fog, from the landing page: it stands in for the wash on public pages.
   A deliberate exception to Sprout §8 (nothing else moves) and §9 (no other
   gradients), approved in 3.10.0 for the public pages only. */
.public.main { background: none; position: relative; isolation: isolate; }
.public > .topbar, .public-body { position: relative; z-index: 1; }
.fog { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.fog-glow { position: absolute; border-radius: 50%; filter: blur(60px); will-change: transform; }
.fog-a { width: 70vmax; height: 46vmax; left: -10vmax; top: -14vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--brand) var(--fog-brand), transparent), transparent); animation: fog-a 48s ease-in-out infinite alternate; }
.fog-b { width: 60vmax; height: 42vmax; right: -18vmax; bottom: -16vmax; background: radial-gradient(closest-side, color-mix(in srgb, var(--info) var(--fog-info), transparent), transparent); animation: fog-b 64s ease-in-out infinite alternate; }
.fog-c { width: 90vmax; height: 30vmax; left: -20vmax; top: 38%; background: radial-gradient(closest-side, color-mix(in srgb, var(--border-strong) var(--fog-mist), transparent), transparent); animation: fog-c 86s ease-in-out infinite alternate; }
.fog-texture { position: absolute; top: -10%; bottom: -10%; left: -1200px; right: 0; background: url(fog.svg) repeat-x left center / 1200px 100%; opacity: var(--fog-texture); animation: fog-roll 140s linear infinite; will-change: transform; }
.fog-stratum { position: absolute; height: 14px; border-radius: 999px; background: var(--fog-stratum); filter: blur(10px); will-change: transform; animation: fog-slide 46s ease-in-out infinite alternate; }
.fog-stratum.s1 { top: 12%; left: -10%; width: 46%; opacity: .9; animation-duration: 38s; }
.fog-stratum.s2 { top: 24%; right: -8%; width: 52%; height: 20px; opacity: .6; animation-duration: 52s; animation-delay: -12s; animation-direction: alternate-reverse; }
.fog-stratum.s3 { top: 41%; left: -14%; width: 34%; height: 10px; opacity: .5; animation-duration: 44s; animation-delay: -20s; }
.fog-stratum.s4 { top: 58%; right: -10%; width: 40%; opacity: .5; animation-duration: 60s; animation-delay: -6s; animation-direction: alternate-reverse; }
.fog-stratum.s5 { top: 73%; left: -12%; width: 44%; height: 20px; opacity: .6; animation-delay: -30s; }
.fog-stratum.s6 { top: 88%; right: -6%; width: 50%; opacity: .9; animation-duration: 56s; animation-delay: -18s; animation-direction: alternate-reverse; }
@keyframes fog-a { to { transform: translate(14vmax, 8vmax) scale(1.12); } }
@keyframes fog-b { to { transform: translate(-16vmax, -6vmax) scale(1.08); } }
@keyframes fog-c { to { transform: translate(22vmax, -4vmax) scale(1.15); } }
@keyframes fog-roll { to { transform: translateX(1200px); } }
@keyframes fog-slide { to { transform: translateX(18vw); } }

/* §6 buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h-ctl); padding: 0 14px; border-radius: var(--r-ctl); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 600 13.5px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; box-shadow: var(--btn-shadow); transition: background-color .12s, border-color .12s; }
.btn:hover { background: var(--hover); }
/* A label wrapping a hidden file input: the focus ring goes on the button. */
.btn:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-tertiary { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-tertiary:hover { background: var(--hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, var(--bg)); }
.btn-danger-outline { color: var(--danger-ink); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger-outline:hover { background: var(--danger-tint); }
.btn-sm { height: var(--h-sm); padding: 0 10px; font-size: 12.5px; gap: 6px; }
.icon-btn { width: var(--h-ctl); padding: 0; }
.icon-btn.btn-sm { width: var(--h-sm); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: inherit; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* A form on its way: its button spins and takes no second click. A live
   region being re-priced dims, late enough that a quick answer never flickers. */
.btn[data-busy] { cursor: progress; }
.btn[data-busy]::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
[data-live-region] { transition: opacity .15s .15s; }
[data-live-region][aria-busy="true"] { opacity: .6; }

/* §6 inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.flabel em { font-style: normal; font-weight: 500; color: var(--text-3); }
.help { font-size: 12.5px; color: var(--text-3); }
.input { width: 100%; height: var(--h-ctl); padding: 0 12px; border-radius: var(--r-input); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 400 13.5px var(--sans); transition: border-color .12s, box-shadow .12s; }
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.input[readonly] { background: var(--surface-2); }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; font: 400 12.5px/1.55 var(--mono); }
textarea.input.prose { font: 400 13.5px/1.5 var(--sans); }
.err { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--danger-ink); }
.err svg.i { width: 14px; height: 14px; }
.input-icon { position: relative; display: block; }
.input-icon > svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 34px; }
.select { position: relative; display: block; }
.select select.input { appearance: none; padding-right: 34px; }
.select > svg.i { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-2); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.inline { display: flex; gap: 8px; align-items: flex-end; }
.inline > .field { flex: 1; }
.typed { min-width: 170px; gap: 8px; }
details > summary.btn { align-self: flex-start; width: max-content; }

/* §6 compact forms (1.1) */
.cform { display: flex; flex-direction: column; gap: var(--form-gap); }
.cform .field { gap: 4px; }
.cform .flabel { font-size: 12.5px; }
.cform .help { font-size: 12px; }
.cform .input { height: var(--h-field); border-radius: var(--r-field); padding: 0 11px; }
.cform textarea.input { height: auto; padding: 8px 11px; }
.cform .duo { display: grid; grid-template-columns: 3fr 1fr; gap: var(--form-gap); }
.cform .two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--form-gap); }
.fsec { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font: 650 13px var(--display); color: var(--text-2); }
.fsec.first { margin: 0; padding: 0; border: 0; }
.fieldset { border: 0; margin: 0; padding: 0; }
.fieldset legend { padding: 0; margin-bottom: 4px; }

/* §6 dialogs: confirm, form dialog, sheet */
dialog { color: var(--text); }
.dialog { width: min(100%, 400px); max-width: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); box-shadow: var(--pop-shadow); }
.dialog::backdrop { background: color-mix(in srgb, var(--bg) 60%, black); }
.fdialog, .sheet { padding: 0; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--pop-shadow); display: none; flex-direction: column; overflow: hidden; max-width: 100%; }
.fdialog[open], .sheet[open] { display: flex; }
.fdialog::backdrop, .sheet::backdrop { background: var(--form-scrim); backdrop-filter: blur(4px); }
.fdialog { width: min(100%, var(--form-w)); max-height: 90vh; border-radius: var(--r-card); }
.sheet { margin: 0 0 0 auto; width: min(100%, var(--sheet-w)); height: 100dvh; max-height: 100dvh; border-radius: var(--r-card) 0 0 var(--r-card); border-right: 0; }
.sheet[open] { animation: sheet-in .15s ease-out; }
@keyframes sheet-in { from { transform: translateX(24px); opacity: .6; } }
.fd-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 16px 14px 4px 20px; }
.fd-h h2 { font: 700 17px var(--display); }
.fd-h p { margin-top: 2px; font-size: 12px; color: var(--text-3); }
.fd-b { flex: 1; overflow-y: auto; padding: 10px 20px 16px; }
.fd-f { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.fd-f .grow { margin-right: auto; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 4px 20px; font: 700 15px var(--display); }
.modal-b { padding: 6px 20px 16px; font-size: 13.5px; color: var(--text-2); }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* §6 tabs, segmented, pager */
.tabs { display: flex; gap: 6px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font: 600 13.5px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"], .tab[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--neutral-tint); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] .count, .tab[aria-current="page"] .count { background: color-mix(in srgb, var(--on-primary) 20%, transparent); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { height: var(--h-sm); padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font: 600 12.5px var(--sans); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px var(--shadow-c), 0 0 0 1px var(--border); }
.pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager [aria-current="page"] { background: var(--brand-tint); color: var(--brand-ink); border-color: transparent; }
.pager .gap { color: var(--text-3); padding: 0 4px; }

/* §6 badges, status icons, dots */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--r-badge); font-size: 12px; font-weight: 600; background: var(--neutral-tint); color: var(--text-2); white-space: nowrap; }
.badge svg.i { width: 13px; height: 13px; }
.badge.success { background: var(--brand-tint); color: var(--brand-ink); }
.badge.danger { background: var(--danger-tint); color: var(--danger-ink); }
.badge.warning { background: var(--warning-tint); color: var(--warning-ink); }
.badge.info { background: var(--info-tint); color: var(--info-ink); }
.st { display: inline-grid; place-items: center; width: 18px; height: 18px; }
.st svg.i { width: 18px; height: 18px; }
.st-pass { color: var(--brand); } .st-run { color: var(--info); } .st-pend { color: var(--warning); }
.st-fail { color: var(--danger); } .st-cancel { color: var(--text-3); }
.st-run svg.i { animation: spin 2.4s linear infinite; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); margin-right: 6px; }
.dot.off { background: var(--text-3); }

/* §6 lists and tables */
.listcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--card-shadow); overflow: hidden; }
.row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; min-height: var(--row); padding: 6px 14px; text-decoration: none; color: inherit; transition: background-color .12s; }
.row + .row { border-top: 1px solid var(--border); }
a.row:hover, .row.link:hover { background: var(--hover); }
.row-main { min-width: 0; }
.row-main b { font-weight: 650; margin-right: 8px; }
.row-main .mono { color: var(--text-2); }
.row-main b.mono { color: var(--text); }
.row-meta { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.tablewrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--card-shadow); overflow-x: auto; scrollbar-color: var(--border-strong) transparent; }
.tbl { width: 100%; min-width: 600px; border-collapse: collapse; }
.tbl th { height: 36px; padding: 0 14px; text-align: left; background: var(--surface-2); font: var(--eb-weight) var(--eb-size) var(--eb-font); color: var(--text-3); white-space: nowrap; }
.tbl td { height: var(--row); padding: 0 14px; border-top: 1px solid var(--border); }
.tbl .num { text-align: right; }
.tbl.quote { min-width: 0; }
.tbl.quote td.num { white-space: nowrap; }
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; }
.filterbar .input-icon { flex: 1; min-width: 240px; }

/* §6 cards, figures, meters */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--card-shadow); padding: var(--pad); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: calc(var(--gap) * .7); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: calc(var(--gap) * .7); }
.kpi { gap: 4px; }
.kpi-d { font-size: 12.5px; color: var(--text-3); }
.kpi-d b { color: var(--brand-ink); font-weight: 600; }
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.meter-top span { color: var(--text-3); font-variant-numeric: tabular-nums; }
/* A <progress>: its value is an attribute, so no inline style is needed. */
.bar { display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--neutral-tint); overflow: hidden; appearance: none; color: var(--brand); }
.bar::-webkit-progress-bar { background: var(--neutral-tint); border-radius: 999px; }
.bar::-webkit-progress-value { background: currentColor; border-radius: 999px; }
.bar::-moz-progress-bar { background: currentColor; border-radius: 999px; }
.bar.warn { color: var(--warning); }
.bar.crit { color: var(--danger); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; align-items: center; }
.kv dt { color: var(--text-3); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }

/* Storage forms and rows */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.choice { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 10px 34px; position: relative; border: 1px solid var(--border-strong); border-radius: var(--r-field); background: var(--surface); cursor: pointer; }
.choice input { position: absolute; left: 12px; top: 12px; margin: 0; accent-color: var(--brand); }
.choice b { font-weight: 650; }
.choice span, .choice output { font-size: 12px; color: var(--text-3); min-height: 1em; }
.choice:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.row .usage { display: flex; flex-direction: column; gap: 4px; width: 160px; }
.listcard.flat { box-shadow: none; }
.bucket-row { grid-template-columns: 20px minmax(0, 1fr) auto auto auto auto; }
.bucket-add { max-width: var(--form-w); }
.affix { display: flex; min-width: 0; }
.affix-pre { display: flex; align-items: center; padding: 0 10px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--r-input) 0 0 var(--r-input); background: var(--surface-2); color: var(--text-2); font: 400 13.5px var(--mono); }
.affix .input { border-radius: 0 var(--r-input) var(--r-input) 0; font-family: var(--mono); }
.form-page { max-width: var(--form-w); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.fdialog > form, .dialog > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.empty .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.kv code { overflow-wrap: anywhere; }
.page-head .sub .badge { vertical-align: 1px; }

/* The file explorer */
.pathbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; }
.pathbar a { color: var(--text-2); }
.pathbar span { color: var(--text-3); }
.pathbar .pathbar-aside { margin-left: auto; color: var(--text-2); }
.selbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tbl.files td { height: 44px; }
.tbl.files .pick { width: 36px; padding-right: 0; }
.tbl.files .pick input { width: 16px; height: 16px; accent-color: var(--brand); }
.tbl.files .acts { text-align: right; white-space: nowrap; }
.tbl.files .acts form { display: inline; }
.entry { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 550; overflow-wrap: anywhere; }
.entry:hover { text-decoration: underline; }
.explorer { position: relative; display: flex; flex-direction: column; gap: 12px; }
.explorer.dropping::after { content: attr(data-drop-hint); position: absolute; inset: 0; display: grid; place-items: center; border: 2px dashed var(--brand); border-radius: var(--r-card); background: color-mix(in srgb, var(--brand-tint) 80%, transparent); font-weight: 650; color: var(--brand-ink); }
.uploads { display: flex; flex-direction: column; gap: 6px; }
.uploads:empty { display: none; }
.upload { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto auto; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-input); background: var(--surface); }
.upload.failed { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keylist { margin: 0; padding-left: 18px; max-height: 240px; overflow-y: auto; }
textarea.input.editor { min-height: 60vh; font: 400 12.5px/1.55 var(--mono); }

/* Billing and account */
.card-on-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-on-file svg.i { width: 20px; height: 20px; color: var(--text-2); }
.check.consent { align-items: flex-start; line-height: 1.45; }
.check.consent input { margin-top: 2px; flex: none; }
.mono-title { font-family: var(--mono); letter-spacing: 0; }
.panel > .t-small { display: block; }

/* §6 feedback */
.alert { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: start; padding: 11px 10px 11px 14px; border-radius: 16px; border: 1px solid; }
.alert > svg.i { width: 18px; height: 18px; margin-top: 1px; }
.alert b { display: block; font-weight: 650; }
.alert p { color: var(--text-2); font-size: 13.5px; }
.alert.info { background: var(--info-tint); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.alert.info > svg.i { color: var(--info-ink); }
.alert.success { background: var(--brand-tint); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.alert.success > svg.i { color: var(--brand-ink); }
.alert.warning { background: var(--warning-tint); border-color: color-mix(in srgb, var(--warning) 40%, transparent); }
.alert.warning > svg.i { color: var(--warning-ink); }
.alert.danger { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.alert.danger > svg.i { color: var(--danger-ink); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 380px; padding: 10px 8px 10px 14px; border-radius: var(--r-card); background: var(--text); color: var(--surface); box-shadow: var(--pop-shadow); font-size: 13.5px; }
.toast .btn-tertiary { color: var(--surface); }
.toast .btn-tertiary:hover { background: color-mix(in srgb, var(--surface) 15%, transparent); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 16px; }
.empty-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: var(--r-card); background: var(--brand-tint); color: var(--brand-ink); }
.empty-ic svg.i { width: 22px; height: 22px; }
.empty b { font-size: 15px; }
.empty p { max-width: 34ch; color: var(--text-2); }
.code { margin: 0; padding: 12px 14px; border-radius: var(--r-input); background: var(--code-bg); color: var(--code-ink); font: 400 12.5px/1.6 var(--mono); overflow-x: auto; white-space: pre; }
.code .c { opacity: .55; }

/* §5 breakpoints */
.scrim { display: none; }
@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  /* Without JS the sidebar stacks above the page. With it, a drawer —
     hidden, not just off-screen, so its links leave the tab order and its shadow the edge. */
  .side { position: static; height: auto; }
  .js .side { position: fixed; height: 100vh; z-index: 40; left: 0; top: 0; width: min(86vw, var(--side-w)); transform: translateX(-100%); visibility: hidden; transition: transform .15s ease-out, visibility .15s; }
  .js .shell.nav-open .side { transform: none; visibility: visible; box-shadow: var(--pop-shadow); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 60%, black); }
  .js .topbar .menu-btn { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .row { grid-template-columns: 20px minmax(0, 1fr) auto; }
  .row .hide-sm, .tbl .hide-sm { display: none; }
  .tbl.files, .tbl.fit { min-width: 0; }
  .tbl.fit td, .tbl.fit th { padding: 0 8px; }
  .tbl.files .acts .btn:not(.icon-btn) { padding: 0 6px; }
  .cform .duo, .cform .two { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .topbar { height: auto; min-height: var(--top-h); flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .row .badge { display: none; }
  .title { font-size: 26px; }
}

/* §8 motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Support threads and banners */
.pre { white-space: pre-line; }
.alert > form { display: contents; }
.nav a .count { margin-left: auto; }
/* A thread reads as a conversation: one's own messages on the right,
   tinted; the other side's on the left. Compact, so a long exchange fits. */
.thread-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.thread-head .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.thread-head .title { margin: 0; }
.thread-head .sub { margin: 0; }
.thread { display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; flex-direction: column; gap: 4px; align-self: flex-start; max-width: 85%; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface); }
.msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--brand-tint) 55%, var(--surface)); border-color: color-mix(in srgb, var(--brand) 30%, var(--border)); }
.msg-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 12.5px; color: var(--text-3); }
.msg-h b { color: var(--text); font-weight: 650; }
.msg-b { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; line-height: 1.5; }
.panel.reply { gap: 8px; padding: 12px 14px; }
.reply .form-actions { margin: 0; }
.msg-imgs { display: flex; flex-wrap: wrap; gap: 6px; }
details.offer { margin-top: 4px; }
details.offer > summary { cursor: pointer; font-size: 12.5px; color: var(--brand-ink); }
details.offer[open] > form { margin-top: 6px; min-width: 260px; }
.msg-imgs a { display: block; line-height: 0; }
.msg-imgs img { height: 120px; max-width: 100%; object-fit: cover; border-radius: var(--r-ctl); border: 1px solid var(--border); background: var(--surface-2); }
.cform .input.file { height: auto; padding: 6px 8px; }
.cform .pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--form-gap); }
.count-n { margin-left: 6px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Support threads at phone width: after their base rules, so they win. */
@media (max-width: 760px) {
  .cform .pair { grid-template-columns: 1fr; }
  .msg { max-width: 100%; }
}
