/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #fafaf7;
  --surface-3: #f1f0eb;
  --border: #e6e3dc;
  --border-strong: #d3cfc5;
  --text: #14171d;
  --text-2: #3c424e;
  --muted: #737884;
  --accent: #1c355e;
  --accent-hover: #24477c;
  --accent-contrast: #ffffff;
  --accent-soft: #edf1f7;
  --brand: #1c355e;
  --gold: #b08d57;
  --negative: #b3261e;
  --danger-soft: #fbecea;
  --focus-ring: 0 0 0 3px rgba(28, 53, 94, 0.16);

  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 29, 0.04);
  --shadow: 0 1px 2px rgba(20, 23, 29, 0.04), 0 3px 10px -4px rgba(20, 23, 29, 0.08);
  --shadow-lg: 0 1px 2px rgba(20, 23, 29, 0.05), 0 14px 32px -14px rgba(20, 23, 29, 0.18);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23737884' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --logo-line: #1c355e;
  --risk-low: #1f8a5b;
  --risk-neutral: #b26f12;
  --risk-high: #c2413b;
  --caution-deep: #8f6a12;
  /* Cloud sync status */
  --sync-ok: #2f7d5b;
  --sync-warn: #a4590f;
  /* Cash-flow chart series (validated categorical order; growth series reuse their source's color, striped) */
  --cf-salary: #2a78d6;
  --cf-salary-invested: #eda100;
  --cf-return: #1baf7a;
  --cf-return-invested: #e34948;
  --cf-investment: #eb6834;
  --cf-initial-payout: #4a3aa7;
  --cf-final-payout: #008300;
  --cf-loan: #e87ba4;
  /* Taxes: three steps of one slate hue (validated as an ordinal ramp), stacked above loan repayments;
     the capital gains tax is the federal step, striped */
  --cf-federal-tax: #424d5f;
  --cf-payroll-tax: #76808f;
  --cf-state-tax: #acb4c0;
  color-scheme: light;
}

/* Dark theme: <html data-theme="dark">, set by js/theme-init.js and ThemeToggle */
:root[data-theme="dark"] {
  --bg: #0b0e13;
  --surface: #12161d;
  --surface-2: #161b23;
  --surface-3: #1c222c;
  --border: #232a35;
  --border-strong: #313a47;
  --text: #e9ebef;
  --text-2: #c3c8d1;
  --muted: #8b93a1;
  --accent: #a8c0ea;
  --accent-hover: #bfd1f1;
  --accent-contrast: #0c1424;
  --accent-soft: #1a2436;
  --brand: #22406f;
  --gold: #c9a56b;
  --negative: #f1897e;
  --danger-soft: #2e1a1a;
  --focus-ring: 0 0 0 3px rgba(168, 192, 234, 0.2);
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
  --shadow-lg: 0 16px 40px -16px rgba(0, 0, 0, 0.6);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --logo-line: #a8c0ea;
  --risk-low: #4fcf92;
  --risk-neutral: #f2b64f;
  --risk-high: #f07a72;
  --caution-deep: #c9962e;
  --cf-salary: #3987e5;
  --cf-salary-invested: #c98500;
  --cf-return: #199e70;
  --cf-return-invested: #e66767;
  --cf-investment: #d95926;
  --cf-initial-payout: #9085e9;
  --cf-final-payout: #008300;
  --cf-loan: #d55181;
  --cf-federal-tax: #bec6d3;
  --cf-payroll-tax: #8892a4;
  --cf-state-tax: #535d70;
  --sync-ok: #6cc59b;
  --sync-warn: #e7a35a;
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }

.container { max-width: 1180px; margin: 0 auto; padding: 36px 24px 96px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.icon { width: 16px; height: 16px; flex: none; display: block; }

.empty {
  margin: 0;
  padding: 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty.big { padding: 56px 24px; font-size: 14px; background: var(--surface); }

/* ==========================================================================
   App bar
   ========================================================================== */
.app-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.app-bar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}
.brand-logo { display: block; width: 38px; height: 38px; flex: none; color: var(--logo-line); }
.brand-logo svg { display: block; width: 100%; height: 100%; }
.brand-logo .logo-pan { fill: var(--gold); }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

/* Theme switch */
.theme-toggle {
  position: relative;
  flex: none;
  width: 56px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s;
}
.theme-toggle:hover { border-color: var(--border-strong); }
.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 0 0 1px var(--border);
  transition: transform 0.22s cubic-bezier(0.3, 0.7, 0.4, 1);
}
.theme-toggle .icon {
  position: absolute;
  top: 50%;
  z-index: 1;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  transition: color 0.2s;
}
.theme-toggle .theme-icon-sun { left: 7px; }
.theme-toggle .theme-icon-moon { left: 33px; }
.theme-toggle[aria-checked="true"] .theme-toggle-knob { transform: translateX(26px); }
.theme-toggle[aria-checked="false"] .theme-icon-sun,
.theme-toggle[aria-checked="true"] .theme-icon-moon { color: var(--text); }

.app-bar-actions { display: flex; align-items: center; gap: 10px; }

/* Cloud sync status button */
.sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.sync-btn[hidden] { display: none; }
.sync-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.sync-btn .icon { width: 15px; height: 15px; color: var(--muted); }
.sync-btn[data-state="synced"] .icon { color: var(--sync-ok); }
.sync-btn:is([data-state="unauthorized"], [data-state="throttled"], [data-state="error"]) .icon { color: var(--sync-warn); }
.sync-btn[data-state="syncing"] .icon,
.sync-status[data-state="syncing"] .icon { animation: sync-spin 1s linear infinite; }
@keyframes sync-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: no-preference) {
  html.theme-transition,
  html.theme-transition *,
  html.theme-transition *::before,
  html.theme-transition *::after {
    transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease !important;
  }
}

/* ==========================================================================
   Form controls
   ========================================================================== */
input, select, button { font: inherit; color: inherit; }

input[type="text"],
input[type="password"],
input.num-input,
select {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input:hover, select:hover { border-color: var(--border-strong); }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}
input::placeholder { color: var(--muted); opacity: 0.75; }
button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input.num-input { font-variant-numeric: tabular-nums; }

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
  text-overflow: ellipsis;
  cursor: pointer;
}

input.invalid {
  border-color: var(--negative);
  background-color: var(--danger-soft);
}
input.invalid:focus { box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.15); }

/* Inline $ / % adornments */
.with-prefix, .with-suffix, .rate-custom-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.prefix, .suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}
.prefix { left: 11px; }
.suffix { right: 11px; }
.with-prefix input { padding-left: 24px; }
.with-suffix input, .rate-custom-wrap input { padding-right: 26px; text-align: right; }
.with-suffix.suffix-wide input { padding-right: 36px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Inline-editable titles: read as text until hovered or focused */
input.title-input {
  height: auto;
  padding: 4px 8px;
  margin-left: -8px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  font-weight: 600;
  color: var(--text);
  text-overflow: ellipsis;
}
input.title-input:hover { background: var(--surface); border-color: var(--border); }
input.title-input:focus { background: var(--surface); border-color: var(--accent); box-shadow: var(--focus-ring); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn .icon { width: 15px; height: 15px; }

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 1px 2px rgba(20, 23, 29, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-contrast); }

.btn.danger-outline { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.danger-outline:hover { background: var(--danger-soft); color: var(--negative); }

.btn.add-btn {
  background: transparent;
  border-style: dashed;
  border-color: var(--border-strong);
  box-shadow: none;
  color: var(--muted);
}
.btn.add-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--negative); }

.collapse-btn .icon { transition: transform 0.2s ease; }
.collapsed > header .collapse-btn .icon { transform: rotate(-90deg); }

/* ==========================================================================
   Home
   ========================================================================== */
.hero { padding: 20px 0 8px; }
.hero h1 {
  margin: 10px 0 12px;
  font-family: var(--font-serif);
  font-size: 44px;
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.025em;
}
.hero p { margin: 0; max-width: 560px; font-size: 15.5px; color: var(--muted); }

.new-project {
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin-top: 28px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.new-project input { flex: 1; height: 42px; font-size: 15px; }
.new-project .btn { height: 42px; padding: 0 20px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 48px 0 12px;
}
.count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.project-list .empty { border: none; padding: 40px 24px; }
.project-list .empty p { margin: 0 0 14px; }
.project-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 14px 14px 18px;
  border-top: 1px solid var(--border);
  transition: background-color 0.15s;
}
.project-item:first-child { border-top: none; }
.project-item:hover { background: var(--surface-2); }
.project-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}
.project-mono {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
}
.project-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.project-name {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-date { font-size: 12.5px; color: var(--muted); }
.project-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s;
}
.project-open .icon { transition: transform 0.15s; }
.project-link:hover .project-open { color: var(--accent); }
.project-link:hover .project-open .icon { transform: translateX(2px); }

/* ==========================================================================
   Project page
   ========================================================================== */
.project-top { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 22px; }
.project-top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.duplicate-btn { height: 32px; padding: 0 12px; font-size: 13px; }
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}
.back-link:hover { color: var(--accent); }
input.project-title {
  width: 100%;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.settings-bar {
  position: sticky;
  top: 12px;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) repeat(4, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 6px;
  align-items: start;
  margin-bottom: 28px;
  padding: 16px 20px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.settings-title { display: flex; flex-direction: column; gap: 3px; align-self: center; grid-row: span 3; }
/* Label / input / note rows line up across settings even when notes differ in length */
.settings-bar .setting { display: grid; grid-row: span 3; grid-template-rows: subgrid; }
.settings-bar .setting .field-label { align-self: end; }
.settings-title strong { font-size: 14.5px; font-weight: 600; }
.settings-title span:last-child { font-size: 12.5px; color: var(--muted); }
.setting .hint { font-size: 11.5px; line-height: 1.4; color: var(--muted); }
/* One-line notes with a "+" toggle */
.note { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.note-text { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.note.is-open { display: block; }
.note.is-open .note-text { white-space: normal; overflow: visible; }
.note.is-open .note-toggle { margin-left: 4px; }
.note:not(.is-truncated):not(.is-open) .note-toggle { display: none; }
.note-toggle {
  flex: none;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
  cursor: pointer;
}
.note-toggle:hover { opacity: 0.75; }

.settings-note {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
  font-size: 11.5px;
  color: var(--muted);
}
.settings-note a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.settings-sentinel { height: 1px; margin-bottom: -1px; }
@media (min-width: 681px) {
  .settings-bar.is-stuck .hint,
  .settings-bar.is-stuck .settings-note,
  .settings-bar.is-stuck .settings-title span:last-child { display: none; }
  .settings-bar.is-stuck { padding-top: 12px; padding-bottom: 12px; }
}
.settings-note a:hover { color: var(--accent); text-decoration-color: currentColor; }

/* Switches under the settings (js/ProjectOptions.js): taxes + state, and what cards show */
.settings-options {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 28px;
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-strong);
}
.option-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-width: 0; }
.option-state { display: flex; align-items: center; gap: 8px; }
.option-state[hidden], .option-hint[hidden] { display: none; }
.option-state select { width: 190px; height: 32px; }
.option-state select.invalid { border-color: var(--negative); }
.option-hint { font-size: 11.5px; color: var(--muted); }
.settings-options + .settings-note { margin-top: 4px; }
@media (min-width: 681px) {
  .settings-bar.is-stuck .option-hint { display: none; }
  .settings-bar.is-stuck .settings-options { margin-top: 4px; padding-top: 8px; }
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.switch:hover { color: var(--text); }
.switch-track {
  position: relative;
  flex: none;
  width: 32px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-3);
  transition: background-color 0.18s, border-color 0.18s;
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--border-strong);
  transition: transform 0.18s cubic-bezier(0.3, 0.7, 0.4, 1);
}
.switch[aria-checked="true"] { color: var(--text); }
.switch[aria-checked="true"] .switch-track { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(14px); background: var(--accent-contrast); box-shadow: none; }

.save-error {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--negative);
  font-weight: 500;
}

.strategy-list { --strategy-gap: 36px; display: flex; flex-direction: column; gap: var(--strategy-gap); margin-bottom: 20px; padding-top: 6px; }

/* Strategy */
.strategy {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.strategy-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}
/* Beacon: each strategy's reference color (set per strategy by Beacon.paint) */
.strategy { position: relative; }
.strategy-wrap { --beacon: var(--beacon-light, var(--accent)); }
:root[data-theme="dark"] .strategy-wrap { --beacon: var(--beacon-dark, var(--accent)); }
.strategy::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 2;
  width: 4px;
  background: var(--beacon);
}
.strategy-header {
  overflow: hidden;
  background: linear-gradient(100deg, color-mix(in srgb, var(--beacon) 9%, var(--surface)) 0%, var(--surface) 60%);
}
.strategy-header > * { position: relative; z-index: 1; }
.strategy-header { cursor: pointer; }
.strategy-header input,
.strategy-header .risk-indicator { cursor: auto; }
.strategy-header:hover .collapse-btn { background: var(--surface-3); color: var(--text); }
/* Oversized numeral watermark */
.strategy-header::after {
  content: attr(data-numeral);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  transform: translate(-50%, -50%) rotate(-6deg);
  font-family: var(--font-serif);
  font-size: 79.65px; /* original 118px, −25% then −10% */
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: var(--beacon);
  opacity: 0.08;
  pointer-events: none;
}

.strategy-wrap { position: relative; }
/* Swap button, centered in the gap between two strategies */
.strategy-swap {
  position: absolute;
  top: calc(var(--strategy-gap) / -2);
  left: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 0 0 4px var(--bg);
  cursor: pointer;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.strategy-swap .icon { width: 21px; height: 21px; transition: transform 0.3s ease; }
.strategy-swap:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.strategy-swap:hover .icon { transform: rotate(180deg); }
.strategy-swap:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px color-mix(in srgb, var(--accent) 35%, transparent); }
.strategy-wrap.just-moved > .strategy { animation: strategy-moved 0.9s ease-out; }
@keyframes strategy-moved {
  0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--beacon) 70%, transparent); }
  100% { box-shadow: 0 0 0 3px transparent; }
}
/* Beacon tab: sits on the strategy's top border, top-left */
.beacon-badge {
  position: absolute;
  top: 0;
  left: 14px;
  z-index: 3;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--beacon) 14%, var(--surface));
  box-shadow:
    0 0 0 3px var(--bg),
    inset 0 0 0 1px color-mix(in srgb, var(--beacon) 60%, transparent);
  color: var(--beacon);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: default;
  user-select: none;
}


/* Carry the beacon color into every card inside the strategy */
.strategy .opportunity { border-top: 3px solid color-mix(in srgb, var(--beacon) 75%, transparent); }
.strategy.collapsed > .strategy-header { border-bottom-color: transparent; }
/* Sized to its text so the rest of the header is click-to-toggle space */
input.strategy-title {
  flex: 0 1 auto;
  width: auto;
  min-width: 8ch;
  max-width: 100%;
  margin-right: auto;
  field-sizing: content;
  padding-right: 14px;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.header-total-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-right: 4px;
  line-height: 1.2;
}
.header-total { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.strategy-header .header-total { font-size: 20px; letter-spacing: -0.015em; }
.header-total.negative { color: var(--negative); }
.strategy-actions { display: flex; align-items: center; gap: 2px; }
.strategy-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--surface-2);
}
.strategy-body > .add-btn { align-self: flex-start; }

/* Sub group */
.subgroup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.subgroup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 10px;
  border-bottom: 1px solid var(--border);
}
.subgroup.collapsed > .subgroup-header { border-bottom-color: transparent; }
.subgroup-header input.title-input { flex: 1; font-size: 15.5px; }
.subgroup-header .header-total { font-size: 15px; margin-right: 4px; }
.subgroup-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: 16px;
  align-items: start;
  padding: 16px;
}
.subgroup-body > .opportunity-list { grid-column: 1 / -1; }
.subgroup-body > .add-btn { justify-self: start; }
.strategy.collapsed > .strategy-body,
.subgroup.collapsed > .subgroup-body { display: none; }

.opportunity-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: 14px;
}
.opportunity-list > .empty { grid-column: 1 / -1; }

/* Opportunity */
.opportunity {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.2s ease;
}
.opportunity:hover, .opportunity:focus-within {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--accent) 3%, var(--surface)); /* a faint tint marks the active card */
}
.opp-header { display: flex; align-items: center; gap: 6px; padding: 10px 8px 2px 16px; }
.opp-header input.title-input { flex: 1; font-size: 15px; }
.opp-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 12px;
  padding: 8px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.opp-grid { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px; }
.field-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Initial payout: rate column appears only when the payout is invested */
.payout-group > .checkbox { grid-column: 1 / -1; margin-top: -4px; }

/* Yearly return / salary: increase, cap, and optional investing */
.stream-group > .checkbox,
.stream-group > .info-note { grid-column: 1 / -1; }
.stream-group > .checkbox { margin-top: -2px; }
.stream-group:not(.is-investing) > .stream-invest { display: none; }
.raise-box { display: flex; gap: 6px; min-width: 0; }
.raise-box > .raise-percent, .raise-box > .raise-fixed { flex: 1; min-width: 0; }
.raise-percent > .with-suffix { width: 100%; }
.raise-box.is-fixed > .raise-percent,
.raise-box:not(.is-fixed) > .raise-fixed { display: none; }

/* Small two-way unit toggle (e.g. % | #) beside an input */
.unit-toggle {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  height: 36px;
  box-sizing: border-box;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.unit-option {
  width: 26px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.unit-option:hover { color: var(--text); }
.unit-option[aria-checked="true"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: var(--shadow-sm);
}
.field.is-disabled { opacity: 0.55; }
input:disabled::placeholder { opacity: 0.6; }

.info-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 0;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}
.info-note .note-icon { width: 16px; height: 16px; margin-top: 1px; color: var(--accent); }
.payout-group:not(.is-invested) > .field:first-child { grid-column: 1 / -1; }
.payout-group:not(.is-invested) > .payout-rate { display: none; }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}
.checkbox input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- Risk: gauge icon, toggle, aggregate indicators ---- */
.risk-gauge { display: block; flex: none; width: 22px; height: 17px; overflow: visible; }
.risk-gauge .seg { fill: none; stroke-width: 2.6; }
.risk-gauge .seg-low { stroke: var(--risk-low); }
.risk-gauge .seg-neutral { stroke: var(--risk-neutral); }
.risk-gauge .seg-high { stroke: var(--risk-high); }
.risk-gauge .needle path { stroke: var(--text); stroke-width: 1.8; stroke-linecap: round; }
.risk-gauge .hub { fill: var(--text); }
.risk-low { --rc: var(--risk-low); }
.risk-neutral { --rc: var(--risk-neutral); }
.risk-high { --rc: var(--risk-high); }

.opp-meta .risk-field { grid-column: 1 / -1; }
.risk-toggle, .filing-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.risk-option, .filing-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.risk-option .risk-gauge { width: 19px; height: 15px; opacity: 0.45; filter: grayscale(0.6); transition: opacity 0.15s; }
.risk-option:hover, .filing-option:hover { color: var(--text); }
.risk-option:hover .risk-gauge { opacity: 0.8; }
.risk-option[aria-checked="true"], .filing-option[aria-checked="true"] {
  color: var(--rc);
  font-weight: 600;
  background: color-mix(in srgb, var(--rc) 13%, var(--surface));
  border-color: color-mix(in srgb, var(--rc) 50%, transparent);
  box-shadow: var(--shadow-sm);
}
.risk-option[aria-checked="true"] .risk-gauge { opacity: 1; filter: none; }

/* Filing status (shown while taxes are included): the risk toggle's look, in the accent color */
.opp-meta .filing-field, .opp-meta .filing-note { grid-column: 1 / -1; }
.opp-meta .filing-field[hidden], .opp-meta .filing-note[hidden] { display: none; }
.filing-field { container-type: inline-size; }
.filing-toggle { grid-template-columns: repeat(2, 1fr); }
.filing-option { --rc: var(--accent); min-width: 0; }
.filing-option > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.filing-short { display: none; }
/* Too narrow for "Married filing jointly": "Joint" (the full status stays in the button's title) */
@container (max-width: 380px) {
  .filing-long { display: none; }
  .filing-short { display: inline; }
}
.opp-meta .filing-note { align-self: start; }

.risk-indicator { display: inline-flex; align-items: center; gap: 8px; cursor: default; }
.risk-indicator[hidden] { display: none; }
.risk-indicator .risk-gauge { width: 30px; height: 23px; }
.risk-text { display: flex; flex-direction: column; gap: 4px; }
.risk-label { font-size: 13px; font-weight: 600; line-height: 1; color: var(--rc); white-space: nowrap; }
.risk-bar { display: flex; gap: 2px; width: 64px; height: 5px; }
.risk-bar > span { border-radius: 3px; min-width: 5px; }
.risk-bar-low { background: var(--risk-low); }
.risk-bar-neutral { background: var(--risk-neutral); }
.risk-bar-high { background: var(--risk-high); }

.strategy-risk { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-right: 18px; padding-right: 18px; border-right: 1px solid var(--border); line-height: 1.2; }
.strategy-risk[hidden] { display: none; }
.subgroup-header .risk-compact { margin-right: 14px; }
.subgroup-header .risk-compact .risk-gauge { width: 24px; height: 18px; }
.subgroup-header .risk-compact .risk-label { font-size: 12px; }
.subgroup-header .risk-compact .risk-bar { width: 52px; height: 4px; }

.rate-selector { display: flex; gap: 6px; min-width: 0; }
.rate-locked { display: none; }
.lockable.is-locked > :not(.rate-locked) { display: none !important; }
.rate-selector.is-locked > select,
.rate-selector.is-locked > .rate-custom-wrap { display: none !important; }
.lockable.is-locked > .rate-locked,
.rate-selector.is-locked > .rate-locked {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: not-allowed;
}
.rate-locked .icon { width: 14px; height: 14px; color: var(--caution-deep); }
.rate-locked span { overflow: hidden; text-overflow: ellipsis; font-style: italic; }
.indefinite-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--risk-neutral) 45%, transparent);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--risk-neutral) 12%, var(--surface));
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}
.indefinite-note[hidden] { display: none; }
.indefinite-note .note-icon { width: 18px; height: 18px; margin-top: 1px; color: var(--risk-neutral); }

/* Notes that collapse to their heading line (indefinite caution, invested salary timing) */
.indefinite-note { --note-color: var(--risk-neutral); }
.info-note { --note-color: var(--accent); }
.collapsible-note strong { color: var(--text); font-weight: 600; }
.collapsible-note .note-content { flex: 1; min-width: 0; margin: 0; }
.collapsible-note.is-collapsed .note-body { display: none; }
.collapsible-note.is-collapsed { align-items: center; }
.collapsible-note.is-collapsed .note-icon { margin-top: 0; }
.note-toggle-btn { width: 24px; height: 24px; margin: -3px -4px -3px 0; color: var(--note-color); }
.note-toggle-btn .icon { width: 15px; height: 15px; transition: transform 0.2s ease; }
.collapsible-note.is-collapsed .note-toggle-btn .icon { transform: rotate(180deg); }
.note-toggle-btn:hover { background: color-mix(in srgb, var(--note-color) 18%, transparent); color: var(--text); }
.rate-selector select { flex: 1 1 auto; min-width: 0; }
.rate-custom-wrap { display: none; flex: 0 0 84px; }
.rate-selector.is-custom .rate-custom-wrap { display: flex; }
.timespan-selector .rate-custom-wrap { flex-basis: 88px; }
.timespan-selector .rate-custom-wrap input { padding-right: 34px; }

.opp-footer {
  margin-top: auto;
  padding: 14px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.pv { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pv-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.pv-value.negative { color: var(--negative); }
.pv-warning {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--risk-neutral) 12%, var(--surface));
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
}
.pv-warning[hidden] { display: none; }
.opportunity.is-indefinite .final-payout-field { opacity: 0.5; }
.opportunity.is-indefinite .final-payout-field .field-label::after { content: " · not received (indefinite)"; text-transform: none; letter-spacing: 0; font-weight: 500; }
input:disabled { cursor: not-allowed; }
.pv-breakdown {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 16px;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pv-breakdown:empty { display: none; }
.pv-breakdown dt { margin: 0; }
.pv-breakdown dd { margin: 0; text-align: right; color: var(--text-2); }
/* "See income & taxes by year": opens the year-by-year present value popup (js/PVBreakdownPopup.js) */
.pv-years-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  margin-top: 12px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.pv-years-btn[hidden] { display: none; }
.pv-years-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pv-years-btn:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.pv-years-btn .icon { width: 15px; height: 15px; }
.pv-years-btn .pv-years-arrow { margin-left: auto; transition: transform 0.15s ease; }
.pv-years-btn:hover .pv-years-arrow { transform: translateX(2px); }

/* Yearly cash-flow chart (js/CashFlowChart.js) */
.cash-flow-chart { padding: 14px 16px 16px; }
.cf-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.cf-actions, .cf-controls { display: flex; align-items: center; gap: 6px; }
.cf-cumulative {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.cf-cumulative:hover { color: var(--text); }
.cf-cumulative[aria-pressed="true"] {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.cf-cumulative:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cf-mode { height: 30px; }
.cf-expand { width: 30px; height: 30px; }
.cf-mode .unit-option { width: auto; padding: 0 9px; font-size: 12px; }
.cf-head[hidden] { display: none; }
.cf-note {
  margin: 0;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
}
.cf-frame {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  column-gap: 8px;
}
.cf-y-axis { position: relative; width: 40px; }
.cf-y-axis span {
  position: absolute;
  right: 0;
  transform: translateY(50%);
  font-size: 11px;
  line-height: 1;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cf-plot { position: relative; height: 175px; border-radius: 4px; }
.cf-plot:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cf-grid span { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.cf-grid span.is-zero { border-top-color: var(--muted); }
.cf-cols { position: absolute; inset: 0; display: flex; }
.cf-col {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 0 3px;
  border-radius: 4px;
}
.cf-col.is-active { background: color-mix(in srgb, var(--text) 5%, transparent); }
.cf-slot { position: relative; flex: 1 1 0; max-width: 44px; min-width: 0; }
.cf-bar {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}
.cf-seg { flex-basis: 0; min-height: 0; transition: opacity 0.12s; }
.cf-plot.has-active .cf-col:not(.is-active) .cf-seg { opacity: 0.45; }
.cf-col.is-active .cf-seg.is-hover { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--text) 55%, transparent); }
.cf-x-axis { display: flex; padding-top: 6px; }
.cf-x-axis span {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cf-x-title { text-align: center; font-size: 11px; color: var(--muted); padding-top: 2px; }
.cf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--text-2);
}
.cf-legend li { display: flex; align-items: center; gap: 6px; }
.cf-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* At rest the chart is just bars: axis labels, legend and the value toggle appear while the card is
   hovered or focused. The y-axis column collapses so the plot widens; the rest keep their space
   (no layout jump). Touch screens without hover always show everything. */
@media (hover: hover) {
  .cf-frame { transition: column-gap 0.2s ease, padding 0.2s ease, opacity 0.2s ease; }
  /* The title is taken out of the flow so it can slide between left-aligned (hovered) and
     centered (at rest); `left` and the transform animate together. */
  .cf-head { position: relative; min-height: 30px; }
  .cf-head > .eyebrow {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translate(0, -50%);
    white-space: nowrap;
    transition: left 0.2s ease, transform 0.2s ease;
  }
  .cf-head > .cf-actions { margin-left: auto; }
  .cf-grid { transition: opacity 0.2s ease; }
  /* At rest the plot grows into 80% of the space of the axis labels and legend (--cf-below,
     measured in CashFlowChart) and the negative margin gives that back, so the card keeps its
     height. */
  .cf-plot { transition: height 0.2s ease; }
  .cf-body { transition: margin-bottom 0.2s ease; }
  .opportunity:not(:hover, :focus-within) .cf-plot { height: calc(175px + 0.8 * var(--cf-below, 0px)); }
  .opportunity:not(:hover, :focus-within) .cf-body { margin-bottom: calc(-0.8 * var(--cf-below, 0px)); }
  .opportunity:not(:hover, :focus-within) .cf-head > .eyebrow { left: 50%; transform: translate(-50%, -50%); }
  .opportunity:not(:hover, :focus-within) .cf-grid { opacity: 0.5; }
  /* Clip only sideways, so the top and bottom labels (centered on their gridlines) stay whole. */
  .cf-y-axis { clip-path: inset(-12px 0); transition: width 0.2s ease, opacity 0.2s ease; }
  .cf-actions, .cf-x-axis, .cf-x-title, .cf-legend, .yt-expand { transition: opacity 0.2s ease, visibility 0.2s; }
  /* The plot takes 80% of the y-axis column (40px + 8px gap); the other 20% is split either
     side so the plot stays centered in the card. */
  .opportunity:not(:hover, :focus-within) .cf-frame {
    column-gap: 0;
    padding-inline: calc((40px + 8px) * 0.1);
    opacity: 0.75; /* the plot recedes at rest; the title stays at full strength */
  }
  .opportunity:not(:hover, :focus-within) .cf-y-axis { width: 0; opacity: 0; }
  .opportunity:not(:hover, :focus-within) :is(.cf-actions, .cf-x-axis, .cf-x-title, .cf-legend, .yt-expand) {
    opacity: 0;
    visibility: hidden;
  }
}

/* Expanded chart popup: the same chart filling most of the window, labels always shown */
.cf-dialog {
  width: min(1440px, calc(100vw - 48px));
  height: calc(100vh - 48px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.cf-dialog[open] { display: flex; }
.cf-dialog::backdrop { background: rgba(8, 10, 14, 0.55); }
body:has(.cf-dialog[open]) { overflow: hidden; }
.cf-dialog-inner { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 18px 22px 20px; }
.cf-dialog-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.cf-dialog-title { flex: 1; min-width: 0; }
.cf-dialog-title h2 { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-dialog .cash-flow-chart { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; border: none; }
.cf-dialog .cf-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cf-dialog .cf-frame { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr) auto auto; column-gap: 10px; }
.cf-dialog .cf-plot { height: auto; }
.cf-dialog .cf-y-axis { width: 52px; }
.cf-dialog .cf-y-axis span,
.cf-dialog .cf-x-axis span,
.cf-dialog .cf-x-title { font-size: 12px; }
.cf-dialog .cf-slot { max-width: 64px; }
.cf-dialog .cf-col { padding: 0 6px; }
.cf-dialog .cf-legend { font-size: 13px; }
.cf-tooltip {
  position: absolute;
  top: 8px;
  z-index: 2;
  min-width: 190px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  pointer-events: none;
}
.cf-tooltip[hidden] { display: none; }
.cf-tip-title { font-weight: 600; margin-bottom: 4px; }
.cf-tip-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 1px 0;
  color: var(--text-2);
}
.cf-tip-row.is-hover { color: var(--text); font-weight: 600; }
.cf-tip-value { text-align: right; font-variant-numeric: tabular-nums; }
.cf-tip-total { margin-top: 3px; padding-top: 4px; border-top: 1px dashed var(--border-strong); color: var(--text); font-weight: 600; }
.cf-tip-total + .cf-tip-row:not(.cf-tip-total) { margin-top: 4px; }

/* Yearly breakdown table (js/YearlyTable.js), under the chart */
.yearly-table { padding: 14px 16px 16px; }
.cash-flow-chart:not([hidden]) + .yearly-table { padding-top: 0; }
.yearly-table[hidden] { display: none; }
.yt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; margin-bottom: 6px; }
.yt-actions { display: flex; align-items: center; gap: 6px; }
.yt-basis { font-size: 11.5px; color: var(--muted); }
.yt-expand { width: 30px; height: 30px; }
.yt-expand[hidden] { display: none; }
.yt-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.yt-scroll:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.yt {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.yt th, .yt td {
  padding: 5px 7px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.yt thead th {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
}
.yt thead th[title] { cursor: help; }
.yt th.yt-group { text-align: center; color: var(--text-2); }
/* A rule before each column group and before Net */
.yt .yt-first, .yt .yt-net { border-left: 1px solid var(--border); }
/* Year column stays put while the rest scrolls sideways */
.yt .yt-year {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: var(--surface);
}
.yt thead .yt-year { background: var(--surface-2); }
.yt tbody th.yt-year { font-weight: 500; color: var(--text-2); }
.yt td { color: var(--text-2); }
.yt td.yt-net { font-weight: 600; color: var(--text); }
.yt td.negative { color: var(--negative); }
.yt td.yt-zero { color: var(--muted); }
.yt tbody tr:last-child > * { border-bottom: none; }
.yt tr.yt-total > * { font-weight: 600; color: var(--text); background: var(--surface-2); border-top: 1px solid var(--border-strong); }
.yt-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 2px 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.yt-more[hidden] { display: none; }
.yt-more:hover { text-decoration: underline; text-underline-offset: 2px; }
.yt-more .icon { width: 14px; height: 14px; }
.yt-foot { margin: 6px 0 0; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.yt-foot:empty { display: none; }

/* Expanded popup (js/IncomeSourcePopup.js): the chart, the yearly table, or both stacked.
   Table alone: the popup is sized to the table, which scrolls inside it with its header and
   Total rows pinned. */
.popup-kicker, .popup-controls { display: flex; align-items: center; gap: 6px; }
.popup-controls .popup-both { margin-left: 6px; white-space: nowrap; }
.popup-controls .popup-both[hidden], .cf-controls[hidden], .yt-kicker[hidden] { display: none; }
.popup-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 22px; }
.cf-dialog .cash-flow-chart[hidden], .popup-table[hidden], .popup-subhead[hidden] { display: none; }
.popup-table { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.popup-subhead { margin-bottom: 8px; }
.cf-dialog.popup-both .cash-flow-chart { flex: 1 1 0; min-height: 240px; }
.cf-dialog.popup-both .popup-table { flex: 0 1 auto; max-height: 46%; }
.cf-dialog.popup-table-only {
  width: fit-content;
  min-width: min(560px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  height: fit-content;
  max-height: calc(100vh - 48px);
}
.yt-kicker { display: flex; align-items: baseline; gap: 10px; }
.cf-dialog .yearly-table { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0; }
.cf-dialog .yt-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cf-dialog .yt-scroll { flex: 0 1 auto; min-height: 0; overflow: auto; }
.cf-dialog .yt { font-size: 13.5px; }
.cf-dialog .yt th, .cf-dialog .yt td { padding: 7px 14px; }
.cf-dialog .yt thead th { font-size: 11px; }
.cf-dialog .yt thead { position: sticky; top: 0; z-index: 2; }
.cf-dialog .yt tr.yt-total > * { position: sticky; bottom: 0; z-index: 1; }
.cf-dialog .yt tr.yt-total > .yt-year { z-index: 2; }
.cf-dialog .yt-foot { max-width: 70ch; margin-top: 10px; font-size: 12.5px; }

/* Year-by-year present value popup (js/PVBreakdownPopup.js): a summary line, then the table, which
   scrolls inside the popup with its header and Total rows pinned; the popup is sized to the table. */
.cf-dialog.pvb-dialog {
  width: fit-content;
  min-width: min(640px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  height: fit-content;
  max-height: calc(100vh - 48px);
}
.pvb-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 16px; }
.pvb-dialog .yt-kicker { flex-wrap: wrap; row-gap: 0; }
.pvb-summary, .pvb-step { display: flex; align-items: stretch; gap: 8px; }
.pvb-summary { flex-wrap: wrap; }
.pvb-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 9px 14px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.pvb-tile-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pvb-tile-value { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.pvb-tile-value.negative { color: var(--negative); }
.pvb-tile-caption { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pvb-tile.is-result { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.pvb-tile.is-result .pvb-tile-label { color: var(--accent); }
.pvb-op {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.2;
}
.pvb-op-caption { max-width: 8.5em; font-size: 11px; line-height: 1.3; text-align: center; }
.cf-dialog .pvb-table { font-size: 13px; }
.cf-dialog .pvb-table th, .cf-dialog .pvb-table td { padding: 7px 9px; }
.pvb-table td.pvb-strong { font-weight: 600; color: var(--text); }
.pvb-table td.pvb-aux { color: var(--muted); }
.pvb-table td.negative { color: var(--negative); }
.pvb-table td.yt-zero { color: var(--muted); }
/* Opaque tints: the Total row stays pinned over the rows scrolling under it */
.pvb-table td.pvb-pv { background: color-mix(in srgb, var(--accent-soft) 65%, var(--surface)); }
.pvb-table tr.yt-total > td.pvb-pv { background: var(--accent-soft); color: var(--accent); }
.pvb-table tr.yt-total > td.pvb-pv.negative { color: var(--negative); }
.pvb-notes { display: flex; flex-direction: column; gap: 6px; max-width: 82ch; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.pvb-notes p { margin: 0; }

/* Sub group ledger */
.subgroup-totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}
.totals-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-bottom: 4px; }
.totals-by { height: 28px; margin-left: auto; }
.totals-by .unit-option { width: auto; padding: 0 8px; font-size: 11.5px; }
.totals-rows { display: flex; flex-direction: column; gap: 6px; }
.total-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
  color: var(--text-2);
}
.total-row span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.total-row .negative { color: var(--negative); }
.total-row.grand {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border-strong);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
}
.total-row.grand span:last-child { padding-bottom: 2px; border-bottom: 3px double currentColor; }

.btn.add-strategy {
  width: 100%;
  height: 54px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   Strategy rail (js/StrategyRail.js): beacon numerals in the left gutter on
   wide desktop screens, plus a faint page tint in the focused strategy's color
   ========================================================================== */
@property --tint {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}
/* A barely-there glow on both side edges, strongest at mid-height */
.page-tint {
  --tint: var(--tint-light, transparent);
  --tint-strength: 3.5%;
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse 30% 65% at 0% 50%, color-mix(in srgb, var(--tint) var(--tint-strength), transparent), transparent),
    radial-gradient(ellipse 30% 65% at 100% 50%, color-mix(in srgb, var(--tint) var(--tint-strength), transparent), transparent);
  transition: opacity 0.6s ease, --tint 0.7s ease;
}
:root[data-theme="dark"] .page-tint {
  --tint: var(--tint-dark, transparent);
  --tint-strength: 6%;
}
.page-tint.is-visible { opacity: 1; }

.strategy-rail { display: none; }
@media (min-width: 1300px) and (hover: hover) and (pointer: fine) {
  .strategy-rail {
    position: fixed;
    top: 50%;
    /* Content starts at 50% - 566px. Centered in the space left of it,
       but 16px from the content at least and 96px at most. */
    left: calc(50% - 614px - clamp(16px, 25% - 307px, 96px));
    z-index: 20;
    display: block;
    width: 48px;
    opacity: 0;
    visibility: hidden;
    transform: translate(-8px, -50%);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
  }
  .strategy-rail.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
    transition-delay: 0s;
  }
}
.rail-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rail-list li {
  --beacon: var(--beacon-light, var(--accent));
  display: flex;
  flex-direction: column;
  align-items: center;
}
:root[data-theme="dark"] .rail-list li { --beacon: var(--beacon-dark, var(--accent)); }
.rail-item {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 28px;
  padding: 0 6px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: color-mix(in srgb, var(--beacon) 45%, var(--muted));
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  transition: font-size 0.25s ease, height 0.25s ease, min-width 0.25s ease,
    color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.rail-item:hover { color: var(--beacon); background: color-mix(in srgb, var(--beacon) 12%, transparent); }
.rail-item:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--beacon) 55%, transparent); }
/* The strategy in focus: an enlarged copy of its header badge */
.rail-item[aria-current="true"] {
  min-width: 48px;
  height: 40px;
  font-size: 21px;
  color: var(--beacon);
  background: color-mix(in srgb, var(--beacon) 14%, var(--surface));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--beacon) 60%, transparent),
    0 6px 16px -8px color-mix(in srgb, var(--beacon) 70%, transparent);
}
/* Title label on hover / keyboard focus */
.rail-item::after {
  content: attr(data-label);
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  max-width: 260px;
  overflow: hidden;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translate(-4px, -50%);
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.rail-item:hover::after,
.rail-item:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
/* Line under each numeral: fills (in its color) as you read through that strategy */
.rail-track {
  width: 2px;
  height: 18px;
  margin: 4px 0;
  border-radius: 1px;
  background: linear-gradient(var(--beacon) calc(var(--fill, 0) * 100%), var(--border-strong) 0);
}
.rail-list li:last-child .rail-track { height: 12px; }

/* ==========================================================================
   Cloud sync: project-list note, dialog, toasts
   ========================================================================== */
.sync-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 4px 0;
  font-size: 13px;
  color: var(--muted);
}
.sync-note[hidden] { display: none; }
.sync-note .icon { width: 15px; height: 15px; }
.sync-note[data-state="synced"] .icon,
.sync-note[data-state="syncing"] .icon { color: var(--sync-ok); }
.sync-note:is([data-state="unauthorized"], [data-state="throttled"], [data-state="error"]) .icon { color: var(--sync-warn); }

.link-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-btn:hover { text-decoration-color: currentColor; }

.sync-dialog {
  width: min(460px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.sync-dialog::backdrop { background: rgba(8, 10, 14, 0.55); }

/* Small modal (js/ProjectOptions.js state prompt) */
.app-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.app-dialog::backdrop { background: rgba(8, 10, 14, 0.55); }
.app-dialog-inner { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 22px; }
.app-dialog-inner > p { margin: 0; color: var(--text-2); }
.app-dialog-inner > p.app-dialog-fine { font-size: 12.5px; color: var(--muted); }
.app-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.app-dialog-head h2 { font-family: var(--font-serif); font-size: 20px; font-weight: 600; }
.app-dialog-head .icon-btn { margin-right: -8px; }
.app-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.app-dialog-actions .btn:disabled { opacity: 0.55; cursor: not-allowed; }
.sync-dialog-inner { padding: 18px 22px 22px; }
.sync-dialog-inner > p { margin: 0 0 14px; color: var(--text-2); }
.sync-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sync-dialog-head h2 { font-family: var(--font-serif); font-size: 20px; font-weight: 600; }
.sync-dialog-head .icon-btn { margin-right: -8px; }
.sync-form { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.sync-form-row { display: flex; gap: 8px; }
.sync-form-row input { flex: 1; height: 38px; }
.sync-form-row .btn { height: 38px; }
.sync-error { margin: 2px 0 0; color: var(--negative); font-size: 13px; font-weight: 500; }
.sync-error[hidden] { display: none; }
.sync-dialog-inner > p.sync-fine { margin: 0; font-size: 12.5px; color: var(--muted); }
.sync-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.sync-status .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--muted); }
.sync-status[data-state="synced"] .icon { color: var(--sync-ok); }
.sync-status:is([data-state="throttled"], [data-state="error"]) .icon { color: var(--sync-warn); }
.sync-status strong { display: block; font-weight: 600; }
.sync-status span { display: block; font-size: 13px; color: var(--muted); }
.sync-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sync-actions .btn:disabled { opacity: 0.6; cursor: default; }
.sync-steps { margin: 0; padding-left: 20px; color: var(--text-2); }
.sync-steps li + li { margin-top: 6px; }

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.leaving { opacity: 0; transform: translateY(6px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .settings-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-title { grid-column: 1 / -1; grid-row: auto; }
  .settings-bar .setting .hint { margin-bottom: 10px; }
}

@media (max-width: 680px) {
  .app-bar-inner { padding: 0 16px; }
  /* Popup header: title and close on the first row, the view controls on their own row below */
  .cf-dialog { width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
  .cf-dialog:not(.popup-table-only, .pvb-dialog) { height: calc(100vh - 24px); }
  .cf-dialog.pvb-dialog { max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
  .cf-dialog-inner { padding: 14px 14px 16px; }
  .cf-dialog-head { flex-wrap: wrap; row-gap: 10px; }
  .cf-dialog-head > .icon-btn { order: 1; }
  .cf-dialog-head > .popup-controls { order: 2; flex-basis: 100%; flex-wrap: wrap; }
  .popup-controls .popup-both { margin-left: auto; }
  .sync-btn { width: 30px; padding: 0; justify-content: center; }
  .sync-btn .sync-label { display: none; }
  .sync-form-row { flex-direction: column; }
  .container { padding: 24px 16px 64px; }

  .hero h1 { font-size: 32px; }
  .new-project { flex-direction: column; }
  .new-project input { flex: none; }
  .project-open span { display: none; }
  .hide-on-mobile { display: none; }

  input.project-title { font-size: 26px; }
  .settings-bar { position: static; column-gap: 12px; padding: 14px; }

  .strategy-header { flex-wrap: wrap; }
  input.strategy-title { font-size: 19px; }
  .strategy-header::after { display: none; }
  .header-total-wrap {
    order: 5;
    width: 100%;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    padding-left: 42px;
  }
  .header-total-wrap .eyebrow { white-space: nowrap; }
  .strategy-risk {
    order: 4;
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 0 0 0 42px;
    border: none;
  }
  .subgroup-header .risk-compact .risk-text { display: none; }
  .subgroup-header .risk-compact { margin-right: 6px; }
  .risk-option { gap: 5px; padding: 0 4px; font-size: 12.5px; }
  .strategy-body { padding: 12px; }
  .subgroup-body { grid-template-columns: 1fr; padding: 12px; }
  .opportunity-list { grid-template-columns: 1fr; }
  .field-group { grid-template-columns: 1fr; }
  .opp-meta { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .sync-btn .icon, .sync-status .icon, .toast { animation: none !important; }
}
