:root {
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --accent: #059669;
  --ink: #0f172a;
  --muted: #556172;
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e4e8f1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 8px 32px rgba(15, 23, 42, .12);
  --grad: linear-gradient(135deg, #4f46e5, #7c3aed);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* Anchor jumps and the sticky chart have to clear the header, whose mobile row is taller. */
:root { --chrome-h: 76px; scroll-padding-top: var(--chrome-h); }

a, button, input, select, summary { -webkit-tap-highlight-color: rgba(79, 70, 229, .14); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* Keyboard users jump the header straight to the page body; it is invisible until focused. */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 0 0 10px 10px; font-weight: 700; font-size: 14px; text-decoration: none; transition: top .15s; }
.skip-link:focus { top: 0; }
.cv-preview-bar { margin: 14px 0 0; padding: 12px 16px; border-radius: 10px; background: #fff7ed; border: 1px solid #fdba74; border-left: 4px solid #ea580c; color: #7c2d12; font-size: 14px; line-height: 1.5; }
.cv-preview-bar a { color: #9a3412; font-weight: 700; }
[data-theme="dark"] .cv-preview-bar { background: #431407; border-color: #9a3412; color: #fed7aa; }
[data-theme="dark"] .cv-preview-bar a { color: #fdba74; }
main:focus { outline: none; }
img, svg, canvas, video, table { max-width: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ============ Header ============ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
/* The header carries a long wordmark plus seven nav items, so it is given a wider measure than
   the 1180px article container — otherwise every flex child squeezes and labels break mid-word.
   Nothing in it may wrap: `.brand` and `.main-nav a` are nowrap, and the nav becomes a hidden
   scroller as the last resort so an over-stuffed row can never push the page sideways. */
.header-inner { display: flex; align-items: center; gap: 18px; height: 64px; max-width: 1400px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--ink); letter-spacing: -.02em; flex: none; }
.logo:hover { text-decoration: none; }
.brand { white-space: nowrap; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 17px; font-weight: 800;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.logo span em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* The 4px vertical padding keeps the nav's own clip box clear of the 2px/offset focus outline on
   its links — an overflow scroller would otherwise shave the ring off top and bottom. */
.main-nav { display: flex; gap: 2px; flex: 0 1 auto; min-width: 0; padding: 4px 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  white-space: nowrap; padding: 8px 11px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 14px;
}
.main-nav a:hover { color: var(--ink); background: #eef0f6; text-decoration: none; }

.header-search { position: relative; margin-left: auto; flex: 1 1 200px; min-width: 130px; max-width: 340px; }
.header-search input {
  width: 100%; padding: 10px 16px 10px 40px; border: 1.5px solid var(--border);
  border-radius: 11px; font-size: 14.5px; background: #fff; outline: none; transition: border .15s, box-shadow .15s;
}
.header-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.header-search .s-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-dropdown {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 420px; overflow-y: auto; display: none;
}
.search-dropdown.open { display: block; }
.sd-item { display: block; padding: 10px 16px; border-bottom: 1px solid #f1f3f8; color: var(--ink); cursor: pointer; }
.sd-item:hover, .sd-item.active { background: #f4f4ff; text-decoration: none; }
.sd-item .sd-name { font-weight: 600; font-size: 14.5px; }
.sd-item .sd-name mark { background: #ddd6fe; border-radius: 3px; padding: 0 1px; }
.sd-item .sd-meta { font-size: 12px; color: var(--muted); }
.sd-live { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 700; color: var(--accent); background: #d1fae5; border-radius: 20px; padding: 1px 8px; vertical-align: 1px; }
.sd-footer { padding: 10px 16px; font-size: 13px; font-weight: 600; text-align: center; }

/* ============ Hero ============ */
.hero {
  background:
    radial-gradient(1000px 400px at 15% -10%, rgba(124, 58, 237, .16), transparent 60%),
    radial-gradient(900px 420px at 90% 0%, rgba(5, 150, 105, .10), transparent 55%),
    linear-gradient(180deg, #eef0ff 0%, var(--bg) 100%);
  padding: 72px 0 56px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero h1 { font-size: clamp(30px, 5vw, 48px); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { margin: 16px auto 0; max-width: 640px; color: var(--muted); font-size: 17.5px; }
.hero-search { max-width: 620px; margin: 32px auto 0; position: relative; }
.hero-search input {
  width: 100%; padding: 17px 22px 17px 52px; font-size: 16.5px; border: 1.5px solid var(--border);
  border-radius: 15px; box-shadow: var(--shadow-lg); outline: none; background: #fff;
}
.hero-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .14), var(--shadow-lg); }
.hero-search .s-ico { position: absolute; left: 19px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.hero-stats { display: flex; justify-content: center; gap: 40px; margin-top: 36px; flex-wrap: wrap; }
.hero-stat b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.hero-stat span { color: var(--muted); font-size: 13.5px; font-weight: 600; }
.hero-chips { margin-top: 22px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 30px; background: #fff; border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ============ Sections & grids ============ */
.section { padding: 48px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; gap: 16px; }
.section-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.section-head .muted { color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid.cats { grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); }
.grid.calcs { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.cat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s; color: var(--ink);
}
.cat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.cat-ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
}
.cat-ico svg { width: 22px; height: 22px; }
.cat-card h3 { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.cat-card p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.calc-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); color: var(--ink); position: relative;
  transition: transform .15s, box-shadow .15s, border-color .15s; display: block;
}
.calc-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c7cbe0; text-decoration: none; }
.calc-card h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; padding-right: 26px; }
.calc-card p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.badge-live { font-size: 10px; font-weight: 800; letter-spacing: .04em; color: #fff; background: #047857; border-radius: 20px; padding: 2px 8px; flex-shrink: 0; }
.badge-soon { font-size: 10px; font-weight: 800; letter-spacing: .04em; color: var(--muted); background: #eef0f6; border-radius: 20px; padding: 2px 8px; flex-shrink: 0; }

/* ============ Favorites star ============ */
.fav-star {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 8px; color: #94a3b8; cursor: pointer;
  transition: color .15s, background .15s, transform .1s;
}
.fav-star svg { width: 18px; height: 18px; }
.fav-star:hover { color: #f59e0b; background: rgba(245, 158, 11, .12); }
.fav-star:active { transform: scale(.88); }
.fav-star.on { color: #f59e0b; }
.fav-star.on svg { fill: #f59e0b; }
.calc-title-row { display: flex; align-items: flex-start; gap: 10px; }
.calc-title-row h1 { flex: 1; }
.calc-title-row .fav-star { position: static; width: 42px; height: 42px; flex-shrink: 0; margin-top: 2px; }
.calc-title-row .fav-star svg { width: 26px; height: 26px; }
.calc-title-row .fav-star.big { border: 1px solid var(--border); }
.calc-title-row .fav-star.big:hover { border-color: #f0c96a; }

/* ============ Author byline + profiles (E-E-A-T) ============ */
.byline { margin: 2px 0 10px; font-size: 14px; color: var(--muted); }
.byline .by-prep { color: var(--muted); }
.byline .by-link { color: var(--ink); font-weight: 700; text-decoration: none; border-bottom: 1px solid var(--border); }
.byline .by-link:hover { color: var(--brand); border-bottom-color: var(--brand); }
.byline .by-role { color: var(--muted); font-weight: 500; }
.byline .by-dates { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }
.byline .by-dates .bd-upd { color: var(--muted); }
.badge-verified { font-size: 11px; font-weight: 800; letter-spacing: .02em; color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 20px; padding: 2px 9px; vertical-align: middle; }

.author-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; margin-top: 6px; }
.author-card { display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); color: var(--ink); text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; }
.author-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #c7cbe0; text-decoration: none; }
.author-card .ac-body { min-width: 0; }
.author-card h2 { font-size: 16.5px; font-weight: 800; line-height: 1.25; }
.author-card .ac-role { color: var(--brand); font-weight: 700; font-size: 13.5px; margin-top: 2px; }
.author-card .ac-bio { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.5; }
.author-card .ac-count { color: var(--muted); font-size: 12.5px; font-weight: 600; margin-top: 8px; }
.ac-spec { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }

.author-photo { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; flex-shrink: 0; background: var(--bg); border: 1px solid var(--border); }
.author-photo.sm { width: 56px; height: 56px; border-radius: 12px; }
.author-photo.ph { display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: var(--brand); background: #eef2ff; }
.author-photo.ph.sm { font-size: 18px; }

/* ============ Author Page & Profile Styling ============ */
.author-page { padding: 16px 0 60px; }
.author-hero-card {
  display: flex;
  gap: 28px;
  align-items: center;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.06);
  margin-bottom: 24px;
}
.author-hero-media {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.author-hero-media .author-photo {
  width: 130px;
  height: 130px;
  border-radius: 24px;
  box-shadow: 0 8px 24px -4px rgba(0,0,0,0.12);
  border: 3px solid #ffffff;
  object-fit: cover;
}
.author-verified-tag {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 20px;
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.author-hero-info { flex: 1; min-width: 0; }
.author-hero-info h1 {
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 800;
  letter-spacing: -.02em;
  margin: 0 0 6px;
  color: var(--ink, #0f172a);
}
.au-role-badge {
  display: inline-block;
  font-size: 15px;
  font-weight: 700;
  color: var(--brand, #4f46e5);
  margin-bottom: 12px;
}
.au-meta-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--muted, #64748b);
}
.au-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.au-meta-item strong { color: var(--ink, #1e293b); }
.au-icon { font-size: 15px; flex-shrink: 0; }

/* Stats Grid */
.author-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.au-stat-card {
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.au-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}
.au-stat-card.highlight {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, #fdfdff 0%, #eef2ff 100%);
}
.au-stat-card.highlight .au-stat-value {
  color: var(--brand, #4f46e5);
}
.au-stat-icon { font-size: 22px; margin-bottom: 8px; }
.au-stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--ink, #0f172a);
  line-height: 1.1;
  margin-bottom: 4px;
}
.au-stat-value.sm {
  font-size: 18px;
  font-weight: 750;
  line-height: 1.25;
}
.au-stat-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink, #334155);
  margin-bottom: 4px;
}
.au-stat-sub {
  font-size: 12px;
  color: var(--muted, #64748b);
}

/* Section Cards / Panels */
.author-card-panel {
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 18px;
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.panel-heading {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink, #0f172a);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-icon { font-size: 20px; }
.au-bio-text p {
  font-size: 15.5px;
  line-height: 1.7;
  color: #334155;
  margin: 0 0 12px;
}
.au-bio-text p:last-child { margin-bottom: 0; }
.au-standards-list {
  padding-left: 20px;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.au-standards-list li {
  font-size: 14.5px;
  line-height: 1.6;
  color: #334155;
}
.au-standards-list strong { color: var(--ink, #0f172a); }

/* Contact links */
.au-contact-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}
.au-contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  color: var(--ink, #0f172a);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
}
.au-contact-link:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: var(--brand, #4f46e5);
  text-decoration: none;
  transform: translateY(-1px);
}
.au-ci { font-size: 15px; }

/* Calculators Directory in Author Profile */
.panel-header-with-badge {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding-bottom: 14px;
}
.panel-header-with-badge .panel-heading { margin: 0; }
.badge-total-count {
  font-size: 13px;
  font-weight: 800;
  color: var(--brand, #4f46e5);
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  padding: 4px 14px;
}
.au-cat-block {
  margin-bottom: 28px;
}
.au-cat-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--ink, #0f172a);
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #eef2ff;
}
.au-sub-block {
  margin-bottom: 18px;
  padding-left: 6px;
}
.au-sub-title {
  font-size: 14.5px;
  font-weight: 750;
  color: var(--muted, #64748b);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.au-count-pill {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 2px 8px;
}
.au-tool-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.au-tool-item {
  margin: 0;
}
.au-tool-link {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink, #0f172a);
  transition: all .15s;
  height: 100%;
}
.au-tool-link:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transform: translateY(-1px);
  text-decoration: none;
}
.au-tool-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand, #4f46e5);
  margin-bottom: 4px;
}
.au-tool-tagline {
  font-size: 12px;
  color: var(--muted, #64748b);
  line-height: 1.4;
}

@media (max-width: 768px) {
  .author-hero-card { flex-direction: column; text-align: center; padding: 22px; }
  .author-hero-info h1 { font-size: 24px; }
  .au-meta-list { align-items: center; }
  .author-stats-grid { grid-template-columns: 1fr; }
  .au-tool-list { grid-template-columns: 1fr; }
}
.muted { color: var(--muted); font-weight: 500; }

/* ============ Article Author & Verification Card ============
   Collapsed by default on every screen: one line carrying just the author name and the publish day.
   The photo, the ✓ badge, the "N Calculators Authored" pill and the role/credentials unfold on hover,
   on keyboard focus (`:focus-within`, since the line holds links) and on a tap — touch has no hover,
   so app.js toggles `.aac-open` when the card body is tapped. Nothing is removed from the page: the
   fields stay in the DOM (just hidden), on the author profile, and in the JSON-LD. */
.article-author-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius, 12px);
  padding: 11px 16px;
  margin: 10px 0 24px;
  box-shadow: var(--shadow, 0 1px 3px rgba(0, 0, 0, 0.05));
  transition: border-color .15s, box-shadow .15s;
}
.article-author-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.08));
}
.article-author-card .aac-avatar-wrap {
  flex-shrink: 0;
  text-decoration: none;
}
.article-author-card .author-photo {
  width: 58px;
  height: 58px;
  border-radius: 12px;
}
.article-author-card .aac-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 10px;
}
.article-author-card .aac-role { flex: 0 0 100%; }
.article-author-card .aac-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14.5px;
}
.article-author-card .aac-by {
  color: var(--muted, #64748b);
  font-weight: 500;
}
.article-author-card .aac-name {
  color: var(--ink, #0f172a);
  font-weight: 800;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.article-author-card .aac-name:hover {
  color: var(--brand, #4f46e5);
  border-bottom-color: var(--brand, #4f46e5);
}
.article-author-card .aac-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eef2ff;
  color: var(--brand, #4f46e5);
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  margin-left: 4px;
}
.article-author-card .aac-count-badge strong {
  color: #3730a3;
  font-weight: 850;
}
.article-author-card .aac-role {
  color: var(--muted, #64748b);
  font-size: 13.5px;
  margin-top: 3px;
  line-height: 1.4;
}
.article-author-card .aac-cred {
  color: var(--ink, #0f172a);
  font-weight: 600;
}
.article-author-card .aac-dates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 0;
  font-size: 12.5px;
  color: var(--muted, #64748b);
}
.article-author-card .aac-date {
  display: inline-flex;
  align-items: center;
}
.article-author-card .aac-date strong {
  margin-left: 4px;
  color: var(--ink, #0f172a);
  font-weight: 600;
}
.article-author-card .aac-sep {
  opacity: 0.5;
}
/* Collapse/expand. These sit after every component rule above on purpose: `.article-author-card
   .aac-extra` ties the specificity of e.g. `.article-author-card .aac-count-badge`, so it is document
   order that lets the collapsed state win over the pill's own `display: inline-flex`. */
.article-author-card .aac-extra { display: none; }
:is(.article-author-card:hover, .article-author-card:focus-within, .article-author-card.aac-open) .aac-extra { display: block; }
:is(.article-author-card:hover, .article-author-card:focus-within, .article-author-card.aac-open) .aac-extra.aac-inline { display: inline-block; }
/* the count pill is a flex container, not a block — it must unfold as the inline-flex badge */
:is(.article-author-card:hover, .article-author-card:focus-within, .article-author-card.aac-open) .aac-count-badge.aac-extra { display: inline-flex; }
@media (max-width: 640px) {
  /* The card is already one line everywhere; on a phone the unfolded state just needs to fit without
     the photo eating half of the text column. */
  .article-author-card { padding: 10px 12px; margin: 8px 0 20px; border-radius: 10px; }
  .article-author-card .author-photo { width: 42px; height: 42px; border-radius: 10px; }
  .article-author-card .author-photo.ph { font-size: 15px; }
  .article-author-card .aac-top { gap: 4px 6px; font-size: 13px; }
  .article-author-card .aac-name { font-size: 13.5px; }
  .article-author-card .aac-count-badge { gap: 4px; padding: 1px 8px; font-size: 11px; margin-left: 0; }
  .article-author-card .aac-role { margin-top: 0; font-size: 12px; line-height: 1.35; }
  .article-author-card .aac-dates { gap: 3px 8px; font-size: 11.5px; }
  .article-author-card .badge-verified { font-size: 10px; padding: 1px 7px; }
}

/* ============ Breadcrumbs & page heads ============ */
.crumbs { font-size: 13px; color: var(--muted); padding: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--muted); font-weight: 600; }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { opacity: .5; }

.page-head { padding: 14px 0 26px; }
.page-head h1 { font-size: clamp(24px, 3.6vw, 34px); font-weight: 800; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: 8px; max-width: 760px; font-size: 15.5px; }

/* ============ Calculator layout ============ */
.calc-wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 22px; align-items: start; padding-bottom: 40px; }
@media (max-width: 900px) { .calc-wrap { grid-template-columns: 1fr; } }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.panel h2 { font-size: 17px; font-weight: 700; margin-bottom: 16px; }

.field { margin-bottom: 15px; }
.field label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.field .tip { cursor: help; color: var(--muted); border-bottom: 1px dotted var(--muted); font-weight: 500; font-size: 12px; }
.field input[type=number], .field input[type=date], .field input[type=text], .field select {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14.5px; outline: none; background: #fff; transition: border .15s, box-shadow .15s; color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.field input.err { border-color: #dc2626; }
.field .err-msg { color: #dc2626; font-size: 12.5px; margin-top: 4px; display: none; }
.field.has-error .err-msg { display: block; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

.toggle-group { display: inline-flex; background: #eef0f6; border-radius: 10px; padding: 3px; margin-bottom: 18px; }
.toggle-group button {
  border: 0; background: transparent; padding: 7px 16px; border-radius: 8px; font-size: 13px;
  font-weight: 700; color: var(--muted); cursor: pointer;
}
.toggle-group button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }

.results-panel { position: sticky; top: 84px; }
@media (max-width: 900px) { .results-panel { position: static; } }
.result-hero {
  background: var(--grad); color: #fff; border-radius: 12px; padding: 20px 22px; margin-bottom: 16px;
}
.result-hero .rlabel { font-size: 13px; font-weight: 600; opacity: .85; }
.result-hero .rvalue { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin-top: 2px; word-break: break-word; }
.result-hero .rsub { font-size: 13px; opacity: .85; margin-top: 4px; }

.out-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 520px) { .out-grid { grid-template-columns: 1fr; } }
.out-item { background: #f8f9fd; border: 1px solid var(--border); border-radius: 11px; padding: 13px 15px; }
.out-item .olabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.out-item .ovalue { font-size: 18.5px; font-weight: 800; letter-spacing: -.01em; margin-top: 2px; word-break: break-word; }
.out-item .osub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.calc-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 17px; border-radius: 10px;
  font-size: 13.5px; font-weight: 700; border: 1.5px solid var(--border); background: #fff;
  color: #334155; cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn.primary { background: var(--grad); border: 0; color: #fff; }
.btn.primary:hover { opacity: .92; color: #fff; box-shadow: 0 4px 14px rgba(79, 70, 229, .4); }

.chart-box { margin-top: 18px; }
.chart-box h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.chart-box canvas { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

.data-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13.5px; }
.data-table caption { text-align: left; font-weight: 700; font-size: 14px; padding-bottom: 8px; }
.data-table th { text-align: left; padding: 9px 12px; background: #f4f5fa; border-bottom: 2px solid var(--border); font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid #f0f1f6; }
.data-table tr:hover td { background: #fafaff; }
.table-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.steps-box { margin-top: 18px; background: #f8f9fd; border: 1px solid var(--border); border-radius: 11px; padding: 15px 18px; }
.steps-box h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.steps-box ol { padding-left: 20px; font-size: 13.5px; color: #334155; }
.steps-box li { margin-bottom: 4px; }

/* ============ Article / FAQ / related ============ */
.article { max-width: 820px; margin: 0 auto; padding: 12px 20px 40px; }
.article section { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 30px; margin-bottom: 16px; box-shadow: var(--shadow); }
.article h2 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 12px; }
.article p { margin-bottom: 12px; color: #334155; font-size: 15px; }
.article ul, .article ol { margin: 0 0 12px 22px; color: #334155; font-size: 15px; }
.article li { margin-bottom: 6px; }
.article .formula {
  background: #0f172a; color: #a5f3fc; border-radius: 10px; padding: 14px 18px; font-family: "Cascadia Code", Consolas, monospace;
  font-size: 14px; margin: 12px 0; overflow-x: auto;
}
.article table.cmp { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.article table.cmp th { background: #f4f5fa; text-align: left; padding: 9px 12px; border-bottom: 2px solid var(--border); }
.article table.cmp td { padding: 9px 12px; border-bottom: 1px solid #f0f1f6; }
.article ul.lf-sens { list-style: none; margin: 0 0 14px; }
.article ul.lf-sens li { background: #f7f8fc; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 9px; padding: 10px 13px; margin-bottom: 7px; font-size: 14px; }
.article dl.lf-gloss { margin: 0; }
.article dl.lf-gloss dt { font-weight: 700; font-size: 14.5px; margin-top: 12px; color: var(--ink); }
.article dl.lf-gloss dd { margin: 3px 0 0; color: #475569; font-size: 14px; }
.article .inline-related { margin: 16px 0 0; padding: 9px 13px; border-left: 3px solid var(--accent); background: #f7f8fc; border-radius: 0 8px 8px 0; font-size: 13.5px; color: var(--muted); }
.article .inline-related a { color: var(--accent); font-weight: 700; text-decoration: none; }
.article .inline-related a:hover { text-decoration: underline; }

.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: 0; }
.faq-item summary { cursor: pointer; padding: 14px 4px; font-weight: 700; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 20px; color: var(--brand); font-weight: 400; transition: transform .15s; flex-shrink: 0; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item .faq-a { padding: 0 4px 16px; color: #475569; font-size: 14.5px; }

.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }

.disclaimer {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 12px;
  padding: 14px 18px; font-size: 13.5px; margin: 0 auto 40px; max-width: 820px;
}

/* ============ Queued calculator ============ */
.queued {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 40px; text-align: center; max-width: 680px; margin: 10px auto 30px;
}
.queued .q-ico { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 18px; background: #eef0ff; display: grid; place-items: center; color: var(--brand); }
.queued h2 { font-size: 20px; margin-bottom: 8px; }
.queued p { color: var(--muted); font-size: 14.5px; margin-bottom: 20px; }

/* ============ Search results page ============ */
.search-page-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.result-count { color: var(--muted); font-size: 14px; margin: 8px 0 20px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 13px 18px; margin-bottom: 9px; box-shadow: var(--shadow); }
.list-item a { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.list-item a:hover { color: var(--brand); text-decoration: none; }
.list-item .li-meta { font-size: 12px; color: var(--muted); }
.load-more { display: block; margin: 18px auto; }

/* ============ Category / sub page ============ */
.sub-pills { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 26px; }
.sub-pill { padding: 8px 16px; border-radius: 30px; background: #fff; border: 1px solid var(--border); font-size: 13.5px; font-weight: 600; color: #334155; box-shadow: var(--shadow); }
.sub-pill:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.sub-pill .cnt { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 5px; }

.alpha-jump { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 18px; }

/* ============ Footer ============ */
.site-footer { background: #0c1222; color: #94a3b8; padding: 52px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.8fr 1fr 1fr 1fr 1fr; gap: 28px; margin-bottom: 36px; }
@media (max-width: 960px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.site-footer h4 { color: #fff; font-size: 14px; font-weight: 700; margin-bottom: 14px; }
.site-footer a { color: #94a3b8; font-size: 13.5px; display: block; margin-bottom: 8px; }
.site-footer a:hover { color: #fff; }
.footer-brand p { font-size: 13.5px; max-width: 300px; margin-top: 12px; }
.footer-bottom { border-top: 1px solid #1e293b; padding-top: 22px; font-size: 12.5px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ============ Toast & misc ============ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #0f172a; color: #fff; padding: 12px 22px; border-radius: 11px; font-size: 14px;
  font-weight: 600; box-shadow: var(--shadow-lg); transition: transform .25s; z-index: 200;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.empty { text-align: center; color: var(--muted); padding: 50px 0; }

/* ============ Header re-flow ============
   One row needs about 1100px of inner measure (≈1140px of viewport) for the wordmark, seven nav
   labels, the search field and the two header buttons. So the row tightens first, at 1360px, and
   re-flows into identity+search over a full-width nav strip at 1160px — 60px of headroom above
   the point where it would start clipping. These blocks sit before the phone block so its larger
   tap targets and 16px inputs still win at ≤880px. */
@media (max-width: 1360px) {
  .header-inner { gap: 10px; }
  .logo { font-size: 18px; }
  .main-nav a { padding: 8px 7px; font-size: 13.5px; }
  .header-search { flex-basis: 150px; min-width: 110px; max-width: 300px; }
}
@media (max-width: 1160px) {
  :root { --chrome-h: 126px; }
  .header-inner { flex-wrap: wrap; height: auto; gap: 8px 12px; padding: 8px 20px; }
  .logo { flex: none; min-height: 44px; }
  .header-search { order: 2; flex: 1 1 160px; margin-left: 0; min-width: 0; max-width: none; }
  .main-nav { order: 3; flex: 1 1 100%; gap: 4px; margin: 0 -20px; padding: 4px 20px 8px; }
  .main-nav a { padding: 10px 12px; font-size: 14px; }
}

/* ============ Tablet and phone ============
   The desktop rules above stay untouched; every block below only re-flows them. The header
   becomes two rows (identity + search, then a scrollable nav), the calculator's two columns
   stack, and wide furniture — tables, formula strips, the alpha jump — scrolls inside itself
   instead of pushing the page sideways. Inputs are 16px because iOS Safari zooms the whole
   viewport when a focused field is smaller, and tappable things are at least 44px tall. */
@media (max-width: 880px) {
  :root { --chrome-h: 130px; }
  .container { padding: 0 16px; }

  /* Two rows: identity + search beside it, then the nav as a scrollable strip. A third row for
     the search alone would eat a fifth of a phone screen before any content appears. */
  .header-inner { flex-wrap: wrap; height: auto; align-items: center; gap: 8px 10px; padding: 8px 16px; }
  /* The nav strip deliberately bleeds into the container gutter so its strip scrolls edge to
     edge; without the matching padding it would land 16px outside the viewport. */
  .logo { font-size: 18px; flex: none; min-height: 44px; align-items: center; }
  .logo-mark { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
  .header-search { order: 2; flex: 1 1 130px; margin-left: 0; max-width: none; min-width: 0; }
  .header-search input { padding: 12px 14px 12px 40px; font-size: 16px; min-height: 44px; }
  .main-nav {
    order: 3; flex: 1 1 100%; display: flex; gap: 6px; margin: 0 -16px; padding: 4px 16px 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { white-space: nowrap; padding: 11px 14px; font-size: 14px; }
  .search-dropdown { max-height: 60vh; }
  .sd-item { padding: 12px 15px; }

  .hero { padding: 38px 0 34px; }
  .hero p.sub { font-size: 16px; }
  .hero-search { margin-top: 22px; }
  .hero-search input { padding: 15px 18px 15px 46px; font-size: 16px; }
  .hero-search .s-ico { left: 16px; }
  .hero-stats { gap: 16px 26px; margin-top: 24px; }
  .hero-stat b { font-size: 21px; }
  .hero-stat span { font-size: 12.5px; }
  .chip { padding: 12px 15px; }

  .section { padding: 30px 0; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 16px; }
  .section-head h2 { font-size: 20px; }
  .grid { gap: 12px; }
  .grid.cats, .grid.calcs { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .cat-card, .calc-card { padding: 15px 16px; }
  .cat-ico { width: 38px; height: 38px; border-radius: 10px; }

  .crumbs { font-size: 12.5px; padding-top: 2px; gap: 2px 6px; }
  .crumbs a { padding: 11px 5px; margin: -11px -5px; }
  .page-head { padding: 10px 0 18px; }
  .page-head p { font-size: 15px; }

  .calc-wrap { gap: 16px; padding-bottom: 26px; }
  /* A 1fr track is minmax(auto, 1fr), so a number input's intrinsic ~190px width would hold the
     stacked column open and push the page sideways. min-width:0 hands the track back to the viewport. */
  .calc-wrap > * { min-width: 0; }
  .panel { padding: 18px 16px; }
  .field label { font-size: 14px; }
  .field input[type=number], .field input[type=date], .field input[type=text], .field select {
    font-size: 16px; padding: 11px 13px; min-height: 44px; min-width: 0;
  }
  .toggle-group { display: flex; width: 100%; }
  .toggle-group button { flex: 1; min-height: 44px; }
  .btn { padding: 11px 16px; min-height: 44px; font-size: 14px; }
  .result-hero { padding: 17px 18px; }
  .result-hero .rvalue { font-size: 27px; }
  .out-item { padding: 12px 14px; }
  .calc-actions .btn { flex: 1 1 auto; justify-content: center; }
  .chart-box canvas { width: 100% !important; height: auto !important; }

  /* Wide blocks scroll themselves rather than widening the document. */
  .data-table, .article table.cmp {
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap;
    font-size: 13px;
  }
  .data-table th, .data-table td, .article table.cmp th, .article table.cmp td { padding: 8px 10px; }
  .steps-box { padding: 13px 15px; }

  .article { padding: 10px 14px 30px; }
  .article section { padding: 18px 16px; margin-bottom: 12px; }
  .article h2 { font-size: 18.5px; }
  .article .formula { padding: 12px 14px; font-size: 13px; }
  .faq-item summary { padding: 14px 2px; font-size: 14.5px; min-height: 44px; }
  .disclaimer { padding: 13px 15px; font-size: 13px; margin-bottom: 28px; }
  .queued { padding: 28px 18px; }
  .list-item { flex-direction: column; align-items: flex-start; gap: 3px; padding: 13px 15px; }
  .sub-pill { padding: 11px 15px; }
  .alpha-jump a { padding: 9px 10px; }
  .load-more { display: block; width: 100%; max-width: 420px; }

  .site-footer { padding: 34px 0 26px; margin-top: 26px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
  .footer-brand { grid-column: 1 / -1; }
  .site-footer a { padding: 8px 0; margin-bottom: 0; }
  .section-head .muted { padding: 8px 0; }
}

@media (max-width: 560px) {
  :root { --chrome-h: 132px; }
  .grid.cats, .grid.calcs { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .out-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 27px; }
  .page-head h1 { font-size: 23px; }
  .footer-grid { grid-template-columns: 1fr; gap: 4px; }
  .policy-page { padding: 16px 12px 40px; }
  .policy-card { padding: 20px 16px; }
  .policy-page h1 { font-size: 24px; }
  .compare-hero h1 { font-size: 24px; }
  .compare-picker-box { padding: 14px 16px; }
  .compare-col { padding: 16px 14px; }
  /* The desktop toast centres itself with translateX(-50%), which fights a full-width bar: the
     element would sit half off screen. Both states clear the transform and fade instead of sliding. */
  .toast, .toast.show {
    transform: none; left: 14px; right: 14px; bottom: 14px;
    text-align: center; padding: 12px 16px;
  }
  .toast { opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
  .toast.show { opacity: 1; visibility: visible; }
}

/* Below ~520px the wordmark, install and theme buttons can no longer share a row with the search
   field, so the header becomes three stacked rows (~176px measured). scroll-padding-top has to
   follow it, otherwise an in-page jump hides the heading behind the sticky chrome. */
@media (max-width: 520px) {
  :root { --chrome-h: 186px; }
  .logo { flex: 1; }
  .theme-toggle { order: 0; }
  .header-search { order: 2; flex: 1 1 100%; width: 100%; }
}

/* A touch screen has no hover: a card that lifted on the desktop would stay lifted after a tap. */
@media (hover: none) {
  .cat-card:hover, .calc-card:hover { transform: none; box-shadow: var(--shadow); }
  .btn:not(.primary):hover { border-color: var(--border); color: #334155; }
  .btn.primary:hover { opacity: 1; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cat-card, .calc-card, .btn, .toast, .faq-item summary::after { transition: none; }
}

@media print {
  .site-header, .site-footer, .calc-actions, .article, .related, .crumbs, .disclaimer { display: none !important; }
  .calc-wrap { grid-template-columns: 1fr; }
  .results-panel { position: static; }
  body { background: #fff; }
}

/* ============ Dark Theme ============ */
[data-theme="dark"] {
  --brand: #6366f1;
  --brand-2: #8b5cf6;
  --accent: #10b981;
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --bg: #0b0f19;
  --card: #151c2c;
  --border: #232e42;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .6);
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --brand: #6366f1;
    --brand-2: #8b5cf6;
    --accent: #10b981;
    --ink: #f1f5f9;
    --muted: #94a3b8;
    --bg: #0b0f19;
    --card: #151c2c;
    --border: #232e42;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .6);
    --grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  }
}

[data-theme="dark"] .site-header,
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .site-header {
    background: rgba(11, 15, 25, .88);
  }
}

[data-theme="dark"] .hero,
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .hero {
    background: radial-gradient(1000px 400px at 15% -10%, rgba(99, 102, 241, .2), transparent 60%),
                radial-gradient(900px 420px at 90% 0%, rgba(16, 185, 129, .15), transparent 55%),
                linear-gradient(180deg, #131929 0%, var(--bg) 100%);
  }
}

[data-theme="dark"] .header-search input,
[data-theme="dark"] .hero-search input,
[data-theme="dark"] .search-dropdown,
[data-theme="dark"] .calc-wrap input,
[data-theme="dark"] .calc-wrap select,
[data-theme="dark"] .compare-select,
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .header-search input,
  html:not([data-theme="light"]) .hero-search input,
  html:not([data-theme="light"]) .search-dropdown,
  html:not([data-theme="light"]) .calc-wrap input,
  html:not([data-theme="light"]) .calc-wrap select,
  html:not([data-theme="light"]) .compare-select {
    background: #151c2c;
    color: var(--ink);
    border-color: var(--border);
  }
}

[data-theme="dark"] .main-nav a:hover,
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .main-nav a:hover {
    color: #fff;
    background: #1e293b;
  }
}

[data-theme="dark"] .sd-item,
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .sd-item {
    border-bottom-color: var(--border);
    color: var(--ink);
  }
  html:not([data-theme="light"]) .sd-item:hover,
  html:not([data-theme="light"]) .sd-item.active {
    background: #1e293b;
  }
}

[data-theme="dark"] .author-card-panel,
[data-theme="dark"] .author-hero-card,
[data-theme="dark"] .article-author-card,
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .author-card-panel,
  html:not([data-theme="light"]) .author-hero-card,
  html:not([data-theme="light"]) .article-author-card {
    background: var(--card);
    border-color: var(--border);
  }
}

/* Theme toggle button */
.theme-toggle {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: all .2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--brand);
  background: rgba(79, 70, 229, .08);
}
.theme-toggle .moon-icon { display: none; }
.theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .theme-toggle .sun-icon { display: none; }
  html:not([data-theme="light"]) .theme-toggle .moon-icon { display: block; }
}

/* ============ Recently Viewed Strip ============ */
.recent-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.recent-clear {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
}
.recent-clear:hover {
  color: #ef4444;
  border-color: #fca5a5;
  background: rgba(239, 68, 68, .06);
}

/* ============ Compare Calculators ============ */
.compare-hero {
  text-align: center;
  padding: 24px 0 32px;
}
.compare-hero h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -.02em;
}
.compare-hero p {
  color: var(--muted);
  max-width: 600px;
  margin: 0 auto;
}
.compare-selectors-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.compare-picker-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.compare-picker-box label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.compare-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.compare-select:focus {
  border-color: var(--brand);
}
.compare-dual-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
.compare-col {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.compare-col-header {
  border-bottom: 1.5px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.compare-col-header h2 {
  font-size: 18px;
  font-weight: 750;
  margin: 0;
}
@media (max-width: 820px) {
  .compare-selectors-bar, .compare-dual-wrap {
    grid-template-columns: 1fr;
  }
}

/* ============ Standard & Trust Pages ============ */
.policy-page { max-width: 860px; margin: 0 auto; padding: 24px 20px 60px; }
.policy-page h1 { font-size: 32px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.02em; }
.policy-meta { font-size: 13.5px; color: var(--muted); margin-bottom: 24px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.policy-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; margin-bottom: 24px; box-shadow: var(--shadow); }
.policy-card h2 { font-size: 20px; font-weight: 750; margin-bottom: 12px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.policy-card p, .policy-card li { font-size: 15px; line-height: 1.7; color: var(--ink); margin-bottom: 12px; }
.policy-card ul { padding-left: 20px; margin-bottom: 14px; }
.policy-card li { margin-bottom: 6px; }
.policy-card .highlight-box { background: rgba(79, 70, 229, .06); border-left: 4px solid var(--brand); padding: 14px 18px; border-radius: 0 10px 10px 0; margin: 16px 0; font-size: 14.5px; }

/* Contact page */
.contact-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; margin-top: 24px; }
@media (max-width: 768px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-form .form-group { margin-bottom: 16px; }
.contact-form label { display: block; font-size: 13.5px; font-weight: 650; margin-bottom: 6px; color: var(--ink); }
.contact-form input, .contact-form select, .contact-form textarea { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14.5px; background: var(--card); color: var(--ink); outline: none; }
.contact-form input:focus, .contact-form select:focus, .contact-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.contact-channels { display: flex; flex-direction: column; gap: 16px; }
.channel-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.channel-card h3 { font-size: 16px; font-weight: 750; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.channel-card p { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.5; }

/* ============ Advertising ============
   Every rule here styles a node that assets/js/cvads.js creates in the browser. Nothing is
   server-rendered, so a visitor with JavaScript off, a crawler and a signed-in console user all
   get a page with no ad frame, no reserved box and no layout shift from this section. */
.cv-ad {
  position: relative; clear: both; box-sizing: border-box;
  margin: 24px auto; padding: 17px 12px 12px; max-width: 100%;
  border: 1px dashed var(--border); border-radius: 12px;
  background: var(--card); text-align: center;
}
.cv-ad-in { display: flex; align-items: center; justify-content: center; min-height: 50px; overflow: hidden; }
.cv-ad-in ins, .cv-ad-in iframe, .cv-ad-in > script { display: block; max-width: 100%; }
.cv-ad-label {
  position: absolute; top: 3px; left: 10px; font-size: 9.5px; font-weight: 700; line-height: 1;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted); opacity: .65;
}
.cv-ad-x {
  position: absolute; top: 1px; right: 3px; width: 22px; height: 22px; padding: 0;
  border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 20px;
  cursor: pointer; border-radius: 6px;
}
.cv-ad-x:hover { background: var(--bg); color: var(--ink); }
.cv-ad.cv-empty { display: none; }
/* a reserved box is only ever as tall as the unit that will fill it */
.cv-ad-header { max-width: 768px; }
.cv-ad-in-article, .cv-ad-after-faq, .cv-ad-under-result, .cv-ad-hub-grid { max-width: 360px; }
.cv-ad-sidebar {
  /* float + sticky is the combination that keeps the half-page unit beside the guide text and
     still follows the reader down it; the containing block is the article itself */
  float: right; position: sticky; top: 92px;
  width: 300px; max-width: 100%; margin: 0 0 22px 26px; clear: right;
}
.cv-ad-hub-grid { margin-left: 0; text-align: center; }
.cv-ad-under-result { margin-top: 18px; }

/* house ad — our own promotion, built from the campaign fields, never a raw tag */
.cv-house {
  display: flex; gap: 14px; align-items: center; text-align: left;
  padding: 4px; border-radius: 10px; text-decoration: none; color: var(--ink);
}
.cv-house:hover { background: var(--bg); }
.cv-house-img { width: 84px; height: 62px; object-fit: cover; border-radius: 8px; flex: none; }
.cv-house-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cv-house-h { font-size: 15px; font-weight: 750; line-height: 1.3; }
.cv-house-b { font-size: 13px; color: var(--muted); line-height: 1.45; }
.cv-house-cta { font-size: 13px; font-weight: 700; color: var(--brand); }

/* consent bar: bottom-anchored, keyboard reachable, dismissed into localStorage for good */
.cv-consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 999;
  background: var(--card); border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px rgba(15, 18, 34, .14); padding: 14px 0;
}
.cv-consent-in { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.cv-consent p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink); flex: 1 1 340px; }
.cv-consent-btns { display: flex; gap: 10px; flex: none; }
.cv-consent button {
  padding: 9px 18px; border-radius: 9px; font-size: 13.5px; font-weight: 700; cursor: pointer;
  border: 1.5px solid var(--brand); background: var(--brand); color: #fff;
}
.cv-consent .cv-c-deny { background: none; color: var(--ink); border-color: var(--border); }
.cv-consent .cv-c-deny:hover { border-color: var(--ink); }

@media (max-width: 640px) {
  .cv-ad { margin: 18px auto; padding: 15px 8px 8px; }
  .cv-ad-sidebar { float: none; position: static; width: 100%; max-width: 330px; margin: 18px auto; }
  .cv-house-img { width: 64px; height: 48px; }
  .cv-consent-in { flex-direction: column; align-items: stretch; }
  .cv-consent-btns { justify-content: flex-end; }
}
@media (prefers-color-scheme: dark) {
  .cv-ad { background: #12141c; border-color: #2a2d3a; }
  .cv-consent { box-shadow: 0 -10px 30px rgba(0, 0, 0, .5); }
}
@media print { .cv-ad, .cv-consent { display: none !important; } }

/* ================= social share bar ================= */
.share-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.share-label { font-size: 13px; font-weight: 650; color: var(--muted); margin-right: 2px; }
.share-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--muted); cursor: pointer; text-decoration: none; transition: transform .12s, background .15s, color .15s, border-color .15s; }
.share-btn svg { width: 18px; height: 18px; fill: currentColor; }
.share-btn:hover { transform: translateY(-2px); color: #fff; }
.share-btn[data-share="facebook"]:hover { background: #1877f2; border-color: #1877f2; }
.share-btn[data-share="twitter"]:hover { background: #000; border-color: #000; }
.share-btn[data-share="linkedin"]:hover { background: #0a66c2; border-color: #0a66c2; }
.share-btn[data-share="whatsapp"]:hover { background: #25d366; border-color: #25d366; }
.share-btn[data-share="telegram"]:hover { background: #229ed9; border-color: #229ed9; }
.share-btn[data-share="email"]:hover { background: var(--brand); border-color: var(--brand); }
.share-btn[data-share="copy"]:hover { background: var(--ink); border-color: var(--ink); }
[data-theme="dark"] .share-btn { background: #1e293b; border-color: #334155; }

/* ================= embed panel ================= */
.embed-panel { margin: 8px 0 4px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.embed-panel h3 { margin: 0 0 4px; font-size: 18px; }
.embed-panel p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.embed-controls { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; }
.embed-controls label { font-size: 13px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.embed-num { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--ink); font-size: 14px; width: 96px; }
.embed-code { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical; }
.embed-actions { display: flex; gap: 10px; margin-top: 12px; align-items: center; }

/* embed iframe shell — compact, no chrome */
body.cv-embed { background: var(--card); }
.embed-shell { max-width: 720px; margin: 0 auto; padding: 16px 16px 8px; }
.embed-head { padding: 0 0 10px; }
.embed-head h1 { font-size: 21px; line-height: 1.25; }
.embed-wrap { margin-top: 4px; }
.embed-wrap .panel { box-shadow: none; }
.embed-foot { text-align: center; padding: 12px 0 4px; font-size: 12.5px; color: var(--muted); }
.embed-foot a { color: var(--brand); text-decoration: none; font-weight: 600; }
@media (max-width: 560px) { .embed-shell { padding: 12px 10px 4px; } }

/* ================= public API reference (/api) ================= */
.api-hero { background: var(--grad); color: #fff; padding: 56px 0 44px; margin-bottom: 30px; }
.api-hero-in { max-width: 900px; }
.api-eyebrow { font-size: 12.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .82; margin-bottom: 10px; }
.api-hero h1 { color: #fff; font-size: clamp(30px, 5vw, 44px); line-height: 1.12; margin: 0 0 14px; letter-spacing: -.02em; }
.api-lede { font-size: 17px; line-height: 1.6; max-width: 720px; color: rgba(255,255,255,.9); margin: 0 0 20px; }
.api-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.api-badge { font-size: 12.5px; font-weight: 650; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28); color: #fff; }

.api-doc { max-width: 900px; }
.api-doc > .api-section:first-of-type { margin-top: 0; }
.api-toc { position: sticky; top: 62px; z-index: 5; display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 12px 14px; margin: 0 0 30px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.api-toc a { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px 10px; border-radius: 8px; }
.api-toc a:hover { color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, transparent); }

.api-section { margin: 0 0 40px; scroll-margin-top: 120px; }
.api-section h2 { font-size: 22px; margin: 0 0 6px; letter-spacing: -.01em; }
.api-section > p { margin: 10px 0; }
.api-note { font-size: 14px; color: var(--muted); background: color-mix(in srgb, var(--brand) 7%, var(--card)); border-left: 3px solid var(--brand); border-radius: 8px; padding: 10px 14px; margin: 12px 0 18px !important; }

.api-code { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 14px 0; background: #0f172a; box-shadow: var(--shadow); }
.api-code-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #182236; border-bottom: 1px solid #26334d; }
.api-codelang { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8ea3c8; }
.api-copy { font-size: 12px; font-weight: 650; padding: 4px 12px; border-radius: 7px; border: 1px solid #33415c; background: #223047; color: #cdd9f0; cursor: pointer; }
.api-copy:hover { border-color: #4b5f83; color: #fff; }
.api-code pre { margin: 0; padding: 14px 16px; overflow: auto; }
.api-code code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.8px; line-height: 1.6; color: #d6e2ff; white-space: pre; }

.api-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.api-table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); background: var(--bg); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.api-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--ink); }
.api-table tr:last-child td { border-bottom: 0; }
.api-table code { background: color-mix(in srgb, var(--brand) 9%, var(--card)); color: var(--brand); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.api-m-get { display: inline-block; font-size: 11.5px; font-weight: 800; letter-spacing: .04em; padding: 3px 9px; border-radius: 6px; background: #dcfce7; color: #15803d; }
.api-req { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #fef3c7; color: #b45309; }
.api-st { display: inline-block; min-width: 42px; text-align: center; font-weight: 800; font-size: 13px; padding: 2px 9px; border-radius: 7px; background: color-mix(in srgb, var(--muted) 16%, var(--card)); color: var(--muted); }
.api-st-ok { background: #dcfce7; color: #15803d; }

.api-console { border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin: 14px 0; background: var(--card); box-shadow: var(--shadow); }
.api-req-line { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.api-req-line code { font-size: 13px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.api-fields { display: flex; flex-direction: column; gap: 8px; }
.api-frow { display: flex; align-items: center; gap: 8px; }
.api-fk, .api-fv { flex: 1; min-width: 0; padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg); color: var(--ink); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.api-fk { max-width: 200px; }
.api-fk:focus, .api-fv:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.api-feq { color: var(--muted); font-weight: 700; }
.api-fdel { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 6px; border-radius: 7px; }
.api-fdel:hover { color: #dc2626; background: color-mix(in srgb, #dc2626 10%, transparent); }
.api-try-bar { display: flex; gap: 10px; margin: 14px 0 4px; }
.api-res { margin-top: 14px; }
.api-res-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.api-chip { font-size: 12.5px; font-weight: 700; padding: 3px 11px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 16%, var(--card)); color: var(--muted); }
.api-chip-ok { background: #dcfce7; color: #15803d; }
.api-chip-bad { background: #fee2e2; color: #b91c1c; }
.api-time { font-size: 12.5px; color: var(--muted); margin-right: auto; }
.api-out { background: #0f172a; color: #d6e2ff; border-radius: 12px; padding: 14px 16px; overflow: auto; max-height: 420px; margin: 0; }
.api-out code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
@media (max-width: 560px) {
  .api-hero { padding: 40px 0 32px; }
  .api-toc { top: 56px; }
  .api-frow { flex-wrap: wrap; }
  .api-fk { max-width: none; }
}
@media (prefers-color-scheme: dark) { }
[data-theme="dark"] .api-code, [data-theme="dark"] .api-out, [data-theme="dark"] .api-code pre { background: #0b1120; }
[data-theme="dark"] .api-table code { color: #a5b4fc; }

/* ================= embed page ================= */
.embed-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.embed-col { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; background: var(--card); box-shadow: var(--shadow); }
.embed-col h3 { margin: 0 0 10px; font-size: 15px; font-weight: 750; display: flex; align-items: center; gap: 7px; }
.embed-col h3::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.embed-yes { color: #16a34a; }
.embed-no { color: #dc2626; }
.embed-col ul { margin: 0; padding-left: 18px; }
.embed-col li { margin: 7px 0; color: var(--ink); font-size: 14px; line-height: 1.5; }
.embed-preview { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.embed-preview-bar { padding: 8px 14px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--border); }
.embed-preview iframe { display: block; width: 100%; }
@media (max-width: 560px) { .embed-cols { grid-template-columns: 1fr; } }
[data-theme="dark"] .embed-yes { color: #4ade80; }
[data-theme="dark"] .embed-no { color: #f87171; }

/* ================= install (PWA) ================= */
.install-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--ink); font-size: 13.5px; font-weight: 650; cursor: pointer; }
.install-btn:hover { border-color: var(--brand); color: var(--brand); }
.install-btn svg { stroke: currentColor; }
.cv-install { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 320; display: flex; align-items: center; gap: 12px; margin: 0 auto; max-width: 640px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); box-shadow: var(--shadow-lg); font-size: 14px; }
.cv-install-txt { flex: 1; color: var(--ink); }
.cv-install .btn.sm { white-space: nowrap; }
.cv-install-x { border: 0; background: transparent; color: var(--muted); font-size: 16px; cursor: pointer; line-height: 1; padding: 4px 6px; }

/* ================= Professional Calculator (/calculator) ================= */
.pro-calc-page { max-width: 960px; margin: 0 auto; padding: 24px 16px 64px; }
.pro-calc-hero { text-align: center; margin-bottom: 24px; }
.pro-calc-hero h1 { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.pro-calc-hero p { font-size: 15.5px; color: var(--muted); max-width: 620px; margin: 0 auto; line-height: 1.6; }

.pro-calc-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
  margin-bottom: 32px;
}
@media (max-width: 860px) {
  .pro-calc-container { grid-template-columns: 1fr; }
}

.pro-calc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .03);
  overflow: hidden;
}

.pro-calc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(0, 0, 0, .02);
  border-bottom: 1px solid var(--border);
}
.calc-mode-tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 9px; }
.calc-mode-btn {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 650; color: var(--muted); cursor: pointer; transition: all .15s;
}
.calc-mode-btn.active {
  background: var(--card); color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.calc-quick-actions { display: flex; align-items: center; gap: 8px; }
.calc-pill-btn {
  display: inline-flex; align-items: center; gap: 5px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer;
}
.calc-pill-btn:hover { border-color: var(--brand); color: var(--brand); }
.calc-badge {
  display: inline-block; padding: 2px 7px; border-radius: 5px; font-size: 11px; font-weight: 750;
  background: rgba(79, 70, 229, .12); color: var(--brand); text-transform: uppercase;
}

/* Display */
.pro-calc-screen {
  padding: 20px 22px 16px;
  background: linear-gradient(180deg, var(--card) 0%, rgba(246, 247, 251, .6) 100%);
  border-bottom: 1px solid var(--border);
  text-align: right;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
[data-theme="dark"] .pro-calc-screen {
  background: linear-gradient(180deg, #121624 0%, #0d101d 100%);
}
.calc-screen-expr {
  font-size: 15px; color: var(--muted); min-height: 22px; word-break: break-all;
  font-family: 'SF Mono', Consolas, Monaco, monospace; letter-spacing: .02em; margin-bottom: 6px;
}
.calc-screen-val-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.calc-screen-indicators {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted);
}
.calc-screen-val {
  font-size: 38px; font-weight: 800; color: var(--ink); letter-spacing: -.02em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.1; word-break: break-all;
}
@media (max-width: 520px) {
  .calc-screen-val { font-size: 30px; }
}

/* Keypad */
.pro-calc-keypad {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.calc-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.calc-row.row-sci {
  grid-template-columns: repeat(5, 1fr);
}
.calc-row.row-mem {
  grid-template-columns: repeat(5, 1fr);
  margin-bottom: 4px;
}

.c-btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 48px;
  font-size: 16.5px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .12s cubic-bezier(.4, 0, .2, 1);
  user-select: none;
  background: var(--card);
  color: var(--ink);
}
.c-btn:active {
  transform: scale(.96);
}
.c-btn:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.c-btn.b-num {
  font-size: 18px;
  font-weight: 700;
  background: var(--card);
}
.c-btn.b-op {
  background: rgba(79, 70, 229, .07);
  color: var(--brand);
  font-size: 19px;
  font-weight: 700;
}
.c-btn.b-op:hover { background: rgba(79, 70, 229, .14); }
.c-btn.b-fn {
  background: var(--bg);
  font-size: 14px;
  font-weight: 600;
  color: #475569;
}
[data-theme="dark"] .c-btn.b-fn { color: #94a3b8; }
.c-btn.b-mem {
  min-height: 36px;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg);
  color: var(--muted);
  border-radius: 8px;
}
.c-btn.b-mem:hover { color: var(--ink); }
.c-btn.b-clear {
  color: #e11d48;
  background: rgba(225, 29, 72, .07);
}
.c-btn.b-clear:hover { background: rgba(225, 29, 72, .13); }
.c-btn.b-eq {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  font-size: 21px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .35);
}
.c-btn.b-eq:hover {
  background: #4338ca;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .45);
}

/* History tape */
.pro-calc-history {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  max-height: 520px;
}
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.history-head h3 { font-size: 15px; font-weight: 750; margin: 0; }
.history-clear-btn {
  background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 6px;
}
.history-clear-btn:hover { color: #ef4444; }
.history-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}
.history-item {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: right;
  cursor: pointer;
  transition: all .15s;
}
.history-item:hover {
  border-color: var(--brand);
  background: rgba(79, 70, 229, .05);
}
.history-item .h-expr { font-size: 12.5px; color: var(--muted); font-family: monospace; }
.history-item .h-res { font-size: 16px; font-weight: 750; color: var(--ink); margin-top: 2px; }
.history-empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 32px 0; }

/* Educational article below calculator */
.pro-calc-guide {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-top: 24px;
}
.pro-calc-guide h2 { font-size: 22px; font-weight: 750; margin: 24px 0 12px; }
.pro-calc-guide h2:first-child { margin-top: 0; }
.pro-calc-guide p { font-size: 15px; line-height: 1.7; color: var(--ink); margin-bottom: 14px; }
.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}
.shortcut-card {
  padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between; font-size: 13.5px;
}
.shortcut-card kbd {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px;
  font-family: monospace; font-size: 12px; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.cv-install-x:hover { color: var(--ink); }
@media (max-width: 560px) { .install-btn-txt { display: none; } }

