/* ============================================================
   1234Tools — design system
   Dark-futuristic gold theme, originally developed for
   mvritservices.com/tools and carried over unchanged.

   Theming, three modes:
     [data-theme="dark"]    forced dark
     [data-theme="light"]   forced light
     [data-theme="system"]  follows prefers-color-scheme
   Default is dark.
   ============================================================ */

/* ---------- DARK: parent-site tokens, unchanged ---------- */
:root {
  --bg-0: #06080f;
  --bg-1: #0a0e1a;
  --bg-2: #101627;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --border-gold: rgba(247, 201, 72, 0.35);

  --gold-1: #ffe29a;
  --gold-2: #f7c948;
  --gold-3: #e8a020;
  --amber:  #ff9d2e;
  --violet: #7c5cff;
  --cyan:   #2dd4ff;

  --text-1: #f4f6fb;
  --text-2: #b7bfd2;
  --text-3: #8790a5;

  --grad-gold: linear-gradient(120deg, var(--gold-1) 0%, var(--gold-2) 45%, var(--amber) 100%);
  --grad-hero: linear-gradient(120deg, #ffe29a 0%, #f7c948 30%, #ff9d2e 60%, #7c5cff 110%);

  --glow-gold: 0 0 24px rgba(247, 201, 72, 0.35), 0 0 64px rgba(247, 201, 72, 0.12);
  --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.45);

  --radius: 18px;
  --radius-sm: 12px;
  --container: 1180px;

  --font-head: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  /* tools-only additions */
  --recess: #04060c;        /* readout well, deeper than bg-0 */
  --accent: var(--gold-2);  /* the one token that flips per theme */
  --link: var(--gold-2);
  --nav-cta-ink: #1a1204;
  --readout-fg: #d5dceb;
  --readout-label: #7d8699;
  --readout-rule: rgba(255, 255, 255, 0.06);
}

/* ---------- LIGHT: derived from the same brand hues ----------
   #f7c948 measures 1.57:1 on white, so it cannot carry text here.
   Gold is kept for fills, borders and the readout well; a deepened
   bronze from the same hue family (#7d5200, 6.82:1 on white)
   carries links and accent text. Measured, not eyeballed. */
[data-theme="light"] {
  --bg-0: #ffffff;
  --bg-1: #f7f8fb;
  --bg-2: #eef1f7;
  --surface: rgba(6, 8, 15, 0.03);
  --surface-strong: rgba(6, 8, 15, 0.06);
  --border: rgba(6, 8, 15, 0.12);
  --border-gold: rgba(232, 160, 32, 0.45);

  --text-1: #0d1220;   /* 18.7:1 on white */
  --text-2: #4a5568;   /*  7.5:1 */
  --text-3: #5c6a80;   /*  5.5:1 */

  --shadow-card: 0 8px 28px rgba(6, 8, 15, 0.09);
  --glow-gold: 0 0 0 1px rgba(232, 160, 32, 0.28);

  --recess: #0a0e1a;   /* readout stays dark — it is an instrument display */
  --accent: #7d5200;   /* 6.8:1 on white */
  --link: #7d5200;
}

@media (prefers-color-scheme: light) {
  [data-theme="system"] {
    --bg-0: #ffffff;
    --bg-1: #f7f8fb;
    --bg-2: #eef1f7;
    --surface: rgba(6, 8, 15, 0.03);
    --surface-strong: rgba(6, 8, 15, 0.06);
    --border: rgba(6, 8, 15, 0.12);
    --border-gold: rgba(232, 160, 32, 0.45);
    --text-1: #0d1220;
    --text-2: #4a5568;
    --text-3: #5c6a80;
    --shadow-card: 0 8px 28px rgba(6, 8, 15, 0.09);
    --glow-gold: 0 0 0 1px rgba(232, 160, 32, 0.28);
    --recess: #0a0e1a;
    --accent: #7d5200;
    --link: #7d5200;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-2);
  background: var(--bg-0);
  transition: background-color .25s ease, color .25s ease;
}

h1, h2, h3, h4, .brand { font-family: var(--font-head); color: var(--text-1); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

input, select, .result-value, .formula, .stat-num { font-variant-numeric: tabular-nums; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }

.skip {
  position: absolute; left: -9999px;
  background: var(--gold-2); color: #1a1204;
  padding: 12px 20px; border-radius: var(--radius-sm); z-index: 200; font-weight: 600;
}
.skip:focus { left: 16px; top: 12px; }

/* ================= HEADER — mirrors the parent site ================= */

.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg-0) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--border);
}

.nav-wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 78px; gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.12rem; letter-spacing: .01em; }
.brand:hover { text-decoration: none; color: var(--text-1); }
.brand img, .brand svg { width: 42px; height: 42px; flex: none; }
.brand small {
  display: block; font-size: .62rem; font-weight: 500;
  letter-spacing: .28em; text-transform: uppercase; color: var(--accent);
}

.nav-links { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 10px 16px; border-radius: 999px;
  color: var(--text-2); font-weight: 500; font-size: .95rem;
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text-1); background: var(--surface); text-decoration: none; }
.nav-links a.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nav-links .nav-cta {
  background: var(--grad-gold); color: var(--nav-cta-ink);
  font-weight: 600; margin-left: 10px; box-shadow: 0 0 18px rgba(247, 201, 72, .3);
}
.nav-links .nav-cta:hover { color: var(--nav-cta-ink); box-shadow: 0 0 28px rgba(247, 201, 72, .5); }

.nav-toggle {
  display: none; background: none; border: 1px solid var(--border);
  border-radius: 10px; width: 44px; height: 44px; cursor: pointer;
  align-items: center; justify-content: center; flex-direction: column; gap: 5px;
}
.nav-toggle span { width: 18px; height: 2px; background: var(--text-1); border-radius: 2px; transition: .25s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- tools search + theme switch, inside the header bar ---- */

.header-tools { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 420px; }

.search-wrap { position: relative; flex: 1; min-width: 0; }
#q {
  width: 100%; padding: 10px 14px 10px 38px;
  background: var(--surface); color: var(--text-1);
  border: 1px solid var(--border); border-radius: 999px;
  font: inherit; font-size: 16px; font-family: var(--font-body);
}
#q::placeholder { color: var(--text-3); }
#q:focus {
  outline: none; border-color: var(--border-gold); background: var(--surface-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.search-wrap::before {
  content: ""; position: absolute; left: 14px; top: 50%; width: 14px; height: 14px;
  transform: translateY(-50%); pointer-events: none; opacity: .6;
  background: var(--text-3);
  -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");
          mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E");
}

/* three-state segmented theme switch */
.theme-switch {
  display: inline-flex; flex: none; padding: 3px; gap: 2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
}
.theme-switch button {
  width: 32px; height: 30px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 999px; cursor: pointer;
  color: var(--text-3); transition: background .2s, color .2s;
}
.theme-switch button:hover { color: var(--text-1); background: var(--surface-strong); }
.theme-switch button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent);
}
.theme-switch svg { width: 15px; height: 15px; display: block; }

/* ---- search results ---- */
.search-results {
  position: absolute; z-index: 99; left: 0; right: 0; top: calc(100% + 8px);
  max-height: 62vh; overflow-y: auto;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-card);
}
.search-results a {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  color: var(--text-2); border-bottom: 1px solid var(--border); font-size: .92rem;
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a:focus {
  background: var(--surface); color: var(--accent); text-decoration: none;
}
.search-empty { padding: 14px; color: var(--text-3); font-size: .9rem; }

/* ================= PAGE ================= */

main { min-height: 60vh; padding: 32px 0 64px; }

.crumbs { font-size: .82rem; color: var(--text-3); margin-bottom: 18px; }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--accent); }

h1 { font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; margin: 0 0 10px; }
.lede { color: var(--text-2); font-size: 1.02rem; margin: 0 0 28px; max-width: 62ch; }

.eyebrow {
  font-size: .7rem; font-weight: 600; letter-spacing: .28em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}

.panel h2 {
  font-size: .72rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-3); margin: 0 0 12px;
}
.section-title { font-size: clamp(1.15rem, 3vw, 1.5rem); font-weight: 700; margin: 0 0 18px; color: var(--text-1); }

/* ---------- calculator ---------- */

.calc { margin-bottom: 32px; }

@media (min-width: 900px) {
  .calc { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
  .tool-results { position: sticky; top: 96px; order: 2; margin-bottom: 0; }
  .tool-form { order: 1; }
}

/* Readout leads on mobile so the answer stays visible while inputs
   are tuned below it, rather than scrolling out of view. */
.tool-results {
  background: var(--recess);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  padding: 6px 20px; margin-bottom: 16px;
  box-shadow: inset 0 2px 14px rgba(0, 0, 0, .6);
}

.result {
  display: flex; align-items: baseline; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--readout-rule);
}
.result:last-child { border-bottom: 0; }
.result-label { flex: 1; min-width: 0; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--readout-label); }
.result-value { font-family: var(--font-mono); font-size: .98rem; font-weight: 600; color: var(--readout-fg); text-align: right; word-break: break-word; }

/* signature: primary figure as an instrument readout, in brand gold */
.result-primary { padding: 18px 0 20px; border-bottom: 1px solid var(--border-gold); }
.result-primary .result-label { color: rgba(247, 201, 72, .62); }
.result-primary .result-value {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 6.5vw, 2.3rem); font-weight: 700; letter-spacing: -.02em;
  color: var(--gold-2); text-shadow: 0 0 26px rgba(247, 201, 72, .3);
}

.copy {
  flex: none; width: 28px; height: 28px; background: transparent; color: var(--readout-label);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; cursor: pointer; font-size: .78rem;
}
.copy:hover { color: var(--gold-2); border-color: var(--border-gold); }

.all-units { margin-top: 10px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, .08); }
.all-units h3 { font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--readout-label); margin: 10px 0 2px; }

/* ---------- form ---------- */

.tool-form {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.field { margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 0; }
.field label {
  display: block; margin-bottom: 6px; font-size: .72rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-3);
}
.control {
  width: 100%; padding: 12px 14px; font: inherit; font-size: 16px;
  font-family: var(--font-mono); color: var(--text-1);
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.control:focus { outline: none; border-color: var(--border-gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
select.control { font-family: var(--font-body); }

.swap {
  width: 100%; margin-top: 16px; padding: 12px;
  background: transparent; color: var(--accent);
  border: 1px dashed var(--border-gold); border-radius: var(--radius-sm);
  font: inherit; font-family: var(--font-body); font-size: .9rem; font-weight: 500; cursor: pointer;
}
.swap:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* ---------- content ---------- */

.panel {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px;
}
.formula {
  margin: 0; padding: 14px; background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: .86rem; color: var(--accent); overflow-x: auto;
}
.tips { margin: 0; padding-left: 18px; }
.tips li { margin-bottom: 8px; color: var(--text-2); font-size: .94rem; }
.tips li:last-child { margin-bottom: 0; }
.tips li::marker { color: var(--accent); }

details { border-top: 1px solid var(--border); padding: 12px 0; }
details:first-of-type { border-top: 0; padding-top: 0; }
summary { cursor: pointer; font-weight: 600; font-size: .95rem; color: var(--text-1); font-family: var(--font-head); }
summary::marker { color: var(--accent); }
details p { margin: 8px 0 0; color: var(--text-2); font-size: .93rem; }

.related { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 24px; }
.related li { margin-bottom: 7px; break-inside: avoid; }
.related a { font-size: .91rem; }

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

.grid { display: grid; gap: 16px; margin-bottom: 36px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.card {
  display: flex; flex-direction: column; gap: 6px; padding: 20px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-2); transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card:hover {
  border-color: var(--border-gold); transform: translateY(-3px);
  box-shadow: var(--shadow-card); text-decoration: none;
}
.card strong { font-family: var(--font-head); font-size: .96rem; font-weight: 600; color: var(--text-1); line-height: 1.35; }
.card-icon { font-size: 1.3rem; line-height: 1; }
.card-desc { font-size: .84rem; color: var(--text-3); }

/* ---------- hero ---------- */

.hero { padding: 28px 0 40px; border-bottom: 1px solid var(--border); margin-bottom: 40px; }
.hero h1 { max-width: 20ch; }
.hero h1 .grad {
  background: var(--grad-hero); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-stats { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 26px; }
.stat-num { font-family: var(--font-head); font-size: 1.7rem; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-lbl { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin-top: 6px; }

/* ================= FOOTER — mirrors the parent site ================= */

.site-footer { background: var(--bg-1); border-top: 1px solid var(--border); padding: 64px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 48px; }
.footer-about p { color: var(--text-3); font-size: .92rem; margin: 16px 0 0; max-width: 44ch; }
.site-footer h4 {
  font-size: .72rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-1); margin: 0 0 16px;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 10px; }
.site-footer li a { color: var(--text-3); font-size: .92rem; }
.site-footer li a:hover { color: var(--accent); }

.footer-legal {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between;
  margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border);
  font-size: .82rem; color: var(--text-3);
}
.footer-note {
  margin-top: 18px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: .82rem; color: var(--text-3);
}
.footer-note strong { color: var(--text-2); }

/* ================= a11y & responsive ================= */

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .card:hover { transform: none; }
}

@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 36px; }
  .header-tools { max-width: 300px; }
}

@media (max-width: 900px) {
  .nav-wrap { height: auto; min-height: 64px; flex-wrap: wrap; padding-top: 10px; }
  .nav-toggle { display: flex; order: 2; }
  .header-tools { order: 3; max-width: none; width: 100%; padding-bottom: 12px; }
  .nav-links {
    order: 4; width: 100%; flex-direction: column; align-items: stretch;
    gap: 2px; padding-bottom: 14px; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; border-radius: var(--radius-sm); }
  .nav-links .nav-cta { margin-left: 0; margin-top: 8px; text-align: center; }
  .brand small { letter-spacing: .2em; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .related { columns: 1; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card { padding: 14px; }
  .card-desc { display: none; }
  .hero-stats { gap: 22px; }
  .brand span { font-size: .98rem; }
  .brand img, .brand svg { width: 34px; height: 34px; }
}

@media print {
  .site-header, .site-footer, .search-results, .swap, .copy, .skip { display: none; }
  body { background: #fff; color: #000; }
  .tool-results { background: #fff; border: 1px solid #000; box-shadow: none; }
  .result-value, .result-primary .result-value { color: #000; text-shadow: none; }
}

/* ============================================================
   Developer & web tools — code panes, generators, QR, file drop
   ============================================================ */

.tool-io { margin-bottom: 32px; }

.opt-bar {
  display: grid; gap: 14px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  padding: 16px; background: var(--bg-1);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.opt-bar .field { margin-bottom: 0; }

.io-pane {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
}
.io-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.io-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-3);
}
.io-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn-ghost, .btn-copy, .btn-download, .btn-primary {
  padding: 7px 14px; font: inherit; font-size: .8rem; font-weight: 600;
  font-family: var(--font-body); border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text-2);
  transition: border-color .2s, color .2s, background .2s;
}
.btn-ghost:hover, .btn-copy:hover, .btn-download:hover {
  border-color: var(--border-gold); color: var(--accent);
}
.btn-copy.ok { border-color: var(--border-gold); color: var(--accent); }
.btn-primary {
  background: var(--grad-gold); color: var(--nav-cta-ink);
  border-color: transparent; padding: 10px 18px;
}
.btn-primary:hover { box-shadow: 0 0 22px rgba(247,201,72,.4); }

.code-area, .code-out {
  width: 100%; margin: 0; padding: 16px;
  font-family: var(--font-mono); font-size: .85rem; line-height: 1.6;
  color: var(--text-1); background: var(--bg-0);
  border: 0; border-radius: 0; resize: vertical;
  white-space: pre; overflow-x: auto; tab-size: 2;
}
.code-area { display: block; min-height: 180px; font-size: 16px; }
.code-area:focus { outline: none; box-shadow: inset 0 0 0 2px var(--border-gold); }
.code-out { min-height: 120px; max-height: 480px; overflow-y: auto; }
.code-out:empty::before { content: "Output appears here."; color: var(--text-3); font-style: italic; }

@media (min-width: 768px) { .code-area { font-size: .85rem; } }

.io-msg { padding: 0 16px; font-size: .87rem; }
.io-msg:not(:empty) { padding: 12px 16px; }
.io-msg.is-error {
  color: #ff9d8a; background: rgba(255,90,60,.09);
  border-bottom: 1px solid rgba(255,90,60,.25); white-space: pre-wrap;
  font-family: var(--font-mono); font-size: .82rem;
}
.io-msg.is-warn { color: var(--gold-2); background: rgba(247,201,72,.08); border-bottom: 1px solid var(--border-gold); }
.io-msg.is-note { color: var(--text-3); font-style: italic; }
[data-theme="light"] .io-msg.is-error { color: #8c1d0c; background: rgba(200,40,20,.07); }
[data-theme="light"] .io-msg.is-warn { color: #7d5200; }

.stat-grid {
  display: grid; gap: 1px; background: var(--border);
  border-top: 1px solid var(--border);
}
.stat-grid:empty { display: none; }
.stat-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--bg-1); font-size: .82rem;
}
.stat-key { color: var(--text-3); letter-spacing: .04em; }
.stat-val { font-family: var(--font-mono); color: var(--text-1); font-weight: 600; text-align: right; }

/* generator form */
.gen-form {
  display: grid; gap: 14px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 20px; background: var(--bg-1);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.gen-form .field { margin-bottom: 0; }
.gen-form textarea.control { font-family: var(--font-body); resize: vertical; }
.gen-form .btn-primary { grid-column: 1 / -1; justify-self: start; }

.colour-field { display: flex; gap: 8px; align-items: center; }
.colour-swatch {
  width: 46px; height: 42px; padding: 2px; flex: none; cursor: pointer;
  background: var(--bg-0); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.colour-hex { flex: 1; min-width: 0; text-transform: uppercase; }

.swatch-preview {
  display: grid; place-items: center; min-height: 88px;
  padding: 20px; font-size: 21px; font-weight: 600; text-align: center;
  border-bottom: 1px solid var(--border);
}
.gradient-preview { height: 120px; border-bottom: 1px solid var(--border); }

/* QR */
.qr-stage {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.qr-box { display: grid; place-items: center; padding: 28px 20px; background: var(--surface); }
.qr-box:empty { display: none; }
.qr-box svg {
  width: 100%; max-width: 320px; height: auto;
  border-radius: 8px; box-shadow: var(--shadow-card);
}
.qr-actions { padding: 0 16px 16px; justify-content: center; }
.qr-actions:empty { padding: 0; }

/* file tools */
.dropzone {
  display: grid; place-items: center; gap: 6px; text-align: center;
  padding: 40px 20px; margin-bottom: 16px; cursor: pointer;
  background: var(--bg-1); border: 2px dashed var(--border);
  border-radius: var(--radius); transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.over {
  border-color: var(--border-gold); background: var(--surface-strong);
}
.dropzone strong { font-family: var(--font-head); font-size: 1rem; color: var(--text-1); }
.dropzone span { font-size: .85rem; color: var(--text-3); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.file-results {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.file-results:empty { display: none; }
.file-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius);
  text-align: center;
}
.file-card-wide { grid-column: 1 / -1; }
.file-thumb {
  display: grid; place-items: center; min-height: 68px;
  background: repeating-conic-gradient(rgba(128,128,128,.16) 0% 25%, transparent 0% 50%) 50%/16px 16px;
  border-radius: 8px; padding: 4px; max-width: 100%;
}
.file-thumb img { max-width: 100%; max-height: 320px; height: auto; display: block; border-radius: 4px; }
.file-card strong { font-family: var(--font-mono); font-size: .84rem; color: var(--text-1); }
.file-use { font-size: .72rem; color: var(--text-3); }
.file-size { font-family: var(--font-mono); font-size: .72rem; color: var(--accent); }

.privacy-line { margin: 0; color: var(--text-2); font-size: .92rem; }

@media (max-width: 640px) {
  .opt-bar, .gen-form { grid-template-columns: 1fr; padding: 14px; }
  .file-results { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .io-head { padding: 10px 12px; }
  .code-area, .code-out { padding: 12px; }
  .qr-box svg { max-width: 260px; }
}

/* ============================================================
   Icons — one cached sprite, currentColor, crisp at any size
   ============================================================ */

.ico { width: 20px; height: 20px; flex: none; display: block; }

.ico-title {
  width: 34px; height: 34px; color: var(--accent);
  flex: none; margin-right: 2px;
}

h1 { display: flex; align-items: center; gap: 14px; }

/* ============================================================
   Layout — persistent left sidebar on desktop, drawer below
   ============================================================ */

.layout { display: block; }
.content { min-width: 0; }

.sidebar-open {
  display: inline-flex; align-items: center; gap: 10px;
  margin-bottom: 20px; padding: 11px 18px;
  background: var(--bg-1); color: var(--text-1);
  border: 1px solid var(--border); border-radius: 999px;
  font: inherit; font-family: var(--font-head); font-size: .88rem; font-weight: 600;
  cursor: pointer;
}
.sidebar-open:hover { border-color: var(--border-gold); color: var(--accent); }
.sidebar-open .ico { width: 17px; height: 17px; color: var(--accent); }

.sidebar {
  position: fixed; z-index: 120; inset: 0 auto 0 0;
  width: min(84vw, 300px); overflow-y: auto;
  padding: 18px 14px 32px;
  background: var(--bg-1); border-right: 1px solid var(--border);
  transform: translateX(-102%); transition: transform .26s ease;
  overscroll-behavior: contain;
}
.sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.5); }

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; padding: 0 8px 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title {
  font-family: var(--font-head); font-size: .7rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--text-3);
}
.sidebar-close {
  display: grid; place-items: center; width: 34px; height: 34px;
  background: none; border: 1px solid var(--border); border-radius: 9px;
  color: var(--text-2); cursor: pointer;
}
.sidebar-close:hover { border-color: var(--border-gold); color: var(--accent); }

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

.side-group {
  margin: 18px 0 6px; padding: 0 10px;
  font-size: .64rem; font-weight: 700; letter-spacing: .2em;
  text-transform: uppercase; color: var(--text-3);
}

.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 11px;
  color: var(--text-2); font-size: .9rem; text-decoration: none;
  border: 1px solid transparent;
  transition: background .16s, color .16s, border-color .16s;
}
.side-link .ico { width: 19px; height: 19px; color: var(--text-3); transition: color .16s; }
.side-link:hover { background: var(--surface); color: var(--text-1); text-decoration: none; }
.side-link:hover .ico { color: var(--accent); }

.side-link.is-active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--border-gold); color: var(--accent); font-weight: 600;
}
.side-link.is-active .ico { color: var(--accent); }

.side-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-count {
  flex: none; font-family: var(--font-mono); font-size: .7rem;
  color: var(--text-3); font-variant-numeric: tabular-nums;
}
.side-link.is-active .side-count { color: var(--accent); }
.side-sub { padding-left: 18px; font-size: .86rem; }

.scrim {
  position: fixed; inset: 0; z-index: 110;
  background: rgba(3, 5, 10, .62); backdrop-filter: blur(2px);
  animation: scrim-in .2s ease;
}
@keyframes scrim-in { from { opacity: 0 } to { opacity: 1 } }

/* --- desktop: sidebar becomes part of the page --- */
@media (min-width: 1080px) {
  .layout {
    display: grid; grid-template-columns: 262px minmax(0, 1fr);
    gap: 36px; align-items: start;
  }
  .sidebar {
    position: sticky; top: 94px; inset: auto;
    width: auto; transform: none; box-shadow: none;
    max-height: calc(100vh - 118px);
    padding: 4px 4px 20px 0;
    background: transparent; border-right: 0;
  }
  .sidebar-head, .sidebar-open, .scrim { display: none !important; }
  .sidebar::-webkit-scrollbar { width: 5px; }
  .sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
  .content { padding-left: 4px; border-left: 1px solid var(--border); padding-left: 36px; margin-left: -36px; }
}

body.nav-locked { overflow: hidden; }

/* ============================================================
   Cards — large icons
   ============================================================ */

.card-icon {
  display: grid; place-items: center;
  width: 52px; height: 52px; margin-bottom: 10px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  border: 1px solid var(--border-gold);
  color: var(--accent);
  transition: background .2s, transform .2s;
}
.card-icon .ico { width: 27px; height: 27px; }
.card:hover .card-icon { background: color-mix(in srgb, var(--accent) 20%, transparent); transform: scale(1.06); }

.card-lg { padding: 26px 22px; }
.card-lg .card-icon { width: 64px; height: 64px; border-radius: 18px; margin-bottom: 14px; }
.card-lg .card-icon .ico { width: 34px; height: 34px; }
.card-lg strong { font-size: 1.03rem; }

.grid-feature { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid-tight { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 12px; }
.grid-tight .card { padding: 14px 16px; flex-direction: row; align-items: center; gap: 12px; }
.grid-tight .card-icon { width: 40px; height: 40px; margin-bottom: 0; border-radius: 11px; }
.grid-tight .card-icon .ico { width: 21px; height: 21px; }
.grid-tight .card strong { font-size: .87rem; }

/* search results get icons too */
.search-results a .ico { width: 18px; height: 18px; color: var(--accent); flex: none; }
.search-results a span:last-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .ico-title { width: 27px; height: 27px; }
  h1 { gap: 11px; }
  .card-icon { width: 44px; height: 44px; border-radius: 12px; }
  .card-icon .ico { width: 23px; height: 23px; }
  .card-lg .card-icon { width: 52px; height: 52px; }
  .card-lg .card-icon .ico { width: 28px; height: 28px; }
  .grid-feature { grid-template-columns: 1fr 1fr; }
  .grid-tight { grid-template-columns: 1fr; }
  .grid-tight .card-desc { display: none; }
}

/* ============================================================
   Schedule tables — amortisation, depreciation, DCF, commission
   ============================================================ */

.tool-table[hidden] { display: none; }
.tool-table { margin-bottom: 24px; }

.table-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius);
}

table.schedule {
  width: 100%; border-collapse: collapse;
  font-size: .85rem; font-variant-numeric: tabular-nums;
}
table.schedule th {
  position: sticky; top: 0; z-index: 1;
  padding: 12px 14px; text-align: left; white-space: nowrap;
  background: var(--bg-2); color: var(--text-3);
  font-family: var(--font-head); font-size: .68rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
table.schedule td {
  padding: 10px 14px; white-space: nowrap;
  color: var(--text-2); border-bottom: 1px solid var(--border);
}
table.schedule tbody tr:last-child td { border-bottom: 0; }
table.schedule tbody tr:hover td { background: var(--surface); color: var(--text-1); }
table.schedule .num { text-align: right; font-family: var(--font-mono); }
table.schedule td.num { color: var(--text-1); }
table.schedule tbody tr:nth-child(even) td { background: rgba(127, 127, 127, .04); }
table.schedule tbody tr:nth-child(even):hover td { background: var(--surface); }

.table-actions { margin-top: 12px; justify-content: flex-end; }

/* ============================================================
   Currency converter
   ============================================================ */

.fx-table { margin-top: 20px; }
.fx-table:empty { display: none; }
.fx-table h3 {
  font-size: .7rem; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-3); margin: 0 0 12px;
}
.fx-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.fx-cell {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 14px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.fx-code {
  font-family: var(--font-head); font-size: .68rem; font-weight: 700;
  letter-spacing: .14em; color: var(--accent);
}
.fx-val {
  font-family: var(--font-mono); font-size: .92rem; font-weight: 600;
  color: var(--text-1); font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  table.schedule { font-size: .78rem; }
  table.schedule th, table.schedule td { padding: 9px 10px; }
  .fx-grid { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   Image tools
   ============================================================ */

.image-stage {
  display: grid; gap: 14px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.image-stage:empty { display: none; }

.image-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius);
}
.image-card-wide { grid-column: 1 / -1; }
.image-preview {
  max-width: 100%; max-height: 340px; height: auto; display: block; border-radius: 8px;
  background: repeating-conic-gradient(rgba(128,128,128,.16) 0% 25%, transparent 0% 50%) 50%/16px 16px;
}
.image-cap {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: .78rem; color: var(--text-3); text-align: center;
}
.image-cap .file-size { font-family: var(--font-mono); color: var(--accent); }
.image-actions { justify-content: center; margin-bottom: 16px; }
.image-actions:empty { display: none; }

/* file queue */
.file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.file-list:empty { display: none; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: .84rem;
}
.file-idx {
  flex: none; width: 22px; height: 22px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); border-radius: 50%;
  font-family: var(--font-mono); font-size: .7rem; font-weight: 700;
}
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-1); }
.file-meta { flex: none; font-family: var(--font-mono); font-size: .74rem; color: var(--text-3); }
.file-row .btn-ghost { padding: 2px 9px; font-size: .9rem; line-height: 1.4; }

/* range control */
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row .range { flex: 1; padding: 0; background: transparent; border: 0; accent-color: var(--accent); }
.range-val {
  flex: none; min-width: 42px; text-align: right;
  font-family: var(--font-mono); font-size: .82rem; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* drag-to-select */
.select-wrap { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.select-hint { margin: 0; font-size: .85rem; color: var(--text-3); }
.select-canvas {
  max-width: 100%; height: auto; display: block; cursor: crosshair;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  touch-action: none; user-select: none;
}
.select-readout {
  font-family: var(--font-mono); font-size: .8rem; color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* platform presets */
.preset-list {
  display: grid; gap: 4px; max-height: 230px; overflow-y: auto;
  padding: 8px; background: var(--bg-0);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.preset-item {
  display: flex; align-items: center; gap: 9px; padding: 5px 7px;
  border-radius: 7px; cursor: pointer; font-size: .82rem;
}
.preset-item:hover { background: var(--surface); }
.preset-item input { accent-color: var(--accent); flex: none; }
.preset-name { flex: 1; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-dim { flex: none; font-family: var(--font-mono); font-size: .72rem; color: var(--text-3); }

/* palette */
.palette-grid {
  grid-column: 1 / -1;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}
.palette-swatch {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  min-height: 110px; padding: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
  transition: transform .15s;
}
.palette-swatch:hover { transform: translateY(-3px); }
.palette-hex { font-family: var(--font-mono); font-size: .82rem; font-weight: 700; }
.palette-share { font-size: .72rem; opacity: .75; }

@media (max-width: 640px) {
  .image-stage { grid-template-columns: 1fr 1fr; gap: 10px; }
  .image-card { padding: 10px; }
  .palette-grid { grid-template-columns: 1fr 1fr; }
  .file-meta { display: none; }
}

/* ============================================================
   Scientific calculator
   ============================================================ */

.calc-shell { display: grid; gap: 16px; margin-bottom: 20px; }
@media (min-width: 900px) { .calc-shell { grid-template-columns: 1fr 1fr; align-items: start; } }

.calc-display {
  position: relative;
  background: var(--recess); border: 1px solid var(--border-gold);
  border-radius: var(--radius); padding: 34px 18px 18px;
  box-shadow: inset 0 2px 14px rgba(0,0,0,.6);
}
.calc-mode {
  position: absolute; top: 12px; left: 18px;
  font-family: var(--font-mono); font-size: .66rem; font-weight: 700;
  letter-spacing: .16em; color: rgba(247,201,72,.7);
}
.calc-expr {
  width: 100%; padding: 0; margin-bottom: 10px;
  background: transparent; border: 0; color: #b9c3d6;
  font-family: var(--font-mono); font-size: 1rem; text-align: right;
}
.calc-expr:focus { outline: none; }
.calc-expr::placeholder { color: #55617a; }
.calc-result {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 6vw, 2.2rem); font-weight: 700;
  color: var(--gold-2); text-align: right; word-break: break-all;
  text-shadow: 0 0 26px rgba(247,201,72,.3);
}
.calc-result.is-err { font-size: .9rem; color: #ff9d8a; text-shadow: none; }

.calc-pad { display: grid; gap: 8px; }
.calc-angle, .calc-grid { display: grid; gap: 6px; }
.calc-angle { grid-template-columns: repeat(5, 1fr); }
.calc-grid { grid-template-columns: repeat(6, 1fr); }

.calc-key {
  padding: 12px 4px; font: inherit; font-family: var(--font-body);
  font-size: .82rem; font-weight: 600; cursor: pointer;
  background: var(--bg-1); color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, color .15s, background .15s;
}
.calc-key:hover { border-color: var(--border-gold); color: var(--accent); }
.calc-key:active { background: var(--surface-strong); }
.calc-key-num { color: var(--text-1); font-family: var(--font-mono); font-size: .95rem; }
.calc-key-warn { color: #ff9d8a; }
.calc-key-eq { background: var(--grad-gold); color: var(--nav-cta-ink); border-color: transparent; }
.calc-key-eq:hover { color: var(--nav-cta-ink); box-shadow: 0 0 18px rgba(247,201,72,.4); }
.calc-key-mode[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent); border-color: var(--border-gold);
}

.calc-history { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; }
.calc-history:empty { display: none; }
.calc-hist-row {
  display: flex; justify-content: space-between; gap: 14px; padding: 8px 14px;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: .82rem;
}
.calc-hist-row:hover { border-color: var(--border-gold); }
.calc-hist-expr { font-family: var(--font-mono); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.calc-hist-val { font-family: var(--font-mono); color: var(--accent); font-weight: 600; flex: none; }

/* ============================================================
   Countdown
   ============================================================ */

.countdown-stage {
  background: var(--recess); border: 1px solid var(--border-gold);
  border-radius: var(--radius); padding: 28px 20px; margin-bottom: 20px;
  text-align: center; box-shadow: inset 0 2px 14px rgba(0,0,0,.6);
}
.countdown-stage.is-past { border-color: var(--border); }
.countdown-title {
  font-family: var(--font-head); font-size: .72rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--text-3);
  margin-bottom: 18px;
}
.countdown-clock { display: flex; justify-content: center; gap: clamp(10px, 4vw, 34px); flex-wrap: wrap; }
.countdown-unit { min-width: 62px; }
.countdown-val {
  font-family: var(--font-mono); font-size: clamp(1.9rem, 8vw, 3rem);
  font-weight: 700; color: var(--gold-2); line-height: 1;
  font-variant-numeric: tabular-nums; text-shadow: 0 0 26px rgba(247,201,72,.28);
}
.is-past .countdown-val { color: #8b99b0; text-shadow: none; }
.countdown-lbl {
  font-size: .64rem; letter-spacing: .18em; text-transform: uppercase;
  color: #7d8699; margin-top: 8px;
}
.countdown-sub { margin-top: 20px; font-size: .84rem; color: #7d8699; }

/* ============================================================
   Stopwatch / timer / pomodoro
   ============================================================ */

.sw-tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.sw-tab {
  flex: 1; padding: 11px; font: inherit; font-family: var(--font-head);
  font-size: .84rem; font-weight: 600; cursor: pointer;
  background: var(--bg-1); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 999px;
}
.sw-tab[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent); border-color: var(--border-gold);
}

.sw-panel {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px; text-align: center;
}
.sw-panel[hidden] { display: none; }
.sw-panel.is-done, .sw-panel.is-break { border-color: var(--border-gold); }

.sw-display {
  font-family: var(--font-mono); font-size: clamp(2.2rem, 11vw, 3.6rem);
  font-weight: 700; color: var(--gold-2); line-height: 1;
  font-variant-numeric: tabular-nums; margin-bottom: 20px;
  text-shadow: 0 0 26px rgba(247,201,72,.26);
}
.is-break .sw-display { color: var(--cyan); text-shadow: 0 0 26px rgba(45,212,255,.26); }
.sw-phase {
  font-family: var(--font-head); font-size: .72rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--accent);
  margin-bottom: 12px;
}
.is-break .sw-phase { color: var(--cyan); }
.sw-count { font-size: .78rem; color: var(--text-3); margin-bottom: 18px; }

.sw-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.sw-inputs {
  display: grid; gap: 12px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}
.sw-inputs .field { margin-bottom: 0; }
.sw-inputs label { text-align: left; }

.sw-laps { display: flex; flex-direction: column; gap: 4px; margin-top: 18px; max-height: 260px; overflow-y: auto; }
.sw-laps:empty { display: none; }
.sw-lap {
  display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px;
  background: var(--bg-0); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: .82rem;
}
.sw-lap-n { color: var(--text-3); }
.sw-lap-split { color: var(--accent); font-weight: 600; }
.sw-lap-total { color: var(--text-2); }

@media (max-width: 640px) {
  .calc-grid { grid-template-columns: repeat(4, 1fr); }
  .calc-angle { grid-template-columns: repeat(3, 1fr); }
  .calc-key { padding: 14px 4px; font-size: .8rem; }
  .countdown-unit { min-width: 52px; }
}
