:root {
  color-scheme: light;
  --page: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --ink: #12142b;
  --ink-2: #4b4e6d;
  --muted: #8a8ca5;
  --line: #e4e6f0;
  --accent: #4f46e5;
  --accent-2: #0ea5a4;
  --accent-soft: #eef0ff;
  --gold: #f5b942;
  --good: #067a3a;
  --bad: #c02a2a;
  --warn-bg: #fff6e0;
  --err-bg: #fdecec;
  --shadow: 0 1px 2px rgba(18, 20, 43, .04), 0 8px 24px rgba(18, 20, 43, .06);
  --header-bg: linear-gradient(120deg, #1b1650 0%, #2f2a8a 45%, #0d6e7a 100%);
  /* chart tokens */
  --chart-surface: #fcfcfb;
  --chart-grid: #e1e0d9;
  --chart-axis: #898781;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --series-invested: #898781;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0e0f1a; --surface: #171827; --surface-2: #1d1f31; --ink: #eceefa; --ink-2: #b4b7d0;
    --muted: #7f829c; --line: #2a2c42; --accent: #8b85ff; --accent-soft: #24234a; --good: #2ec26b; --bad: #ff6b6b;
    --warn-bg: #3a2f12; --err-bg: #3d1c1c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --chart-surface: #171827; --chart-grid: #2c2c2a; --chart-axis: #898781;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0e0f1a; --surface: #171827; --surface-2: #1d1f31; --ink: #eceefa; --ink-2: #b4b7d0;
  --muted: #7f829c; --line: #2a2c42; --accent: #8b85ff; --accent-soft: #24234a; --good: #2ec26b; --bad: #ff6b6b;
  --warn-bg: #3a2f12; --err-bg: #3d1c1c; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --chart-surface: #171827; --chart-grid: #2c2c2a; --chart-axis: #898781;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 14px 28px;
  background: var(--header-bg);
  color: #fff;
  box-shadow: 0 4px 20px rgba(27, 22, 80, .35);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 54px; height: 54px; flex-shrink: 0; display: block; }
.brand-title {
  margin: 0; font-family: Inter, system-ui, sans-serif; font-weight: 700;
  font-size: 30px; letter-spacing: -1px; line-height: 1; color: #fff;
}
.brand-title span { color: #f5b942; }
.brand-tag { margin: 4px 0 0; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; opacity: .75; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.db-status {
  font-size: 12px; padding: 5px 12px; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2);
}
.db-status.ok::before { content: "● "; color: #5ef0a0; }
.db-status.busy::before { content: "● "; color: #ffcf5c; }
.theme-toggle, .menu-toggle {
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff;
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 16px;
}
.menu-toggle { display: none; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: calc(100vh - 72px); }
.sidebar {
  width: 250px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 12px; position: sticky; top: 72px; height: calc(100vh - 72px); overflow-y: auto;
  display: flex; flex-direction: column;
}
.nav-group { margin-bottom: 6px; }
.nav-home {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 6px; border-radius: 10px;
  font-weight: 600; color: var(--ink); text-decoration: none;
}
.nav-home:hover { background: var(--surface-2); }
.nav-home.active { background: var(--accent-soft); color: var(--accent); }
.nav-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 0; background: none; cursor: pointer;
  font-weight: 600; font-size: 14px; border-radius: 10px; text-align: left;
}
.nav-head:hover { background: var(--surface-2); }
.nav-icon { width: 20px; text-align: center; }
.chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.nav-group:not(.open) > .nav-head .chev { transform: rotate(-90deg); }
.nav-group:not(.open) > .nav-items { display: none; }
.nav-items { padding-left: 18px; border-left: 2px solid var(--line); margin-left: 21px; }
.nav-items a {
  display: block; padding: 8px 12px; margin: 2px 0; border-radius: 8px;
  color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav-items a:hover { background: var(--surface-2); color: var(--ink); }
.nav-items a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-group.sub { margin: 2px 0 0 -6px; }
.nav-group.sub > .nav-head { font-weight: 500; color: var(--ink-2); padding: 8px 12px; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: var(--muted); padding: 12px; }

.content { flex: 1; min-width: 0; padding: 28px 32px 60px; max-width: 1280px; }

/* ---------- page pieces ---------- */
.page-head { margin-bottom: 20px; }
.crumb { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }
.page-head h2 { margin: 4px 0 6px; font-size: 26px; letter-spacing: -.3px; }
.page-head p { margin: 0; color: var(--ink-2); max-width: 760px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px;
}
.card h3 { margin: 0 0 14px; font-size: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h3 { margin: 0; }

.shared-dates { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.apply-all {
  display: flex; gap: 12px 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px;
  padding: 12px 14px; border-radius: 12px; background: var(--accent-soft);
}
.apply-label { align-self: center; font-weight: 600; color: var(--accent); margin-right: 4px; }
.apply-all .hint.warn { color: var(--bad); }
.apply-all .hint { align-self: center; }

label.fld { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=number], input[type=date] {
  height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); background: var(--surface); }

.fund-rows { display: flex; flex-direction: column; gap: 10px; }
.fund-row {
  display: grid; gap: 10px; align-items: end;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.fund-row.with-dates { grid-template-columns: 28px minmax(220px, 1fr) 130px 150px 150px 40px; }
.fund-row.no-dates { grid-template-columns: 28px minmax(220px, 1fr) 150px 40px; }
.row-num {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; margin-bottom: 6px;
}
.fund-row .note { grid-column: 2 / -1; font-size: 12px; color: var(--muted); margin-top: -4px; }
.fund-row .note.warn { color: var(--bad); }

.picker { position: relative; }
.picker input { width: 100%; }
.picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 320px; overflow-y: auto; display: none;
}
.picker-list.show { display: block; }
.picker-item { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.picker-item:last-child { border-bottom: 0; }
.picker-item:hover, .picker-item.hi { background: var(--accent-soft); }
.picker-item .pn { font-weight: 500; }
.picker-item .pm { font-size: 11px; color: var(--muted); }
.picker-item .pm .closed { color: var(--bad); }
.picker-empty { padding: 12px; color: var(--muted); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; color: var(--muted); font-size: 18px;
}
.icon-btn:hover { color: var(--bad); border-color: var(--bad); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.btn {
  height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #7c3aed); color: #fff; border: 0;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.add { border-style: dashed; color: var(--accent); }
.btn:disabled { opacity: .6; cursor: progress; }
.spacer { flex: 1; }
.hint { font-size: 12px; color: var(--muted); }

.upload {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; margin-bottom: 16px; background: var(--surface-2);
}
.upload input[type=file] { display: none; }

.alert { padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; }
.alert.err { background: var(--err-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- results ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.tile .tl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.tile .tv { font-size: 24px; font-weight: 700; margin-top: 4px; }
.tile .ts { font-size: 12px; color: var(--ink-2); }
.tile.hero { background: linear-gradient(135deg, #1b1650, #2f2a8a 60%, #0d6e7a); color: #fff; border: 0; }
.tile.hero .tl, .tile.hero .ts { color: rgba(255,255,255,.75); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 240px; }
tr.total td { font-weight: 700; background: var(--accent-soft); }
tr.index td:first-child { color: var(--ink-2); }
td .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: middle; }
.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.chip.win { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good); }
.chip.lose { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-box { position: relative; height: 340px; }
.chart-box.tall { height: 380px; }

/* ---------- home ---------- */
.home-hero {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: 28px; align-items: center;
  padding: 32px; border-radius: 20px; margin-bottom: 24px; color: #fff;
  background: var(--header-bg); box-shadow: 0 10px 30px rgba(27, 22, 80, .25);
}
.home-hero .crumb { color: #ffd56b; }
/* the name written like the header logo, not in the label's capitals */
.brand-inline {
  font-family: Inter, system-ui, sans-serif; font-weight: 700; font-size: 17px;
  text-transform: none; letter-spacing: -.3px; color: #fff; margin-left: 2px;
}
.brand-inline span { color: #f5b942; }
.home-hero h2 { font-family: "Playfair Display", Georgia, serif; font-size: 32px; line-height: 1.2; margin: 8px 0 12px; }
.home-hero p { margin: 0; opacity: .88; font-size: 15px; max-width: 620px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-actions .btn { text-decoration: none; }
.hero-actions .btn:not(.primary) { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.hero-actions .btn:not(.primary):hover { background: rgba(255,255,255,.2); }
.hero-actions .btn.primary { background: linear-gradient(135deg, #ffd56b, #ff9d5c); color: #1b1650; box-shadow: none; }
.hero-stats { display: grid; gap: 12px; }
.hero-stats .stat { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 14px; padding: 14px 18px; }
.hero-stats .sv { font-size: 26px; font-weight: 700; }
.hero-stats .sl { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: 1px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card.feature { display: flex; flex-direction: column; margin-bottom: 0; }
.feature-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--accent-soft); margin-bottom: 12px; }
.card.feature h3 { font-size: 18px; margin-bottom: 8px; }
.card.feature > p { margin: 0 0 16px; color: var(--ink-2); }
.feature-links { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.feature-link {
  display: block; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  transition: border-color .15s, background .15s;
}
.feature-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.feature-link b { display: block; color: var(--accent); font-size: 14px; }
.feature-link span { font-size: 12px; color: var(--ink-2); }

.data-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 20px; }
.data-strip b { display: block; margin-bottom: 4px; }
.data-strip span { color: var(--ink-2); font-size: 13px; }

.contact-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; border: 2px solid var(--accent); }
.contact-icon { font-size: 30px; }
.contact-text { flex: 1; min-width: 240px; }
.contact-text h3 { margin: 0 0 4px; }
.contact-text p { margin: 0; color: var(--ink-2); }
.contact-card .btn { text-decoration: none; }
.contact-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.contact-actions a { color: var(--accent); }
.contact-dialog {
  width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 24px;
  background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.contact-dialog::backdrop { background: rgba(14, 15, 26, .55); backdrop-filter: blur(2px); }
.contact-dialog form { display: flex; flex-direction: column; gap: 12px; }
.contact-dialog .dlg-head { display: flex; align-items: center; justify-content: space-between; }
.contact-dialog .dlg-head h3 { margin: 0; font-size: 20px; }
.contact-dialog .hint { margin: -4px 0 4px; }
.contact-dialog textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
  font: inherit; color: inherit; resize: vertical; min-height: 120px; outline: none;
}
.contact-dialog textarea:focus { border-color: var(--accent); background: var(--surface); }
.contact-dialog .bad { border-color: var(--bad) !important; }
.field-err { color: var(--bad); font-size: 12px; font-weight: 500; min-height: 0; }
.field-err:empty { display: none; }
.contact-dialog .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.dlg-msg:empty { display: none; }
.dlg-msg { padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.dlg-msg.err { background: var(--err-bg); color: var(--bad); }
.dlg-msg.warn { background: var(--warn-bg); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.dlg-done { text-align: center; padding: 16px 0 4px; }
.dlg-done .status-icon { margin: 0 auto 10px; width: 46px; height: 46px; font-size: 22px; }
.dlg-done h3 { margin: 0 0 6px; }
.dlg-done p { color: var(--ink-2); margin: 0 0 18px; }
.disclaimer { font-size: 12px; color: var(--muted); max-width: 900px; line-height: 1.6; }
.brand { cursor: pointer; text-decoration: none; color: inherit; }

@media (max-width: 1100px) {
  .home-hero { grid-template-columns: 1fr; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .feature-grid, .data-strip { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .home-hero { padding: 22px; }
  .home-hero h2 { font-size: 24px; }
  .hero-stats { grid-template-columns: 1fr; }
}

/* ---------- export ---------- */
.export-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-bottom: 14px; }
.export-bar .btn { height: 36px; padding: 0 14px; }
.loading.dark { border-color: color-mix(in srgb, var(--accent) 30%, transparent); border-top-color: var(--accent); }

/* ---------- fund performance ---------- */
.perf-filters { display: flex; flex-wrap: wrap; gap: 14px 16px; align-items: flex-end; }
.perf-filters .fld.wide select { min-width: 300px; }
.perf-filters .hint.full { flex-basis: 100%; margin: 0; }
.perf-table.ranked td.rank { text-align: center; font-weight: 700; color: var(--muted); }
.perf-table.ranked th:first-child, .perf-table.ranked td:first-child { min-width: 40px; width: 40px; text-align: center; }
.perf-table.ranked th:nth-child(2), .perf-table.ranked td:nth-child(2) { text-align: left; white-space: normal; min-width: 260px; }
.tile .of { font-size: 14px; font-weight: 500; opacity: .75; }
.perf-period { margin: -6px 0 16px; }
.perf-table .adj { color: var(--accent); border-bottom: 1px dotted; cursor: help; }

/* ---------- rolling returns ---------- */
.fund-row.name-only { grid-template-columns: 28px minmax(220px, 1fr) 40px; }
select {
  height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); min-width: 180px;
}
.period-picks { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.chip-check { display: inline-flex; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; color: var(--ink-2); transition: all .15s;
}
.chip-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip-check input:checked + span::before { content: "✓ "; margin-right: 4px; }
.chip-check input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.chip-check.solo { align-self: flex-end; }
.custom-years input { width: 140px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 7px 14px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.roll-table tr.index td:first-child { color: var(--ink-2); }
.roll-table tr.index td { background: var(--surface-2); }
.muted-cell { text-align: left !important; color: var(--muted); font-style: italic; }

/* ---------- retirement ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
/* labels may wrap to two lines: keep the label at the top and the input on the row's bottom edge */
.form-grid > label.fld { justify-content: space-between; }
.ret-inputs { margin-bottom: 20px; }
.sizing-note { margin: -8px 0 18px; }
.scss-note {
  margin: 16px 0 0; padding: 10px 14px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
  background: var(--accent-soft); color: var(--ink-2); font-size: 12.5px; line-height: 1.6;
}
details.adv summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.adv summary::before { content: "▸"; color: var(--muted); transition: transform .2s; }
details.adv[open] summary::before { transform: rotate(90deg); }
details.adv summary h3 { margin: 0; }
details.adv[open] summary { margin-bottom: 14px; }
.strategy { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; color: var(--ink-2); max-width: 820px; }
.strategy b { color: var(--ink); }
.corpus-card { border: 2px solid var(--accent); }
.corpus-words { align-self: end; padding-bottom: 10px; font-size: 18px; font-weight: 700; color: var(--accent); }
.status { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: 14px; margin-bottom: 20px; line-height: 1.6; }
.status.ok { background: color-mix(in srgb, var(--good) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); }
.status.bad { background: var(--err-bg); border: 2px solid var(--bad); }
.status-icon { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--good); }
.status.bad .status-icon { background: var(--bad); }
.status-title { font-size: 17px; font-weight: 700; }
.status.bad .status-title { color: var(--bad); }
.plan-table td, .plan-table th { padding: 8px 10px; font-size: 13px; }
.plan-table th:first-child, .plan-table td:first-child { min-width: 50px; text-align: right; }
.plan-table td.note-cell { text-align: left; white-space: normal; min-width: 280px; color: var(--ink-2); font-size: 12px; }
.plan-table tr.strain td { background: var(--warn-bg); }
.plan-table tr.fail td { background: var(--err-bg); color: var(--bad); }

.loading { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .fund-row.with-dates { grid-template-columns: 28px 1fr 1fr 40px; }
  .fund-row.with-dates .picker { grid-column: 2 / 4; }
  .fund-row.with-dates .rm { grid-column: 4; grid-row: 1; }
  .fund-row.with-dates .f-amt { grid-column: 2 / 4; }
  .fund-row.with-dates .f-from { grid-column: 2; }
  .fund-row.with-dates .f-to { grid-column: 3; }
  .chart-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .topbar { padding: 12px 16px; }
  .brand-title { font-size: 24px; }
  .brand-tag, .db-status { display: none; }
  .sidebar { position: fixed; left: 0; top: 64px; height: calc(100vh - 64px); z-index: 15; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.show { transform: none; }
  .content { padding: 20px 16px 48px; }
  .fund-row.no-dates { grid-template-columns: 28px 1fr 40px; }
  .fund-row.no-dates .f-amt { grid-column: 2; }
}
