:root {
      --ink: #182620;
      --ink-soft: #3d4a44;
      --paper: #eef1ea;
      --panel: #ffffff;
      --line: #d7ddd2;
      --muted: #6d786f;
      --teal: #1f7a6c;
      --teal-deep: #145a4f;
      --teal-soft: #e3f0ec;
      --amber: #c97a2b;
      --amber-soft: #f7e9d8;
      --rose: #a8503f;
      --rose-soft: #faebe8;
      --green: #2e7d32;
      --green-soft: #e8f5e9;
      --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
      --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "URW Palladio L", P052, serif;
      --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
      --wrap: 1140px;
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      background: var(--paper);
      color: var(--ink);
      font-family: var(--sans);
      line-height: 1.6;
      -webkit-font-smoothing: antialiased;
      padding-bottom: 64px;
    }
    a { color: inherit; }
    img { max-width: 100%; display: block; }
    ::selection { background: var(--teal); color: #fff; }
    :focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 4px; }

    .wrap { width: min(var(--wrap), 100% - clamp(24px, 5vw, 64px)); margin-inline: auto; }

    /* ---------- Nav ---------- */
    .nav {
      position: sticky; top: 0; z-index: 40;
      background: rgba(238,241,234,.94);
      backdrop-filter: saturate(1.4) blur(10px);
      -webkit-backdrop-filter: saturate(1.4) blur(10px);
      border-bottom: 1px solid var(--line);
    }
    .nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 0; }
    .nav-left { display: flex; align-items: center; gap: 16px; }
    .nav img { height: 40px; width: auto; }
    .back-btn {
      display: inline-flex; align-items: center; gap: 6px;
      font-family: var(--mono); font-size: 12px; font-weight: 700;
      color: var(--teal); text-decoration: none; padding: 6px 12px;
      border-radius: 6px; background: var(--teal-soft); border: 1px solid rgba(31,122,108,.2);
      transition: all .15s ease;
    }
    .back-btn:hover { background: var(--teal); color: #fff; }

    .nav-links { display: flex; align-items: center; gap: 18px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
    .nav-links a { text-decoration: none; color: var(--ink-soft); transition: color .15s ease; }
    .nav-links a:hover, .nav-links a.active { color: var(--teal); font-weight: 700; }
    
    .nav-btn {
      display: inline-flex; align-items: center; justify-content: center; gap: 6px;
      font-family: var(--mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
      text-decoration: none; cursor: pointer; padding: 8px 16px; border-radius: 999px;
      font-weight: 700; transition: all .18s ease; outline: none; border: 2px solid transparent;
      line-height: 1.2;
    }
    .nav-btn.primary {
      background: var(--teal); color: #ffffff !important; border-color: var(--teal);
      box-shadow: 0 2px 8px rgba(31,122,108,.3);
    }
    .nav-btn.primary:hover {
      background: var(--teal-deep); border-color: var(--teal-deep); color: #ffffff !important;
      transform: translateY(-1px);
    }
    .nav-btn.secondary {
      background: var(--panel); color: var(--ink); border-color: var(--line);
    }
    .nav-btn.secondary:hover { border-color: var(--teal); color: var(--teal); }

    /* ---------- Hero ---------- */
    .calc-hero {
      padding: clamp(32px, 5vh, 48px) 0 clamp(20px, 3vh, 32px);
      background:
        radial-gradient(ellipse 650px 380px at 5% 0%, rgba(31,122,108,.12), transparent 60%),
        radial-gradient(ellipse 550px 380px at 95% 100%, rgba(201,122,43,.14), transparent 60%),
        var(--paper);
      border-bottom: 1px solid var(--line);
    }
    .hero-content { max-width: 860px; }
    .eyebrow {
      font-family: var(--mono); font-size: 11.5px; letter-spacing: .14em;
      text-transform: uppercase; color: var(--teal); margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
    }
    .eyebrow .badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
    .calc-hero h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 3.8vw, 40px); line-height: 1.18; margin: 0 0 10px; }
    .calc-hero .lede { font-size: clamp(15px, 1.2vw, 17px); color: var(--ink-soft); max-width: 760px; margin: 0 0 16px; line-height: 1.5; }
    
    .hero-meta-row {
      display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
    }
    .hero-badge {
      display: inline-flex; align-items: center; gap: 6px;
      background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
      padding: 5px 12px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft);
      white-space: nowrap;
    }
    .hero-badge strong { color: var(--teal); font-weight: 700; }

    /* ---------- Calculator Card ---------- */
    .calc-section {
      padding: 32px 0 20px;
    }
    .re-calc-card {
      background: radial-gradient(ellipse 650px 380px at 90% 10%, rgba(201,122,43,.08), transparent 70%), var(--panel);
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: clamp(20px, 3vw, 32px);
      box-shadow: 0 6px 20px rgba(0,0,0,.03);
    }
    .re-calc-header {
      margin-bottom: 22px;
      border-bottom: 1px solid var(--line);
      padding-bottom: 16px;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-items: baseline;
      gap: 12px;
    }
    .re-calc-title {
      font-family: var(--serif);
      font-size: 23px;
      font-weight: 600;
      margin: 0;
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .re-calc-desc {
      font-size: 14px;
      color: var(--muted);
      margin: 6px 0 0;
      line-height: 1.5;
      max-width: 820px;
    }
    .re-calc-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 28px;
    }
    .re-calc-inputs-pane {
      background: #fafbfa;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 22px;
    }
    .re-calc-results-pane {
      background: #ffffff;
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 22px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    .control-label {
      font-family: var(--mono);
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: .06em;
      color: var(--muted);
      display: block;
      margin-bottom: 6px;
    }
    .segment-select {
      font-family: var(--sans);
      font-size: 13.5px;
      padding: 9px 12px;
      background: var(--paper);
      border: 1px solid var(--line);
      border-radius: 8px;
      color: var(--ink);
      outline: none;
      cursor: pointer;
      font-weight: 600;
      width: 100%;
      transition: border-color .15s ease;
    }
    .segment-select:focus { border-color: var(--teal); }

    .re-slider-group {
      margin-bottom: 20px;
    }
    .re-slider-header {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      margin-bottom: 8px;
    }
    .re-slider-label {
      font-family: var(--sans);
      font-size: 13px;
      font-weight: 600;
      color: var(--ink);
    }
    .re-slider-value-badge {
      font-family: var(--mono);
      font-size: 13px;
      font-weight: 700;
      color: var(--teal);
      background: var(--teal-soft);
      padding: 3px 9px;
      border-radius: 5px;
    }
    .re-range-input {
      width: 100%;
      height: 6px;
      border-radius: 999px;
      background: var(--line);
      outline: none;
      -webkit-appearance: none;
      appearance: none;
      cursor: pointer;
    }
    .re-range-input::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: var(--teal);
      border: 2px solid #ffffff;
      box-shadow: 0 2px 6px rgba(31,122,108,.35);
      cursor: pointer;
      transition: transform .12s ease;
    }
    .re-range-input::-webkit-slider-thumb:hover {
      transform: scale(1.15);
      background: var(--teal-deep);
    }
    .re-range-input::-moz-range-thumb {
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: var(--teal);
      border: 2px solid #ffffff;
      box-shadow: 0 2px 6px rgba(31,122,108,.35);
      cursor: pointer;
    }

    /* Preset Chips */
    .preset-chips-row {
      display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line);
    }
    .preset-chip {
      font-family: var(--mono); font-size: 11px; font-weight: 600;
      color: var(--ink-soft); background: var(--paper); border: 1px solid var(--line);
      padding: 4px 10px; border-radius: 999px; cursor: pointer; transition: all .15s ease;
    }
    .preset-chip:hover {
      background: var(--teal-soft); color: var(--teal); border-color: rgba(31,122,108,.3);
    }

    .re-calc-rates-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 14px;
      margin-bottom: 18px;
    }
    .re-rate-box {
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 14px 16px;
      background: #fafbfa;
    }
    .re-rate-box.broker {
      border-color: rgba(201,122,43,.35);
      background: var(--amber-soft);
    }
    .re-rate-box.carpet {
      border-color: rgba(31,122,108,.35);
      background: var(--teal-soft);
    }
    .re-rate-lbl {
      font-family: var(--mono);
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: .05em;
      color: var(--muted);
    }
    .re-rate-box.broker .re-rate-lbl { color: #82470e; font-weight: 700; }
    .re-rate-box.carpet .re-rate-lbl { color: var(--teal-deep); font-weight: 700; }
    .re-rate-val {
      font-family: var(--mono);
      font-size: 21px;
      font-weight: 700;
      color: var(--ink);
      margin-top: 4px;
    }
    .re-rate-sub {
      font-size: 11px;
      color: var(--muted);
      margin-top: 4px;
    }
    .re-breakdown-list {
      border-top: 1px solid var(--line);
      padding-top: 14px;
      margin-bottom: 16px;
      font-size: 13.5px;
    }
    .re-breakdown-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 0;
      color: var(--ink-soft);
    }
    .re-breakdown-row.total {
      border-top: 1.5px solid var(--ink);
      margin-top: 8px;
      padding-top: 10px;
      font-weight: 700;
      font-size: 15px;
      color: var(--ink);
    }
    .re-breakdown-row.total .val {
      font-family: var(--mono);
      font-size: 19px;
      color: var(--teal-deep);
    }
    .re-calc-insight-callout {
      background: #f7ede2;
      border: 1px solid rgba(201,122,43,.35);
      border-radius: 8px;
      padding: 12px 16px;
      font-size: 12.5px;
      color: #5a3206;
      line-height: 1.5;
      margin-top: 14px;
    }

    /* ---------- Educational Explainer Cards ---------- */
    .edu-section {
      padding: 36px 0;
    }
    .edu-header {
      margin-bottom: 22px;
      padding-bottom: 12px;
      border-bottom: 2px solid var(--line);
    }
    .edu-title {
      font-family: var(--serif);
      font-size: 24px;
      font-weight: 400;
      margin: 0;
    }
    .edu-desc {
      font-size: 14px;
      color: var(--muted);
      margin: 4px 0 0;
    }
    .edu-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 18px;
    }
    .edu-card {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 20px;
      transition: transform .15s ease, box-shadow .15s ease;
    }
    .edu-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 20px rgba(0,0,0,.04);
      border-color: var(--teal);
    }
    .edu-card-icon {
      font-size: 26px;
      margin-bottom: 10px;
    }
    .edu-card h4 {
      font-family: var(--sans);
      font-size: 15px;
      font-weight: 700;
      margin: 0 0 6px;
      color: var(--ink);
    }
    .edu-card p {
      font-size: 13px;
      color: var(--ink-soft);
      margin: 0;
      line-height: 1.5;
    }


    @media (max-width: 900px) {
      .nav-links { display: none; }
      .re-calc-grid { grid-template-columns: 1fr; gap: 18px; }
      .re-calc-rates-row { grid-template-columns: 1fr; }
    }
    @media (max-width: 600px) {
      .re-calc-card { padding: 16px; }
      .re-calc-inputs-pane, .re-calc-results-pane { padding: 16px; }
      .re-rate-val { font-size: 18px; }
    }

/* Utilities replacing inline styles */
.is-hidden { display: none; }
th.th-right { text-align: right; }
.mb-8 { margin-bottom:8px; }
.re-badge-amber { color:var(--amber);background:var(--amber-soft); }
.re-range-ends { display:flex;justify-content:space-between;font-family:var(--mono);font-size:11px;color:var(--muted);margin-top:4px; }
.re-row-label { font-family:var(--mono);font-size:11px;color:var(--muted);width:100%;margin-bottom:2px; }
.re-two-col { margin-bottom:16px;display:grid;grid-template-columns:1fr 1fr;gap:12px; }
.text-amber-deep { color:#82470e; }
.text-rose { color:var(--rose); }
