
:root {
  --bg: #fcfdff;
  --bg-soft: #f4f7fd;
  --bg-inset: #e9eff9;
  --bg-raised: #ffffff;

  --fg: #0f172a;
  --fg-muted: #48566a;
  --fg-subtle: #5e6a7d;

  --border: #e4eaf4;
  --border-strong: #cdd7e8;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-fg: #ffffff;
  --accent-soft: #eef4ff;
  --accent-border: #c7d9fe;

  --lav: #6b47e8;
  --lav-soft: #f3efff;
  --lav-border: #ddd2fb;

  --ok: #0c7050;
  --ok-soft: #e6f6ef;
  --ok-border: #a5dcc4;

  --warn: #a04a08;
  --warn-soft: #fdf3e6;
  --danger: #d0342c;
  --danger-soft: #fdeeec;
  --danger-border: #f6c8c4;

  --shadow-sm: 0 1px 2px rgb(15 23 42 / 6%);
  --shadow-md: 0 8px 24px -8px rgb(15 23 42 / 10%);
  --shadow-lg: 0 24px 48px -16px rgb(15 23 42 / 14%);
  --ring: 0 0 0 3px rgb(37 99 235 / 22%);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-xs: 0.8125rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-lg: 1.125rem;
  --t-xl: 1.5rem;
  --t-2xl: clamp(1.625rem, 1.2rem + 1.7vw, 2.125rem);

  --wrap: 1080px;
  --dur: 180ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0a0f1a;
    --bg-soft: #101725;
    --bg-inset: #17202f;
    --bg-raised: #131b29;

    --fg: #e8eef8;
    --fg-muted: #9aa9bf;
    --fg-subtle: #7a8798;

    --border: #212c3d;
    --border-strong: #33415a;

    --accent: #5b93f7;
    --accent-hover: #85b0fa;
    --accent-fg: #06132b;
    --accent-soft: #16233c;
    --accent-border: #29405f;

    --lav: #a78bfa;
    --lav-soft: #1e1b34;
    --lav-border: #38306b;

    --ok: #34d399;
    --ok-soft: #0c2620;
    --ok-border: #1d4a3c;

    --warn: #f0b429;
    --warn-soft: #2a1f08;
    --danger: #ff8a7a;
    --danger-soft: #2c1512;
    --danger-border: #5a2a22;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-md: 0 8px 24px -8px rgb(0 0 0 / 55%);
    --shadow-lg: 0 24px 48px -16px rgb(0 0 0 / 65%);
    --ring: 0 0 0 3px rgb(91 147 247 / 30%);
  }
}

:root[data-theme='dark'] {
  --bg: #0a0f1a;
  --bg-soft: #101725;
  --bg-inset: #17202f;
  --bg-raised: #131b29;

  --fg: #e8eef8;
  --fg-muted: #9aa9bf;
  --fg-subtle: #7a8798;

  --border: #212c3d;
  --border-strong: #33415a;

  --accent: #5b93f7;
  --accent-hover: #85b0fa;
  --accent-fg: #06132b;
  --accent-soft: #16233c;
  --accent-border: #29405f;

  --lav: #a78bfa;
  --lav-soft: #1e1b34;
  --lav-border: #38306b;

  --ok: #34d399;
  --ok-soft: #0c2620;
  --ok-border: #1d4a3c;

  --warn: #f0b429;
  --warn-soft: #2a1f08;
  --danger: #ff8a7a;
  --danger-soft: #2c1512;
  --danger-border: #5a2a22;

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 8px 24px -8px rgb(0 0 0 / 55%);
  --shadow-lg: 0 24px 48px -16px rgb(0 0 0 / 65%);
  --ring: 0 0 0 3px rgb(91 147 247 / 30%);
}

*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: light dark; }
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='dark'] { color-scheme: dark; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: var(--t-2xl); }
h2 { font-size: var(--t-lg); }
h3 { font-size: var(--t-base); }
p { margin: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute;
  left: var(--s3);
  top: -3rem;
  z-index: 20;
  padding: var(--s2) var(--s4);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--s3); }

/* --- top bar ------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: var(--s3) var(--s4);
  display: flex;
  align-items: center;
  gap: var(--s4);
}

/*
 * The wordmark, matched to swapformat.com.
 *
 * Same size, same gradient tile, same two-tone lowercase name, same tracking.
 * The apex sets these in .logo / .logo-mark; if one moves, move the other in
 * the same commit. A visitor crossing between the two origins should not be
 * able to tell that they did.
 *
 * The typeface is the one thing that cannot match exactly. The apex loads Inter
 * from Google Fonts; this plane's CSP is default-src 'self' with no font-src
 * exception, and relaxing it to pull a third-party font onto the page holding
 * someone's account would be the wrong trade for a slightly closer glyph. The
 * weight and tracking below are tuned so the system stack sits as close to
 * Inter as it can.
 */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--fg);
  text-decoration: none;
  font-weight: 800;
  font-size: var(--t-base);
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.brand:hover { color: var(--fg); }

.brand-mark {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--accent), var(--lav));
  display: inline-grid;
  place-items: center;
  /*
   * Always white, in both themes. --accent-fg inverts to dark in dark mode so
   * filled buttons stay readable on a light accent, and dark navy on this
   * gradient would not be.
   */
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.brand-mark svg { display: block; }

/*
 * "swap" in the foreground colour, "format" in the accent.
 *
 * The gap between the two words is not a space in the markup — there is none,
 * exactly as on the apex. .brand is inline-flex, so the bare text node "swap"
 * and the <span>format</span> are two separate flex items and the container's
 * gap separates them. Wrapping both in one element closes that gap and the
 * wordmark reads "swapformat", which is how this first went wrong.
 */
.brand > span:last-child { color: var(--accent); }

.nav { display: flex; gap: var(--s1); margin-inline-start: var(--s3); flex: 1; min-width: 0; }
.nav-link {
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: var(--t-sm);
  font-weight: 550;
  white-space: nowrap;
}
.nav-link:hover { background: var(--bg-inset); color: var(--fg); }
.nav-link.is-current { background: var(--accent-soft); color: var(--accent); }

.topbar-end { display: flex; align-items: center; gap: var(--s2); margin-inline-start: auto; }
.topbar-plain .topbar-inner { justify-content: center; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  color: var(--fg-muted);
  cursor: pointer;
}
.icon-button:hover { border-color: var(--border-strong); color: var(--fg); }

.i-sun, .i-moon { width: 16px; height: 16px; display: none; background: currentColor; }
/*
 * Drawn with box-shadow rather than an SVG file: img-src allows data: but a
 * second asset request for a 16px glyph is not worth it, and an inline <svg>
 * is fine but this is fewer bytes. The rays are shadows with negative spread.
 */
.i-sun {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: currentColor;
  box-shadow:
    0 -8px 0 -3px currentColor, 0 8px 0 -3px currentColor,
    -8px 0 0 -3px currentColor, 8px 0 0 -3px currentColor,
    -6px -6px 0 -3.5px currentColor, 6px 6px 0 -3.5px currentColor,
    -6px 6px 0 -3.5px currentColor, 6px -6px 0 -3.5px currentColor;
}
.i-moon {
  border-radius: 50%;
  background: transparent;
  box-shadow: inset -4px -1px 0 0 currentColor;
  width: 14px; height: 14px;
}
:root[data-theme='dark'] .i-sun { display: block; }
:root:not([data-theme='dark']) .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']):not([data-theme='dark']) .i-sun { display: block; }
  :root:not([data-theme='light']):not([data-theme='dark']) .i-moon { display: none; }
}

.theme-form { display: flex; margin: 0; }

/* --- account menu -------------------------------------------------------- */

.menu { position: relative; }
.menu-trigger {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s1) var(--s2) var(--s1) var(--s1);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-raised);
  cursor: pointer;
  font-size: var(--t-sm);
  list-style: none;
}
.menu-trigger::-webkit-details-marker { display: none; }
.menu-trigger:hover { border-color: var(--border-strong); }
.avatar {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--lav));
  color: #fff;
  font-weight: 650;
  font-size: var(--t-xs);
}
.menu-name { max-width: 10ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-muted); }

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s2));
  min-width: 220px;
  padding: var(--s2);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  display: grid;
  gap: 2px;
}
.menu-meta { padding: var(--s2) var(--s3); font-size: var(--t-xs); color: var(--fg-subtle); }
.menu-meta strong { color: var(--fg); font-weight: 600; }
.menu-item {
  display: block; width: 100%; text-align: left;
  padding: var(--s2) var(--s3);
  border: 0; border-radius: var(--r-sm);
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: var(--t-sm);
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover { background: var(--bg-inset); }
.menu-item-danger { color: var(--danger); }
.menu form { margin: 0; }

/* --- layout -------------------------------------------------------------- */

.main {
  flex: 1;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: var(--s6) var(--s4) var(--s7);
}
.is-narrow .main { max-width: 420px; padding-top: var(--s7); }

.page-head { margin-bottom: var(--s5); display: grid; gap: var(--s1); }
.page-head p { color: var(--fg-muted); font-size: var(--t-sm); }

.stack { display: grid; gap: var(--s4); }
/* align-items:start so a short card sizes to its content instead of being
   stretched to match a tall neighbour and ending in dead space. */
.grid-2 { display: grid; gap: var(--s4); align-items: start; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* --- cards --------------------------------------------------------------- */

.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3);
  margin-bottom: var(--s4);
}
.card-head h2 { font-size: var(--t-base); font-weight: 620; }
.card-note { font-size: var(--t-xs); color: var(--fg-subtle); }

.stats { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat { display: grid; gap: 2px; }
.stat-value { font-size: var(--t-xl); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: var(--t-xs); color: var(--fg-subtle); }

.meter { height: 6px; border-radius: var(--r-pill); background: var(--bg-inset); overflow: hidden; }
.meter-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--lav)); }
.meter-fill.is-full { background: var(--danger); }

/*
 * Meter widths as classes rather than a style attribute.
 *
 * `style-src 'self'` blocks inline style ATTRIBUTES, not just <style> blocks,
 * so `style="width:43%"` would silently render a zero-width bar. Bucketing to
 * 5% is the honest trade: a usage bar is a glance, not a readout, and the
 * exact figure is printed next to it in words.
 */
.m-0 { width: 0; }
.m-5 { width: 5%; }
.m-10 { width: 10%; }
.m-15 { width: 15%; }
.m-20 { width: 20%; }
.m-25 { width: 25%; }
.m-30 { width: 30%; }
.m-35 { width: 35%; }
.m-40 { width: 40%; }
.m-45 { width: 45%; }
.m-50 { width: 50%; }
.m-55 { width: 55%; }
.m-60 { width: 60%; }
.m-65 { width: 65%; }
.m-70 { width: 70%; }
.m-75 { width: 75%; }
.m-80 { width: 80%; }
.m-85 { width: 85%; }
.m-90 { width: 90%; }
.m-95 { width: 95%; }
.m-100 { width: 100%; }

/* Spacing utilities, for the same reason. */
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }
.mt-5 { margin-top: var(--s5); }
.row-plain { border-bottom: 0; padding-bottom: var(--s2); }

/* --- capability list ----------------------------------------------------- */

.rows { display: grid; gap: 0; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--t-sm);
}
.row:last-child { border-bottom: 0; }
.row-label { color: var(--fg-muted); min-width: 0; }
.row-label small { display: block; color: var(--fg-subtle); font-size: var(--t-xs); }
.row-value {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--s3);
  font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.row form { margin: 0; }

.badge {
  display: inline-block;
  padding: 2px var(--s2);
  border-radius: var(--r-pill);
  font-size: var(--t-xs);
  font-weight: 600;
  border: 1px solid transparent;
}
.badge-on { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge-off { background: var(--bg-inset); color: var(--fg-subtle); border-color: var(--border); }
.badge-info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }

/* --- activity ------------------------------------------------------------ */

.activity { display: grid; gap: 0; }
.activity-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: 0; }
.activity-formats { font-weight: 600; font-size: var(--t-sm); }
.activity-arrow { color: var(--fg-subtle); padding: 0 var(--s1); }
.activity-meta { font-size: var(--t-xs); color: var(--fg-subtle); }
.activity-when { font-size: var(--t-xs); color: var(--fg-subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
.activity-item form { margin: 0; }

.empty {
  padding: var(--s6) var(--s4);
  text-align: center;
  color: var(--fg-subtle);
  font-size: var(--t-sm);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
}
.empty strong { display: block; color: var(--fg); font-size: var(--t-base); margin-bottom: var(--s1); }

/* --- forms --------------------------------------------------------------- */

form { margin: 0; }
.field { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.field:last-of-type { margin-bottom: var(--s5); }
.field label { font-size: var(--t-sm); font-weight: 560; }
/* A 1000px-wide password box is not a better password box. */
.is-app .card .field { max-width: 460px; }
.field-hint { font-size: var(--t-xs); color: var(--fg-subtle); }

input[type='text'], input[type='email'], input[type='password'], input[type='number'], select {
  width: 100%;
  padding: 10px var(--s3);
  font: inherit;
  font-size: var(--t-sm);
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[aria-invalid='true'] { border-color: var(--danger); }

/*
 * The reveal button is positioned against the INPUT, not against the field.
 * Anchoring it to .field put it halfway down a block that also contains a
 * label and a hint, which is only accidentally in the right place — and was
 * visibly wrong on the change-password form, where the hint is longer.
 */
.input-wrap { position: relative; display: block; }
.field-password input { padding-right: 4rem; }
.reveal {
  position: absolute; right: var(--s2); top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--fg-subtle);
  font: inherit; font-size: var(--t-xs); font-weight: 600;
  cursor: pointer; padding: var(--s1) var(--s2);
}
.reveal:hover { color: var(--fg); }

.check { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.check:last-of-type { border-bottom: 0; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check-text { display: grid; gap: 2px; font-size: var(--t-sm); }
.check-text small { color: var(--fg-subtle); font-size: var(--t-xs); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  padding: 10px var(--s5);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font: inherit; font-size: var(--t-sm); font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-fg);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.button:hover { background: var(--accent-hover); color: var(--accent-fg); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button-block { width: 100%; }
.button-secondary { background: var(--bg-raised); color: var(--fg); border-color: var(--border-strong); }
.button-secondary:hover { background: var(--bg-inset); color: var(--fg); }
.button-danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.button-danger:hover { background: var(--danger); color: #fff; }
.button-small { padding: 6px var(--s3); font-size: var(--t-xs); }
.button-link { background: none; border: 0; color: var(--fg-subtle); padding: 4px var(--s2); font-size: var(--t-xs); font-weight: 600; cursor: pointer; }
.button-link:hover { color: var(--danger); background: none; }

.actions { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }

.divider { display: flex; align-items: center; gap: var(--s3); margin: var(--s5) 0; color: var(--fg-subtle); font-size: var(--t-xs); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.provider {
  display: flex; align-items: center; justify-content: center; gap: var(--s3);
  width: 100%;
  padding: 10px var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  color: var(--fg);
  font-size: var(--t-sm); font-weight: 600;
  text-decoration: none;
}
.provider:hover { background: var(--bg-inset); color: var(--fg); }
.provider-mark {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0);
  mask: radial-gradient(circle 4px at center, transparent 98%, #000);
}

/* --- notices ------------------------------------------------------------- */

.notice {
  padding: var(--s3) var(--s4);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-size: var(--t-sm);
  margin-bottom: var(--s4);
}
.notice-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.notice-success { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.notice-info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }

.callout {
  display: flex; gap: var(--s4); align-items: center; flex-wrap: wrap;
  padding: var(--s4) var(--s5);
  border-radius: var(--r-lg);
  border: 1px solid var(--accent-border);
  background: linear-gradient(120deg, var(--accent-soft), var(--lav-soft));
  margin-bottom: var(--s4);
}
.callout p { flex: 1; min-width: 220px; font-size: var(--t-sm); color: var(--fg-muted); }
.callout strong { display: block; color: var(--fg); font-size: var(--t-base); }

/* --- auth pages ---------------------------------------------------------- */

.auth-head { text-align: center; margin-bottom: var(--s5); display: grid; gap: var(--s2); }
.auth-head h1 { font-size: var(--t-xl); }
.auth-head p { color: var(--fg-muted); font-size: var(--t-sm); }
.auth-alt { margin-top: var(--s5); text-align: center; font-size: var(--t-sm); color: var(--fg-muted); }
.auth-aside {
  margin-top: var(--s5);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--ok-soft);
  border: 1px solid var(--ok-border);
  color: var(--ok);
  font-size: var(--t-xs);
  text-align: center;
}

/* --- onboarding ---------------------------------------------------------- */

.question { padding-bottom: var(--s5); margin-bottom: var(--s5); border-bottom: 1px solid var(--border); }
.question:last-of-type { border-bottom: 0; margin-bottom: var(--s4); }
.question legend { font-size: var(--t-base); font-weight: 620; padding: 0; margin-bottom: var(--s1); }
.question .field-hint { margin-bottom: var(--s3); }
fieldset { border: 0; padding: 0; margin: 0; }
/* A radio list is a reading task; 1000px-wide rows make it a scanning one. */
.options { display: grid; gap: var(--s2); max-width: 560px; }
.option {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: var(--t-sm);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.option:hover { border-color: var(--border-strong); background: var(--bg-soft); }
.option input { accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

/*
 * The data notice.
 *
 * A reading surface, not a control panel: the rows carry paragraphs rather
 * than a value on the right, so they stack instead of trying to align.
 */
.disclosure-row { display: block; padding: var(--s4) 0; }
.disclosure-row .row-label { display: block; color: var(--fg); }
.disclosure-row small { display: block; margin-top: var(--s1); color: var(--fg-muted); line-height: 1.6; }
.disclosure-meta { color: var(--fg-subtle) !important; font-size: var(--t-xs); }

/* --- developer surface --------------------------------------------------- */

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-inset);
  padding: 1px 5px;
  border-radius: 5px;
}

/*
 * The revealed key.
 *
 * Deliberately a <code> block and not an <input>. A secret in a form field is
 * offered to password managers as a credential for this origin, autofilled
 * later, and resubmitted — none of which should happen to a value that is only
 * meant to be copied once.
 */
.callout-key { border-color: var(--ok-border); background: var(--ok-soft); }
.callout-key p strong { color: var(--ok); }
.secret {
  display: block;
  flex-basis: 100%;
  padding: var(--s3) var(--s4);
  background: var(--bg-raised);
  border: 1px solid var(--ok-border);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: var(--t-sm);
  /* A key has no spaces, so it must be allowed to break or it overflows. */
  word-break: break-all;
  user-select: all;
}

.field-legend { font-size: var(--t-sm); font-weight: 560; padding: 0; }
.row-label code { font-size: var(--t-xs); }

/*
 * The one irreversible control on this plane.
 *
 * Set apart rather than styled loudly: a red button among other red buttons
 * stops reading as a warning. The border is what says "this section is
 * different", and the confirmation is what actually protects anyone.
 */
.danger-zone {
  padding: var(--s4);
  border: 1px solid var(--danger-border);
  border-radius: var(--r-md);
  background: var(--danger-soft);
}
.danger-zone h3 { color: var(--danger); margin-bottom: var(--s2); }
.danger-zone .field-hint { margin-bottom: var(--s2); }

/* --- footer -------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--border);
  padding: var(--s5) var(--s4);
  text-align: center;
  font-size: var(--t-xs);
  color: var(--fg-subtle);
}
.footer a { color: var(--fg-muted); }

/* --- narrow -------------------------------------------------------------- */

@media (max-width: 640px) {
  .topbar-inner { flex-wrap: wrap; row-gap: var(--s2); }
  .nav { order: 3; flex-basis: 100%; margin-inline-start: 0; overflow-x: auto; }
  .menu-name { display: none; }
  .main { padding-top: var(--s5); }
  .card { padding: var(--s4); }
  /*
   * Two columns on a phone: details and time on the first row, the remove
   * control right-aligned beneath the time rather than orphaned under the
   * text, where it reads as part of the previous line.
   */
  .activity-item { grid-template-columns: 1fr auto; row-gap: var(--s2); }
  .activity-when { grid-column: 2; }
  .activity-item form { grid-column: 2; justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* --- the plan page ------------------------------------------------------- */

/* Two buttons side by side, wrapping on a narrow screen. */
.plan-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin: var(--s4) 0;
}

/* A value the account gets because it pays for it. */
.row-value.is-paid {
  color: var(--accent);
  font-weight: 650;
}

/* --- the operator's overview --------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s4);
  margin: var(--s2) 0 var(--s4);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-size: var(--t-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-label {
  font-size: var(--t-sm);
  color: var(--fg-muted);
}

.stat-hint {
  font-size: var(--t-xs);
  color: var(--fg-subtle);
}

/* --- what an account stores, said before it is created ------------------- */

.signup-notice {
  margin: var(--s4) 0;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  font-size: var(--t-sm);
}

.signup-notice summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--fg);
}

.signup-notice ul {
  margin: var(--s3) 0 0;
  padding-left: var(--s4);
  color: var(--fg-muted);
}

.signup-notice li { margin-bottom: var(--s2); }
.signup-notice p { margin-top: var(--s3); }
