/* ============================================================
   DigiCalc — hi-fi visual system
   Trustworthy, modern, Wise/Stripe-adjacent.
   ============================================================ */

:root {
  /* Palette — light */
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f3f2ed;
  --surface-warm: #f0ead9;
  --ink: #0a0b0d;
  --ink-2: #2a2d33;
  --muted: #5b6470;
  --faint: #9aa0a8;
  --rule: #e8e6e1;
  --rule-strong: #d8d5cd;
  --accent: #2a6fdb;
  --accent-fg: #ffffff;
  --accent-soft: rgba(42, 111, 219, .08);
  --pos: #1f8a5b;
  --neg: #c43c2c;
  --warn: #d18a1a;

  /* Type */
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Courier New", monospace;

  /* Density */
  --pad: 16px;
  --pad-lg: 24px;
  --pad-xl: 40px;
  --radius: 10px;
  --radius-sm: 6px;

  /* Motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 120ms;
  --t-med: 220ms;

  /* Shadows */
  --shadow-card: 0 1px 0 rgba(10,11,13,.04), 0 0 0 1px var(--rule);
  --shadow-pop: 0 1px 2px rgba(10,11,13,.04), 0 8px 28px rgba(10,11,13,.08);
  --shadow-focus: 0 0 0 3px rgba(42, 111, 219, .18);
}

[data-theme="dark"] {
  --bg: #0c0d10;
  --surface: #14161a;
  --surface-2: #1c1f25;
  --ink: #f4f3ee;
  --ink-2: #d8d5cd;
  --muted: #98a0ab;
  --faint: #6b7380;
  --rule: #23262d;
  --rule-strong: #2c2f37;
  --accent-soft: rgba(42, 111, 219, .14);
  --shadow-card: 0 1px 0 rgba(255,255,255,.02), 0 0 0 1px var(--rule);
  --shadow-pop: 0 1px 2px rgba(0,0,0,.5), 0 12px 32px rgba(0,0,0,.5);
}

/* density variants */
[data-density="compact"] { --pad: 12px; --pad-lg: 18px; --pad-xl: 30px; }
[data-density="comfy"]   { --pad: 20px; --pad-lg: 32px; --pad-xl: 56px; }

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: var(--accent-fg); }

a { color: inherit; text-decoration: none; }

/* ============================================================
   Layout primitives
   ============================================================ */
.dc-page { min-height: 100vh; display: flex; flex-direction: column; }
.dc-shell { max-width: 1240px; margin: 0 auto; padding: 0 var(--pad-lg); width: 100%; }
.dc-shell.narrow { max-width: 1080px; }

/* ============================================================
   Brand wordmark (Direction D)
   ============================================================ */
.dc-brand {
  display: inline-flex; align-items: baseline;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -.035em;
  color: var(--ink);
  line-height: 1;
}
.dc-brand .dot {
  width: .26em; height: .26em;
  background: var(--accent);
  border-radius: 50%;
  margin-left: .04em;
  align-self: center;
  position: relative; top: .32em;
}
.dc-brand.lg { font-size: 64px; }
.dc-brand.xl { font-size: 96px; }

/* ============================================================
   Header
   ============================================================ */
.dc-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--rule);
}
.dc-header-row {
  display: flex; align-items: center; gap: 18px;
  height: 60px;
}
.dc-header .grow { flex: 1; }
.dc-header .nav-links {
  display: flex; align-items: center; gap: 24px;
  font-size: 14px; color: var(--muted);
}
.dc-header .nav-links a { transition: color var(--t-fast); }
.dc-header .nav-links a:hover { color: var(--ink); }
.dc-header .signin {
  border: 1px solid var(--rule-strong); border-radius: 999px;
  padding: 6px 14px; color: var(--ink); font-size: 13px;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.dc-header .signin:hover { background: var(--surface); border-color: var(--ink-2); }
@media (max-width: 720px) {
  .dc-header .nav-links a:not(.signin) { display: none; }
}

/* command-palette style search */
.dc-search-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-size: 13px; color: var(--muted);
  min-width: 240px; max-width: 360px; flex: 1;
  cursor: text;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.dc-search-trigger:hover { border-color: var(--rule-strong); }
.dc-search-trigger .kbd {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--rule);
}
.dc-search-trigger .icon { width: 14px; height: 14px; opacity: .65; }

/* ============================================================
   Buttons
   ============================================================ */
.dc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
.dc-btn:hover { background: var(--surface-2); }
.dc-btn:active { transform: translateY(1px); }
.dc-btn.primary {
  background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
}
.dc-btn.primary:hover { filter: brightness(.96); background: var(--accent); }
.dc-btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.dc-btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.dc-btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.dc-btn.lg { padding: 12px 20px; font-size: 15px; }

.dc-iconbtn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--surface);
  color: var(--muted); cursor: pointer; transition: all var(--t-fast);
}
.dc-iconbtn:hover { color: var(--ink); border-color: var(--rule-strong); }

/* ============================================================
   Pill / chip / kbd
   ============================================================ */
.dc-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--rule);
}
.dc-pill.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dc-pill.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.dc-kbd {
  font-family: var(--font-mono); font-size: 11px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--rule);
}

/* ============================================================
   Meta labels — tiny tracked caps
   ============================================================ */
.dc-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  font-weight: 500;
}

/* ============================================================
   Footer
   ============================================================ */
.dc-footer {
  margin-top: auto;
  border-top: 1px solid var(--rule);
  padding: 40px 0 32px;
  background: var(--bg);
}
.dc-footer-grid {
  display: grid; grid-template-columns: 2fr repeat(3, 1fr);
  gap: 32px;
}
.dc-footer h5 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); font-weight: 600; margin: 0 0 12px;
}
.dc-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.dc-footer ul a { color: var(--ink-2); font-size: 14px; transition: color var(--t-fast); }
.dc-footer ul a:hover { color: var(--accent); }
.dc-footer .legal {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--faint);
}
@media (max-width: 720px) {
  .dc-footer-grid { grid-template-columns: 1fr 1fr; }
  .dc-footer-grid > div:first-child { grid-column: 1 / -1; }
}

/* ============================================================
   Numbers — tabular & big
   ============================================================ */
.num { font-variant-numeric: tabular-nums; }
.display {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: .95;
}

/* ============================================================
   Card surfaces
   ============================================================ */
.dc-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.dc-divider {
  height: 1px; background: var(--rule); border: 0; margin: 0;
}

/* ============================================================
   Directory — pill list (homepage)
   ============================================================ */
.dc-directory {
  margin-top: 8px;
  padding: 0;
}
.dc-directory-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px; padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.dc-directory-head h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700; letter-spacing: -.015em;
  margin: 0;
}
.dc-dir-rows {
  display: flex; flex-direction: column;
}

/* Featured block — tinted panel to separate from the directory below */
.dc-featured-section {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 18px 18px 18px;
  margin-top: 18px;
}
.dc-featured-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 4px 12px;
}
.dc-featured-meta {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); font-weight: 500;
}

/* Directory block — sits on the page bg, separated by the featured panel above */
.dc-dir-block {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}
.dc-dir-block-head {
  margin: 0 0 14px;
}

/* Featured row */
.dc-featured {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0 18px;
}
@media (max-width: 860px) {
  .dc-featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.dc-feat {
  text-align: left;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  cursor: pointer;
  color: inherit;
  transition: border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  font-family: var(--font-ui);
  min-height: 132px;
}
.dc-feat:hover {
  border-color: var(--rule-strong);
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(10,11,13,.04), 0 6px 20px rgba(10,11,13,.05);
}
.dc-feat-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.dc-feat-name {
  font-size: 16px; font-weight: 600; color: var(--ink);
  letter-spacing: -.01em;
}
.dc-feat-meta-row {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
  font-weight: 500;
}
.dc-feat-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.dc-feat-cat { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-feat-popular {
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  letter-spacing: .08em;
}
.dc-feat-sample {
  display: flex; align-items: baseline; gap: 6px;
  margin-top: auto;
}
.dc-feat-sample .display { font-size: 30px; }
.dc-feat-unit { font-size: 12px; color: var(--muted); font-weight: 500; }
.dc-feat-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}
.dc-feat-sub { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-dir-row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}
.dc-dir-row:last-child { border-bottom: 0; }
.dc-dir-cat {
  display: flex; align-items: center; gap: 10px;
  padding-top: 6px;
}
.dc-dir-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex: none;
}
.dc-dir-cat-label {
  font-family: var(--font-display);
  font-size: 18px; letter-spacing: -.01em;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}
.dc-dir-pills {
  display: flex; flex-wrap: wrap; gap: 8px;
}

.dc-pill-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -.005em;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease),
              background var(--t-fast),
              box-shadow var(--t-fast),
              border-color var(--t-fast),
              color var(--t-fast);
}
.dc-pill-btn:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.dc-pill-btn:active { transform: translateY(1px); }
.dc-pill-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}
.dc-pill-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.dc-pill-btn:hover .dc-pill-dot { background: var(--bg); }

@media (max-width: 720px) {
  .dc-dir-row { grid-template-columns: 1fr; gap: 10px; padding: 16px 0; }
  .dc-dir-cat { padding-top: 0; }
}

/* ============================================================
   Calculator page — grid + hero + sliders
   ============================================================ */
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas:
    "hero  aside"
    "input aside";
  gap: 20px;
}
.calc-hero { grid-area: hero; }
.calc-inputs { grid-area: input; padding: 22px 24px 18px; display: flex; flex-direction: column; gap: 14px; }
.calc-aside { grid-area: aside; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1020px) {
  .calc-grid { grid-template-columns: 1fr; grid-template-areas: "hero" "input" "aside"; }
}

/* hero result card */
.calc-hero {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: 24px; padding: 28px 32px;
}
.calc-hero-main { min-width: 0; }
.calc-hero-chart {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.calc-hero-legend {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; color: var(--muted); width: 100%;
}
.calc-hero-legend > div {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 4px 0;
}
.calc-hero-legend .sw {
  width: 10px; height: 10px; border-radius: 2px; display: inline-block;
}
.calc-hero-legend b { color: var(--ink); font-weight: 600; }
@media (max-width: 720px) {
  .calc-hero { grid-template-columns: 1fr; }
}

.calc-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 4px;
}

/* ============================================================
   BMI calculator
   ============================================================ */
.bmi-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
}
@media (max-width: 1020px) { .bmi-grid { grid-template-columns: 1fr; } }
.bmi-result { padding: 28px 32px; }
.bmi-gauge-track {
  position: relative;
  height: 14px; border-radius: 999px;
  background: var(--surface-2);
  overflow: visible;
}
.bmi-gauge-seg {
  position: absolute; top: 0; bottom: 0;
  opacity: .85;
}
.bmi-gauge-seg:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
.bmi-gauge-seg:last-child  { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
.bmi-gauge-marker {
  position: absolute; top: -3px; bottom: -3px;
  width: 4px; border-radius: 4px;
  background: var(--ink);
  transform: translateX(-50%);
  transition: left 220ms var(--ease);
}
.bmi-gauge-bubble {
  position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
  white-space: nowrap;
}
.bmi-gauge-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: var(--ink);
}
.bmi-gauge-legend {
  display: flex; justify-content: space-between;
  margin-top: 10px;
  font-family: var(--font-mono); font-size: 11px; color: var(--faint);
}
.bmi-field {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 0;
}
.bmi-field label {
  font-size: 13.5px; font-weight: 500; color: var(--ink);
}

/* ============================================================
   Compound interest
   ============================================================ */
.comp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
}
.comp-grid .calc-inputs,
.bmi-grid .calc-inputs { grid-area: auto; }
@media (max-width: 1020px) { .comp-grid { grid-template-columns: 1fr; } }
.comp-result { padding: 24px 28px; }
.comp-legend {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--muted);
}
.comp-legend > div {
  display: grid; grid-template-columns: 14px 1fr auto;
  align-items: center; gap: 10px;
}
.comp-legend .sw {
  width: 12px; height: 12px; border-radius: 3px;
}
.comp-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============================================================
   Time zone converter
   ============================================================ */
.tz-pair {
  display: grid;
  grid-template-columns: 1fr 80px 1fr;
  gap: 16px; align-items: stretch;
}
@media (max-width: 720px) {
  .tz-pair { grid-template-columns: 1fr; }
  .tz-arrow { transform: rotate(90deg); padding: 8px 0; }
}
.tz-pane {
  padding: 18px 20px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.tz-pane.hi {
  background: var(--accent-soft);
  border-color: transparent;
}
.tz-select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  color: var(--ink);
  cursor: pointer;
}
.tz-time {
  font-size: 44px; line-height: 1; margin-top: 4px;
  letter-spacing: -.02em;
}
.tz-pane.hi .tz-time { color: var(--accent); }
.tz-arrow {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--muted);
}

.tz-strip {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 4px;
  background: var(--surface);
}
.tz-cell {
  appearance: none; border: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 2px;
  padding: 8px 0 6px;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast);
}
.tz-cell:hover { background: var(--surface-2); }
.tz-cell.overlap { background: color-mix(in srgb, var(--pos) 10%, transparent); }
.tz-cell.active {
  background: var(--accent); color: var(--accent-fg);
  box-shadow: 0 0 0 1px var(--accent);
}
.tz-cell.active.overlap { background: var(--accent); }
.tz-cell-from { font-size: 12px; font-weight: 600; }
.tz-cell-to   { font-size: 10px; opacity: .7; font-family: var(--font-mono); }
.tz-cell-dot {
  position: absolute; bottom: 3px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--pos);
}
.tz-cell.active .tz-cell-dot { background: var(--accent-fg); }

/* slider row */
.sr-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 0;
}
.sr-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sr-lbl {
  font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.sr-hint {
  font-size: 12px; color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%;
}
.sr-controls {
  display: grid; grid-template-columns: 1fr 130px;
  gap: 14px; align-items: center;
}
.sr-controls:has(.sr-segments:only-child) { grid-template-columns: 1fr; }

.sr-track-wrap { position: relative; height: 28px; display: flex; align-items: center; }

/* range input — fully styled */
input.sr-track {
  --pct: 0%;
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0 var(--pct), var(--surface-2) var(--pct) 100%);
  outline: none; cursor: pointer;
  margin: 0;
}
input.sr-track::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: 0 1px 3px rgba(10,11,13,.15);
  cursor: grab;
  transition: transform var(--t-fast);
}
input.sr-track:active::-webkit-slider-thumb { transform: scale(1.1); cursor: grabbing; }
input.sr-track::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  box-shadow: 0 1px 3px rgba(10,11,13,.15);
  cursor: grab;
}
input.sr-track:focus-visible { box-shadow: var(--shadow-focus); }

/* numeric input */
.sr-num {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  height: 36px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.sr-num:focus-within { border-color: var(--accent); box-shadow: var(--shadow-focus); }
.sr-num input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-family: var(--font-ui); font-size: 14px; font-weight: 500;
  color: var(--ink); text-align: right;
  font-variant-numeric: tabular-nums;
  padding: 0;
}
.sr-num .sr-unit {
  font-size: 12px; color: var(--muted); font-weight: 500;
  white-space: nowrap;
}

/* segmented (term selector) */
.sr-segments {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: 8px; padding: 3px;
  gap: 2px;
  width: fit-content;
}
.sr-seg {
  border: 0; background: transparent;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  color: var(--muted);
  padding: 6px 12px; border-radius: 6px;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
  font-variant-numeric: tabular-nums;
}
.sr-seg:hover { color: var(--ink); }
.sr-seg.active {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(10,11,13,.06), 0 0 0 1px var(--rule);
}

/* advanced details */
.calc-advanced { padding-top: 4px; }
.calc-advanced summary {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; color: var(--muted); cursor: pointer;
  padding: 6px 0;
  list-style: none;
  user-select: none;
}
.calc-advanced summary::-webkit-details-marker { display: none; }
.calc-advanced summary:hover { color: var(--ink); }
.calc-advanced[open] summary svg { transform: rotate(45deg); transition: transform var(--t-fast); }
.calc-advanced summary svg { transition: transform var(--t-fast); }
.adv-grid {
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 8px;
}

