/* ===================================================================
   Calculix — Design System
   Designed & Developed by AjonTec (https://ajontec.com)
   -------------------------------------------------------------------
   Palette : Midnight #0B1020 · Slate surface #151C36 · Indigo #4F46E5
             Violet #7C3AED · Cyan #06B6D4 · Mint #34D399 · Coral #FB7185
   Type    : Sora (display) · Inter (body) · JetBrains Mono (ledger tape)
   Signature: the "ledger tape" — every result prints like a thermal
              receipt, because these are money calculators.
   =================================================================== */

:root {
  /* Brand gradient */
  --cx-g1: #4F46E5;
  --cx-g2: #7C3AED;
  --cx-g3: #06B6D4;
  --cx-gradient: linear-gradient(135deg, var(--cx-g1) 0%, var(--cx-g2) 52%, var(--cx-g3) 100%);
  --cx-gradient-soft: linear-gradient(135deg, rgba(79,70,229,.14), rgba(6,182,212,.10));

  /* Semantic */
  --cx-positive: #10B981;
  --cx-positive-soft: rgba(16,185,129,.12);
  --cx-negative: #E11D48;
  --cx-negative-soft: rgba(225,29,72,.10);
  --cx-warning: #F59E0B;

  /* Light surfaces (default) */
  --cx-bg: #F6F7FB;
  --cx-bg-alt: #EDEFF7;
  --cx-surface: #FFFFFF;
  --cx-surface-2: #F9FAFE;
  --cx-border: #E2E6F0;
  --cx-border-strong: #CBD2E4;
  --cx-text: #101426;
  --cx-text-2: #4A5169;
  --cx-text-3: #7B8299;
  --cx-tape: #FCFCFD;

  /* Shape & motion */
  --cx-r-sm: 10px;
  --cx-r: 16px;
  --cx-r-lg: 22px;
  --cx-r-xl: 30px;
  --cx-shadow: 0 1px 2px rgba(16,20,38,.04), 0 8px 28px rgba(16,20,38,.07);
  --cx-shadow-lg: 0 20px 60px rgba(16,20,38,.14);
  --cx-ring: 0 0 0 4px rgba(79,70,229,.18);
  --cx-ease: cubic-bezier(.22,.68,0,1);

  --cx-header-h: 62px;
  --cx-tabbar-h: 64px;
  --cx-max: 1240px;
  --cx-gutter: 18px;

  --cx-font-display: 'Sora', 'Segoe UI', system-ui, sans-serif;
  --cx-font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cx-font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

[data-theme="dark"] {
  --cx-bg: #080C18;
  --cx-bg-alt: #0C1223;
  --cx-surface: #131A31;
  --cx-surface-2: #182140;
  --cx-border: #232D4D;
  --cx-border-strong: #33406B;
  --cx-text: #EEF1FA;
  --cx-text-2: #A8B1CC;
  --cx-text-3: #737D9C;
  --cx-tape: #0F1528;
  --cx-shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 34px rgba(0,0,0,.44);
  --cx-shadow-lg: 0 24px 70px rgba(0,0,0,.6);
  --cx-positive-soft: rgba(16,185,129,.16);
  --cx-negative-soft: rgba(225,29,72,.18);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--cx-bg);
  color: var(--cx-text);
  font-family: var(--cx-font-body);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
  padding-bottom: env(safe-area-inset-bottom);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1,h2,h3,h4 { font-family: var(--cx-font-display); font-weight: 700; letter-spacing: -.022em; margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: clamp(1.65rem, 4.6vw, 2.6rem); }
h2 { font-size: clamp(1.3rem, 3.1vw, 1.85rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; color: var(--cx-text-2); }
:focus-visible { outline: 2px solid var(--cx-g1); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(124,58,237,.24); }

.cx-wrap { width: 100%; max-width: var(--cx-max); margin-inline: auto; padding-inline: var(--cx-gutter); }
.cx-gradient-text {
  background: var(--cx-gradient);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* =================== HEADER =================== */
.cx-header {
  position: sticky; top: 0; z-index: 60;
  height: var(--cx-header-h);
  background: color-mix(in srgb, var(--cx-surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--cx-border);
  padding-top: env(safe-area-inset-top);
}
.cx-header__inner { height: var(--cx-header-h); display: flex; align-items: center; gap: 14px; }
.cx-logo { display: flex; align-items: center; gap: 10px; font-family: var(--cx-font-display); font-weight: 800; font-size: 1.16rem; letter-spacing: -.03em; }
.cx-logo__mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--cx-gradient);
  display: grid; place-items: center;
  color: #fff; font-size: .95rem; font-weight: 800;
  box-shadow: 0 6px 18px rgba(79,70,229,.36);
}
.cx-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.cx-nav a {
  padding: 8px 13px; border-radius: 10px; font-size: .9rem; font-weight: 500;
  color: var(--cx-text-2); transition: background .18s, color .18s;
}
.cx-nav a:hover, .cx-nav a.is-active { background: var(--cx-bg-alt); color: var(--cx-text); }
.cx-icon-btn {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--cx-border);
  background: var(--cx-surface); display: grid; place-items: center; cursor: pointer;
  transition: border-color .18s, transform .18s;
}
.cx-icon-btn:hover { border-color: var(--cx-border-strong); transform: translateY(-1px); }
@media (max-width: 860px) { .cx-nav { display: none; } }

/* =================== HERO =================== */
.cx-hero { position: relative; padding: 34px 0 24px; overflow-x: clip; }
.cx-hero::before {
  content: ''; position: absolute; inset: -30% 0 auto 0; height: 460px;
  background: radial-gradient(60% 60% at 30% 20%, rgba(79,70,229,.20), transparent 70%),
              radial-gradient(50% 50% at 80% 10%, rgba(6,182,212,.16), transparent 70%);
  pointer-events: none;
}
.cx-hero__inner { position: relative; }
.cx-eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--cx-g2); background: var(--cx-gradient-soft);
  border: 1px solid color-mix(in srgb, var(--cx-g1) 22%, transparent);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
}
.cx-hero p.cx-lede { font-size: 1.04rem; max-width: 58ch; }

/* Search */
.cx-search { position: relative; max-width: 520px; margin-top: 22px; }
.cx-search input {
  width: 100%; padding: 14px 16px 14px 46px; border-radius: 14px;
  border: 1px solid var(--cx-border); background: var(--cx-surface);
  box-shadow: var(--cx-shadow); transition: box-shadow .2s, border-color .2s;
}
.cx-search input:focus { outline: none; border-color: var(--cx-g1); box-shadow: var(--cx-ring); }
.cx-search svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--cx-text-3); }
.cx-search__results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 40;
  background: var(--cx-surface); border: 1px solid var(--cx-border);
  border-radius: var(--cx-r); box-shadow: var(--cx-shadow-lg); overflow: hidden; display: none;
}
.cx-search__results.is-open { display: block; }
.cx-search__results a { display: block; padding: 11px 16px; font-size: .92rem; border-bottom: 1px solid var(--cx-border); }
.cx-search__results a:last-child { border-bottom: 0; }
.cx-search__results a:hover { background: var(--cx-bg-alt); }

/* =================== CARDS / GRID =================== */
.cx-section { padding: 26px 0; }
.cx-section__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.cx-section__head p { margin: 0; font-size: .93rem; }

.cx-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }

.cx-card {
  position: relative; background: var(--cx-surface);
  border: 1px solid var(--cx-border); border-radius: var(--cx-r-lg);
  padding: 18px; box-shadow: var(--cx-shadow);
  transition: transform .24s var(--cx-ease), box-shadow .24s var(--cx-ease), border-color .24s;
  overflow: hidden;
}
.cx-card::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--cx-gradient); opacity: 0; transition: opacity .24s;
}
.cx-card:hover { transform: translateY(-3px); box-shadow: var(--cx-shadow-lg); border-color: var(--cx-border-strong); }
.cx-card:hover::after { opacity: 1; }
.cx-card__icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cx-gradient-soft); color: var(--cx-g2); margin-bottom: 12px;
  border: 1px solid color-mix(in srgb, var(--cx-g1) 16%, transparent);
  transition: transform .24s var(--cx-ease), background .24s, color .24s;
}
.cx-card:hover .cx-card__icon {
  transform: translateY(-1px) scale(1.05);
  background: var(--cx-gradient); color: #fff;
  border-color: transparent;
}

/* Shared icon sizing — SVG and glyph fallbacks line up identically */
.cx-icon { width: 23px; height: 23px; display: block; flex: none; }
.cx-icon--glyph {
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; line-height: 1; width: 23px; height: 23px;
}

/* Calculator page heading */
.cx-calc-head { display: flex; align-items: center; gap: 13px; padding-top: 14px; margin-bottom: 6px; }
.cx-calc-head h1 { margin: 0; }
.cx-calc-head__icon {
  width: 50px; height: 50px; border-radius: 15px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--cx-gradient); color: #fff;
  box-shadow: 0 8px 20px rgba(79,70,229,.3);
}
.cx-calc-head__icon .cx-icon { width: 26px; height: 26px; }
@media (max-width: 560px) {
  .cx-calc-head { gap: 11px; }
  .cx-calc-head__icon { width: 42px; height: 42px; border-radius: 13px; }
  .cx-calc-head__icon .cx-icon { width: 22px; height: 22px; }
}
.cx-card h3 { font-size: 1rem; margin-bottom: 4px; }
.cx-card p { font-size: .865rem; margin: 0; color: var(--cx-text-3); line-height: 1.55; }
.cx-card__meta { margin-top: 12px; font-size: .74rem; color: var(--cx-text-3); font-family: var(--cx-font-mono); }

/* =================== CALCULATOR SHELL =================== */
.cx-calc { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 22px; align-items: start; padding: 24px 0 40px; }
@media (max-width: 1020px) { .cx-calc { grid-template-columns: 1fr; } .cx-calc__aside { order: 3; } }

.cx-panel {
  background: var(--cx-surface); border: 1px solid var(--cx-border);
  border-radius: var(--cx-r-lg); box-shadow: var(--cx-shadow); overflow: hidden;
}
.cx-panel__head { padding: 18px 20px 0; }
.cx-panel__body { padding: 18px 20px 22px; }

.cx-fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.cx-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cx-field--full { grid-column: 1 / -1; }
.cx-label { font-size: .8rem; font-weight: 600; color: var(--cx-text-2); display: flex; align-items: center; gap: 6px; }
.cx-hint { font-size: .74rem; color: var(--cx-text-3); line-height: 1.45; }
.cx-input-shell { position: relative; display: flex; align-items: center; }
.cx-input-shell__prefix, .cx-input-shell__suffix {
  position: absolute; font-size: .87rem; color: var(--cx-text-3); font-family: var(--cx-font-mono); pointer-events: none;
}
.cx-input-shell__prefix { left: 13px; }
.cx-input-shell__suffix { right: 13px; }
.cx-input, .cx-select {
  width: 100%; padding: 11px 13px; border-radius: var(--cx-r-sm);
  border: 1px solid var(--cx-border); background: var(--cx-surface-2);
  font-family: var(--cx-font-mono); font-size: .95rem; font-variant-numeric: tabular-nums;
  transition: border-color .18s, box-shadow .18s, background .18s;
  min-width: 0;
}
.cx-input:focus, .cx-select:focus { outline: none; border-color: var(--cx-g1); box-shadow: var(--cx-ring); background: var(--cx-surface); }
.cx-input.has-prefix { padding-left: 30px; }
.cx-input.has-suffix { padding-right: 34px; }
.cx-input.is-error { border-color: var(--cx-negative); box-shadow: 0 0 0 4px var(--cx-negative-soft); }
.cx-error { font-size: .76rem; color: var(--cx-negative); }
.cx-select { font-family: var(--cx-font-body); cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%237B8299' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* Segmented control */
.cx-segment { display: flex; padding: 3px; gap: 3px; background: var(--cx-bg-alt); border-radius: var(--cx-r-sm); border: 1px solid var(--cx-border); }
.cx-segment button {
  flex: 1; padding: 8px 6px; border: 0; background: transparent; border-radius: 8px; cursor: pointer;
  font-size: .8rem; font-weight: 600; color: var(--cx-text-3); transition: all .2s var(--cx-ease); min-width: 0;
}
.cx-segment button.is-active { background: var(--cx-surface); color: var(--cx-text); box-shadow: 0 1px 4px rgba(16,20,38,.12); }

/* Toggle */
.cx-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--cx-border); border-radius: var(--cx-r-sm); background: var(--cx-surface-2); }
.cx-toggle__label { font-size: .84rem; font-weight: 500; color: var(--cx-text-2); }
.cx-switch { position: relative; width: 44px; height: 25px; flex: none; cursor: pointer; }
.cx-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.cx-switch span { position: absolute; inset: 0; background: var(--cx-border-strong); border-radius: 999px; transition: background .22s var(--cx-ease); }
.cx-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform .22s var(--cx-ease); box-shadow: 0 1px 3px rgba(0,0,0,.28); }
.cx-switch input:checked + span { background: var(--cx-gradient); }
.cx-switch input:checked + span::after { transform: translateX(19px); }
.cx-switch input:focus-visible + span { box-shadow: var(--cx-ring); }

/* Buttons */
.cx-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.cx-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 650; font-size: .93rem; cursor: pointer;
  transition: transform .16s var(--cx-ease), box-shadow .2s, opacity .2s;
}
.cx-btn:active { transform: scale(.975); }
.cx-btn--primary { background: var(--cx-gradient); color: #fff; box-shadow: 0 8px 22px rgba(79,70,229,.32); }
.cx-btn--primary:hover { box-shadow: 0 12px 30px rgba(79,70,229,.42); }
.cx-btn--ghost { background: var(--cx-surface); border-color: var(--cx-border); color: var(--cx-text-2); }
.cx-btn--ghost:hover { border-color: var(--cx-border-strong); }
.cx-btn[disabled] { opacity: .55; cursor: not-allowed; }
.cx-btn__spinner { width: 15px; height: 15px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: cx-spin .7s linear infinite; display: none; }
.is-loading .cx-btn__spinner { display: block; }
@keyframes cx-spin { to { transform: rotate(360deg); } }

/* =================== SIGNATURE: THE LEDGER TAPE =================== */
.cx-result { margin-top: 20px; display: none; }
.cx-result.is-visible { display: block; animation: cx-rise .45s var(--cx-ease) both; }
@keyframes cx-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.cx-headline {
  position: relative; border-radius: var(--cx-r-lg); padding: 24px 22px;
  background: var(--cx-gradient); color: #fff; overflow: hidden;
  box-shadow: 0 14px 40px rgba(79,70,229,.32);
}
.cx-headline::after {
  content: ''; position: absolute; right: -30px; top: -50px; width: 190px; height: 190px;
  border-radius: 50%; background: rgba(255,255,255,.10);
}
.cx-headline__label { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; opacity: .82; font-weight: 700; }
.cx-headline__value { font-family: var(--cx-font-mono); font-size: clamp(1.9rem, 7vw, 2.9rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.cx-headline--negative { background: linear-gradient(135deg, #BE123C, #E11D48 60%, #F97316); box-shadow: 0 14px 40px rgba(225,29,72,.3); }

.cx-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(146px, 1fr)); gap: 10px; margin-top: 12px; }
.cx-stat { background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: var(--cx-r); padding: 13px 14px; }
.cx-stat__label { font-size: .74rem; color: var(--cx-text-3); font-weight: 600; letter-spacing: .02em; }
.cx-stat__value { font-family: var(--cx-font-mono); font-size: 1.16rem; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.cx-stat--positive .cx-stat__value { color: var(--cx-positive); }
.cx-stat--negative .cx-stat__value { color: var(--cx-negative); }

/* The tape itself */
.cx-tape {
  margin-top: 14px; background: var(--cx-tape);
  border: 1px solid var(--cx-border); border-radius: var(--cx-r);
  position: relative; overflow: hidden;
}
.cx-tape::before, .cx-tape::after {
  content: ''; position: absolute; left: 0; right: 0; height: 8px;
  background-image: radial-gradient(circle at 5px 0, transparent 4px, var(--cx-tape) 4.5px);
  background-size: 10px 8px;
}
.cx-tape::before { top: 0; transform: rotate(180deg); }
.cx-tape::after { bottom: 0; }
.cx-tape__head {
  padding: 16px 18px 10px; border-bottom: 1px dashed var(--cx-border-strong);
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
}
.cx-tape__title { font-family: var(--cx-font-display); font-size: .95rem; font-weight: 700; letter-spacing: -.01em; }
.cx-tape__stamp { font-family: var(--cx-font-mono); font-size: .68rem; color: var(--cx-text-3); text-transform: uppercase; letter-spacing: .08em; }
.cx-tape__rows { padding: 6px 18px 14px; }
.cx-tape__row {
  display: flex; align-items: baseline; gap: 10px; padding: 8px 0;
  border-bottom: 1px dotted var(--cx-border);
}
.cx-tape__row:last-child { border-bottom: 0; }
.cx-tape__row-label { font-size: .855rem; color: var(--cx-text-2); flex: 1; min-width: 0; }
.cx-tape__row-value { font-family: var(--cx-font-mono); font-size: .93rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cx-tape__row--emphasis { border-top: 1px solid var(--cx-border-strong); margin-top: 4px; padding-top: 11px; }
.cx-tape__row--emphasis .cx-tape__row-label { font-weight: 650; color: var(--cx-text); }
.cx-tape__row--emphasis .cx-tape__row-value { font-size: 1.05rem; }
.cx-tape__row-hint { display: block; font-size: .72rem; color: var(--cx-text-3); margin-top: 2px; }

.cx-notes { margin-top: 12px; display: grid; gap: 8px; }
.cx-note {
  display: flex; gap: 9px; font-size: .8rem; color: var(--cx-text-2); line-height: 1.55;
  background: var(--cx-bg-alt); border-radius: var(--cx-r-sm); padding: 10px 12px;
  border-left: 3px solid var(--cx-g2);
}

/* Chart */
.cx-chart { margin-top: 14px; background: var(--cx-surface); border: 1px solid var(--cx-border); border-radius: var(--cx-r); padding: 16px; }
.cx-chart__legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; }
.cx-chart__legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--cx-text-2); }
.cx-chart__swatch { width: 10px; height: 10px; border-radius: 3px; }

/* =================== ADS =================== */
.cx-ad {
  position: relative; margin: 16px 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; min-height: 0;
}
.cx-ad__tag {
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--cx-text-3); margin-bottom: 5px; font-weight: 600;
}
.cx-ad__body { width: 100%; display: flex; justify-content: center; overflow: hidden; }
.cx-ad--sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 55; margin: 0;
  background: var(--cx-surface); border-top: 1px solid var(--cx-border);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 22px rgba(16,20,38,.12);
}
.cx-ad--sticky .cx-ad__close {
  position: absolute; top: -13px; right: 10px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--cx-surface); border: 1px solid var(--cx-border); cursor: pointer;
  display: grid; place-items: center; font-size: .8rem; color: var(--cx-text-3);
}
body.has-sticky-ad { padding-bottom: 74px; }
@media (min-width: 861px) { .cx-ad--sticky { display: none; } }

/* =================== FOOTER + MOBILE TAB BAR =================== */
.cx-footer { background: var(--cx-surface); border-top: 1px solid var(--cx-border); padding: 40px 0 26px; margin-top: 40px; }
.cx-footer__grid { display: grid; gap: 26px; grid-template-columns: 1.6fr repeat(3, 1fr); }
@media (max-width: 780px) { .cx-footer__grid { grid-template-columns: 1fr 1fr; } }
.cx-footer h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--cx-text-3); margin-bottom: 12px; }
.cx-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.cx-footer li a { font-size: .88rem; color: var(--cx-text-2); }
.cx-footer li a:hover { color: var(--cx-g2); }
.cx-footer__bar {
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--cx-border);
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: .8rem; color: var(--cx-text-3);
}
.cx-footer__brand strong { color: var(--cx-text-2); }

.cx-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 58; display: none;
  background: color-mix(in srgb, var(--cx-surface) 92%, transparent);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-top: 1px solid var(--cx-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.cx-tabbar__inner { display: grid; grid-template-columns: repeat(4, 1fr); height: var(--cx-tabbar-h); }
.cx-tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .68rem; font-weight: 600; color: var(--cx-text-3); position: relative;
}
.cx-tabbar a.is-active { color: var(--cx-g2); }
.cx-tabbar a.is-active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 4px 4px; background: var(--cx-gradient);
}
@media (max-width: 860px) {
  .cx-tabbar { display: block; }
  body { padding-bottom: calc(var(--cx-tabbar-h) + env(safe-area-inset-bottom)); }
  body.has-sticky-ad { padding-bottom: calc(var(--cx-tabbar-h) + 62px); }
  .cx-ad--sticky { bottom: calc(var(--cx-tabbar-h) + env(safe-area-inset-bottom)); }
}

/* =================== CONTENT / FAQ =================== */
.cx-prose { max-width: 74ch; }
.cx-prose h2 { margin-top: 1.6em; }
.cx-prose ul, .cx-prose ol { color: var(--cx-text-2); padding-left: 1.2em; }
.cx-prose li { margin-bottom: .45em; }
.cx-prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .9rem; }
.cx-prose th, .cx-prose td { border: 1px solid var(--cx-border); padding: 9px 11px; text-align: left; }
.cx-prose th { background: var(--cx-bg-alt); font-weight: 650; }

.cx-faq { border: 1px solid var(--cx-border); border-radius: var(--cx-r); background: var(--cx-surface); overflow: hidden; }
.cx-faq details { border-bottom: 1px solid var(--cx-border); }
.cx-faq details:last-child { border-bottom: 0; }
.cx-faq summary { padding: 15px 18px; cursor: pointer; font-weight: 600; font-size: .93rem; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.cx-faq summary::-webkit-details-marker { display: none; }
.cx-faq summary::after { content: '+'; font-family: var(--cx-font-mono); color: var(--cx-g2); font-size: 1.2rem; flex: none; }
.cx-faq details[open] summary::after { content: '−'; }
.cx-faq details > div { padding: 0 18px 16px; font-size: .89rem; color: var(--cx-text-2); }

/* Breadcrumb */
.cx-crumbs { display: flex; gap: 7px; flex-wrap: wrap; font-size: .78rem; color: var(--cx-text-3); padding-top: 16px; }
.cx-crumbs a:hover { color: var(--cx-g2); }

/* Toast */
.cx-toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 20px);
  background: var(--cx-text); color: var(--cx-bg); padding: 11px 18px; border-radius: 999px;
  font-size: .85rem; font-weight: 600; z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s var(--cx-ease);
}
.cx-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Skeleton */
.cx-skeleton { background: linear-gradient(90deg, var(--cx-bg-alt) 25%, var(--cx-surface-2) 50%, var(--cx-bg-alt) 75%); background-size: 200% 100%; animation: cx-shimmer 1.4s infinite; border-radius: var(--cx-r-sm); }
@keyframes cx-shimmer { to { background-position: -200% 0; } }

/* Alerts */
.cx-alert { padding: 12px 15px; border-radius: var(--cx-r-sm); font-size: .88rem; margin-bottom: 14px; border: 1px solid transparent; }
.cx-alert--success { background: var(--cx-positive-soft); color: var(--cx-positive); border-color: color-mix(in srgb, var(--cx-positive) 30%, transparent); }
.cx-alert--error { background: var(--cx-negative-soft); color: var(--cx-negative); border-color: color-mix(in srgb, var(--cx-negative) 30%, transparent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
  .cx-header, .cx-tabbar, .cx-ad, .cx-actions, .cx-footer { display: none !important; }
  body { background: #fff; }
  .cx-headline { box-shadow: none; }
}

/* ===================================================================
   PHASE 2 — Blog, chips, pagination, article typography
   Calculix by AjonTec
   =================================================================== */

/* Chips (category filters, tags) */
.cx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.cx-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  background: var(--cx-surface); border: 1px solid var(--cx-border); color: var(--cx-text-2);
  transition: border-color .18s, color .18s, transform .18s var(--cx-ease);
}
.cx-chip:hover { border-color: var(--cx-border-strong); color: var(--cx-text); transform: translateY(-1px); }
.cx-chip.is-active { background: var(--cx-gradient); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.28); }
.cx-chip__count { font-family: var(--cx-font-mono); font-size: .7rem; opacity: .7; }

/* Post grid & cards */
.cx-grid--posts { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.cx-post-card { padding: 0; }
.cx-post-card__link { display: flex; flex-direction: column; height: 100%; }
.cx-post-card__media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--cx-bg-alt); }
.cx-post-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--cx-ease); }
.cx-post-card:hover .cx-post-card__media img { transform: scale(1.045); }
.cx-post-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.cx-post-card__cat {
  font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--cx-g2); margin-bottom: 7px;
}
.cx-post-card h3 { font-size: 1.03rem; line-height: 1.32; margin-bottom: 7px; }
.cx-post-card p { font-size: .855rem; color: var(--cx-text-3); margin: 0 0 12px; flex: 1; }
.cx-post-card__meta {
  display: flex; gap: 7px; align-items: center; font-size: .74rem;
  color: var(--cx-text-3); font-family: var(--cx-font-mono);
}

/* Byline */
.cx-byline { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.cx-byline__avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--cx-gradient); color: #fff; display: grid; place-items: center;
  font-family: var(--cx-font-display); font-weight: 700; font-size: 1rem;
}
.cx-byline strong { display: block; font-size: .89rem; }
.cx-byline span { font-size: .78rem; color: var(--cx-text-3); }

/* Article */
.cx-post-hero { width: 100%; border-radius: var(--cx-r-lg); margin: 16px 0 4px; box-shadow: var(--cx-shadow); object-fit: cover; }
.cx-standfirst {
  font-size: 1.1rem; line-height: 1.6; color: var(--cx-text-2); font-weight: 450;
  border-left: 3px solid var(--cx-g2); padding-left: 16px; margin-bottom: 26px;
}
.cx-prose--article { font-size: 1.02rem; line-height: 1.78; max-width: none; }
.cx-prose--article h2 { margin-top: 1.9em; margin-bottom: .5em; }
.cx-prose--article h3 { margin-top: 1.5em; font-size: 1.08rem; }
.cx-prose--article p { color: var(--cx-text-2); }
.cx-prose--article img { border-radius: var(--cx-r); margin: 1.4em 0; box-shadow: var(--cx-shadow); }
.cx-prose--article blockquote {
  margin: 1.5em 0; padding: 14px 20px; border-left: 3px solid var(--cx-g2);
  background: var(--cx-gradient-soft); border-radius: 0 var(--cx-r-sm) var(--cx-r-sm) 0;
  font-size: 1.02rem; color: var(--cx-text-2);
}
.cx-prose--article blockquote p:last-child { margin-bottom: 0; }
.cx-prose--article code {
  font-family: var(--cx-font-mono); font-size: .88em; background: var(--cx-bg-alt);
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--cx-border);
}
.cx-prose--article pre {
  background: var(--cx-tape); border: 1px solid var(--cx-border); border-radius: var(--cx-r);
  padding: 16px; overflow-x: auto; font-size: .85rem;
}
.cx-prose--article pre code { background: none; border: 0; padding: 0; }
.cx-prose--article a { color: var(--cx-g2); text-decoration: underline; text-underline-offset: 3px; }
.cx-prose--article a:hover { color: var(--cx-g1); }

/* Share row */
.cx-share {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--cx-border);
  font-size: .84rem;
}
.cx-share span { color: var(--cx-text-3); font-weight: 600; }
.cx-share a {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--cx-border);
  color: var(--cx-text-2); font-weight: 600; transition: border-color .18s, color .18s;
}
.cx-share a:hover { border-color: var(--cx-g2); color: var(--cx-g2); }

/* Pagination */
.cx-pagination { margin-top: 28px; display: flex; justify-content: center; }
.cx-pagination nav { display: flex; }
.cx-pagination svg { width: 16px; height: 16px; }
.cx-pagination .pagination, .cx-pagination ul {
  display: flex; gap: 5px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; align-items: center;
}
.cx-pagination li > * , .cx-pagination li span, .cx-pagination li a {
  display: grid; place-items: center; min-width: 38px; height: 38px; padding: 0 11px;
  border-radius: 10px; border: 1px solid var(--cx-border); background: var(--cx-surface);
  font-size: .86rem; font-weight: 600; color: var(--cx-text-2);
}
.cx-pagination li a:hover { border-color: var(--cx-border-strong); color: var(--cx-text); }
.cx-pagination li[aria-current] span, .cx-pagination .active span {
  background: var(--cx-gradient); border-color: transparent; color: #fff;
}
.cx-pagination .disabled span { opacity: .45; }

/* ===================================================================
   PHASE 3 — Instant home, accounts, pricing
   Calculix by AjonTec
   =================================================================== */

/* ---- Instant calculator on the home page ---- */
.cx-instant { position: relative; padding: 10px 0 6px; overflow-x: clip; }
.cx-instant::before {
  /* Kept inside the viewport: negative insets here were widening the page and
     producing a horizontal scrollbar on wide screens. */
  content: ''; position: absolute; inset: -20% 0 auto 0; height: 380px;
  background: radial-gradient(55% 55% at 25% 20%, rgba(79,70,229,.18), transparent 70%),
              radial-gradient(45% 45% at 82% 8%, rgba(6,182,212,.14), transparent 70%);
  pointer-events: none; z-index: -1;
}
.cx-instant__head {
  display: flex; gap: 18px; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; margin-bottom: 14px;
}
.cx-instant__title { font-size: clamp(1.35rem, 3.4vw, 2.1rem); margin: 4px 0 0; }
.cx-instant__search { margin-top: 0; width: min(340px, 100%); }
.cx-instant__search input { padding-block: 11px; }

.cx-switcher {
  display: flex; gap: 7px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cx-switcher::-webkit-scrollbar { display: none; }
.cx-switcher__tab {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 9px 15px; border-radius: 999px; font-size: .855rem; font-weight: 600;
  background: var(--cx-surface); border: 1px solid var(--cx-border); color: var(--cx-text-2);
  transition: border-color .18s, color .18s, transform .18s var(--cx-ease);
}
.cx-switcher__tab:hover { border-color: var(--cx-border-strong); color: var(--cx-text); transform: translateY(-1px); }
.cx-switcher__tab.is-active {
  background: var(--cx-gradient); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(79,70,229,.3);
}
.cx-switcher__icon { font-size: 1rem; line-height: 1; }
.cx-switcher__tab--more { border-style: dashed; }

/* The calculator sits centred on the page — nothing beside it competing. */
.cx-stage { max-width: 900px; margin: 0 auto; }
.cx-stage__panel[hidden] { display: none; }
.cx-stage__panel--enter { animation: cx-panel-in .28s var(--cx-ease) both; }
@keyframes cx-panel-in {
  from { opacity: 0; transform: translateY(8px) scale(.995); }
  to   { opacity: 1; transform: none; }
}

/* Tighter padding so more of the calculator is visible on first paint */
.cx-panel--tight .cx-panel__body { padding: 14px 16px 16px; }
.cx-instant__label { margin-bottom: 10px; }
.cx-instant__label h2 { font-size: 1.05rem; margin: 0 0 1px; }
.cx-instant__label p { font-size: .83rem; margin: 0; color: var(--cx-text-3); }
.cx-instant .cx-fields { gap: 11px; }
.cx-instant .cx-field { gap: 4px; }
.cx-instant .cx-actions { margin-top: 12px; }
.cx-instant .cx-hint { font-size: .72rem; }
.cx-instant .cx-ad { max-width: 900px; margin-inline: auto; }

@media (max-width: 700px) {
  :root { --cx-gutter: 14px; }
  .cx-instant { padding: 6px 0 4px; }
  .cx-instant__head { margin-bottom: 10px; }
  .cx-eyebrow { margin-bottom: 6px; font-size: .66rem; padding: 4px 10px; }
  .cx-instant__title { margin: 3px 0 10px; }
  .cx-search--center input { padding-block: 10px; }
  .cx-panel--tight .cx-panel__body { padding: 12px 12px 14px; }
  .cx-instant .cx-fields { grid-template-columns: 1fr 1fr; gap: 9px; }
  .cx-instant .cx-field--full { grid-column: 1 / -1; }
  .cx-instant .cx-hint { display: none; } /* hints crowd a phone; the full page keeps them */
  .cx-instant .cx-actions { gap: 7px; }
  .cx-instant .cx-actions .cx-btn { flex: 1; min-width: 0; padding: 11px 12px; font-size: .87rem; }
  .cx-section { padding: 20px 0; }
  .cx-stats { gap: 8px; }
  .cx-tape__rows { padding: 4px 14px 12px; }
  .cx-headline { padding: 18px 16px; }
}
@media (max-width: 430px) {
  .cx-instant .cx-fields { grid-template-columns: 1fr; }
  .cx-instant .cx-actions .cx-btn { font-size: .84rem; padding: 10px 10px; }
}

/* ---- Upsell strip ---- */
.cx-upsell {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 22px 24px; border-radius: var(--cx-r-lg);
  background: var(--cx-gradient-soft); border: 1px solid color-mix(in srgb, var(--cx-g1) 20%, transparent);
}
.cx-upsell p { font-size: .9rem; max-width: 56ch; }

/* ---- Auth cards ---- */
.cx-auth { display: grid; place-items: center; padding: 34px 0 46px; }
.cx-auth__card {
  width: 100%; max-width: 430px; background: var(--cx-surface);
  border: 1px solid var(--cx-border); border-radius: var(--cx-r-xl);
  padding: 28px; box-shadow: var(--cx-shadow-lg);
}
.cx-auth__card h1 { font-size: 1.4rem; margin-bottom: 6px; }
.cx-auth__card > p { font-size: .9rem; margin-bottom: 20px; }
.cx-auth__foot { text-align: center; font-size: .86rem; margin-top: 18px; color: var(--cx-text-3); }
.cx-auth__foot a { color: var(--cx-g2); font-weight: 600; }

/* ---- Account shell ---- */
.cx-account { display: grid; grid-template-columns: 218px minmax(0,1fr); gap: 22px; padding: 24px 0 44px; align-items: start; }
@media (max-width: 900px) { .cx-account { grid-template-columns: 1fr; } }
.cx-account__nav {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--cx-surface); border: 1px solid var(--cx-border);
  border-radius: var(--cx-r-lg); padding: 12px; box-shadow: var(--cx-shadow);
}
@media (max-width: 900px) { .cx-account__nav { flex-direction: row; overflow-x: auto; } }
.cx-account__nav a {
  padding: 9px 13px; border-radius: 10px; font-size: .88rem; font-weight: 600;
  color: var(--cx-text-2); white-space: nowrap; transition: background .16s, color .16s;
}
.cx-account__nav a:hover { background: var(--cx-bg-alt); color: var(--cx-text); }
.cx-account__nav a.is-active { background: var(--cx-gradient); color: #fff; }

.cx-badge-pro {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 999px; font-size: .68rem; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; background: var(--cx-gradient); color: #fff;
}

/* ---- History rows ---- */
.cx-hist {
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px;
  border-bottom: 1px solid var(--cx-border);
}
.cx-hist:last-child { border-bottom: 0; }
.cx-hist__main { flex: 1; min-width: 0; }
.cx-hist__title { font-size: .92rem; font-weight: 650; }
.cx-hist__value { font-family: var(--cx-font-mono); font-size: 1.02rem; font-weight: 700; color: var(--cx-g2); }
.cx-hist__meta { font-size: .74rem; color: var(--cx-text-3); font-family: var(--cx-font-mono); margin-top: 3px; }
.cx-hist__inputs { font-size: .78rem; color: var(--cx-text-3); margin-top: 5px; word-break: break-word; }
.cx-hist__actions { display: flex; gap: 6px; flex: none; }
.cx-hist__actions button, .cx-hist__actions a {
  border: 1px solid var(--cx-border); background: var(--cx-surface); cursor: pointer;
  border-radius: 8px; padding: 5px 10px; font-size: .74rem; font-weight: 600; color: var(--cx-text-2);
}
.cx-hist__actions button:hover, .cx-hist__actions a:hover { border-color: var(--cx-border-strong); color: var(--cx-text); }

/* ---- Pricing ---- */
.cx-plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); margin-top: 8px; }
.cx-plan {
  position: relative; background: var(--cx-surface); border: 1px solid var(--cx-border);
  border-radius: var(--cx-r-lg); padding: 24px 22px; display: flex; flex-direction: column;
  box-shadow: var(--cx-shadow); transition: transform .24s var(--cx-ease), box-shadow .24s;
}
.cx-plan:hover { transform: translateY(-3px); box-shadow: var(--cx-shadow-lg); }
.cx-plan--featured { border-color: transparent; box-shadow: 0 0 0 2px var(--cx-g2), var(--cx-shadow-lg); }
.cx-plan__tag {
  position: absolute; top: -11px; left: 22px; padding: 3px 12px; border-radius: 999px;
  background: var(--cx-gradient); color: #fff; font-size: .68rem; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
}
.cx-plan__name { font-family: var(--cx-font-display); font-size: 1.05rem; font-weight: 700; }
.cx-plan__price { font-family: var(--cx-font-mono); font-size: 2.1rem; font-weight: 700; letter-spacing: -.03em; margin: 10px 0 2px; }
.cx-plan__period { font-size: .8rem; color: var(--cx-text-3); }
.cx-plan__desc { font-size: .87rem; color: var(--cx-text-2); margin: 12px 0; }
.cx-plan__features { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 9px; flex: 1; }
.cx-plan__features li { display: flex; gap: 9px; font-size: .86rem; color: var(--cx-text-2); }
.cx-plan__features li::before { content: '✓'; color: var(--cx-positive); font-weight: 800; flex: none; }

/* ---- Member strip in the header ---- */
.cx-userchip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 6px;
  border-radius: 999px; border: 1px solid var(--cx-border); background: var(--cx-surface);
  font-size: .82rem; font-weight: 600; color: var(--cx-text-2);
}
.cx-userchip__avatar {
  width: 25px; height: 25px; border-radius: 50%; background: var(--cx-gradient);
  color: #fff; display: grid; place-items: center; font-size: .74rem; font-weight: 800; flex: none;
}
.cx-userchip__name { white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.cx-userchip:hover { border-color: var(--cx-g2); color: var(--cx-text); }

.cx-note--pro { border-left-color: var(--cx-positive); }

/* Spinner also works when the class sits on the button itself (checkout) */
.cx-btn.is-loading .cx-btn__spinner { display: block; }

/* ===================================================================
   PHASE 3.1 — Switcher, centred search, floating theme control,
   and a print sheet that contains only the calculation.
   Calculix by AjonTec
   =================================================================== */

/* ---- Home header, centred ---- */
.cx-instant__head { display: block; text-align: center; margin-bottom: 14px; }
.cx-instant__title { font-size: clamp(1.35rem, 3.2vw, 2rem); margin: 4px 0 12px; }
.cx-search--center { margin-left: auto; margin-right: auto; max-width: 440px; text-align: left; }
.cx-search--center input { padding-block: 11px; }

/* ---- Quick switcher ---- */
.cx-switcher-wrap { position: relative; margin: 0 0 12px; }
.cx-switcher-wrap::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 8px; width: 42px;
  background: linear-gradient(90deg, transparent, var(--cx-bg));
  pointer-events: none;
}
.cx-switcher {
  display: flex; align-items: center; gap: 7px; flex-wrap: nowrap;
  overflow-x: auto; padding: 2px 42px 6px 0;
  scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.cx-switcher::-webkit-scrollbar { display: none; }
@media (min-width: 900px) {
  .cx-switcher { justify-content: center; flex-wrap: wrap; padding-right: 0; overflow: visible; }
  .cx-switcher-wrap::after { display: none; }
}
.cx-switcher__tab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; flex: none;
  padding: 10px 16px; border-radius: 999px;
  font-size: .875rem; font-weight: 600; line-height: 1;
  background: var(--cx-surface); border: 1px solid var(--cx-border); color: var(--cx-text-2);
  box-shadow: 0 1px 2px rgba(16,20,38,.04);
  scroll-snap-align: start;
  transition: border-color .18s, color .18s, transform .18s var(--cx-ease), box-shadow .18s;
}
.cx-switcher__tab:hover {
  border-color: var(--cx-border-strong); color: var(--cx-text);
  transform: translateY(-2px); box-shadow: var(--cx-shadow);
}
.cx-switcher__tab.is-active {
  background: var(--cx-gradient); border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px rgba(79,70,229,.32);
  padding-left: 13px;
}
.cx-switcher__tab.is-active:hover { color: #fff; transform: none; }
/* A tick makes the current tool obvious at a glance, not just "a bit bluer" */
.cx-switcher__tab.is-active::before {
  content: '✓'; font-size: .8rem; font-weight: 800; line-height: 1;
  display: inline-grid; place-items: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(255,255,255,.25); flex: none;
}
.cx-switcher__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: none; opacity: .92;
}
.cx-switcher__icon .cx-icon { width: 18px; height: 18px; }
.cx-switcher__tab.is-active .cx-switcher__icon { opacity: 1; }
.cx-switcher__text { display: inline-block; }
.cx-switcher__tab--more { border-style: dashed; font-weight: 650; }

@media (max-width: 860px) {
  /* Sticks under the header so switching tools feels like an app's tab bar */
  .cx-switcher-wrap {
    position: sticky; top: calc(var(--cx-header-h) + env(safe-area-inset-top));
    z-index: 40; margin-inline: calc(var(--cx-gutter) * -1); padding-inline: var(--cx-gutter);
    background: color-mix(in srgb, var(--cx-bg) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--cx-border);
  }
  .cx-switcher { padding-top: 8px; }
  .cx-switcher__tab { padding: 9px 14px; font-size: .82rem; }
  .cx-switcher-wrap::after { right: 0; }
}

/* ---- Header actions & theme switch ---- */
.cx-header__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.cx-nav { margin-left: auto; margin-right: 6px; }
.cx-header__signin {
  padding: 8px 13px; border-radius: 10px; font-size: .875rem; font-weight: 600;
  color: var(--cx-text-2); transition: background .18s, color .18s;
}
.cx-header__signin:hover { background: var(--cx-bg-alt); color: var(--cx-text); }

.cx-theme-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 5px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--cx-border); background: var(--cx-bg-alt);
  color: var(--cx-text-2); font-size: .82rem; font-weight: 650; line-height: 1;
  box-shadow: inset 0 1px 2px rgba(16,20,38,.05);
  transition: border-color .2s, background .2s, color .2s, box-shadow .2s;
}
.cx-theme-btn:hover { border-color: var(--cx-g2); color: var(--cx-text); }
.cx-theme-btn:active { transform: scale(.97); }
.cx-theme-btn:focus-visible { outline: 2px solid var(--cx-g1); outline-offset: 2px; }

/* The knob reads as the moving part of a switch, not a decorative badge. */
.cx-theme-btn__icon {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: .9rem;
  background: var(--cx-gradient); color: #fff;
  box-shadow: 0 2px 8px rgba(79,70,229,.38);
  transition: transform .32s var(--cx-ease), background .25s;
}
.cx-theme-btn:hover .cx-theme-btn__icon { transform: rotate(-20deg) scale(1.06); }

/* Dark mode engaged: the whole control fills, so its state is obvious. */
[data-theme="dark"] .cx-theme-btn {
  background: var(--cx-gradient); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(79,70,229,.4); text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
[data-theme="dark"] .cx-theme-btn:hover { color: #fff; border-color: transparent; }
[data-theme="dark"] .cx-theme-btn__icon {
  background: #fff; color: #4F46E5; box-shadow: 0 2px 8px rgba(0,0,0,.28);
  transform: translateX(1px);
}
.cx-theme-btn__text { white-space: nowrap; letter-spacing: .01em; }
/* On phones the account lives in the bottom tab bar, so the header carries
   nothing but the logo and the theme switch — no crowding, no duplication. */
@media (max-width: 860px) {
  .cx-header__actions { margin-left: auto; }
  .cx-header__signin, .cx-userchip { display: none; }
  .cx-theme-btn { padding: 6px 14px 6px 6px; font-size: .8rem; }
}
@media (max-width: 380px) {
  .cx-theme-btn__text { display: none; }
  .cx-theme-btn { padding: 6px; }
}

/* ---- Print sheet: only the calculation reaches paper or PDF ---- */
#cxPrintSheet { display: none; }

.cx-print__brand {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 16px;
}
.cx-print__brand strong { font-size: 1.15rem; letter-spacing: -.02em; }
.cx-print h1 { font-size: 1.3rem; margin: 0 0 4px; }
.cx-print__stamp { font-size: .78rem; color: #555; }
.cx-print__section { margin-top: 16px; page-break-inside: avoid; }
.cx-print__section h2 {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .1em;
  color: #555; margin: 0 0 8px; border-bottom: 1px solid #ddd; padding-bottom: 4px;
}
.cx-print__row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 5px 0; border-bottom: 1px dotted #ddd; font-size: .92rem;
}
.cx-print__row:last-child { border-bottom: 0; }
.cx-print__row span:last-child { font-family: var(--cx-font-mono); font-weight: 600; white-space: nowrap; }
.cx-print__row--total { border-top: 1.5px solid #111; border-bottom: 0; margin-top: 6px; padding-top: 9px; font-weight: 700; }
.cx-print__headline {
  border: 2px solid #111; border-radius: 8px; padding: 14px 16px; margin-bottom: 6px;
}
.cx-print__headline small { display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: #555; }
.cx-print__headline strong { font-family: var(--cx-font-mono); font-size: 1.8rem; letter-spacing: -.02em; }
.cx-print__notes { font-size: .8rem; color: #444; }
.cx-print__notes li { margin-bottom: 4px; }
.cx-print__foot {
  margin-top: 22px; padding-top: 10px; border-top: 1px solid #ddd;
  font-size: .72rem; color: #666; display: flex; justify-content: space-between; gap: 16px;
}

@media print {
  /* Hide the entire site, then show only the generated sheet. */
  body.cx-printing > * { display: none !important; }
  body.cx-printing #cxPrintSheet {
    display: block !important;
    position: static; width: 100%;
    padding: 0; margin: 0;
    color: #000; background: #fff;
    font-family: var(--cx-font-body);
  }
  body.cx-printing { background: #fff !important; padding: 0 !important; }
  @page { margin: 14mm; }
}
