  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #0f1117; --surface: #1a1d27; --surface2: #232636;
    --border: #2e3148; --accent: #6c8ef5; --accent2: #4ade80;
    --warn: #f59e0b; --danger: #f87171;
    --text: #e2e8f0; --muted: #94a3b8; --dim: #64748b;
    --radius: 8px; --shadow: 0 2px 12px rgba(0,0,0,0.4); --marker-color: #ffffff;
  }
  [data-theme="light"] {
    --bg: #f0f2f8; --surface: #ffffff; --surface2: #eef1f8;
    --border: #d8dded; --accent: #3d5ce8; --accent2: #16a34a;
    --warn: #b45309; --danger: #dc2626;
    --text: #1e293b; --muted: #475569; --dim: #94a3b8;
    --shadow: 0 2px 12px rgba(0,0,0,0.08); --marker-color: #1e293b;
  }
  [data-theme="light"] .spinner { border-color: rgba(0,0,0,0.15); border-top-color: var(--text); }
  [data-theme="light"] .verdict-card { background: linear-gradient(135deg, rgba(22,163,74,0.07) 0%, var(--surface) 60%); }
  body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; }
  h1 { font-size: 1.4rem; font-weight: 700; color: var(--accent); }
  h2 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 12px; }
  h3 { font-size: 0.85rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
  header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 24px; display: flex; align-items: center; gap: 16px; }
  header p { color: var(--muted); font-size: 0.85rem; }
  /* Three-column header layout: logo | tagline (centered, flexes) | buttons */
  .header-tagline { flex: 1; text-align: center; max-width: 640px; margin: 0 auto; }
  /* Brand logo in the page header: H1 wraps the SVG so screen readers + Google
     still see a heading (via the img's alt text) while users see the logo. */
  .brand-h1 { margin: 0; line-height: 0; }
  .brand-logo { height: 56px; width: auto; display: block; transition: opacity 0.15s; }
  .brand-logo:hover { opacity: 0.85; }
  .theme-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; cursor: pointer; font-size: 0.8rem; font-weight: 600; color: var(--muted); transition: all 0.15s; flex-shrink: 0; }
  .theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
  .save-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; cursor: pointer; font-size: 0.8rem; font-weight: 600; color: var(--muted); transition: all 0.15s; flex-shrink: 0; }
  .save-btn:hover { border-color: var(--accent2); color: var(--accent2); }
  .save-btn.has-save { border-color: var(--accent2); color: var(--accent2); }
  .save-clear-link { font-size: 0.72rem; color: var(--dim); cursor: pointer; text-decoration: underline; white-space: nowrap; }
  .save-clear-link:hover { color: var(--danger); }
  .toast { position: fixed; bottom: 28px; right: 28px; background: var(--surface); border: 1px solid var(--accent2); color: var(--accent2); border-radius: var(--radius); padding: 10px 18px; font-size: 0.85rem; font-weight: 600; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 9999; pointer-events: none; }
  .toast.show { transform: translateY(0); opacity: 1; }
  .tabs { display: flex; gap: 2px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; }
  .tab { padding: 10px 18px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); font-size: 0.875rem; font-weight: 500; transition: all 0.15s; }
  .tab.active { color: var(--accent); border-bottom-color: var(--accent); }
  .tab:hover:not(.active) { color: var(--text); }
  .tab-content { display: none; padding: 24px; }
  .tab-content.active { display: block; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
  .grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
  .card + .card { margin-top: 16px; }
  .section { margin-bottom: 20px; }
  label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
  input, select { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; color: var(--text); font-size: 0.875rem; transition: border-color 0.15s; }
  input:focus, select:focus { outline: none; border-color: var(--accent); }
  input[type=range] { padding: 4px 0; accent-color: var(--accent); }
  .field { margin-bottom: 12px; }
  .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px; border: none; border-radius: 6px; font-size: 0.875rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
  .btn-primary { background: var(--accent); color: #fff; }
  .btn-primary:hover { background: #5a7ef0; }
  .btn-sm { padding: 5px 12px; font-size: 0.8rem; }
  .btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
  .btn-outline:hover { border-color: var(--accent); color: var(--accent); }
  .metric-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
  .metric { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
  .metric .label { font-size: 0.75rem; color: var(--muted); margin-bottom: 6px; }
  .metric .value { font-size: 1.25rem; font-weight: 700; }
  .metric .sub { font-size: 0.75rem; color: var(--dim); margin-top: 3px; }
  .metric.good .value { color: var(--accent2); }
  .metric.warn .value { color: var(--warn); }
  .metric.bad .value { color: var(--danger); }
  table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
  th { background: var(--surface2); color: var(--muted); text-align: right; padding: 8px 10px; font-weight: 600; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
  th:first-child { text-align: left; }
  td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
  td:first-child { text-align: left; font-weight: 500; }
  tr:hover td { background: rgba(108,142,245,0.05); }
  tr.retirement-start td { border-top: 2px solid var(--accent); }
  tr.ss-start td { border-top: 2px solid var(--accent2); }
  tr.rmd-start td { border-top: 2px solid var(--warn); }
  tr.death-row td { background: rgba(248,113,113,0.06); }
  tr.irmaa-t2 td { background: rgba(245,158,11,0.04); }
  tr.irmaa-t3 td { background: rgba(248,113,113,0.05); }
  tr.irmaa-t4 td, tr.irmaa-t5 td { background: rgba(239,68,68,0.08); }
  tr.proj-hover td { background: rgba(108,142,245,0.18) !important; box-shadow: inset 0 0 0 1px rgba(108,142,245,0.45); }
  .table-wrap { overflow: auto; max-height: 550px; border: 1px solid var(--border); border-radius: var(--radius); }
  .badge { display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; }
  .badge-blue { background: rgba(108,142,245,0.2); color: var(--accent); }
  .badge-green { background: rgba(74,222,128,0.2); color: var(--accent2); }
  .badge-yellow { background: rgba(245,158,11,0.2); color: var(--warn); }
  .badge-red { background: rgba(248,113,113,0.2); color: var(--danger); }
  .note { font-size: 0.78rem; color: var(--dim); margin-top: 8px; line-height: 1.5; }
  .note strong { color: var(--muted); }
  .scenario-check { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer; font-size: 0.875rem; }
  .scenario-check input[type=checkbox] { width: auto; accent-color: var(--accent); }
  .compare-table th, .compare-table td { padding: 7px 14px; }
  .compare-table .best { color: var(--accent2); font-weight: 700; }
  .compare-table .worst { color: var(--danger); }
  .section-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
  .slot-panel { position:absolute; top:calc(100% + 6px); right:0; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px; width:295px; z-index:600; box-shadow:var(--shadow); display:none; }
  .slot-panel.open { display:block; }
  .slot-row { display:flex; align-items:flex-start; gap:8px; padding:9px 0; border-bottom:1px solid var(--border); }
  .slot-row:last-of-type { border-bottom:none; }
  .slot-name-input { font-size:0.8rem; width:100%; }
  .cmp-table { width:100%; border-collapse:collapse; font-size:0.82rem; }
  .cmp-table th { background:var(--surface2); color:var(--muted); padding:9px 14px; text-align:right; white-space:nowrap; border-bottom:2px solid var(--border); font-weight:600; }
  .cmp-table th:first-child { text-align:left; }
  .cmp-table td { padding:8px 14px; border-bottom:1px solid var(--border); text-align:right; }
  .cmp-table td:first-child { text-align:left; }
  .cmp-metric { color:var(--muted); font-size:0.77rem; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; white-space:nowrap; }
  .cmp-best { color:var(--accent2) !important; font-weight:700; }
  .cmp-worst { color:var(--danger) !important; }
  .ssbe-chart-wrap { position:relative; height:260px; margin-bottom:4px; }
  .ssbe-table { width:100%; border-collapse:collapse; font-size:0.83rem; margin-top:12px; }
  .ssbe-table th { background:var(--surface2); color:var(--muted); padding:8px 12px; text-align:right; border-bottom:2px solid var(--border); font-weight:600; white-space:nowrap; }
  .ssbe-table th:first-child { text-align:left; }
  .ssbe-table td { padding:7px 12px; border-bottom:1px solid var(--border); text-align:right; }
  .ssbe-table td:first-child { text-align:left; }
  .ssbe-user-row { background:var(--surface2); }
  .strategy-row { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; margin-bottom: 10px; }
  .strategy-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
  .strategy-row .sub-fields { margin-top: 10px; padding-left: 24px; display: none; }
  .strategy-row.expanded .sub-fields { display: block; }
  .legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
  .chart-wrap { position: relative; height: 300px; }
  .flex { display: flex; align-items: center; gap: 10px; }
  .flex-between { display: flex; align-items: center; justify-content: space-between; }
  .gap-8 { gap: 8px; }
  .mt-8 { margin-top: 8px; }
  .mt-16 { margin-top: 16px; }
  .alert { padding: 10px 14px; border-radius: 6px; font-size: 0.82rem; margin-bottom: 14px; line-height: 1.5; }
  .alert-info { background: rgba(108,142,245,0.12); border: 1px solid rgba(108,142,245,0.3); color: var(--accent); }
  .alert-warn { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: var(--warn); }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--surface); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
  .spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
  /* Advisor tab styles */
  .verdict-card { border-radius: var(--radius); padding: 24px 28px; margin-bottom: 24px; border-left: 5px solid var(--accent2); background: linear-gradient(135deg, rgba(74,222,128,0.07) 0%, var(--surface) 60%); }
  .verdict-card h2 { font-size: 1.1rem; margin-bottom: 6px; }
  .verdict-card .verdict-winner { font-size: 1.6rem; font-weight: 800; margin: 10px 0; }
  .verdict-card .verdict-body { font-size: 0.88rem; color: var(--muted); line-height: 1.7; }
  .verdict-card .verdict-body strong { color: var(--text); }
  .verdict-card .verdict-stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
  .verdict-stat { }
  .verdict-stat .vs-label { font-size: 0.72rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
  .verdict-stat .vs-value { font-size: 1.1rem; font-weight: 700; color: var(--accent2); }
  .verdict-stat .vs-sub { font-size: 0.75rem; color: var(--dim); }
  .strat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
  .strat-card-header { padding: 14px 18px 12px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
  .strat-card-header .sc-name { font-weight: 700; font-size: 0.95rem; }
  .strat-card-header .sc-badge { margin-left: auto; font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
  .strat-card-body { padding: 16px 18px; flex: 1; }
  .strat-card-footer { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface2); font-size: 0.78rem; color: var(--dim); line-height: 1.5; }
  .pros-cons { margin-bottom: 14px; }
  .pros-cons h4 { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
  .pros-cons h4.pro-head { color: var(--accent2); }
  .pros-cons h4.con-head { color: var(--danger); }
  .pros-cons ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }
  .pros-cons ul li { font-size: 0.82rem; color: var(--muted); padding-left: 18px; position: relative; line-height: 1.4; }
  .pros-cons ul li::before { position: absolute; left: 0; font-weight: 700; }
  .pros-cons ul.pros li::before { content: '+'; color: var(--accent2); }
  .pros-cons ul.cons li::before { content: '−'; color: var(--danger); }
  .pros-cons ul li strong { color: var(--text); }
  .suited-for { font-size: 0.8rem; color: var(--muted); font-style: italic; line-height: 1.5; }
  .suited-for strong { color: var(--accent); font-style: normal; }
  .strat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
  .plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 14px; }
  .plan-pillar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; }
  .pp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .pp-icon { font-size: 1.2rem; flex-shrink: 0; }
  .pp-label { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
  .pp-rec { font-size: 1rem; font-weight: 800; line-height: 1.3; margin-bottom: 10px; }
  .pp-bullets { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }
  .pp-bullets li { font-size: 0.79rem; color: var(--muted); padding-left: 14px; position: relative; line-height: 1.45; }
  .pp-bullets li::before { content: '›'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
  .pp-bullets li strong { color: var(--text); }
  .caution-box { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); border-radius: var(--radius); padding: 14px 16px; margin-top: 20px; }
  .caution-box h3 { color: var(--warn); font-size: 0.8rem; margin-bottom: 8px; }
  .caution-box ul { list-style: disc; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
  .caution-box ul li { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
  .rank-pill { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; font-size: 0.72rem; font-weight: 800; flex-shrink: 0; }
  /* Compare-the-Alternatives table (Advisor tab) */
  .compare-head { display: flex; align-items: center; gap: 10px; margin: 28px 0 6px; flex-wrap: wrap; }
  .cmp-rank-by { margin-left: auto; font-size: 0.75rem; color: var(--dim); display: flex; align-items: center; gap: 6px; }
  .cmp-rank-by select { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; color: var(--text); font-size: 0.8rem; cursor: pointer; }
  .compare-hint { font-size: 0.78rem; color: var(--dim); margin-bottom: 12px; line-height: 1.45; }
  /* table-layout:fixed pins the table to 100% of its parent; without it the
     open detail panel's prose (max-content width) blows the table out wider
     than the window. Column widths are set on the header cells below. */
  .cmp-table { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .cmp-table th:nth-child(1) { width: 30%; }
  .cmp-table th:nth-child(2), .cmp-table th:nth-child(3), .cmp-table th:nth-child(4),
  .cmp-table th:nth-child(5), .cmp-table th:nth-child(6) { width: 13%; }
  .cmp-table th:nth-child(7) { width: 5%; }
  .cmp-table thead th { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); font-weight: 700; text-align: right; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface2); white-space: nowrap; }
  .cmp-table thead th:first-child { text-align: left; }
  .cmp-row { cursor: pointer; transition: background 0.12s; }
  .cmp-row:hover { background: var(--surface2); }
  .cmp-row > td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
  .cmp-row .cmp-name { font-weight: 600; color: var(--text); }
  .cmp-name-inner { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .cmp-name-inner > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cmp-num { text-align: right; color: var(--muted); white-space: nowrap; }
  .cmp-toggle { text-align: center; color: var(--dim); width: 30px; }
  .cmp-winner { background: rgba(74,222,128,0.06); }
  .cmp-winner:hover { background: rgba(74,222,128,0.10); }
  .cmp-rank { font-size: 0.7rem; color: var(--dim); margin-left: 2px; }
  .cmp-recbadge { background: rgba(74,222,128,0.15); color: var(--accent2); font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; margin-left: 2px; }
  .cmp-detail-row > td { padding: 0; border-bottom: 1px solid var(--border); }
  /* Override the global `td { white-space: nowrap }` so the pros/cons prose and
     "best suited for" text wrap inside the fixed-width detail cell instead of
     running off the right edge. */
  .cmp-detail { padding: 6px 16px 16px; background: var(--surface2); white-space: normal; overflow-wrap: break-word; }
  .cmp-detail-inner { padding-top: 8px; }
  @media (max-width: 560px) {
    .cmp-table thead { display: none; }
    .cmp-row > td.cmp-num:not(:nth-child(2)) { display: none; }
  }
  /* FAQ tab */
  .faq-section-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); margin: 32px 0 4px; display: flex; align-items: center; gap: 10px; }
  .faq-section-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
  .faq-section-title:first-child { margin-top: 8px; }
  .faq-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
  .faq-item:last-child { border-bottom: none; }
  .faq-q { font-weight: 700; font-size: 0.92rem; color: var(--text); margin-bottom: 8px; }
  .faq-a { font-size: 0.82rem; color: var(--muted); line-height: 1.7; }
  .faq-a p { margin-bottom: 8px; }
  .faq-a p:last-child { margin-bottom: 0; }
  .faq-a strong { color: var(--text); }
  .faq-a ul, .faq-a ol { list-style: disc; padding-left: 18px; margin: 6px 0; display: flex; flex-direction: column; gap: 3px; }
  .faq-a ol { list-style: decimal; }
  .concept-key { background: rgba(108,142,245,0.08); border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; padding: 10px 14px; margin-top: 10px; font-size: 0.79rem; color: var(--text); line-height: 1.6; }
  .concept-key::before { content: '💡 Key takeaway: '; font-weight: 700; color: var(--accent); }
  .concept-warn { background: rgba(245,158,11,0.08); border-left: 3px solid var(--warn); border-radius: 0 6px 6px 0; padding: 10px 14px; margin-top: 10px; font-size: 0.79rem; color: var(--text); line-height: 1.6; }
  .concept-warn::before { content: '⚠️ Watch out: '; font-weight: 700; color: var(--warn); }
  .concepts-search { width: 100%; max-width: 380px; margin-bottom: 4px; }
  /* Legacy / Heirs tab */
  .legacy-config { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
  .legacy-strat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; margin: 20px 0; }
  .legacy-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .legacy-card-header { padding: 13px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
  .legacy-card-header .lc-name { font-weight: 700; font-size: 0.9rem; flex: 1; }
  .legacy-card-header .lc-year { font-size: 0.78rem; color: var(--dim); }
  .estate-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
  .estate-table th { background: var(--surface2); color: var(--dim); padding: 7px 14px; text-align: right; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
  .estate-table th:first-child { text-align: left; }
  .estate-table td { padding: 8px 14px; text-align: right; border-bottom: 1px solid var(--border); }
  .estate-table td:first-child { text-align: left; color: var(--muted); }
  .estate-table tr.total-row td { font-weight: 700; background: var(--surface2); color: var(--text); border-top: 2px solid var(--border); border-bottom: none; }
  .estate-table .tax-cell { color: var(--danger); }
  .estate-table .net-cell { color: var(--accent2); }
  .estate-table .free-cell { color: var(--dim); font-size: 0.75rem; }
  .per-heir-strip { padding: 14px 18px; border-top: 1px solid var(--border); background: var(--surface2); }
  .per-heir-strip h4 { font-size: 0.72rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
  .per-heir-pills { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
  .heir-pill { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 14px; text-align: center; min-width: 110px; }
  .heir-pill .hp-label { font-size: 0.7rem; color: var(--dim); margin-bottom: 3px; }
  .heir-pill .hp-value { font-size: 1rem; font-weight: 700; }
  .pct-bar-wrap { height: 10px; background: var(--surface); border-radius: 5px; overflow: hidden; display: flex; }
  .pct-bar-wrap .bar-free { background: var(--accent2); }
  .pct-bar-wrap .bar-tax { background: var(--danger); }
  .estate-tax-alert { margin: 12px 14px; padding: 10px 14px; border-radius: 6px; background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.3); font-size: 0.8rem; color: var(--danger); line-height: 1.5; }
  .legacy-summary-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
  .legacy-summary-table th { background: var(--surface2); color: var(--muted); padding: 8px 14px; text-align: right; font-weight: 600; white-space: nowrap; }
  .legacy-summary-table th:first-child { text-align: left; }
  .legacy-summary-table td { padding: 8px 14px; text-align: right; border-bottom: 1px solid var(--border); }
  .legacy-summary-table td:first-child { text-align: left; font-weight: 500; color: var(--muted); }
  .legacy-summary-table .best { color: var(--accent2); font-weight: 700; }
  .legacy-summary-table .worst { color: var(--danger); }
  .legacy-chart-wrap { position: relative; height: 260px; margin: 20px 0; }
  /* Tooltips */
  .tt { position: relative; display: inline-flex; align-items: center; cursor: help; vertical-align: middle; margin-left: 5px; }
  .tt-icon { font-size: 0.7rem; color: var(--dim); border: 1px solid var(--dim); border-radius: 50%; width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1; transition: color 0.15s, border-color 0.15s; }
  .tt:hover .tt-icon, .tt.open .tt-icon { color: var(--accent); border-color: var(--accent); }
  .tt-text { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 7px); width: 270px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 0.78rem; color: var(--text); line-height: 1.5; font-weight: 400; z-index: 200; pointer-events: none; opacity: 0; transition: opacity 0.15s; box-shadow: 0 6px 20px rgba(0,0,0,0.35); white-space: normal; }
  .tt-text::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--border); }
  .tt:hover .tt-text, .tt.open .tt-text { opacity: 1; pointer-events: auto; }
  /* Disclosure modal */
  .disc-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.75); z-index:9999; display:flex; align-items:center; justify-content:center; padding:20px; }
  .disc-modal { background:var(--surface); border:1px solid var(--border); border-radius:10px; max-width:640px; width:100%; max-height:90vh; overflow-y:auto; box-shadow:0 8px 40px rgba(0,0,0,0.6); }
  .disc-modal-header { padding:20px 24px 16px; border-bottom:1px solid var(--border); }
  .disc-modal-header h2 { font-size:1.1rem; color:var(--text); margin-bottom:4px; }
  .disc-modal-header p { font-size:0.8rem; color:var(--warn); font-weight:600; }
  .disc-modal-body { padding:20px 24px; font-size:0.82rem; color:var(--muted); line-height:1.7; }
  .disc-modal-body ol { padding-left:20px; display:flex; flex-direction:column; gap:10px; margin:12px 0; }
  .disc-modal-body strong { color:var(--text); }
  .disc-modal-footer { padding:16px 24px; border-top:1px solid var(--border); background:var(--surface2); border-radius:0 0 10px 10px; }
  .disc-modal-footer p { font-size:0.78rem; color:var(--dim); margin-bottom:12px; line-height:1.5; }
  /* Persistent footer disclaimer */
  .global-disc-bar { background:var(--surface); border-top:1px solid var(--border); padding:8px 24px; font-size:0.72rem; color:var(--dim); line-height:1.5; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
  .global-disc-bar strong { color:var(--muted); }
  /* Drawdown Sandbox */
  /* Drawdown tab */
  .dd-wrap { }
  .dd-chart-wrap { position:relative; height:150px; }
  .dd-sliders-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .dd-si { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:9px 11px; }
  .dd-si-top { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:2px; }
  .dd-si input[type=range] { width:100%; margin:2px 0 0; display:block; }
  .dd-sl-label { font-size:0.78rem; color:var(--muted); font-weight:500; }
  .dd-sl-val { font-size:0.82rem; font-weight:700; color:var(--accent); white-space:nowrap; }
  .dd-sl-note { font-size:0.7rem; color:var(--dim); margin-top:3px; }
  @media (min-width:769px) {
    .dd-sliders-grid { grid-template-columns:repeat(3,1fr); }
    .dd-chart-wrap { height:230px; }
  }
  @media (max-width: 900px) {
    #tab-drawdown > div > div[style*="grid-template-columns:320px"] { grid-template-columns:1fr; }
  }
  @media (max-width: 768px) {
    /* Grids & form rows */
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .field-row, .field-row-3 { grid-template-columns: 1fr; }
    /* Header */
    header { padding: 10px 14px; gap: 8px; }
    header p { display: none; }
    h1 { font-size: 1.15rem; }
    .brand-logo { height: 42px; }
    /* Tab bar — horizontally scrollable, no visible scrollbar */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 0 8px; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex-shrink: 0; white-space: nowrap; padding: 10px 11px; font-size: 0.8rem; }
    /* Tab content & cards */
    .tab-content { padding: 14px 12px; }
    .card { padding: 14px 12px; }
    /* Run button full-width */
    .btn.btn-primary { width: 100%; justify-content: center; box-sizing: border-box; }
    /* Tooltip width clamped to viewport */
    .tt-text { width: min(270px, calc(100vw - 32px)); }
  }
  @media (max-width: 480px) {
    h1 { font-size: 1rem; }
    .tab { padding: 9px 9px; font-size: 0.75rem; }
    .tab-content { padding: 10px 8px; }
    .card { padding: 12px 10px; }
  }
  /* ===== COMPUTATIONS TAB ===== */
  .comp-section { margin-bottom: 32px; }
  .comp-section-title { font-size:0.78rem; font-weight:700; text-transform:uppercase; letter-spacing:0.08em; color:var(--dim); margin:0 0 12px; padding-bottom:6px; border-bottom:1px solid var(--border); }
  .comp-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(310px, 1fr)); gap:14px; }
  .comp-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:16px; }
  .comp-card-name { font-size:0.7rem; font-weight:700; text-transform:uppercase; letter-spacing:0.07em; color:var(--accent); margin-bottom:8px; }
  .comp-formula { font-family:monospace; font-size:0.78rem; background:var(--bg); border:1px solid var(--border); border-radius:4px; padding:8px 10px; margin:8px 0; color:var(--text); line-height:1.6; white-space:pre-wrap; }
  .comp-plain { font-size:0.88rem; line-height:1.55; color:var(--text); margin:8px 0; }
  .comp-plain ol, .comp-plain ul { margin:6px 0 6px 1.2em; padding:0; }
  .comp-plain li { margin-bottom:4px; }
  .comp-formula-toggle { margin:6px 0 4px; }
  .comp-formula-toggle summary { cursor:pointer; color:var(--muted); font-size:0.78rem; padding:3px 0; user-select:none; list-style:none; }
  .comp-formula-toggle summary::before { content:'▶ '; font-size:0.65rem; transition:transform 0.15s; display:inline-block; }
  .comp-formula-toggle[open] summary::before { content:'▼ '; }
  .comp-formula-toggle summary:hover { color:var(--accent); }

  /* Flash highlight on a comp-card after navigating to it from a tooltip link */
  @keyframes compCardFlash { 0% { box-shadow: 0 0 0 0 var(--accent); } 50% { box-shadow: 0 0 0 4px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
  .comp-card-flash { animation: compCardFlash 1.6s ease-out; }

  /* Link footer inside a tooltip body that opens the relevant Computations card */
  .tt-link { display:inline-block; margin-top:8px; font-size:0.72rem; color:var(--accent); text-decoration:none; border-top:1px solid var(--border); padding-top:6px; width:100%; }
  .tt-link:hover { color:var(--accent2); text-decoration:underline; }

  /* Collapsible "New here?" card */
  .newhere-collapsible summary::-webkit-details-marker { display:none; }
  .newhere-collapsible summary:hover strong { color:var(--accent); }
  .newhere-collapsible .newhere-arrow::before { content:'▼ Hide examples'; }
  .newhere-collapsible:not([open]) .newhere-arrow::before { content:'▶ Show examples'; }
  .comp-desc { font-size:0.84rem; color:var(--text); line-height:1.55; margin:0; }
  .comp-tip { font-size:0.78rem; color:var(--dim); margin-top:8px; padding-top:8px; border-top:1px solid var(--border); line-height:1.45; }
  .comp-seq { display:flex; flex-wrap:wrap; gap:0; align-items:center; margin-top:10px; }
  .comp-seq-step { background:var(--bg); border:1px solid var(--border); border-radius:6px; padding:8px 12px; font-size:0.8rem; }
  .comp-seq-step strong { display:block; font-size:0.72rem; text-transform:uppercase; letter-spacing:0.06em; color:var(--accent); margin-bottom:2px; }
  .comp-seq-arrow { color:var(--dim); font-size:1rem; padding:0 6px; }
  .comp-full { grid-column:1 / -1; }
  /* Age-warning modal */
  .modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:2000; display:flex; align-items:center; justify-content:center; }
  .modal-box { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:28px 30px; max-width:460px; width:90%; box-shadow:0 24px 64px rgba(0,0,0,0.45); }
  .modal-title { font-size:1.05rem; font-weight:700; margin:0 0 10px; }
  .modal-body { color:var(--dim); font-size:0.875rem; line-height:1.65; margin-bottom:22px; }
  .modal-actions { display:flex; justify-content:flex-end; }
  .tab-sub { display:block; font-size:0.6rem; font-weight:400; color:var(--dim); margin-top:1px; letter-spacing:0; text-transform:none; }
  .tab.active .tab-sub { color:var(--accent); }
  /* Mobile projection table: hide low-priority columns */
  @media (max-width: 768px) {
    .proj-hide-mobile { display: none !important; }
    #proj-table { font-size: 0.72rem; }
    #proj-table td, #proj-table th { padding: 4px 5px; }
    .proj-scroll-hint { display: block !important; }
  }
  .proj-scroll-hint { display: none; font-size: 0.72rem; color: var(--dim); margin-bottom: 6px; text-align: center; }

  /* Click-to-hide columns in the projections table */
  .proj-col-toggle { cursor: pointer; user-select: none; position: relative; }
  .proj-col-toggle:hover { background: var(--surface2); color: var(--accent); }
  .proj-col-toggle:hover::after { content: '×'; position: absolute; top: 1px; right: 3px; font-size: 0.7rem; opacity: 0.65; }
  .proj-col-hidden { display: none !important; }

  /* ── Print / Save as PDF ──────────────────────────────── */
  #print-summary { display: none; }
  @media print {
    /* Force light palette regardless of dark/light mode */
    :root {
      --bg: #f0f2f8; --surface: #ffffff; --surface2: #eef1f8;
      --border: #d8dded; --accent: #3d5ce8; --accent2: #16a34a;
      --warn: #b45309; --danger: #dc2626;
      --text: #1e293b; --muted: #475569; --dim: #94a3b8;
      --radius: 6px; --shadow: none; --marker-color: #1e293b;
    }
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
    body > *:not(#print-summary) { display: none !important; }
    #print-summary { display: block !important; }
    @page { margin: 1.4cm 1.8cm; size: letter; }
    .pr-avoid { page-break-inside: avoid; }
    .pr-break { page-break-before: always; }
    /* Projection table — show all columns, compact font */
    .print-proj-table-wrap .proj-hide-mobile { display: table-cell !important; }
    .print-proj-table-wrap table { width: 100%; border-collapse: collapse; font-size: 7.5px; }
    .print-proj-table-wrap td, .print-proj-table-wrap th { padding: 2px 3px !important; white-space: nowrap; }
  }

/* ── Monthly View: dotted leader rows ── */
.mv-row { display: flex; align-items: baseline; padding: 3px 0; }
.mv-row .mv-label { flex-shrink: 0; }
.mv-row .mv-amt { flex-shrink: 0; text-align: right; }
.mv-row .mv-leader {
  flex: 1;
  border-bottom: 1px dotted var(--border);
  margin: 0 6px 5px;
  min-height: 1px;
  min-width: 16px;
}
.mv-row.mv-total {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-weight: 700;
}
.mv-row.mv-subtotal { font-weight: 600; }

/* ── Conversion strategy dropdown — consistent across all tabs ── */
.conv-strategy-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 240px;
  width: fit-content;
}
.conv-strategy-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.conv-strategy-select {
  font-size: 1rem;
  font-weight: 600;
  padding: 8px 12px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  min-width: 240px;
  width: auto;
}
.conv-strategy-hint {
  font-size: 0.7rem;
  color: var(--dim);
}

/* ── SS Break-Even toggle checkboxes ── */
.ssbe-toggles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}
.ssbe-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1.4;
}
.ssbe-toggle input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
  cursor: pointer;
  accent-color: var(--accent);
}
.ssbe-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.ssbe-toggle-title { display: block; }
.ssbe-toggle-rate {
  color: var(--dim);
  font-size: 0.72rem;
  margin-left: 4px;
}
.ssbe-toggle-desc {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

/* ── Sponsored CTA (Advisor Analysis tab) ── */
.cta-sponsored {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 0 0 24px;
}
.cta-sponsored-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 8px;
}
.cta-sponsored-title {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 700;
}
.cta-sponsored-body {
  margin: 0 0 14px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}
.cta-sponsored-btn { text-decoration: none; }
.cta-sponsored-disclosure {
  margin: 12px 0 0;
  font-size: 0.72rem;
  color: var(--dim);
  line-height: 1.45;
}
.cta-sponsored-disclosure strong { color: var(--muted); }
