:root {
  --bg: #f5ecdc;
  --bg-soft: #fbf7ef;
  --panel: rgba(255, 250, 241, 0.82);
  --panel-strong: #fffaf1;
  --ink: #1f2a28;
  --muted: #6f6a61;
  --line: rgba(55, 71, 67, 0.14);
  --accent: #145c50;
  --accent-2: #c95d38;
  --accent-3: #1d3557;
  --success: #0f7b53;
  --warning: #aa6a00;
  --danger: #a93636;
  --shadow: 0 24px 60px rgba(33, 44, 42, 0.12);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

/* Ensure the HTML `hidden` attribute always wins over display rules */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(201, 93, 56, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(20, 92, 80, 0.16), transparent 28%),
    linear-gradient(180deg, #f0e4cf 0%, #f7f2e8 42%, #efe4d4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(20, 92, 80, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 92, 80, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 85%);
}

.page-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 24px auto 60px;
  position: relative;
  z-index: 1;
}

.login-shell {
  width: min(760px, calc(100vw - 24px));
  margin: 24px auto 60px;
  position: relative;
  z-index: 1;
}

.login-card {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  border-radius: 34px;
  padding: 28px;
  animation: rise-in 500ms ease;
}

.login-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.compact-form {
  margin-top: 0;
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.login-help {
  margin-top: 18px;
}

.login-note {
  margin: 12px 0 0;
  color: var(--muted);
}

.hero,
.panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

/* The logged-in header reuses the sign-in page's hero styling but needs to
   read as a slim app header, not a marketing splash — the actual dashboard
   content (verdict, KPIs) should be the first thing a client sees. */
.hero {
  border-radius: 20px;
  padding: 14px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  overflow: hidden;
  position: relative;
  animation: rise-in 500ms ease;
}

.hero-copy,
.hero-actions {
  min-width: 0;
}

.hero-copy {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 14px;
}

.hero .eyebrow {
  margin: 0;
}

.hero h1 {
  font-size: 1.05rem !important;
  max-width: none !important;
}

.hero .hero-text {
  display: none;
}

.hero .session-meta,
.hero .profile-switcher {
  flex-basis: 100%;
}

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

.save-indicator {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  padding: 8px 16px;
  border: none;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 40, 35, 0.18);
  background: #2f6f63;
  color: #fff;
  opacity: 0.92;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.save-indicator:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.save-indicator:disabled {
  cursor: default;
  background: #e4ece9;
  color: #5b756e;
  box-shadow: none;
  opacity: 0.85;
}

.save-indicator.btn-primary {
  background: var(--accent);
  color: #fff;
}

/* On narrow viewports this fixed pill sits over whatever page content scrolls
   beneath it. While idle (nothing pending) there's nothing urgent to show, so
   shrink it to a small dot instead of a full label — it still expands back to
   the full pill the moment there's something to say (saving, an error, or
   unsaved changes). */
@media (max-width: 760px) {
  .admin-fund-price-sync { align-items: stretch; flex-direction: column; }
  .admin-fund-price-sync-actions { justify-content: stretch; }
  .admin-fund-price-sync-actions .btn { flex: 1; }
  .save-indicator.is-idle {
    width: 14px;
    height: 14px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
  }
}

.hero h1,
.panel h2 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(2.15rem, 4vw, 3.7rem);
  max-width: 12ch;
}

.hero-text,
.status-banner,
.meta-pill,
.summary-list,
.checks-list,
th,
td,
input,
select,
button {
  font-size: 0.95rem;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
}

.hero-text {
  color: var(--muted);
  max-width: 68ch;
  margin-top: 14px;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
}

.session-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* ============================================================
   Profile Switcher
   ============================================================ */
.profile-switcher {
  display: flex;
  margin-top: 18px;
}

.profile-switcher-pills {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(20, 92, 80, 0.06);
  border-radius: 999px;
  width: fit-content;
  border: 1px solid rgba(20, 92, 80, 0.10);
}

.profile-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: all 220ms ease;
  letter-spacing: 0.02em;
}

.profile-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.profile-btn.active {
  background: var(--ink);
  color: white;
  box-shadow: 0 6px 18px rgba(31, 42, 40, 0.22);
  transform: scale(1.02);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled,
input:disabled,
select:disabled,
.danger-link:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0d4139);
  color: white;
  box-shadow: 0 18px 28px rgba(20, 92, 80, 0.28);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border: 1px solid rgba(20, 92, 80, 0.12);
}

.btn-danger {
  background: rgba(180, 30, 30, 0.1);
  color: #b41e1e;
  border: 1px solid rgba(180, 30, 30, 0.2);
}
.btn-danger:hover {
  background: rgba(180, 30, 30, 0.18);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.import-label {
  text-align: center;
}

.status-banner,
.meta-pill {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(29, 53, 87, 0.07);
  color: var(--accent-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================
   App Body — sidebar + main content grid
   ============================================================ */
.app-body {
  margin-top: 20px;
  min-width: 0;
}

/* ============================================================
   Sidebar Navigation — a hamburger-triggered drawer that occupies
   the full height of the left edge on narrower widths, and a
   permanent horizontal top navbar on wide/desktop widths (see the
   min-width:981px override further down). It's a sibling of .hero
   in the markup, not nested inside it — .hero has backdrop-filter
   (a new containing block) and overflow:hidden, either of which
   would clip or trap a fixed-position panel taller than the header.
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 85vw);
  overflow-y: auto;
  backdrop-filter: blur(14px);
  background: var(--panel);
  border-right: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  z-index: 25;
  transform: translateX(-100%);
  opacity: 0;
  /* No visibility in the transition on purpose — a page that's momentarily
     backgrounded (tab switch, etc.) can pause an in-flight CSS transition, and
     visibility's own hidden<->visible step timing makes a stuck mid-transition
     especially easy to end up wrong. opacity + pointer-events (the latter not
     animated at all) are enough to make the closed state both invisible and
     non-interactive without that failure mode. */
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.sidebar.is-open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.nav-group:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.nav-group-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-label {
  margin: 6px 0 6px 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.nav-btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.9rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: background 180ms ease, color 180ms ease;
  width: 100%;
}

.nav-btn:hover {
  background: rgba(20, 92, 80, 0.07);
  color: var(--ink);
}

.nav-btn.active {
  background: linear-gradient(135deg, var(--accent), #0d4139);
  color: white;
  box-shadow: 0 6px 18px rgba(20, 92, 80, 0.24);
}

/* ============================================================
   Hamburger button — the single nav trigger at every viewport
   width now, not just on mobile.
   ============================================================ */
.hamburger-btn {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 42px;
  height: 42px;
  justify-content: center;
  align-items: center;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow);
}

/* Pinned to the header's top-left at every width; the drawer it opens slides
   in from the same edge. .hero is the nearest positioned ancestor. */
.hamburger-btn {
  position: absolute;
  top: 36px;
  left: 18px;
  transform: translateY(-50%);
  z-index: 5;
}

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 220ms ease, opacity 220ms ease;
}

.sidebar-open .hamburger-btn span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.sidebar-open .hamburger-btn span:nth-child(2) {
  opacity: 0;
}
.sidebar-open .hamburger-btn span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  z-index: 10;
  animation: rise-in 200ms ease;
}

/* ============================================================
   Portfolio alerts (short summary in Portfolio view)
   ============================================================ */
.portfolio-alerts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.portfolio-alerts-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.portfolio-alerts-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ============================================================
   Layout
   ============================================================ */
.layout {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.view-shell {
  display: grid;
  gap: 20px;
  min-width: 0;
}

/* No entrance animation here on purpose — view-shell sections stay
   mounted and just toggle [hidden] on switch, so unhiding one restarts
   CSS animations on every .panel inside it at once (10+ panels on some
   views). A screenshot taken mid-switch then catches several panels
   still fading/sliding at slightly different offsets, which reads as
   broken, overlapping text rather than a subtle entrance effect. */
.panel {
  border-radius: var(--radius-lg);
  padding: 22px;
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  min-width: 0;
}

.panel-head > * {
  min-width: 0;
}

.panel-head h2 {
  font-size: clamp(1.5rem, 2vw, 2.1rem);
}

.portfolio-report-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.personal-report-option {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.panel-kpis {
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.88), rgba(246, 237, 224, 0.88)),
    radial-gradient(circle at top right, rgba(201, 93, 56, 0.08), transparent 24%);
}

/* ============================================================
   Grids
   ============================================================ */
.kpi-grid,
.live-prices-grid,
.summary-grid,
.two-up {
  display: grid;
  gap: 16px;
}

.kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* 6 columns is too narrow for longer currency values (e.g. "+SGD 3,123.79")
   to stay on one line at any font size that's still readable — collapses to
   3 columns well before the shared .live-prices-grid/.summary-grid breakpoint
   below, since those don't carry the same long-value problem. */
@media (max-width: 1550px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.summary-grid,
.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.live-prices-block {
  margin-top: 18px;
}

.live-prices-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.live-prices-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.live-prices-head p {
  margin: 0;
  color: var(--muted);
}

.live-prices-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ============================================================
   Cards
   ============================================================ */
.kpi-card,
.price-card,
.summary-card,
.check-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
}

.kpi-card {
  min-height: 132px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.price-card {
  min-height: 146px;
  display: grid;
  gap: 8px;
}

.price-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.price-card h4 {
  margin: 0;
  font-size: 1.1rem;
}

.price-symbol {
  color: var(--muted);
  font-size: 0.8rem;
  word-break: break-word;
}

.price-value {
  font-size: 2rem;
  font-family: var(--font-display);
}

.price-meta {
  color: var(--muted);
  display: grid;
  gap: 4px;
  font-size: 0.86rem;
}

.record-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.record-grid > * { min-width: 0; }

.asset-grid,
.holdings-grid,
.transaction-grid,
.ledger-grid {
  grid-template-columns: 1fr;
}

.record-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.record-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.record-card-head h3,
.record-card-head h4 {
  margin: 0;
  font-size: 1rem;
}

.record-card-subtitle {
  color: var(--muted);
  font-size: 0.8rem;
  word-break: break-word;
}

.record-fields {
  display: grid;
  gap: 10px 14px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: start;
}

.record-card-asset .record-fields {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.record-card-transaction .record-fields {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.record-card-holding .record-fields,
.record-card-lot .record-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.record-card-match .record-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.record-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.record-field.span-2 {
  grid-column: span 2;
}

.record-field.span-3 {
  grid-column: span 3;
}

.record-field.full {
  grid-column: 1 / -1;
}

.record-label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.record-value {
  font-weight: 600;
  line-height: 1.28;
  font-size: 0.92rem;
  word-break: break-word;
}

.record-field.metric-field .record-value {
  font-size: 1rem;
  font-weight: 700;
}

.record-field.metric-field {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(20, 92, 80, 0.06);
  border: 1px solid rgba(20, 92, 80, 0.08);
}

.record-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: 2px;
}

.section-summary-card .summary-list {
  margin-top: 0;
}

.section-summary-card .status-banner {
  margin-top: 16px;
}

.life-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.life-page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.life-plan-switcher {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.life-plan-switcher-pill {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 2px;
}
.life-plan-switcher-pill.is-active {
  border-color: var(--accent);
  background: rgba(20, 92, 80, 0.1);
}
.life-plan-switcher-name {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.life-plan-switcher-pill.is-active .life-plan-switcher-name {
  color: var(--accent);
}
.life-plan-switcher-name:disabled {
  cursor: default;
}
.life-plan-switcher-icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  width: 22px;
  height: 22px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
}
.life-plan-switcher-icon-btn:hover {
  background: rgba(148, 163, 184, 0.2);
}
.life-plan-switcher-add {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.life-page-nav .btn.is-active {
  background: linear-gradient(135deg, var(--accent-3), #182c46);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 16px 28px rgba(29, 53, 87, 0.22);
}

.life-dashboard-stack {
  display: grid;
  gap: 24px;
}

.life-dashboard-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: start;
}

.life-dashboard-events {
  display: grid;
  gap: 16px;
}

.life-plan-chart-container {
  position: relative;
  height: 520px;
  min-width: 0;
  overflow: hidden;
}

.life-plan-chart-svg-host,
.life-plan-chart-svg-host svg {
  width: 100%;
  height: 100%;
  display: block;
}

.life-plan-chart-svg-host {
  min-width: 0;
  position: relative;
}

.life-plan-chart-grid-line {
  stroke: rgba(0, 0, 0, 0.07);
  stroke-width: 1;
}

.life-plan-chart-axis {
  stroke: rgba(31, 42, 40, 0.18);
  stroke-width: 1;
}

.life-plan-chart-zero {
  stroke: #17231f;
  stroke-width: 1.5;
}

.life-plan-chart-tick {
  fill: var(--muted);
  font-size: 12px;
  font-family: var(--font-body);
}

.life-plan-chart-liquid-line {
  stroke: #2980b9;
  stroke-width: 1.25;
  stroke-dasharray: 4 3;
  opacity: 0.7;
}

.life-plan-chart-liquid-dot {
  fill: #2980b9;
}

.life-plan-chart-liquid-label {
  fill: #2471a3;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-body);
}

.life-plan-chart-bar {
  shape-rendering: geometricPrecision;
}

.life-plan-chart-hover-zone {
  fill: transparent;
  pointer-events: all;
}

.life-plan-chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(31, 42, 40, 0.94);
  color: #fffaf1;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
}

.life-plan-chart-tooltip[hidden] {
  display: none;
}

.life-plan-chart-tooltip-year {
  font-weight: 700;
  margin-bottom: 8px;
}

.life-plan-chart-tooltip-list {
  display: grid;
  gap: 6px;
}

.life-plan-chart-tooltip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  font-size: 0.84rem;
}

.life-plan-chart-tooltip-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.life-plan-chart-tooltip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 10px;
}

.life-plan-chart-tooltip-label-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.life-plan-chart-tooltip-value {
  font-variant-numeric: tabular-nums;
}

.life-plan-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 16px;
}

.life-plan-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  font-size: 0.84rem;
  color: var(--muted);
}

.life-plan-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 10px;
}

/* Clickable toggle buttons for chart series (GE App style) */
.life-plan-legend-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface, #fff);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.life-plan-legend-btn.is-active {
  color: var(--text);
  border-color: var(--line);
}
.life-plan-legend-btn:hover {
  border-color: var(--text-soft, #888);
}
.life-plan-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: 0 0 12px;
}

/* Legend chips grouped by kind (Cash & CPF / Investments / Property / Vehicles)
   so a chart with many series reads at a glance instead of as one long row. */
.life-plan-legend-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--line);
}

.life-plan-legend-group-toggle {
  align-self: flex-start;
  border: none;
  background: none;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
}

.life-plan-legend-group-toggle.is-active {
  color: var(--accent);
}

.life-plan-legend-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.life-plan-form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.life-plan-field {
  display: grid;
  gap: 8px;
}

.life-plan-field.wide {
  grid-column: span 2;
}

.life-plan-field-hint {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.35;
}

/* Grouped profile inputs */
.life-profile-sections {
  display: grid;
  gap: 26px;
}

.life-profile-section-head h3 {
  margin: 0 0 2px;
  font-size: 1.02rem;
}

.life-profile-section-head p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Headline "are you on track?" verdict banner */
.life-plan-verdict-card {
  border-radius: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  display: grid;
  gap: 14px;
}

.life-plan-verdict-card.is-good {
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.32);
}

.life-plan-verdict-card.is-warning {
  background: rgba(217, 119, 6, 0.10);
  border-color: rgba(217, 119, 6, 0.34);
}

.life-plan-verdict-card.is-danger {
  background: rgba(220, 38, 38, 0.10);
  border-color: rgba(220, 38, 38, 0.34);
}

.life-plan-verdict-headline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.life-plan-verdict-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.9rem;
  flex: 0 0 26px;
  color: #fff;
}

.is-good .life-plan-verdict-icon { background: #16a34a; }
.is-warning .life-plan-verdict-icon { background: #d97706; }
.is-danger .life-plan-verdict-icon { background: #dc2626; }

.life-plan-verdict-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.life-plan-verdict-metric {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.life-plan-verdict-metric-label {
  font-size: 0.74rem;
  color: var(--muted);
}

.life-plan-verdict-metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

/* Per-investment cards (capital invested vs. value for a chosen year) */
.life-plan-investments-age {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.life-plan-investment-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.life-plan-investment-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.life-plan-investment-card.is-matured {
  opacity: 0.82;
}

.life-plan-investment-card h3 {
  margin: 0;
  font-size: 0.98rem;
}

.life-plan-investment-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.life-plan-investment-stat .label {
  font-size: 0.78rem;
  color: var(--muted);
}

.life-plan-investment-stat .value {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}

.life-plan-investment-gain {
  font-size: 0.86rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 10px;
  text-align: center;
}

.life-plan-investment-gain.is-pos {
  color: #15803d;
  background: rgba(22, 163, 74, 0.12);
}

.life-plan-investment-gain.is-neg {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.12);
}

.life-plan-investment-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  padding: 6px 10px;
  text-align: center;
}

/* Cash Flow Events panel */
.life-plan-cashflow-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  font-size: 0.94rem;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--muted);
}

.life-plan-cashflow-summary .is-out { color: #b91c1c; }
.life-plan-cashflow-summary .is-in { color: #15803d; }

.life-plan-balances-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.life-plan-balances-strip:empty { display: none; }
.life-plan-balances-age {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.life-plan-balances-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.84rem;
}
.life-plan-balances-item .label { color: var(--muted); }
.life-plan-balances-item .value { font-weight: 700; color: var(--ink); }

.life-plan-cashflow-group {
  margin-bottom: 20px;
}

.life-plan-cashflow-group:last-child {
  margin-bottom: 0;
}

.life-plan-cashflow-group h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  margin: 0 0 10px;
}

.life-plan-cashflow-direction {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 10px;
  text-align: center;
}

.life-plan-cashflow-direction.is-in {
  color: #15803d;
  background: rgba(22, 163, 74, 0.12);
}

.life-plan-cashflow-direction.is-out {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.12);
}

/* Coverage discoverability hint */
.life-plan-coverage-hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Assumptions panel */
.life-plan-assumptions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px 16px;
  margin-bottom: 18px;
}

.life-plan-assumptions-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.life-plan-assumptions-item .label {
  font-size: 0.78rem;
  color: var(--muted);
}

.life-plan-assumptions-item .value {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
}

.life-plan-disclaimer {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

/* Event timeline (Gantt-style) */
.life-plan-timeline {
  width: 100%;
  overflow-x: auto;
}

.life-plan-timeline-gridline {
  stroke: rgba(0, 0, 0, 0.07);
  stroke-width: 1;
}

.life-plan-timeline-tick {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font-body);
}

.life-plan-timeline-label {
  fill: var(--ink);
  font-size: 12px;
  font-family: var(--font-body);
}

.life-plan-timeline-bar,
.life-plan-timeline-dot {
  shape-rendering: geometricPrecision;
}

.life-plan-form-grid > .gia-editor-section,
.life-plan-form-grid > .gia-product-details,
.life-plan-form-grid > .property-event-section {
  grid-column: 1 / -1;
}

.property-event-grid {
  margin-top: 0;
}

.property-event-calculator-slot {
  margin-top: 16px;
}

.life-plan-events-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.life-plan-editor-card {
  display: grid;
  gap: 16px;
  align-self: start;
}

.life-plan-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.life-plan-inline-field {
  min-width: 220px;
}

.life-plan-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.life-plan-events-column {
  display: grid;
  gap: 12px;
  min-height: 0;
}

.life-plan-event-tabs,
.tab-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.tab-btn {
  border: 1px solid rgba(20, 92, 80, 0.1);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.4;
  display: inline-flex;
  align-items: center;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), #0d4139);
  color: white;
  border-color: transparent;
}

.life-plan-events-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  max-height: 620px;
  overflow-y: auto;
  padding-right: 4px;
  padding-bottom: 8px;
}

.life-plan-event-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  display: grid;
  gap: 12px;
}

.life-plan-event-card.is-disabled {
  opacity: 0.72;
  background: rgba(255, 255, 255, 0.52);
}

/* Adviser-locked: read-only for the client. Marked with a left rule rather than a
   tint, so it still reads clearly when the event is also toggled off. */
.life-plan-event-card.is-locked {
  border-left: 3px solid var(--accent);
}

.event-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(20, 92, 80, 0.10);
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}
.event-lock-badge::before {
  content: "🔒";
  font-size: 0.72rem;
}

.event-lock-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: italic;
}

.life-plan-event-card h3 {
  margin: 0;
  font-size: 1rem;
}

.life-plan-event-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.gsh-premium-preview {
  margin-top: 5px !important;
  font-size: 0.8rem;
  color: var(--ink) !important;
  background: var(--surface-2, #f0e9d8);
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-block;
}

.life-plan-event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.life-plan-column-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.life-plan-column-toggle-actions {
  flex-basis: 100%;
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

/* Emergency-fund warning: cash savings below 6 months of that year's income. */
.life-plan-row-low-cash {
  background: rgba(231, 76, 60, 0.10);
}

.life-plan-row-low-cash:hover {
  background: rgba(231, 76, 60, 0.16);
}

.life-plan-cell-low-cash {
  color: #c0392b;
  font-weight: 700;
}

.life-plan-cell-low-cash::before {
  content: "⚠ ";
}

.life-plan-emergency-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #5b756e;
  margin: 0 0 10px;
}

.life-plan-emergency-legend .legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: rgba(231, 76, 60, 0.18);
  border: 1px solid rgba(231, 76, 60, 0.5);
}

.life-plan-column-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
}

.life-profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.life-profile-save-state {
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 600;
}

.life-profile-save-state.is-saved {
  color: var(--success);
}

.life-plan-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.life-plan-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

.life-plan-modal-card {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 32px));
  max-height: min(90vh, 920px);
  overflow-y: auto;
  border-radius: 24px;
  padding: 24px;
  background: #fff;
  border: 1px solid rgba(20, 92, 80, 0.1);
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.22);
}

.life-plan-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.life-plan-modal-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.life-plan-modal-copy {
  margin: 6px 0 0;
  color: var(--muted);
}

.life-plan-modal-body {
  display: grid;
  gap: 16px;
}

.gia-editor-section,
.gia-product-details {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(247, 244, 236, 0.75);
}

.gia-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.gia-editor-head h3,
.gia-product-details h3 {
  margin: 0;
  font-size: 1rem;
}

.gia-editor-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.gia-topup-list {
  display: grid;
  gap: 12px;
}

.gia-derived-grid {
  display: grid;
  gap: 12px;
}

.gia-topup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.gia-topup-remove {
  min-height: 48px;
}

.gia-product-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.gia-product-details-body {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.gia-product-details-body section {
  display: grid;
  gap: 8px;
}

@media (max-width: 760px) {
  .gia-editor-head {
    flex-direction: column;
  }

  .gia-topup-row {
    grid-template-columns: 1fr;
  }

  .gia-topup-remove {
    width: 100%;
  }
}

.life-plan-column-toggle input {
  width: auto;
}

.kpi-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
}

.kpi-value {
  font-size: clamp(1.45rem, 2vw, 2.3rem);
  font-family: var(--font-display);
  overflow-wrap: break-word;
  word-break: break-word;
}

.kpi-sub {
  color: var(--muted);
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 10px;
}

.summary-list li,
.check-card p {
  color: var(--muted);
  line-height: 1.45;
}

/* ============================================================
   Sector / Allocation Chart
   ============================================================ */
.sector-chart-block {
  margin-top: 22px;
}

.sector-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sector-chart-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.sector-chart-head p {
  margin: 0;
  color: var(--muted);
}

.sector-chart-container {
  position: relative;
  height: 300px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
}

.sector-chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  background: rgba(255, 255, 255, 0.55);
}

.compact-table {
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(245, 236, 220, 0.94);
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

td {
  background: rgba(255, 255, 255, 0.45);
}

tr:nth-child(even) td {
  background: rgba(255, 250, 241, 0.86);
}

input,
select {
  width: 100%;
  background: white;
  border: 1px solid rgba(29, 53, 87, 0.12);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  min-width: 0;
}

input:focus,
select:focus {
  outline: 2px solid rgba(20, 92, 80, 0.16);
  border-color: rgba(20, 92, 80, 0.28);
}

.danger-link {
  border: 1px solid rgba(169, 54, 54, 0.18);
  background: rgba(169, 54, 54, 0.06);
  border-radius: 999px;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  padding: 9px 14px;
  white-space: nowrap;
}

/* ============================================================
   Pills
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pill-live,
.pill-ok {
  background: rgba(15, 123, 83, 0.12);
  color: var(--success);
}

.pill-warning {
  background: rgba(170, 106, 0, 0.12);
  color: var(--warning);
}

.pill-error {
  background: rgba(169, 54, 54, 0.12);
  color: var(--danger);
}

/* ============================================================
   Checks & misc
   ============================================================ */
.checks-list {
  display: grid;
  gap: 12px;
}

.check-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.check-card p {
  margin: 0;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.is-negative {
  color: var(--danger);
}

.is-positive {
  color: var(--success);
}

/* ============================================================
   Transaction Table
   ============================================================ */
.tx-table th,
.tx-table td {
  padding: 8px 10px;
  vertical-align: middle;
}

.tx-input,
.tx-select {
  width: 100%;
  background: white;
  border: 1px solid rgba(29, 53, 87, 0.10);
  border-radius: 7px;
  padding: 5px 7px;
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--ink);
  min-width: 0;
}

.tx-input:focus,
.tx-select:focus {
  outline: 2px solid rgba(20, 92, 80, 0.16);
  border-color: rgba(20, 92, 80, 0.28);
}

.tx-num {
  min-width: 80px;
  text-align: right;
}

.tx-ccy {
  min-width: 52px;
}

.tx-computed {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
}

.tx-badge {
  margin-left: 6px;
  font-size: 0.72rem;
  padding: 3px 7px;
  vertical-align: middle;
}

.tx-delete {
  padding: 5px 10px;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ============================================================
   Asset Chart
   ============================================================ */
.panel-chart {
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.92), rgba(243, 235, 222, 0.92)),
    radial-gradient(circle at bottom left, rgba(20, 92, 80, 0.06), transparent 30%);
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.chart-select {
  width: auto;
  min-width: 160px;
  background: white;
  border: 1px solid rgba(20, 92, 80, 0.14);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
}

.chart-select:focus {
  outline: 2px solid rgba(20, 92, 80, 0.16);
  border-color: rgba(20, 92, 80, 0.28);
}

.chart-range-btns {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: rgba(20, 92, 80, 0.06);
  border-radius: 999px;
  border: 1px solid rgba(20, 92, 80, 0.08);
}

.range-btn {
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: all 180ms ease;
  letter-spacing: 0.04em;
}

.range-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
}

.range-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 12px rgba(20, 92, 80, 0.22);
}

.chart-status {
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.4em;
  margin-bottom: 8px;
}

.chart-container {
  position: relative;
  height: 380px;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ============================================================
   Animations
   ============================================================ */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1480px) {
  .record-card-transaction .record-fields {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .record-card-asset .record-fields,
  .record-card-holding .record-fields,
  .record-card-lot .record-fields,
  .record-card-match .record-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .hero,
  .summary-grid,
  .two-up {
    grid-template-columns: 1fr;
  }

  .live-prices-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chart-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-select {
    width: 100%;
  }

  .life-dashboard-grid,
  .life-plan-events-layout,
  .life-plan-form-grid {
    grid-template-columns: 1fr;
  }

  .life-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .record-card-asset .record-fields,
  .record-card-transaction .record-fields,
  .record-card-holding .record-fields,
  .record-card-lot .record-fields,
  .record-card-match .record-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .life-plan-field.wide {
    grid-column: auto;
  }

  .record-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 980px) {
  .page-shell {
    width: min(100vw - 20px, 1440px);
    margin-top: 12px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .live-prices-grid,
  .summary-grid,
  .two-up,
  .life-dashboard-grid,
  .life-plan-events-layout,
  .life-plan-form-grid {
    grid-template-columns: 1fr;
  }

  .record-card-asset .record-fields,
  .record-card-transaction .record-fields,
  .record-card-holding .record-fields,
  .record-card-lot .record-fields,
  .record-card-match .record-fields {
    grid-template-columns: 1fr;
  }

  .record-field.span-2,
  .record-field.span-3 {
    grid-column: auto;
  }

  .chart-controls,
  .life-page-header,
  .life-profile-actions,
  .life-plan-modal-head {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-select {
    width: 100%;
    min-width: 0;
  }

  .chart-range-btns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
    border-radius: 18px;
  }

  .range-btn {
    text-align: center;
  }

  .life-plan-column-toggles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-table {
    min-width: 720px;
  }

  .compact-table {
    min-width: 620px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 18px, 1440px);
    margin-top: 10px;
  }

  .hero,
  .panel {
    padding: 18px;
    border-radius: 24px;
  }

  .hero {
    padding-left: 60px;
  }

  .live-prices-grid {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-switcher {
    width: 100%;
    justify-content: center;
  }

  .profile-switcher-pills {
    flex-wrap: wrap;
    justify-content: center;
  }

  .record-card {
    padding: 14px;
  }

  .record-card-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .record-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .record-actions .danger-link {
    width: 100%;
  }

  .life-plan-editor-actions .btn,
  .life-plan-event-actions .btn,
  .life-plan-inline-field {
    width: 100%;
  }

  .life-plan-toolbar,
  .life-plan-event-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .life-plan-chart-container {
    height: 300px;
  }

  .life-plan-modal {
    padding: 12px;
  }

  .life-plan-modal-card {
    width: min(100vw - 24px, 960px);
    padding: 18px;
  }

  .life-page-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-container {
    height: 280px;
  }

  .life-plan-column-toggles {
    grid-template-columns: 1fr;
  }

  .data-table,
  .compact-table {
    min-width: 560px;
  }
}

@media (max-width: 520px) {
  .hero h1 {
    max-width: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .life-plan-chart-container {
    height: 260px;
  }

  .life-plan-column-toggles {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 10px 10px;
  }
}

/* ── Income Allocation Donut Chart ───────────────────────────────── */
.life-plan-coverage-rings {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  padding-top: 12px;
  align-items: flex-start;
}

.equity-toggle-btn {
  padding: 5px 12px;
  border: 1px solid rgba(47, 111, 99, 0.35);
  border-radius: 999px;
  background: transparent;
  color: #2f6f63;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.equity-toggle-btn:hover {
  background: rgba(47, 111, 99, 0.08);
}

.equity-toggle-btn.is-active {
  background: #2f6f63;
  color: #fff;
  border-color: #2f6f63;
}

.coverage-ring-card {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 16px 10px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.04);
}

/* A $0 ring at this age (not started yet, or already ended) — dimmed and
   labelled so it reads as intentional, not as a loading/broken state. */
.coverage-ring-card.is-empty {
  opacity: 0.6;
  border-style: dashed;
}

.coverage-ring-empty-note {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.coverage-ring-title {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.3;
  min-height: 2.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.coverage-ring-chart {
  position: relative;
  width: 100%;
  max-width: 120px;
  aspect-ratio: 1 / 1;
}

.coverage-ring-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 1180px) {
  .life-plan-coverage-rings {
    flex-wrap: wrap;
    justify-content: center;
  }
  .coverage-ring-card {
    flex: 1 1 160px;
    max-width: 260px;
  }
}

/* Phones: two rings per row, larger touch-friendly cards */
@media (max-width: 640px) {
  .life-plan-coverage-rings {
    gap: 10px;
  }
  .coverage-ring-card {
    flex: 1 1 calc(50% - 10px);
    max-width: none;
    padding: 14px 8px;
  }
  .coverage-ring-chart {
    max-width: 132px;
  }
  .coverage-ring-title {
    min-height: 2.8em;
    font-size: 0.72rem;
  }
  .coverage-ring-total {
    font-size: 0.95rem;
  }
}

/* ============================================================
   Adviser-only client portfolio workspace
   ============================================================ */
.panel-copy {
  max-width: 760px;
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.admin-portfolio-heading { align-items: flex-start; }
.admin-portfolio-client-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 18px;
  margin: 22px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.48);
}

.admin-portfolio-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 24px 0 14px;
}
.admin-portfolio-search { width: min(440px, 100%); }

.admin-portfolio-client-list { display: grid; gap: 12px; }
.admin-portfolio-client-card {
  display: grid;
  grid-template-columns: 48px minmax(180px, 1fr) minmax(150px, auto) auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.52);
}
.admin-client-monogram {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #238778);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
}
.admin-client-card-copy h3,
.admin-product-head h2,
.admin-product-section h3,
.admin-import-review-card h2 { margin: 0; font-family: var(--font-display); }
.admin-client-card-copy p { margin: 5px 0 0; color: var(--muted); font-size: .9rem; }
.admin-client-card-value { display: grid; text-align: right; }
.admin-client-card-value span,
.admin-product-value span,
.admin-product-metrics span,
.admin-import-summary-grid span { color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.admin-client-card-value strong { font-size: 1.05rem; }

.text-button {
  padding: 0;
  margin: 0 0 18px;
  border: 0;
  color: var(--accent);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.admin-portfolio-detail,
.admin-portfolio-products { display: grid; gap: 20px; min-width: 0; }
.admin-portfolio-detail > * { min-width: 0; }
.admin-fund-price-sync {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  margin: 18px 0;
  padding: 16px 18px;
  border: 1px solid rgba(40, 83, 165, .2);
  border-radius: var(--radius-md);
  background: rgba(40, 83, 165, .06);
}
.admin-fund-price-sync h3,
.admin-fund-price-sync p { margin: 0; }
.admin-fund-price-sync h3 { margin-bottom: 5px; font-family: var(--font-display); }
.admin-fund-price-sync p { font-weight: 800; }
.admin-fund-price-sync small { display: block; margin-top: 4px; color: var(--muted); }
.admin-fund-price-sync-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.admin-portfolio-client-hero .kpi-grid { margin-top: 22px; }
.admin-portfolio-link-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.admin-portfolio-link-row .field-label { min-width: 220px; }
.admin-portfolio-link-row #admin-portfolio-link-status { margin: 0; color: var(--muted); font-size: 0.85rem; }
.admin-client-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.admin-client-link-pill.is-linked { color: var(--success); }
.kpi-positive .kpi-value { color: var(--success); }
.kpi-warning .kpi-value { color: var(--warning); }
.kpi-negative .kpi-value { color: var(--danger); }

.admin-allocation-layout {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(280px, 1fr);
  align-items: center;
  gap: 34px;
}
.admin-allocation-chart { height: 330px; }
.admin-allocation-legend { display: grid; gap: 8px; }
.admin-allocation-legend > div {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.42);
}
.allocation-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 999px; }
.admin-allocation-legend p { margin: 0; display: grid; gap: 2px; }
.admin-allocation-legend small { color: var(--muted); }

.admin-product-card { overflow: hidden; }
.admin-product-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.admin-product-value { display: grid; text-align: right; }
.admin-product-value strong { font-size: 1.6rem; font-family: var(--font-display); }
.admin-product-value small { color: var(--muted); }
.admin-product-metrics {
  display: grid;
  /* auto-fit (not a fixed repeat(6, ...)) so a variant with fewer tiles (e.g.
     the client-facing view, which omits the two fee tiles) fills the row
     instead of leaving empty grid tracks showing through as a blank box. */
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1px;
  margin: 20px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}
.admin-product-metrics > div { display: grid; gap: 5px; padding: 14px; background: var(--panel-strong); }
.admin-product-metrics strong { font-size: 1rem; overflow-wrap: break-word; word-break: break-word; }
.positive { color: var(--success) !important; }
.fee-text { color: var(--danger) !important; }

.admin-prestige-charge {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin: 0 0 22px;
  border: 1px solid rgba(170, 106, 0, .24);
  border-radius: var(--radius-md);
  background: rgba(226, 163, 58, .10);
}
.admin-prestige-charge p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; }
.admin-prestige-charge label { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.admin-prestige-charge input { width: 90px; }

.admin-gwa-fee-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 18px;
  padding: 16px;
  margin: 0 0 22px;
  border: 1px solid rgba(170, 106, 0, .24);
  border-radius: var(--radius-md);
  background: rgba(226, 163, 58, .10);
}
.admin-gwa-fee-note p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; }
.admin-gwa-fee-note > strong { color: var(--danger); font-size: 1rem; }
.admin-gwa-fee-note > small { grid-column: 1 / -1; color: var(--muted); }

.admin-product-section { padding-top: 22px; border-top: 1px solid var(--line); }
.admin-portfolio-table { width: 100%; border-collapse: collapse; }
.admin-portfolio-table th,
.admin-portfolio-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.admin-portfolio-table th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.admin-portfolio-table td:first-child { min-width: 250px; white-space: normal; }
.admin-portfolio-table td small { display: block; margin-top: 4px; color: var(--muted); }

.admin-fund-select { min-width: 280px; }
.admin-fund-chart { height: 330px; }
.admin-marker-key { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; color: var(--muted); font-size: .82rem; font-weight: 800; }
.admin-marker-key .is-entry { color: #147b74; }
.admin-marker-key .is-exit { color: #b64f39; }
.admin-marker-key .is-fee { color: #9b650c; }

.admin-product-activity { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.admin-product-activity summary { color: var(--accent); font-weight: 800; cursor: pointer; }
.admin-activity-list { display: grid; gap: 8px; margin-top: 14px; }
.admin-activity-list article {
  display: grid;
  grid-template-columns: 72px minmax(180px, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.4);
}
.admin-activity-list p { margin: 3px 0 0; color: var(--muted); font-size: .82rem; }
.admin-activity-list article > div:last-child { display: grid; text-align: right; }
.admin-activity-list small { color: var(--muted); }
.admin-activity-marker { padding: 5px 8px; border-radius: 999px; text-align: center; background: var(--bg-soft); font-size: .72rem; font-weight: 900; }
.admin-activity-marker.is-entry { color: #147b74; background: rgba(20,163,154,.12); }
.admin-activity-marker.is-exit { color: #b64f39; background: rgba(220,107,82,.12); }
.admin-activity-marker.is-fee { color: #8f5a05; background: rgba(226,163,58,.14); }

.admin-import-source { margin-top: 16px; }
.admin-import-source textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.6);
  color: var(--ink);
  font: 500 .88rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.admin-import-actions,
.admin-import-confirm { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 14px; }
.admin-import-preview { display: grid; gap: 20px; }

.tx-paste-textarea {
  width: 100%;
  min-height: 140px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.6);
  color: var(--ink);
  font: 500 .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tx-paste-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.import-readiness { padding: 8px 12px; border-radius: 999px; font-size: .8rem; font-weight: 900; }
.import-readiness.is-ready { color: var(--success); background: rgba(15,123,83,.12); }
.import-readiness.needs-help { color: var(--warning); background: rgba(170,106,0,.12); }
.admin-import-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.admin-import-summary-grid article,
.admin-import-detail-grid article {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,.46);
}
.admin-import-summary-grid strong { font-size: 1.15rem; }
.admin-import-summary-grid small { color: var(--muted); line-height: 1.4; }
.admin-import-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.admin-import-detail-grid dl { margin: 4px 0 0; display: grid; gap: 8px; }
.admin-import-detail-grid dl div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.admin-import-detail-grid dt { color: var(--muted); }
.admin-import-detail-grid dd { margin: 0; font-weight: 800; text-align: right; }
.admin-import-questions,
.admin-import-notes { margin-top: 20px; padding: 18px; border-radius: var(--radius-md); }
.admin-import-questions { border: 1px solid rgba(170,106,0,.28); background: rgba(226,163,58,.1); }
.admin-import-notes { border: 1px solid rgba(15,123,83,.2); background: rgba(15,123,83,.07); }
.admin-import-questions h3 { margin: 0 0 12px; }
.admin-import-questions p,
.admin-import-notes p { display: flex; gap: 10px; margin: 8px 0; }
.admin-import-questions p span,
.admin-import-notes p span { font-weight: 900; }
.admin-import-confirm { padding-top: 20px; border-top: 1px solid var(--line); }
.admin-import-confirm p { margin: 0; color: var(--muted); }

.admin-report-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.admin-report-actions .text-button { margin: 0; }
.admin-investment-report-page {
  width: 100%;
  padding: clamp(24px, 4vw, 58px);
  overflow: hidden;
  border: 1px solid #e2ddd2;
  border-radius: 3px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(31, 42, 40, .10);
  color: #1b2430;
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.admin-report-header { padding-bottom: 26px; }
.admin-report-header .admin-report-kicker {
  display: none;
}
.admin-report-header h1 {
  margin: 0;
  font: 500 clamp(2.4rem, 5vw, 4rem)/1.05 Georgia, "Times New Roman", serif;
  letter-spacing: -.035em;
}
.admin-report-rule {
  width: 58px;
  height: 2px;
  margin: 32px 0 25px;
  background: #9a896a;
}
.admin-report-header p:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0;
  color: #645f58;
  font-size: .95rem;
}
.admin-report-header p strong { color: #1b2430; }
.admin-report-overview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 22px;
  padding: 25px 0 28px;
  border-top: 1px solid #ded5c4;
  border-bottom: 1px solid #ded5c4;
}
.admin-report-metric { display: grid; align-content: start; gap: 9px; }
.admin-report-metric span {
  color: #817b72;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: uppercase;
}
.admin-report-metric strong { font-size: clamp(1rem, 2vw, 1.65rem); line-height: 1.1; overflow-wrap: break-word; word-break: break-word; }
.admin-report-metric.is-positive strong { color: #377b4c; }
.admin-report-metric.is-negative strong { color: #a64538; }
.admin-report-section { padding-top: 38px; }
.admin-report-section > h2 {
  margin: 0 0 28px;
  font: 500 1.85rem/1 Georgia, "Times New Roman", serif;
}
.admin-report-policy + .admin-report-policy { margin-top: 30px; }
.admin-report-policy-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.admin-report-policy-title h3 {
  margin: 0;
  font: 500 1.45rem/1.1 Georgia, "Times New Roman", serif;
}
.admin-report-policy-title > span,
.admin-report-product-tag {
  display: inline-flex;
  padding: 2px 7px;
  border: 1px solid #d7cbb6;
  border-radius: 2px;
  color: #827767;
  font: 600 .66rem/1.2 Georgia, "Times New Roman", serif;
  letter-spacing: .06em;
}
.admin-report-policy-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 130px));
  gap: 18px;
  margin: 14px 0 16px;
}
.admin-report-policy-summary .admin-report-metric { gap: 5px; }
.admin-report-policy-summary .admin-report-metric strong { font-size: 1.05rem; }
.admin-report-fee-note {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-left: 3px solid #c79b4b;
  background: #f7f1e6;
  color: #6f675c;
  font-size: .75rem;
  line-height: 1.5;
}
.admin-report-table { width: 100%; border-collapse: collapse; }
.admin-report-table th,
.admin-report-table td {
  padding: 13px 10px;
  border-bottom: 1px solid #e5dccb;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.admin-report-table th {
  color: #817b72;
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .15em;
  text-transform: uppercase;
}
.admin-report-table th:first-child,
.admin-report-table td:first-child { width: 34%; padding-left: 12px; text-align: left; white-space: normal; }
.admin-report-table td { font-size: .86rem; }
.admin-report-table td:first-child strong { font-weight: 500; line-height: 1.45; }
.admin-report-table td:first-child small { display: block; margin-top: 5px; color: #8a8175; font-style: italic; }
.admin-report-product-tag { margin-left: 6px; vertical-align: middle; }
.admin-report-allocation-row {
  display: grid;
  grid-template-columns: minmax(220px, 36%) 1fr 58px;
  align-items: center;
  gap: 18px;
  margin: 12px 0;
}
.admin-report-allocation-row p { margin: 0; font-size: .86rem; font-weight: 500; }
.admin-report-allocation-row p small { display: inline-block; margin-left: 7px; color: #8a8175; }
.admin-report-allocation-row > div { height: 9px; overflow: hidden; border-radius: 999px; background: #ece5d8; }
.admin-report-allocation-row > div span { display: block; height: 100%; background: #97876c; }
.admin-report-allocation-row > strong { color: #5e5a53; font-size: .82rem; text-align: right; }
.admin-report-performance { break-before: page; }
.admin-report-chart-card { margin-bottom: 34px; break-inside: avoid; }
.admin-report-chart-card h3 { margin: 0 0 14px; font-size: 1rem; }
.admin-report-chart-card > div { height: 280px; }
.admin-report-chart-card > p { margin: 8px 0 0; color: #817b72; font-size: .72rem; }
.admin-report-footer {
  padding-top: 20px;
  border-top: 1px solid #ded5c4;
  color: #817b72;
  font-size: .72rem;
  line-height: 1.5;
}
.report-disclaimer {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #ded5c4;
  border-radius: 8px;
  color: #6f675c;
  font-size: .7rem;
  line-height: 1.5;
  break-inside: avoid;
}
.report-disclaimer h4 {
  margin: 0 0 6px;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.report-disclaimer p { margin: 0 0 6px; }
.report-disclaimer p:last-child { margin-bottom: 0; }

@media (max-width: 1050px) {
  .admin-product-metrics { grid-template-columns: repeat(3, 1fr); }
  .admin-import-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-report-overview { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 760px) {
  .admin-portfolio-client-form,
  .admin-allocation-layout,
  .admin-import-detail-grid { grid-template-columns: 1fr; }
  .admin-portfolio-client-card { grid-template-columns: 44px 1fr; }
  .admin-client-card-value { text-align: left; grid-column: 2; }
  .admin-portfolio-client-card .btn { grid-column: 1 / -1; }
  .admin-product-head { display: grid; }
  .admin-product-value { text-align: left; }
  .admin-product-metrics { grid-template-columns: repeat(2, 1fr); }
  .admin-prestige-charge { grid-template-columns: 1fr; }
  .admin-gwa-fee-note { grid-template-columns: 1fr; }
  .admin-activity-list article { grid-template-columns: 64px 1fr; }
  .admin-activity-list article > div:last-child { grid-column: 2; text-align: left; }
  .admin-import-summary-grid { grid-template-columns: 1fr; }
  .admin-report-overview,
  .admin-report-policy-summary { grid-template-columns: repeat(2, 1fr); }
  .admin-report-allocation-row { grid-template-columns: 1fr 48px; gap: 8px; }
  .admin-report-allocation-row > div { grid-row: 2; }
  .admin-report-allocation-row > strong { grid-column: 2; grid-row: 2; }
  .admin-report-table { min-width: 820px; }
  .admin-import-actions,
  .admin-import-confirm { align-items: stretch; flex-direction: column; }
  .admin-import-actions .btn,
  .admin-import-confirm .btn { width: 100%; }
}

@media print {
  /* This report's fund table runs 9 columns wide (fund name + 8 numeric
     columns) — too wide for portrait even at a small font, so it prints on
     its own named landscape page, same as the personal report below.
     Browsers without named-page support just fall back to the default
     (portrait) @page, which degrades safely rather than breaking. */
  @page admin-investment-report { size: A4 landscape; margin: 10mm; }
  body.printing-investment-report .admin-investment-report { page: admin-investment-report; }

  body.printing-investment-report { background: #fff !important; }
  body.printing-investment-report::before { display: none !important; }
  /* Isolate the report by hiding every OTHER sibling at each level of its
     ancestor chain, instead of visibility:hidden + position:absolute on the
     report itself. A position:absolute box that runs taller than one page
     doesn't reliably paginate across multiple printed pages in Chrome — it
     was silently truncating anything past page 1. Keeping the report in
     normal document flow (just display:none around it) lets print pagination
     work the way it's supposed to, however many pages the report needs. */
  body.printing-investment-report > *:not(#app-shell) { display: none !important; }
  body.printing-investment-report #app-shell > *:not(.app-body) { display: none !important; }
  /* .app-body is a 220px-sidebar + 1fr grid; with the sidebar hidden above,
     the remaining content would otherwise still be squeezed into the second
     column track instead of using the full page width. */
  body.printing-investment-report .app-body { display: block !important; }
  body.printing-investment-report .app-body > *:not(.layout) { display: none !important; }
  body.printing-investment-report .layout > *:not(#admin-portfolios-view) { display: none !important; }
  body.printing-investment-report #admin-portfolios-view > *:not(#admin-portfolio-detail) { display: none !important; }
  body.printing-investment-report #admin-portfolio-detail > *:not(.admin-investment-report) { display: none !important; }
  body.printing-investment-report .no-print { display: none !important; }
  body.printing-investment-report .admin-investment-report-page {
    padding: 0;
    border: 0;
    box-shadow: none;
    font-size: 9.5pt;
  }
  body.printing-investment-report .admin-report-header h1 { font-size: 34pt; }
  body.printing-investment-report .admin-report-section { padding-top: 24px; }
  body.printing-investment-report .admin-report-section > h2 { margin-bottom: 18px; font-size: 19pt; }
  body.printing-investment-report .table-wrap { overflow: visible; border: none; }
  body.printing-investment-report .admin-report-table { table-layout: fixed; }
  body.printing-investment-report .admin-report-table th,
  body.printing-investment-report .admin-report-table td {
    padding: 6px 5px;
    font-size: 8pt;
    overflow-wrap: break-word;
    white-space: normal;
  }
  body.printing-investment-report .admin-report-table th:first-child,
  body.printing-investment-report .admin-report-table td:first-child { width: 26%; }
  body.printing-investment-report .admin-report-table tr { break-inside: avoid; }
  body.printing-investment-report .admin-report-policy { break-inside: avoid; }
  body.printing-investment-report .admin-report-chart-card > div { height: 225px; }
}

@media print {
  /* The personal report's tables run 7-11 columns wide (FIFO lots, ledger) —
     too wide for portrait even at a small font, so it prints on its own named
     landscape page. Browsers that don't support named pages just fall back to
     the default (portrait) @page below, so this degrades safely. */
  @page personal-investment-report { size: A4 landscape; margin: 10mm; }
  body.printing-personal-report .personal-investment-report { page: personal-investment-report; }

  body.printing-personal-report { background: #fff !important; }
  body.printing-personal-report::before { display: none !important; }
  /* Same reasoning as the admin report block above: isolate via display:none
     on siblings up the ancestor chain, not visibility+position:absolute on
     the report itself — an absolutely-positioned box taller than one page
     doesn't paginate reliably in Chrome's print engine, which was cutting
     the report off after roughly the first page's worth of content. */
  body.printing-personal-report > *:not(#app-shell) { display: none !important; }
  body.printing-personal-report #app-shell > *:not(.app-body) { display: none !important; }
  /* Same reason as the admin block: drop the sidebar column so the report
     uses the full page width instead of being squeezed into the 1fr track. */
  body.printing-personal-report .app-body { display: block !important; }
  body.printing-personal-report .app-body > *:not(.layout) { display: none !important; }
  body.printing-personal-report .layout > *:not(#portfolio-view) { display: none !important; }
  body.printing-personal-report #portfolio-view > *:not(#personal-investment-report) { display: none !important; }
  body.printing-personal-report .no-print { display: none !important; }
  body.printing-personal-report .admin-investment-report-page {
    padding: 0;
    border: 0;
    box-shadow: none;
    font-size: 9.5pt;
  }
  body.printing-personal-report .admin-report-header h1 { font-size: 34pt; }
  body.printing-personal-report .admin-report-section { padding-top: 24px; }
  body.printing-personal-report .admin-report-section > h2 { margin-bottom: 18px; font-size: 19pt; }
  /* .table-wrap clips horizontal overflow for on-screen scrolling; in print
     nothing can scroll, so that clip was silently cutting columns off the
     right edge of every wide table. Let the table lay out at full width
     instead — the narrower column budget below is what keeps it on the page. */
  body.printing-personal-report .table-wrap { overflow: visible; border: none; }
  body.printing-personal-report .admin-report-table { table-layout: fixed; }
  body.printing-personal-report .admin-report-table th,
  body.printing-personal-report .admin-report-table td {
    padding: 5px 4px;
    font-size: 7pt;
    overflow-wrap: break-word;
    white-space: normal;
  }
  body.printing-personal-report .admin-report-table th:first-child,
  body.printing-personal-report .admin-report-table td:first-child { width: 14%; }
  body.printing-personal-report .admin-report-table tr { break-inside: avoid; }
  body.printing-personal-report .admin-report-chart-card > div { height: 225px; }
}

.coverage-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.coverage-ring-total {
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.15;
  max-width: 88%;
  color: var(--ink);
}

.coverage-ring-sub {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 2px;
}

.coverage-ring-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.coverage-ring-card:hover .coverage-ring-legend {
  opacity: 1;
}

.coverage-ring-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
}

.coverage-ring-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.coverage-ring-legend-label {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coverage-ring-legend-val {
  margin-left: auto;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
}

.life-plan-allocation-wrap {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-top: 12px;
}

.life-plan-allocation-donut-col {
  flex: 0 0 260px;
}

.life-plan-allocation-donut-col canvas {
  width: 260px !important;
  height: 260px !important;
}

.life-plan-allocation-legend-col {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.life-plan-alloc-age-label {
  font-size: 0.85rem;
  color: var(--text-2, #666);
  margin: 0 0 8px;
}

.life-plan-alloc-legend-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.life-plan-alloc-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
}

.life-plan-alloc-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.life-plan-alloc-legend-label {
  flex: 1;
  color: var(--text-1, #222);
}

.life-plan-alloc-legend-val {
  font-variant-numeric: tabular-nums;
  color: var(--text-1, #222);
  min-width: 90px;
  text-align: right;
}

.life-plan-alloc-legend-pct {
  font-variant-numeric: tabular-nums;
  color: var(--text-2, #666);
  min-width: 48px;
  text-align: right;
}

.life-plan-allocation-benchmark {
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.life-plan-allocation-benchmark.benchmark-ok {
  background: #eafaf1;
  color: #1e8449;
  border: 1px solid #a9dfbf;
}

.life-plan-allocation-benchmark.benchmark-over {
  background: #fdf2f2;
  color: #c0392b;
  border: 1px solid #f1948a;
}

.life-plan-alloc-empty {
  font-size: 0.88rem;
  color: var(--text-2, #888);
  padding: 12px 0;
}

[data-life-plan-hover-index] {
  cursor: pointer;
}

@media (max-width: 600px) {
  .life-plan-allocation-wrap {
    flex-direction: column;
  }
  .life-plan-allocation-donut-col {
    flex: none;
    width: 100%;
    display: flex;
    justify-content: center;
  }
}

/* ---------- Life Planning guided tour ---------- */
.guide-help-btn { white-space: nowrap; }
.guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(31, 42, 40, 0.55);
}
.guide-overlay.has-spotlight { background: transparent; }
.guide-spotlight {
  position: fixed;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(31, 42, 40, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.92);
  pointer-events: none;
  transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
  z-index: 1;
}
.guide-coachmark {
  position: fixed;
  z-index: 3;
  width: min(360px, calc(100vw - 24px));
  background: var(--panel-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.guide-coachmark.is-centered {
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%);
}
.guide-coachmark:not(.is-centered) { transform: none; }
.guide-step-counter {
  margin: 0 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.guide-step-title { margin: 0 0 8px; font-size: 1.12rem; color: var(--ink); }
.guide-step-body { margin: 0 0 14px; font-size: 0.9rem; line-height: 1.55; color: var(--muted); }
.guide-dots { display: flex; gap: 6px; margin-bottom: 16px; }
.guide-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.guide-dot.is-active { background: var(--accent); }
.guide-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.guide-actions-right { display: flex; gap: 8px; }

/* ---------- Investment Comparison tab ---------- */
.compare-products { display: grid; gap: 16px; }
.compare-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.compare-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.compare-card-head h3 { margin: 0; font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.compare-card-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.compare-remove-btn { padding: 4px 12px; font-size: 0.8rem; }
.compare-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px 16px; }
.compare-chart-host { position: relative; height: 360px; }
.compare-legend-item { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; font-size: 0.82rem; color: var(--muted); }
.compare-legend-swatch { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.compare-legend-swatch-dash { background-image: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
.compare-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 18px; }
.compare-summary-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.compare-summary-card h4 { margin: 0 0 12px; font-size: 0.95rem; }
.compare-summary-metrics { display: grid; gap: 10px; }
.compare-summary-metrics > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.compare-metric-label { font-size: 0.8rem; color: var(--muted); }
.compare-metric-value { font-size: 0.95rem; font-weight: 700; }
.compare-metric-value.is-pos { color: var(--success); }
.compare-metric-value.is-neg { color: var(--danger); }
.compare-mechanics { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.compare-mech-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 14px 16px;
}
.compare-mech-card h4 { margin: 0 0 12px; font-size: 0.95rem; }
.compare-mech-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.compare-mech-row { display: flex; gap: 10px; align-items: flex-start; }
.compare-mech-tag {
  flex: 0 0 auto;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 1px;
}
.compare-mech-tag.is-bonus { background: rgba(15, 123, 83, 0.14); color: var(--success); }
.compare-mech-tag.is-charge { background: rgba(169, 54, 54, 0.14); color: var(--danger); }
.compare-mech-tag.is-info { background: rgba(111, 106, 97, 0.16); color: var(--muted); }
.compare-mech-text { font-size: 0.84rem; line-height: 1.45; color: var(--ink); }

.compare-legend-note { font-size: 0.82rem; color: var(--muted); }
.compare-legend-note code { background: rgba(111,106,97,0.12); padding: 1px 5px; border-radius: 4px; }

.compare-card.is-invalid { border-color: rgba(170,106,0,0.5); }
.compare-card-warning {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: rgba(170,106,0,0.10);
  border: 1px solid rgba(170,106,0,0.28);
  border-radius: var(--radius-sm);
  color: var(--warning);
  font-size: 0.82rem;
}
.compare-legend-item.is-invalid { opacity: 0.55; text-decoration: line-through; }

/* ---------- Save vs Invest ---------- */
.svi-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 4px; }
.svi-inflation-field { max-width: 340px; margin: 0 0 18px; }

.svi-verdict {
  margin: 4px 0 18px;
  padding: 12px 16px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink);
}

.life-plan-event-error {
  margin: -4px 0 0;
  padding: 10px 14px;
  background: rgba(169, 54, 54, 0.10);
  border: 1px solid rgba(169, 54, 54, 0.32);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 700;
}

.life-plan-retirement-card {
  max-width: 340px;
}
.life-plan-retirement-card.is-shortfall {
  border-color: rgba(169, 54, 54, 0.35);
  background: rgba(169, 54, 54, 0.06);
}

.life-plan-goal-card.is-shortfall {
  border-color: rgba(169, 54, 54, 0.35);
  background: rgba(169, 54, 54, 0.06);
}

.life-plan-goal-progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.life-plan-goal-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #d29922;
  transition: width 0.3s ease;
}

.life-plan-goal-progress-fill.is-funded {
  background: #2ea043;
}

.life-plan-goal-source-note {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  font-style: italic;
}

#life-plan-retirement-card:not(:empty) {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.life-plan-scenario-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.life-plan-scenario-toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
}
.life-plan-scenario-body {
  margin-top: 14px;
}
.life-plan-scenario-controls {
  max-width: 320px;
  margin-bottom: 16px;
}
.life-plan-scenario-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--muted);
}
.life-plan-scenario-field input,
.life-plan-scenario-field select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 0.86rem;
}
.life-plan-scenario-chart-wrap {
  position: relative;
  height: 260px;
  margin-bottom: 16px;
}
.life-plan-scenario-kpis td.is-pos { color: var(--success); font-weight: 700; }
.life-plan-scenario-kpis td.is-neg { color: var(--danger); font-weight: 700; }

@media (max-width: 720px) {
  .life-plan-scenario-controls {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   "Your plan in 6 steps" checklist
   ============================================================ */
/* Neutral pill for steps not started yet — .pill on its own has no fill. */
.pill-muted {
  background: rgba(55, 71, 67, 0.08);
  color: var(--muted);
}

/* Shown while a profile has no age/income: no verdict to give yet. */
.life-plan-verdict-card.is-neutral {
  border-color: var(--line);
  background: var(--bg-soft);
}
.life-plan-verdict-card.is-neutral .life-plan-verdict-icon {
  color: var(--accent);
}

.plan-checklist {
  padding: 0;
  overflow: hidden;
}

.plan-checklist-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px;
  cursor: pointer;
  list-style: none;
}
.plan-checklist-summary::-webkit-details-marker { display: none; }
.plan-checklist-summary:hover { background: rgba(20, 92, 80, 0.04); }
.plan-checklist-summary h2 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
}
.plan-checklist-summary-text { min-width: 0; }

/* Affordance that this panel collapses, rotating when open. */
.plan-checklist-summary::after {
  content: "⌄";
  order: 3;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  transition: transform 0.2s ease;
}
.plan-checklist[open] .plan-checklist-summary::after { transform: rotate(180deg); }

.plan-checklist-intro {
  margin: 0;
  padding: 0 26px;
  color: var(--muted);
  font-size: 0.9rem;
}

.plan-checklist-steps {
  list-style: none;
  margin: 0;
  padding: 18px 26px 26px;
  display: grid;
  gap: 4px;
}

.plan-checklist-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  position: relative;
}
.plan-checklist-step:first-child { border-top: none; }
/* Vertical rail linking the step markers into a single journey. */
.plan-checklist-step::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 44px;
  bottom: -16px;
  width: 2px;
  background: var(--line);
}
.plan-checklist-step:last-child::before { display: none; }

.plan-checklist-marker {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  border: 2px solid var(--line);
  background: var(--panel-strong);
  color: var(--muted);
}
.plan-checklist-step.is-done .plan-checklist-marker {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.plan-checklist-step.is-partial .plan-checklist-marker {
  border-color: var(--warning);
  color: var(--warning);
}
.plan-checklist-step.is-waiting { opacity: 0.62; }

.plan-checklist-step-body { min-width: 0; }
.plan-checklist-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.plan-checklist-step-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.plan-checklist-blurb {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}
.plan-checklist-detail {
  margin: 8px 0 0;
  font-size: 0.88rem;
  font-weight: 600;
}
.plan-checklist-note {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.plan-progress {
  margin-top: 8px;
  height: 7px;
  border-radius: 999px;
  background: rgba(55, 71, 67, 0.10);
  overflow: hidden;
}
.plan-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--warning);
  transition: width 0.3s ease;
}
.plan-progress-fill.is-done { background: var(--success); }
.plan-progress-fill.is-todo { background: rgba(55, 71, 67, 0.22); }

.plan-checklist-subitems {
  list-style: none;
  margin: 12px 0 0;
  padding: 12px 14px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}
.plan-checklist-subitem {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
}
.plan-checklist-submarker {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.4;
}
.plan-checklist-subitem.is-done .plan-checklist-submarker { color: var(--success); }
.plan-checklist-subitem.is-partial .plan-checklist-submarker { color: var(--warning); }
.plan-checklist-subbody { min-width: 0; }
.plan-checklist-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.plan-checklist-sublabel { font-weight: 700; font-size: 0.9rem; }
.plan-checklist-subfigures {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}
.plan-checklist-subblurb {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}
.plan-checklist-gap {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--warning);
}

.plan-checklist-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.plan-checklist-actions .btn { font-size: 0.82rem; padding: 8px 14px; }

@media (max-width: 640px) {
  .plan-checklist-summary { padding: 18px; }
  .plan-checklist-intro { padding: 0 18px; }
  .plan-checklist-steps { padding: 14px 18px 20px; }
  .plan-checklist-subfigures { white-space: normal; }
}

/* Below 768px these tables (Trade Ledger, FIFO Ledger, FIFO Matches, and the
   admin/client Fund Holdings table) have too many columns to fit without
   horizontal scrolling, so each row becomes a stacked card instead — every
   cell keeps its data-label attribute as a visible prefix rather than relying
   on a header row. Deliberately kept at the end of the file: earlier @media
   blocks already set .data-table/.compact-table min-width at smaller
   breakpoints (920px -> 720px -> 560px), and with equal selector specificity
   the later rule in source order wins a cascade tie — this needs to win over
   all of those, not just the closest one. */
@media (max-width: 768px) {
  .table-wrap:has(.tx-table),
  .table-wrap:has(.admin-portfolio-table) {
    /* overflow stays "auto" (not "visible") on purpose: a scroll container
       has an automatic minimum size of 0 in a grid/flex track, while
       "visible" would let its content's natural width push the grid track
       wider than the viewport again — the exact bug this block exists to
       fix. Nothing inside should need to actually scroll once stacked. */
    min-width: 0;
    border: 0;
    background: transparent;
  }
  .tx-table,
  .admin-portfolio-table {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .tx-table thead,
  .admin-portfolio-table thead { display: none; }
  .tx-table tbody,
  .admin-portfolio-table tbody { display: block; }
  .tx-table tr,
  .admin-portfolio-table tr {
    display: block;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.55);
  }
  .tx-table tr:nth-child(even) td,
  .admin-portfolio-table tr:nth-child(even) td { background: transparent; }
  .tx-table td,
  .admin-portfolio-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px dashed var(--line);
    background: transparent !important;
    white-space: normal;
    min-width: 0;
  }
  .tx-table td:last-child,
  .admin-portfolio-table td:last-child { border-bottom: 0; }
  .tx-table td::before,
  .admin-portfolio-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .tx-table td[data-label=""] {
    justify-content: flex-end;
  }
  .tx-table td[data-label=""]::before { content: none; }
  .tx-table td > *,
  .admin-portfolio-table td > * { flex: 1 1 auto; min-width: 0; }
  .tx-table td .tx-num,
  .tx-table td .tx-ccy { text-align: right; }
  .admin-portfolio-table td:first-child { min-width: 0; }
  .admin-portfolio-table td:not(:first-child) { text-align: right; justify-content: space-between; }
}

/* ============================================================
   Dashboard: slim Goal cards + standardised Event cards.
   Kept at the end of the file so these win over the older rules above.
   ============================================================ */
.goal-age {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
}
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.goal-card {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  min-width: 0;
}
.goal-card.is-shortfall { border-color: rgba(169, 54, 54, 0.35); }
.goal-card.is-funded { border-color: rgba(15, 123, 83, 0.35); }
.goal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.goal-head h3 { margin: 0; font-size: 0.98rem; }
.goal-status {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.goal-card.is-shortfall .goal-status { color: var(--danger); background: rgba(169, 54, 54, 0.12); }
.goal-card.is-funded .goal-status { color: var(--success); background: rgba(15, 123, 83, 0.12); }
.goal-figures {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}
.goal-figures div { display: grid; gap: 1px; }
.goal-figures div:last-child { text-align: right; }
.goal-figures b {
  color: var(--ink);
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}
.goal-card .life-plan-goal-progress-track { height: 4px; }
.goal-gap { margin: 0; color: var(--muted); font-size: 0.78rem; }
.goal-card.is-shortfall .goal-gap { color: var(--danger); }
.goal-more { font-size: 0.76rem; color: var(--muted); }
.goal-more summary { cursor: pointer; list-style: none; }
.goal-more summary::-webkit-details-marker { display: none; }
.goal-more summary::after { content: " +"; }
.goal-more[open] summary::after { content: " –"; }
.goal-more p { margin: 6px 0 0; line-height: 1.5; }

.life-plan-events-list {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  grid-auto-rows: 1fr;
  gap: 12px;
  max-height: none;
  overflow: visible;
  padding: 0;
}
.life-plan-event-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-height: 150px;
  padding: 16px;
}
.life-plan-event-card h3 {
  font-size: 0.98rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.life-plan-event-card .event-detail {
  margin-top: 6px;
  font-size: 0.86rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.life-plan-event-card .gsh-premium-preview {
  font-size: 0.72rem;
  line-height: 1.4;
}
.life-plan-event-actions {
  margin-top: auto;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}
.life-plan-event-actions .btn {
  min-width: 0;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
}

/* Expandable rows inside "Year breakdown" (Investments, Cash Flow Events). */
.subfold-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  list-style: none;
  cursor: pointer;
  padding-right: 34px;
  position: relative;
}
.subfold-summary::-webkit-details-marker { display: none; }
.subfold-summary h3 { margin: 0; font-size: 1.02rem; }
.subfold-hint { color: var(--muted); font-size: 0.82rem; }
.subfold-summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--ink);
  line-height: 1;
}
.subfold[open] > .subfold-summary::after { content: "–"; }
.subfold[open] > .subfold-summary { margin-bottom: 14px; }

/* Price-chart status line: message plus a retry button when loading fails. */
.chart-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.chart-retry-btn { padding: 6px 14px; font-size: 0.8rem; }

/* Fund price coverage (Client Portfolios > Fund Data) and the chart's data-coverage line. */
.admin-fund-price-sync { flex-wrap: wrap; }
.fund-coverage { flex: 1 1 100%; margin-top: 4px; }
.fund-coverage > summary { font-weight: 400; cursor: pointer; color: var(--muted); font-size: 0.88rem; list-style: none; }
.fund-coverage > summary::-webkit-details-marker { display: none; }
.fund-coverage > summary::before { content: "+ "; }
.fund-coverage[open] > summary::before { content: "– "; }
.fund-coverage-help { font-weight: 400; margin: 10px 0; max-width: 74ch; color: var(--muted); font-size: 0.85rem; line-height: 1.55; }
.fund-coverage-notes { margin: 0 0 10px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(170, 106, 0, 0.35); background: rgba(170, 106, 0, 0.08); font-size: 0.84rem; }
.fund-coverage-notes p { margin: 0 0 4px; }
.fund-coverage-list { display: grid; gap: 10px; }
.coverage-row { display: grid; gap: 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-strong); }
.coverage-row.is-warn { border-color: rgba(170, 106, 0, 0.4); }
.coverage-row.is-none { border-color: rgba(169, 54, 54, 0.35); }
.coverage-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.coverage-title small { color: var(--muted); }
.coverage-source { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; border: 1px solid var(--line); }
.coverage-row.is-ok .coverage-source { color: var(--success); }
.coverage-row.is-warn .coverage-source { color: var(--warning); }
.coverage-row.is-none .coverage-source { color: var(--danger); }
.coverage-meta { margin: 6px 0 0; color: var(--muted); font-size: 0.84rem; line-height: 1.5; }
.coverage-message { margin: 8px 0 0; font-size: 0.85rem; line-height: 1.5; }
.coverage-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.coverage-actions .btn { padding: 7px 14px; font-size: 0.8rem; }
.coverage-form { display: grid; gap: 10px; justify-items: start; }
.coverage-form textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }
.coverage-form code { font-size: 0.8rem; }
.admin-price-coverage { margin: 8px 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.admin-price-coverage:empty { display: none; }

/* Entry & Exit chart: fund picker + "how far back" buttons, and the backfill choice. */
.admin-fund-controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 12px 16px; }
.admin-fund-range { display: inline-flex; }
.admin-fund-range .range-btn { padding: 7px 12px; font-size: 0.8rem; white-space: nowrap; }
.sync-lookback { display: flex; flex-direction: column; gap: 4px; font-size: 0.74rem; color: var(--muted); }
.sync-lookback select { padding: 7px 10px; font-size: 0.85rem; }
@media (max-width: 760px) {
  .admin-fund-controls { justify-content: stretch; width: 100%; }
  .admin-fund-range { display: flex; flex-wrap: wrap; width: 100%; overflow: visible; border-radius: 18px; }
  .admin-fund-range .range-btn { flex: 1 1 28%; text-align: center; }
  .sync-lookback { flex: 1 1 100%; }
}

#login-status:empty { display: none; }
