/* True North — App shell */

:root {
  /* True North brand tokens */
  --tn-navy:        #0E2240;
  --tn-navy-deep:   #0A1A33;
  --tn-brass:       #B68A4A;
  --tn-brass-soft:  #F1E7D0;
  --tn-parchment:   #F4F6F9;
  --tn-surface:     #FFFFFF;
  --tn-text:        #0E2240;
  --tn-muted:       #5C6B7E;
  --tn-border:      #E1E6ED;
  --tn-border-strong: #C5CDD8;
  --tn-info:        #3E5C92;
  --tn-info-soft:   #E4ECF6;
  --tn-danger:      #A8463A;

  /* Legacy aliases — keep component var() references working */
  --cream:  #F4F6F9;
  --stone:  #8FA3BD;
  --lime:   #B68A4A;
  --green:  #9A7340;
  --forest: #0E2240;
  --ink:    #0E2240;
  --muted:  #5C6B7E;
  --line:   rgba(14, 34, 64, 0.10);
  --rail-w: 240px;
  --topbar-h: 60px;
  --tabbar-h: 52px;
  --subtabbar-h: 46px;

  /* Chart series — True North palette */
  --chart-1: #2E5BAA; /* Taxable */
  --chart-2: #0E2240; /* Non-Taxable */
  --chart-3: #A8997A; /* Tertiary */
  --chart-4: #8FA3BD; /* Banking */
  --chart-5: #B68A4A; /* Sometimes Taxable */
  --chart-6: #5C6B7E; /* Other/FL */
  --chart-7: #3E5C92; /* Info blue */
  --chart-8: #6B7A8D; /* Mid-slate */
  --chart-9: #8FA3BD; /* Slate */
  --chart-10: #E1E6ED; /* Light */

  /* Chart infrastructure */
  --chart-grid:  rgba(14, 34, 64, 0.07);
  --chart-axis:  rgba(14, 34, 64, 0.12);
  --chart-hover: rgba(182, 138, 74, 0.09);
  --chart-text:  #8FA3BD;

  /* Typography */
  --font-head: 'Source Serif 4', 'Source Serif Pro', Georgia, serif;
  --font-body: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--forest); }
.icon-btn {
  background: transparent; border: none; cursor: pointer;
  padding: 6px; border-radius: 6px;
  display: grid; place-items: center;
  color: inherit;
}
.help-drawer a:hover, .help-center-panel a:hover { color: inherit; }

/* ── App layout ─────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Left rail ─────────────────────── */
.rail {
  background: var(--forest);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0,0,0,0.2);
  height: 100vh;
  overflow: hidden;
}
.rail-brand {
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.rail-brand:hover { opacity: 0.85; color: inherit; }
.rail-brand .logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.rail-brand .logo svg { width: 100%; height: 100%; display: block; }
.rail-brand .name {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  line-height: 1.2;
}
.rail-brand .name em {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}

.rail-section {
  padding: 16px 12px 8px;
}
.rail-section .heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(246,245,242,0.45);
  padding: 0 8px 8px;
}

.rail-list {
  list-style: none;
  margin: 0; padding: 0;
}
.rail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 6px;
  color: rgba(246,245,242,0.85);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  user-select: none;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.rail-item:hover { background: rgba(255,255,255,0.06); color: var(--cream); }
.rail-item.active {
  background: rgba(182,138,74,0.18);
  color: var(--lime);
}
.rail-item.active .rail-icon { color: var(--lime); }
.rail-sublist {
  list-style: none;
  margin: 4px 0 8px 18px;
  padding: 0 0 0 12px;
  border-left: 1px solid rgba(255,255,255,0.08);
  display: none;
}
.rail-sublist.active { display: block; }
.rail-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: transparent;
  color: rgba(246,245,242,0.72);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 4px;
  text-align: left;
}
.rail-subitem:hover { background: rgba(255,255,255,0.06); color: var(--cream); }
.rail-subitem.active { color: var(--lime); font-weight: 600; background: rgba(182,138,74,0.10); }
.rail-subitem .step-dot {
  display: grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  color: rgba(246,245,242,0.65);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.rail-subitem.active .step-dot { background: var(--lime); color: var(--forest); }
.rail-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: rgba(246,245,242,0.7);
}

.rail-spacer { flex: 1; }

.rail-foot {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 14px 14px 18px;
}
.rail-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rail-user .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--green);
  display: grid; place-items: center;
  color: var(--cream);
  font-size: 12px;
  font-weight: 700;
}
.rail-user .who {
  font-size: 13px;
  color: var(--cream);
  font-weight: 600;
}
.rail-user .role {
  font-size: 11px;
  color: rgba(246,245,242,0.55);
}
.rail-help {
  font-size: 12px;
  color: rgba(246,245,242,0.85);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 6px 8px;
  border-radius: 6px;
  width: 100%;
  text-align: left;
}
.rail-help:hover { color: var(--lime); }

/* ── Main pane ─────────────────────── */
.main {
  display: flex;
  flex-direction: column;
  background: var(--cream);
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar .crumb {
  font-size: 12px;
  color: var(--stone);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 600;
}
.topbar h1 {
  font-family: var(--font-head);
  font-size: 18px;
  font-weight: 500;
  margin: 2px 0 0;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.save-status {
  font-size: 11px;
  color: var(--stone);
  font-style: italic;
  margin-right: 4px;
  min-width: 80px;
  text-align: right;
}
.save-status.saved { color: var(--green); }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: var(--green);
  transition: background .12s ease, border-color .12s ease;
}
.btn-primary {
  background: var(--lime);
  color: var(--forest);
}
.btn-primary:hover { background: #9A7340; }
.btn-secondary { background: var(--forest); color: #fff; border-color: var(--forest); }
.btn-secondary:hover { background: #0A1A33; border-color: #0A1A33; }
.btn-outline {
  border-color: var(--line);
  color: var(--green);
  background: #fff;
}
.btn-outline:hover { border-color: var(--green); }
.btn-ghost { color: var(--green); }
.btn-ghost:hover { background: rgba(182,138,74,0.10); }
.btn-excel { color: var(--tn-brass); font-weight: 600; }
.btn-excel:hover { background: rgba(182,138,74,0.10); }

/* Top tab strip — numbered step indicator */
.tabbar {
  display: flex;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 18px 28px;
  gap: 0;
  overflow-x: auto;
  position: relative;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px 0 0;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  color: var(--stone);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  flex: 0 0 auto;
}
.tab:not(:last-child)::after {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  background: var(--line);
  margin-left: 4px;
}
.tab:hover { color: var(--forest); }
.tab.active { color: var(--forest); }
.tab .step-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  color: var(--stone);
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.tab.active .step-dot {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.tab.done .step-dot {
  background: var(--lime);
  color: var(--forest);
  border-color: var(--lime);
}

/* Sub-tab strip */
.subtabbar {
  display: flex;
  gap: 28px;
  padding: 0 28px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.subtab {
  background: transparent;
  border: none;
  height: var(--subtabbar-h);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.subtab:hover { color: var(--forest); }
.subtab.active {
  color: var(--forest);
  border-bottom-color: var(--green);
}
.subtab { display: inline-flex; align-items: center; gap: 8px; }
.subtab .sub-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--lime);
  display: inline-block;
}

/* ── Content area ─────────────────────── */
.main-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.left-col {
  flex: 0 0 60%;
  max-width: 60%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.content {
  padding: 28px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.right-pane {
  flex: 0 0 40%;
  max-width: 40%;
  overflow-y: auto;
  background: #fff;
  border-left: 1px solid var(--line);
  padding: 22px 24px;
}
.right-panel { display: none; }
.right-panel.active { display: block; }

/* Total bar */
.total-bar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 22px;
}
.total-bar .row1 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.total-bar .label {
  font-size: 13px;
  color: var(--stone);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.total-bar .amount {
  font-size: 24px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
}
.bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--cream);
  display: flex;
  overflow: hidden;
}
.bar > span { display: block; height: 100%; }
.bar .seg-stocks { background: var(--green); }
.bar .seg-bonds  { background: var(--lime); }
.bar .seg-other  { background: var(--stone); }
.bar .seg-taxable   { background: var(--stone); }
.bar .seg-sometimes { background: var(--lime); }
.bar .seg-nontax    { background: var(--green); }
.legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.legend .dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}
.legend .dot.stocks { background: var(--green); }
.legend .dot.bonds  { background: var(--lime); }
.legend .dot.other  { background: var(--stone); }
.legend .dot.taxable   { background: var(--stone); }
.legend .dot.sometimes { background: var(--lime); }
.legend .dot.nontax    { background: var(--green); }
.legend .legend-pct {
  margin-left: 4px;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Action row */
.action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.action-row .left { display: flex; gap: 8px; }
.action-row .right { display: flex; gap: 8px; }

/* Compact row card (default closed) */
.acct-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}
.acct-header {
  display: grid;
  grid-template-columns: 24px 36px 2fr 0.8fr 80px 100px 116px 28px 28px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
}
.acct-header .drag-handle {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--stone);
  cursor: grab;
  border-radius: 4px;
  flex-shrink: 0;
}
.acct-header .drag-handle svg { pointer-events: none; }
.acct-header .drag-handle:hover { background: rgba(182,138,74,0.10); color: var(--green); }
.acct-header .drag-handle:active { cursor: grabbing; }
.acct-card.dragging {
  opacity: 0.5;
  transform: rotate(0.5deg);
}
.acct-header .date {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.acct-header .tax-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(143, 142, 127, 0.15);
  color: var(--muted);
  justify-self: start;
  white-space: nowrap;
}
.acct-header .tax-badge::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--stone);
  flex-shrink: 0;
}
.acct-header .tax-badge.tax-taxable   { background: var(--tn-info-soft); color: var(--tn-info); }
.acct-header .tax-badge.tax-taxable::before   { background: var(--tn-info); }
.acct-header .tax-badge.tax-sometimes { background: var(--tn-brass-soft); color: var(--tn-brass); }
.acct-header .tax-badge.tax-sometimes::before { background: var(--tn-brass); }
.acct-header .tax-badge.tax-nontax    { background: rgba(14,34,64,0.07); color: var(--tn-navy); }
.acct-header .tax-badge.tax-nontax::before    { background: var(--tn-navy); }
.acct-header:hover { background: rgba(182,138,74,0.04); }
.acct-header .owner-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.acct-header .who {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.acct-header .name {
  font-weight: 600;
  color: var(--ink);
}
.acct-header .type {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}
.acct-header .type .type-icon {
  width: 18px; height: 18px;
  color: var(--stone);
  flex-shrink: 0;
}
.acct-header .balance {
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.acct-header .balance .balance-input {
  display: none;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--green);
  border-radius: 6px;
  font: inherit;
  text-align: right;
  background: #fff;
  color: var(--ink);
}
.acct-header .balance .balance-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(30,125,110,0.18);
}
#account-list.balance-edit .acct-header .balance .balance-display { display: none; }
#account-list.balance-edit .acct-header .balance .balance-input { display: block; }
#account-list.balance-edit .acct-header { cursor: default; }
.acct-header .icon-btn {
  background: transparent;
  border: none;
  color: var(--stone);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: grid; place-items: center;
}
.acct-header .icon-btn:hover { color: var(--green); background: rgba(47,183,164,0.1); }
.acct-header .chev {
  color: var(--stone);
  text-align: center;
  font-size: 20px;
  line-height: 1;
  transition: transform .15s ease;
}
.acct-card.open .chev { transform: rotate(180deg); }

/* Wider grid for expense rows (date + frequency) */
.acct-header.expense-row {
  grid-template-columns: 24px 36px 1.5fr 110px 150px 130px 28px 28px;
}
.acct-header.expense-simple-row {
  grid-template-columns: 24px 1fr 130px 150px 160px 28px 28px;
}
.acct-header.expense-simple-row .balance { text-align: left; }
.acct-header.expense-row .when {
  color: var(--muted);
  font-size: 13px;
}
.acct-header.expense-row .freq {
  color: var(--muted);
  font-size: 13px;
}
.acct-header.expense-row .balance { text-align: left; }

.banking-card .acct-header,
.banking-header {
  grid-template-columns: 24px 36px 2fr 0.8fr 116px 28px 28px;
}
.ac-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 2px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

.acct-body {
  display: none;
  border-top: 1px solid var(--line);
  padding: 22px;
  background: #F8F9FB;
}
.acct-card.open .acct-body { display: block; }

.annuity-auto-expense {
  border-left: 3px solid var(--chart-1);
  background: rgba(182, 138, 74, 0.04);
}
.annuity-auto-expense .acct-header { cursor: default !important; }
.annuity-lock-icon {
  width: 18px; flex-shrink: 0;
  color: var(--chart-1);
  display: flex; align-items: center;
}
.annuity-badge {
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--chart-1);
  background: rgba(182, 138, 74, 0.12);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 22px;
}
.field-foreign,
.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--stone);
  font-weight: 700;
}
.field input, .field select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(30,125,110,0.12);
}
.field input.field-error {
  border-color: #b04a2f;
  background: #fdf3f0;
}
.field input.calculated {
  background: #F0F3F7;
  color: var(--stone);
  border-color: var(--line);
}
.field input.calculated:focus {
  background: #fff;
  color: var(--ink);
}
.field .hint {
  font-size: 11px;
  color: var(--muted);
}
.field-wide { grid-column: span 3; }
.field-half { grid-column: span 2; }

.checkrow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--ink);
}
.checkrow input { accent-color: var(--green); }

/* Generic data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  font-size: 13px;
}
.data-table thead {
  background: #F8F9FB;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--stone);
  font-weight: 700;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(182,138,74,0.04); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(182,138,74,0.18);
  color: var(--green);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tag--alt { background: rgba(30,125,110,0.12); color: var(--forest); }
.tag--neutral { background: rgba(143,142,127,0.18); color: var(--muted); }

/* Editable bracket / numbers tables */
.numbers-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  border-bottom: none;
  padding: 14px 18px;
}
.numbers-head h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}
.numbers-head .year-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.numbers-head select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  color: var(--ink);
}
.numbers-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  font-size: 13px;
  margin-bottom: 22px;
}
.numbers-table thead { background: #F8F9FB; }
.numbers-table th, .numbers-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.numbers-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--stone);
  font-weight: 700;
}
.numbers-table tbody tr:last-child td { border-bottom: none; }
.numbers-table .rate {
  font-weight: 700;
  color: var(--forest);
  width: 90px;
}
.numbers-table .range {
  display: flex;
  align-items: center;
  gap: 6px;
}
.numbers-table .range input[type="text"] {
  width: 100px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  background: #fff;
  color: var(--ink);
}
.numbers-table .range input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(30,125,110,0.12);
}
.numbers-table .range .dash { color: var(--stone); }
.numbers-table .range .over {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--stone);
  letter-spacing: 0.5px;
  font-weight: 700;
  margin-right: 2px;
}
.numbers-table .empty-cell { color: var(--stone); font-style: italic; font-size: 12px; }

.flat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  padding: 18px;
  margin-bottom: 22px;
}
.flat-grid .field { gap: 4px; }
.flat-grid .field label {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 500;
}

/* Number cards */
.number-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.number-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--lime);
  border-radius: 8px;
  padding: 18px;
}
.number-card .lbl {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--stone);
  font-weight: 700;
  margin-bottom: 6px;
}
.number-card .val {
  font-size: 22px;
  font-weight: 800;
  color: var(--forest);
  line-height: 1.1;
  margin-bottom: 4px;
}
.number-card .note {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.section-block { margin-bottom: 28px; }
.section-block h2 {
  font-size: 15px;
  margin: 0 0 12px;
  font-weight: 700;
  color: var(--ink);
}
.section-block .desc {
  font-size: 12.5px;
  color: var(--muted);
  margin: -8px 0 14px;
}

/* Empty / placeholder state */
.empty {
  background: #fff;
  border: 1px dashed rgba(30,125,110,0.35);
  border-radius: 10px;
  padding: 36px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  margin-bottom: 4px;
}

/* hidden/visible panels */
.panel { display: none; }
.panel.active { display: block; }

/* Description banner (under sub-tabs) */
.tab-desc {
  background: rgba(182,138,74,0.08);
  border: 1px solid rgba(30,125,110,0.18);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--muted);
  margin: -8px 0 18px;
  text-align: center;
}

/* Wizard footer (Back / Next) */
.wizard-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.btn-pill {
  border-radius: 999px;
  padding: 10px 28px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.btn-pill:hover { border-color: var(--green); color: var(--green); }
.btn-pill-primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-pill-primary:hover { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn-pill:disabled,
.btn-pill:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--ink);
}
.btn-pill-primary:disabled,
.btn-pill-primary:disabled:hover {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* Two-column form layout (Household Info) */
.form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 32px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 18px;
}
.form-2col .field { gap: 4px; }
.form-2col .field label {
  font-size: 11.5px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 500;
}
.form-2col .full { grid-column: 1 / -1; }
.form-link {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.form-link:hover { color: var(--forest); }
.form-help {
  font-size: 11.5px;
  color: var(--stone);
  font-style: italic;
}

/* Client Info dual-column */
.client-info-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 14px;
}
.client-info-head h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}
.client-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.client-col h3 {
  font-size: 14px;
  margin: 0 0 14px;
  font-weight: 700;
  color: var(--ink);
}
.client-col .field { margin-bottom: 14px; }
.client-col .field:last-child { margin-bottom: 0; }
@media (max-width: 900px) {
  .form-2col, .client-grid { grid-template-columns: 1fr; }
}

/* Expanded form sub-section header (e.g. "Tax Treatment", "Frequency") */
.form-subhead {
  grid-column: 1 / -1;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 8px 0 -4px;
  padding-top: 6px;
}
.form-subhead:first-child { padding-top: 0; }

.field input:disabled, .field select:disabled {
  background: #F0F3F7;
  color: var(--stone);
  cursor: not-allowed;
}

/* ── Social Security Calculator ──────────────────── */
.ss-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) { .ss-calc-grid { grid-template-columns: 1fr; } }

.ss-calc-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ss-col-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

/* Benefit input section */
.ss-benefit-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: #fff;
}
.ss-benefit-head {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}
.ss-benefit-sub {
  font-size: 12px;
  color: var(--stone);
  margin: 0 0 14px;
}
.ss-pia-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--cream);
}
.ss-pia-label {
  display: block;
  font-size: 11px;
  color: var(--stone);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.1px;
}
.ss-pia-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ss-pia-currency {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.ss-pia-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  outline: none;
  min-width: 0;
  font-family: inherit;
}
.ss-pia-input::placeholder { color: var(--stone); font-weight: 400; }
.ss-pia-period {
  font-size: 12px;
  color: var(--stone);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Claiming details card */
.ss-claiming-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ss-claiming-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}
.ss-claiming-card-sub {
  font-size: 12px;
  color: var(--stone);
  margin: -6px 0 0;
}

/* Claiming age row */
.ss-claim-age-field { display: flex; flex-direction: column; gap: 6px; }
.ss-claim-age-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.ss-claim-age-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--cream);
}
.ss-claim-age-badge {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  flex: 1;
  font-variant-numeric: tabular-nums;
}
.ss-claim-date {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  outline: none;
  font-family: inherit;
  cursor: pointer;
}
.ss-claim-date::-webkit-calendar-picker-indicator { opacity: 0.6; cursor: pointer; }

/* Range slider */
.ss-slider-wrap { display: flex; flex-direction: column; gap: 6px; }
.ss-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
.ss-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.20);
  cursor: pointer;
}
.ss-range::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.20);
  cursor: pointer;
}
.ss-range-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--stone);
  font-weight: 600;
}
.ss-fra-tick {
  color: var(--green);
  font-weight: 700;
  text-align: center;
}

/* Projected benefit result */
.ss-projected-card {
  background: #F4F6F9;
  border: 1px solid rgba(30,125,110,0.15);
  border-radius: 8px;
  padding: 12px 14px;
}
.ss-projected-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.ss-projected-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

/* Annuity planning cards */
.annuity-planning-grid {
  margin-bottom: 6px;
}
.annuity-phase-card {
  border: 1px solid #b8d4f0;
  border-radius: 8px;
  background: #f0f7ff;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.annuity-phase-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #0070C0;
  margin-bottom: 4px;
}
.annuity-phase-card .ss-summary-row {
  color: #334;
}
.annuity-phase-card .ss-summary-row span:last-child {
  font-weight: 700;
  color: #0070C0;
}
.annuity-neutral-val {
  font-weight: 700;
  color: #334 !important;
}
.annuity-quote-divider {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #888;
  border-top: 1px solid #c8ddf0;
  padding-top: 8px;
  margin-top: 4px;
}
.annuity-quote-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #0070C0;
  text-decoration: none;
  border: 1px solid #0070C0;
  border-radius: 4px;
  padding: 4px 10px;
  text-align: center;
  transition: background .15s, color .15s;
}
.annuity-quote-link:hover {
  background: #0070C0;
  color: #fff;
}
.annuity-planning-note {
  font-size: 11px;
  color: var(--stone);
  font-style: italic;
  margin: 0 0 22px;
}

/* Year detail right panel */
.year-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 180px;
  color: var(--stone);
  text-align: center;
  padding: 32px 16px;
}
.year-detail-placeholder[hidden] { display: none !important; }
.year-detail-placeholder svg { opacity: 0.4; }
.year-detail-placeholder p { font-size: 13px; margin: 0; line-height: 1.5; }
.year-detail-header { margin-bottom: 18px; }
.year-detail-header h3 { font-size: 16px; font-weight: 700; color: var(--forest); margin: 0; }
.year-detail-block {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.year-detail-block-head {
  background: var(--cream);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--stone);
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}
.year-detail-sub-head {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--lime);
  padding: 6px 10px 2px;
}
.year-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  font-size: 12px;
  border-top: 1px solid var(--line);
  gap: 8px;
}
.year-detail-row:first-child { border-top: none; }
.year-detail-row span:first-child { color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.year-detail-row span:last-child { font-weight: 600; color: var(--forest); flex-shrink: 0; }
.year-detail-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  background: #F0F3F7;
  border-top: 1px solid var(--line);
  color: var(--forest);
}
.year-detail-shortage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--line);
  border-radius: 8px;
  margin-top: 4px;
}
tr.detail-year-row { cursor: pointer; }
tr.detail-year-row:hover { background: #f0f7ff; }
tr.detail-year-row.selected { background: #e6f0fb; }

/* Summary rows */
.ss-summary-rows {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #F8F9FB;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ss-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.ss-summary-val {
  font-weight: 700;
  color: var(--green);
}

.ss-spousal-card {
  border: 1px solid #b8d4f0;
  border-radius: 8px;
  background: #f0f7ff;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.ss-spousal-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #0070C0;
  margin-bottom: 2px;
}
.ss-spousal-card .ss-summary-row {
  color: #334;
}
.ss-spousal-card .ss-summary-val {
  color: #0070C0;
}

/* Soft total bar (no card) */
.total-soft {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}
.total-soft .row1 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.total-soft .label {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.total-soft .amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.total-soft .legend { justify-content: center; }

/* Responsive — collapse rail */
@media (max-width: 900px) {
  :root { --rail-w: 64px; }
  .rail-brand .name,
  .rail-section .heading,
  .rail-item span.label,
  .rail-user .who,
  .rail-user .role,
  .rail-help span { display: none; }
  .rail-item { justify-content: center; padding: 12px 8px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide, .field-half { grid-column: span 1; }
  .number-grid { grid-template-columns: 1fr; }
  .acct-header { grid-template-columns: 24px 28px 1fr 24px; }
  .acct-header .type, .acct-header .balance, .acct-header .tax-badge, .acct-header .date { display: none; }
}

/* Confirm modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 33, 14, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(20, 33, 14, 0.25);
  width: 100%;
  max-width: 420px;
  padding: 24px 26px 20px;
}
.modal-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.modal-body {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-pill-danger {
  background: #b04a2f;
  color: #fff;
  border-color: #b04a2f;
}
.btn-pill-danger:hover {
  background: #8d3a25;
  border-color: #8d3a25;
  color: #fff;
}

/* ── Income Projection Chart ─────────────── */
.income-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.income-chart-head .ic-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.income-chart-head .ic-sub {
  font-size: 11px;
  color: var(--stone);
  font-weight: 600;
}
.income-chart-legend {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}
.ic-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 4px;
  vertical-align: middle;
}
/* Legend dot chart-color utility classes — change :root vars, dots update automatically */
.cc1 { background: var(--chart-1); }
.cc2 { background: var(--chart-2); }
.cc3 { background: var(--chart-3); }
.cc4 { background: var(--chart-4); }
.cc5 { background: var(--chart-5); }
.cc6 { background: var(--chart-6); }
.cc7 { background: var(--chart-7); }
.cc8 { background: var(--chart-8); }
.cc9 { background: var(--chart-9); }
.cc-fl {
  background: none;
  width: 14px;
  height: 0;
  border-radius: 0;
  border-bottom: 2px dashed var(--chart-6);
  margin-bottom: 1px;
}

/* Chart tooltip */
.chart-tooltip {
  position: absolute;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(20,33,14,0.18);
  padding: 10px 13px;
  pointer-events: none;
  z-index: 200;
  min-width: 168px;
  font-size: 12px;
}
.tt-year {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
.tt-ages {
  font-size: 11px;
  color: var(--stone);
  margin-bottom: 8px;
}
.tt-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}
.tt-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.tt-row .tt-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.tt-row .tt-name {
  flex: 1;
  color: var(--muted);
}
.tt-row .tt-val {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tt-total {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 7px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ── Withdrawal & Tax Strategy ─────────── */
.ws-table { font-size: 12px; }
.ws-table th { font-size: 11px; white-space: nowrap; }
.ws-table td { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.ws-table td:first-child,
.ws-table td:nth-child(2),
.ws-table td:last-child { text-align: left; }

.ws-flag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-right: 2px;
  white-space: nowrap;
}
.ws-flag-irmaa   { background: #fff3e0; color: #e65100; }
.ws-flag-aca     { background: #fce4ec; color: #c62828; }
.ws-flag-rmd     { background: #ede7f6; color: #4527a0; }
.ws-flag-roth    { background: var(--tn-info-soft); color: var(--tn-info); }
.ws-flag-deficit { background: #ffebee; color: #b71c1c; }

/* Draw order configurator */
.draw-order-list { display: flex; flex-direction: column; gap: 6px; max-width: 520px; margin-bottom: 12px; }
.draw-order-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.draw-order-rank {
  width: 22px; height: 22px;
  background: var(--forest); color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
}
.draw-order-label { flex: 1; font-size: 13px; font-weight: 600; color: var(--ink); }
.draw-order-item .drag-handle {
  display: grid; place-items: center;
  width: 24px; height: 24px;
  color: var(--stone); cursor: grab;
  border-radius: 4px; flex-shrink: 0;
}
.draw-order-item .drag-handle svg { pointer-events: none; }
.draw-order-item .drag-handle:hover { background: rgba(182,138,74,0.10); color: var(--green); }
.draw-order-item .drag-handle:active { cursor: grabbing; }
.draw-order-item.dragging { opacity: 0.4; }

/* Roth conversion callout in right panel */
.ws-roth-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--tn-info-soft);
  border-radius: 8px;
  border-left: 3px solid var(--tn-info);
}

/* Client report bar (year picker + button row) */
.ws-report-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.ws-report-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ws-report-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.ws-report-year-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
  min-width: 80px;
}

/* Full-width mode for withdrawal year-by-year (right pane becomes slide-in drawer) */
.main-split.ws-full .left-col {
  flex: 1;
  max-width: 100%;
}
.main-split.ws-full .right-pane {
  position: fixed;
  top: 56px;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 90vw;
  z-index: 200;
  box-shadow: -6px 0 32px rgba(0,0,0,0.18);
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(.4,0,.2,1);
  border-left: none;
}
.main-split.ws-full .right-pane.ws-drawer-open {
  transform: translateX(0);
}
.ws-drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0,0,0,0.25);
}
.ws-drawer-backdrop.visible { display: block; }
.ws-drawer-close-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

/* Year detail drawer redesign */
.wd-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--forest);
}
.wd-year {
  font-size: 20px;
  font-weight: 800;
  color: var(--forest);
}
.wd-ages {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.wd-section-head {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--forest);
  margin: 14px 0 5px;
}
.wd-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid var(--line);
  gap: 8px;
  font-size: 12px;
}
.wd-row:last-child { border-bottom: none; }
.wd-label { color: var(--ink); flex: 1; }
.wd-val   { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; flex-shrink: 0; }
.wd-sub   { color: var(--muted); font-weight: 400; font-size: 11px; }
.wd-subtotal .wd-label,
.wd-subtotal .wd-val { font-weight: 700; }
.wd-sub-row { padding: 2px 0 2px 10px; border-bottom: none; }
.wd-sub-row .wd-label { color: var(--muted); font-size: 11px; }
.wd-sub-row .wd-val   { font-size: 11px; font-weight: 500; }
.wd-sub-block { margin-bottom: 4px; }
.wd-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}
.wd-total {
  display: flex;
  justify-content: space-between;
  padding: 5px 0 3px;
  font-weight: 700;
  font-size: 13px;
  border-top: 2px solid #cbd5e1;
  margin-top: 2px;
}

/* Scenario cards */
.sc-cards { display:flex; flex-direction:column; gap:8px; margin-bottom:24px; }
.sc-card { border:1px solid #e2e8f0; border-radius:10px; background:#fff; overflow:hidden; }
.sc-card-header { display:flex; align-items:center; gap:12px; padding:14px 16px; cursor:pointer; user-select:none; }
.sc-card-header:hover { background:#f8fafc; }
.sc-chevron { width:16px; height:16px; transition:transform 0.15s; flex-shrink:0; color:#94a3b8; }
.sc-card.expanded .sc-chevron { transform:rotate(90deg); }
.sc-card-name { font-weight:600; font-size:14px; flex:1; }
.sc-card-name-input { font-weight:600; font-size:14px; border:none; border-bottom:1px solid #3b82f6; outline:none; background:transparent; width:160px; }
.sc-card-meta { display:flex; align-items:center; gap:16px; font-size:12px; color:#64748b; }
.sc-card-body { padding:16px 20px; border-top:1px solid #f1f5f9; display:none; }
.sc-card.expanded .sc-card-body { display:block; }

/* Strategy tags */
.sc-tag { display:inline-block; padding:2px 10px; border-radius:99px; font-size:11px; font-weight:600; }
.sc-tag-neutral { background:#f1f5f9; color:#64748b; }
.sc-tag-teal { background:#ccfbf1; color:#0f766e; }
.sc-tag-blue { background:#dbeafe; color:#1d4ed8; }
.sc-tag-purple { background:#ede9fe; color:#6d28d9; }

/* Scenario rules section */
.sc-rules { display:flex; flex-wrap:wrap; gap:12px 24px; margin-bottom:16px; }
.sc-rule-row { display:flex; align-items:center; gap:6px; font-size:13px; }

/* Comparison table */
.sc-compare-wrap { overflow-x:auto; margin-top:24px; }
.sc-compare-table { width:100%; border-collapse:collapse; font-size:13px; }
.sc-compare-table th { background:#f8fafc; padding:8px 14px; text-align:right; font-weight:600; font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:#64748b; border-bottom:2px solid #e2e8f0; white-space:nowrap; }
.sc-compare-table th:first-child { text-align:left; min-width:180px; }
.sc-compare-table td { padding:7px 14px; text-align:right; border-bottom:1px solid #f1f5f9; vertical-align:middle; }
.sc-compare-table td:first-child { text-align:left; color:#64748b; font-size:12px; }
.sc-compare-table tr.sc-section-head td { background:#f8fafc; font-weight:700; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:#475569; padding:10px 14px 4px; border-bottom:none; }
.sc-compare-table tr.sc-row-bold td { font-weight:700; }
.sc-compare-table tr.sc-row-delta td { font-size:11px; color:#64748b; }
.sc-best-col { background:#F1E7D0 !important; }
.sc-run-bar { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.sc-run-bar h2 { font-size:20px; font-weight:700; margin:0; }

/* Scenarios full-width layout — hides right pane */
.main-split.sc-full .left-col { flex:1; max-width:100%; }
.main-split.sc-full .right-pane { display:none; }

/* Conditional column visibility for Canadian/Foreign accounts */
#ws-yearby-table.no-col-rrsp th:nth-child(9),
#ws-yearby-table.no-col-rrsp td:nth-child(9) { display:none; }
#ws-yearby-table.no-col-foreign th:nth-child(10),
#ws-yearby-table.no-col-foreign td:nth-child(10) { display:none; }

/* ── Help Button (topbar) ───────────────────────────────── */
.btn-help {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  color: var(--green);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.btn-help:hover { background: rgba(47,183,164,0.12); }
.btn-help svg { display: block; }

/* ── Help Drawer ────────────────────────────────────────── */
.help-drawer {
  position: fixed;
  top: 0; right: -400px;
  width: 360px; height: 100vh;
  background: #fff;
  box-shadow: -6px 0 32px rgba(14,34,64,0.16);
  z-index: 600;
  display: flex; flex-direction: column;
  transition: right 0.25s cubic-bezier(0.4,0,0.2,1);
}
.help-drawer.open { right: 0; }
.help-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #e8ecf0;
  flex-shrink: 0;
}
.help-drawer-header h2 {
  font-size: 16px; font-weight: 700;
  color: var(--tn-navy); margin: 0;
  font-family: var(--font-head);
}
.help-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 20px;
  font-size: 13.5px; line-height: 1.65;
  color: #334155;
}
.help-drawer-body p { margin: 0 0 14px; }
.help-drawer-body dl { margin: 0 0 14px; }
.help-drawer-body dt {
  font-weight: 700; color: var(--tn-navy);
  margin-top: 10px; margin-bottom: 2px;
  font-size: 13px;
}
.help-drawer-body dd { margin: 0 0 6px 0; color: #475569; }
.help-tip {
  background: #f0fdf4; border-left: 3px solid var(--green);
  border-radius: 4px; padding: 10px 12px;
  font-size: 12.5px; color: #166534;
  margin-top: 16px;
}
.help-drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid #e8ecf0;
  flex-shrink: 0;
}
.help-center-link {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--green); font-size: 13px; font-weight: 600;
  padding: 0;
  transition: color 0.15s;
}
.help-center-link:hover { color: var(--forest); }
.help-backdrop {
  display: none; position: fixed; inset: 0;
  z-index: 599; background: rgba(0,0,0,0.18);
}
.help-backdrop.visible { display: block; }

/* ── Help Center Overlay ────────────────────────────────── */
.help-center-overlay {
  position: fixed; inset: 0;
  z-index: 800;
  display: flex; align-items: center; justify-content: center;
}
.help-center-overlay[hidden] { display: none; }
.help-center-backdrop {
  position: absolute; inset: 0;
  background: rgba(14,34,64,0.65);
}
.help-center-panel {
  position: relative; z-index: 1;
  background: #fff; border-radius: 14px;
  width: 720px; max-width: 95vw;
  max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(14,34,64,0.28);
  overflow: hidden;
}
.help-center-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  padding: 24px 28px 18px;
  border-bottom: 1px solid #e8ecf0;
  flex-shrink: 0;
  background: var(--tn-navy);
  color: #fff;
}
.help-center-eyebrow {
  font-size: 10px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: rgba(255,255,255,0.55);
  margin-bottom: 4px;
}
.help-center-header h2 {
  font-size: 20px; font-weight: 700; margin: 0;
  color: #fff; font-family: var(--font-head);
}
.help-center-header .icon-btn { color: #fff; }
.help-center-header .icon-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.help-center-body {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0; overflow-y: auto; flex: 1;
}
.help-center-col {
  padding: 24px 28px;
}
.help-center-col:first-child {
  border-right: 1px solid #e8ecf0;
}
.help-center-group { margin-bottom: 28px; }
.help-center-group:last-child { margin-bottom: 0; }
.help-center-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: #94a3b8;
  margin-bottom: 8px;
}
.help-center-item {
  display: flex; align-items: center; width: 100%;
  background: none; border: none; cursor: pointer;
  padding: 9px 12px; border-radius: 7px;
  font-size: 14px; color: #1e293b; text-align: left;
  transition: background 0.12s, color 0.12s;
  font-family: var(--font-body);
}
.help-center-item::after {
  content: "→"; margin-left: auto;
  color: #cbd5e1; font-size: 12px;
  transition: color 0.12s, transform 0.12s;
}
.help-center-item:hover {
  background: rgba(47,183,164,0.08); color: var(--forest);
}
.help-center-item:hover::after { color: var(--green); transform: translateX(3px); }
