/* Nidhidrik — "midnight treasury": deep lapis night, temple gold, jade growth, ivory ink. */

:root {
  --night: #0b1424;
  --night-2: #101c33;
  --lapis: #1b2b4f;
  --lapis-line: rgba(140, 165, 220, .16);
  --glass: rgba(20, 33, 60, .62);
  --glass-strong: rgba(24, 39, 70, .82);

  --gold: #f2c14e;
  --gold-soft: #f6d27a;
  --gold-deep: #c98a22;
  --gold-glow: rgba(242, 193, 78, .35);
  --jade: #34d3a6;
  --jade-glow: rgba(52, 211, 166, .3);
  --coral: #ff7a59;

  /* Asset-class colours: equity in blues, debt in greens, commodities in metal tones. */
  --c-large: #2f6fed; --c-mid: #5b9bff; --c-small: #9cc2ff; --c-flexi: #6366f1; --c-thematic: #a78bfa; --c-intl: #22d3ee;
  --c-fd: #34d3a6; --c-debtfund: #8be9c5;
  --c-gold: #f2c14e; --c-silver: #d4d8e0;
  --c-cash: #ff7a59; --c-other: #8e9bb8;

  --ivory: #f6efe0;
  --ink-soft: #c9cfdd;
  --mist: #8e9bb8;

  --radius: 22px;
  --radius-sm: 12px;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  background: var(--night);
  color: var(--ivory);
  font: 500 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
em { font-style: italic; color: var(--gold); }
button { font: inherit; color: inherit; }
.defs { position: absolute; }

/* ---------- Night sky ---------- */
.sky {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(246, 239, 224, .7) 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 72%, rgba(246, 239, 224, .5) 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 44% 34%, rgba(242, 193, 78, .8) 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 12%, rgba(246, 239, 224, .6) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 78% 58%, rgba(246, 239, 224, .55) 50%, transparent 51%),
    radial-gradient(1px 1px at 91% 26%, rgba(242, 193, 78, .7) 50%, transparent 51%),
    radial-gradient(1px 1px at 8% 88%, rgba(246, 239, 224, .4) 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 55% 90%, rgba(246, 239, 224, .45) 50%, transparent 51%),
    radial-gradient(ellipse at 50% -20%, #1d3263 0%, transparent 60%),
    linear-gradient(180deg, var(--night-2), var(--night) 60%);
}
.aurora { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .55; animation: drift 22s ease-in-out infinite alternate; }
.aurora-a { width: 46vw; height: 46vw; left: -10vw; top: -12vw; background: radial-gradient(circle, rgba(242, 193, 78, .32), transparent 70%); }
.aurora-b { width: 52vw; height: 52vw; right: -16vw; bottom: -20vw; background: radial-gradient(circle, rgba(52, 211, 166, .22), transparent 70%); animation-delay: -9s; }
@keyframes drift { to { transform: translate(6vw, 4vw) scale(1.08); } }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 34px; height: 34px; color: var(--gold); filter: drop-shadow(0 0 12px var(--gold-glow)); }
.brand-mark .mark-bar, .boot-mark .mark-bar { fill: var(--night); }
.brand-name { font: 600 22px/1 var(--serif); letter-spacing: .01em; }
.demo-badge {
  font: 700 10px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  padding: 5px 8px; border-radius: 999px; color: var(--night); background: var(--coral);
}

.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot-mark { width: 56px; height: 56px; color: var(--gold); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }

/* ---------- Sign-in ---------- */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; align-items: center;
  gap: clamp(32px, 6vw, 96px); padding: clamp(24px, 5vw, 72px); max-width: 1280px; margin: 0 auto;
}
.hero { display: flex; flex-direction: column; gap: 26px; }
.hero-title { font: 400 clamp(44px, 6vw, 76px)/1.02 var(--serif); letter-spacing: -.02em; margin: 18px 0 0; }
.hero-copy { margin: 0; max-width: 34ch; color: var(--ink-soft); font-size: 18px; }
.hero-copy i { font-family: var(--serif); color: var(--gold-soft); }

.hero-chart { position: relative; margin: 0; height: 180px; max-width: 520px; border-bottom: 1px solid var(--lapis-line); }
.hero-chart svg { width: 100%; height: 100%; overflow: visible; }
.grid line { stroke: var(--lapis-line); stroke-dasharray: 3 6; }
.chart-line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.6s cubic-bezier(.6, .1, .2, 1) .3s forwards; filter: drop-shadow(0 0 8px var(--gold-glow)); }
.chart-line-jade { stroke: var(--jade); stroke-width: 1.8; opacity: .8; animation-delay: .7s; filter: drop-shadow(0 0 6px var(--jade-glow)); }
.chart-area { opacity: 0; animation: fade 1.2s ease 2s forwards; }
.chart-dot {
  position: absolute; right: -6px; top: calc(13% - 6px); width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 0 6px var(--gold-glow), 0 0 24px var(--gold);
  opacity: 0; animation: fade .4s ease 2.8s forwards, beacon 2.4s ease-in-out 3.2s infinite;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes beacon { 50% { box-shadow: 0 0 0 12px rgba(242, 193, 78, .08), 0 0 30px var(--gold); } }

.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: var(--ink-soft); font-size: 15px; }
.hero-points li { display: flex; align-items: center; gap: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-gold { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.dot-jade { background: var(--jade); box-shadow: 0 0 10px var(--jade); }

.card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--glass-strong), var(--glass));
  border: 1px solid var(--lapis-line); border-radius: var(--radius);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.card-glint {
  position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; padding: 1px;
  background: linear-gradient(130deg, rgba(242, 193, 78, .7), transparent 30%, transparent 70%, rgba(52, 211, 166, .45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.auth-card { display: flex; flex-direction: column; gap: 18px; padding: clamp(28px, 4vw, 44px); max-width: 440px; width: 100%; justify-self: center; }
.eyebrow { margin: 0; font: 700 11px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.auth-title { margin: 0; font: 400 38px/1.08 var(--serif); letter-spacing: -.01em; }
.auth-copy { margin: -6px 0 4px; color: var(--ink-soft); font-size: 15px; }

.field { display: grid; gap: 8px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--mist); }
.field input {
  width: 100%; padding: 14px 16px; border-radius: var(--radius-sm);
  background: rgba(8, 15, 30, .55); border: 1px solid var(--lapis-line); color: var(--ivory);
  font: 500 16px/1.2 var(--sans); outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: rgba(142, 155, 184, .6); }
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242, 193, 78, .15); }
.field input:read-only { color: var(--mist); }
.code-input { font: 600 28px/1 var(--serif) !important; letter-spacing: .5em; text-align: center; padding-left: calc(16px + .5em) !important; }
.is-code #code-field { animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--mist); display: grid; place-items: center; transition: .2s; }
.check input:checked + .check-box { background: var(--jade); border-color: var(--jade); }
.check input:checked + .check-box::after { content: ''; width: 5px; height: 10px; border: solid var(--night); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.check input:focus-visible + .check-box { box-shadow: 0 0 0 4px rgba(52, 211, 166, .25); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 15px 24px; cursor: pointer; font-weight: 700; font-size: 16px;
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.button-gold { color: #1a1306; background: linear-gradient(135deg, var(--gold-soft), var(--gold) 45%, var(--gold-deep)); box-shadow: 0 10px 30px rgba(242, 193, 78, .28); }
.button-gold:hover { transform: translateY(-1px); box-shadow: 0 14px 36px rgba(242, 193, 78, .38); }
.button-gold:active { transform: translateY(1px); }
.button:focus-visible { outline: 3px solid var(--ivory); outline-offset: 3px; }
.button:disabled { cursor: progress; filter: saturate(.6) brightness(.9); }
.button .arrow { transition: transform .2s; }
.button:hover .arrow { transform: translateX(4px); }
.is-busy .arrow { animation: nudge .8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(6px); } }

.auth-links { display: flex; gap: 10px; justify-content: center; color: var(--mist); font-size: 14px; }
.link-button { background: none; border: 0; padding: 0; color: var(--gold-soft); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(246, 210, 122, .4); }
.link-button:hover { color: var(--gold); }
.auth-error { margin: 0; min-height: 1.2em; color: var(--coral); font-size: 14px; text-align: center; }
.auth-error:empty { display: none; }
.auth-note { margin: 0; color: var(--jade); font-size: 13px; text-align: center; }
.auth-note:empty { display: none; }

/* ---------- Home ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: rgba(11, 20, 36, .7); border-bottom: 1px solid var(--lapis-line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar-spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 999px; background: var(--glass); border: 1px solid var(--lapis-line); min-width: 0; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 15px/1 var(--serif); color: var(--night); background: linear-gradient(135deg, var(--jade), #1fa883); flex: none; }
.user-email { font-size: 14px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-button {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--glass); border: 1px solid var(--lapis-line); cursor: pointer; transition: .2s;
}
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: var(--ink-soft); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { border-color: var(--coral); }
.icon-button:hover svg { stroke: var(--coral); }
.icon-button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.home { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: clamp(20px, 4vw, 40px) clamp(16px, 4vw, 48px) 32px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 44px; }

/* ---------- Top bar: tabs and privacy ---------- */
.tabs { display: flex; gap: 4px; margin-left: 18px; padding: 4px; border-radius: 999px; background: rgba(8, 15, 30, .45); border: 1px solid var(--lapis-line); }
.tab { border: 0; background: none; padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--mist); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.tab[aria-current="page"] { color: var(--night); background: var(--gold); }
.tab:disabled { cursor: default; opacity: .7; }
.tab-soon { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 5px; border-radius: 6px; background: rgba(242, 193, 78, .12); color: var(--gold-soft); }
.privacy-toggle .eye-shut, .is-private .privacy-toggle .eye-open { display: none; }
.is-private .privacy-toggle .eye-shut { display: block; }
.is-private .privacy-toggle { border-color: var(--gold); }
.is-private .privacy-toggle svg { stroke: var(--gold); }
.privacy-toggle:hover { border-color: var(--gold); }
.privacy-toggle:hover svg { stroke: var(--gold); }
/* Values typed into forms are masked too while amounts are hidden. */
.is-private .sheet input[inputmode="decimal"] { -webkit-text-security: disc; }

/* ---------- Amounts: own currency large, the other beneath ---------- */
.amt { display: inline-grid; gap: 2px; font-variant-numeric: tabular-nums; }
.amt-main { font-weight: 700; color: var(--ivory); white-space: nowrap; }
.amt-alt { font-size: .78em; color: var(--mist); white-space: nowrap; }
.amt-hero .amt-main { font: 400 clamp(40px, 6vw, 64px)/1.05 var(--serif); letter-spacing: -.02em; }
.amt-hero .amt-alt { font-size: 20px; }
.amt-large .amt-main { font: 600 30px/1.1 var(--serif); }
.amt-large .amt-alt { font-size: 15px; }
.gain { color: var(--jade); }

/* ---------- Alerts ---------- */
.alerts { display: grid; gap: 10px; }
.alerts:empty { display: none; }
.alert { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius-sm); background: rgba(242, 193, 78, .1); border: 1px solid rgba(242, 193, 78, .4); }
.alert svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.alert p { margin: 0; flex: 1; font-size: 15px; color: var(--ink-soft); }
.alert strong { color: var(--ivory); }
.alert-due { background: rgba(255, 122, 89, .1); border-color: rgba(255, 122, 89, .5); }
.alert-due svg { stroke: var(--coral); }

/* ---------- Summary ---------- */
.summary { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; }
.networth { padding: clamp(24px, 3.5vw, 40px); display: grid; align-content: center; gap: 14px; }
.fx-note { margin: 0; font-size: 13px; color: var(--mist); }
.people { display: grid; gap: 16px; }
.person { padding: 22px 24px; display: grid; gap: 10px; box-shadow: none; }
.person-head { display: flex; align-items: center; gap: 10px; }
.person-head h2, .person-head h3 { margin: 0; font: 600 18px/1 var(--serif); flex: 1; }
.person-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 600 15px/1 var(--serif); color: var(--night); background: var(--gold); flex: none; }
.person-radhini .person-avatar, .cash:nth-child(2) .person-avatar { background: var(--jade); }
.person-share { font-size: 13px; color: var(--mist); }
.person-meta { margin: 0; font-size: 13px; color: var(--mist); }
.person-meta strong { color: var(--ivory); }

/* ---------- Sections ---------- */
.section-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 18px; margin-bottom: 16px; }
.section-title { margin: 0; font: 400 28px/1.1 var(--serif); }
.section-note { margin: 0; font-size: 14px; color: var(--mist); flex: 1; }
.hint { margin: 10px 2px 0; font-size: 13px; color: var(--mist); }

.table-card { box-shadow: none; overflow-x: auto; }
.allocation { width: 100%; border-collapse: collapse; min-width: 560px; }
.allocation th, .allocation td { padding: 14px 20px; text-align: right; border-bottom: 1px solid var(--lapis-line); vertical-align: middle; }
.allocation th:first-child { text-align: left; }
.allocation thead th { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--mist); }
.allocation tbody th { font-weight: 600; white-space: nowrap; }
.allocation td .amt { justify-items: end; font-size: 15px; }
.allocation .pct { display: block; margin-top: 2px; font-size: 12px; color: var(--gold-soft); }
.allocation .empty { color: rgba(142, 155, 184, .45); }
.allocation .total th, .allocation .total td { border-bottom: 0; background: rgba(242, 193, 78, .05); }
.allocation .total .amt-main { color: var(--gold-soft); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 10px; vertical-align: 1px; }
.swatch-mf { background: var(--c-mid); } .swatch-etf { background: var(--c-intl); } .swatch-stock { background: var(--c-flexi); }
.swatch-gold { background: var(--c-gold); } .swatch-silver { background: var(--c-silver); } .swatch-fd { background: var(--c-fd); } .swatch-cash { background: var(--c-cash); }

.filters { display: flex; gap: 6px; flex: 1; }
.filter { border: 1px solid var(--lapis-line); background: var(--glass); color: var(--ink-soft); padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; }
.filter[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); background: rgba(242, 193, 78, .08); }
.button-small { padding: 10px 18px; font-size: 14px; }
.button-quiet { background: none; color: var(--ink-soft); border: 1px solid var(--lapis-line); padding: 10px 18px; font-size: 14px; }
.button-quiet:hover { border-color: var(--ink-soft); }
.button-danger { color: var(--coral); border-color: rgba(255, 122, 89, .4); }
.button-danger:hover { border-color: var(--coral); }

.fd-stats { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0 0 14px; font-size: 14px; color: var(--mist); }
.fd-stats:empty { display: none; }
.fd-stats strong { color: var(--ivory); margin-left: 6px; font-variant-numeric: tabular-nums; }
.fd-stats strong.gain { color: var(--jade); }
.fd-list { display: grid; gap: 12px; }
.fd { display: grid; gap: 16px; padding: 20px 24px; text-align: left; cursor: pointer; box-shadow: none; transition: border-color .2s, transform .2s; width: 100%; }
.fd:hover { border-color: rgba(242, 193, 78, .5); }
.fd:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.fd-name { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 16px; }
.fd-label { color: var(--mist); font-size: 14px; }
.owner-chip { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; color: var(--night); background: var(--gold); }
.owner-radhini { background: var(--jade); }
.warn { font-size: 12px; font-weight: 700; color: var(--coral); border: 1px solid rgba(255, 122, 89, .5); padding: 3px 8px; border-radius: 999px; }
.fd-figures { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.fd-figures dt { font-size: 12px; color: var(--mist); margin-bottom: 4px; }
.fd-figures dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; display: grid; gap: 2px; }
.fd-figures dd .gain { font-size: 12px; font-weight: 600; }
.fd-timeline { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: 12px; color: var(--mist); }
.track { height: 6px; border-radius: 999px; background: rgba(8, 15, 30, .6); overflow: hidden; }
.track .fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #1fa883, var(--c-fd)); }
.empty-state { padding: 28px; border: 1px dashed var(--lapis-line); border-radius: var(--radius); text-align: center; color: var(--mist); }
.empty-state p { margin: 0 0 8px; }

.cash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cash { padding: 20px 24px; display: grid; gap: 16px; box-shadow: none; }
.cash-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cash-rows > div { display: grid; gap: 6px; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(8, 15, 30, .35); }
.cash-ccy { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--mist); }

/* ---------- Net-worth history ---------- */
.history { padding: clamp(20px, 3vw, 28px); box-shadow: none; }
.history .section-head { align-items: flex-start; }
.history-heading { flex: 1; min-width: 0; display: grid; gap: 6px; }
.history-change { margin: 0; font-size: 15px; min-height: 1.4em; }
.history-change .muted { color: var(--mist); font-weight: 500; }
.loss { color: var(--coral); }
.ranges { flex: none; }
.ranges .filter { padding: 6px 11px; min-width: 40px; }
.chart { position: relative; width: 100%; min-height: 220px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--lapis-line); stroke-dasharray: 3 5; }
.chart-grid text, .chart-axis text { fill: var(--mist); font: 500 11px/1 var(--sans); font-variant-numeric: tabular-nums; }
.nw-line { fill: none; stroke: var(--gold); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px var(--gold-glow)); }
.nw-end { fill: var(--gold); stroke: var(--night); stroke-width: 2; }
.nw-cross { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 2 3; }
.nw-dot { fill: var(--gold); stroke: var(--night); stroke-width: 2; }
.nw-capture { fill: transparent; cursor: crosshair; }
.nw-tip { position: absolute; transform: translateX(-50%); pointer-events: none; display: grid; gap: 2px; padding: 8px 12px; border-radius: 10px; background: var(--night-2); border: 1px solid rgba(242, 193, 78, .4); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: 12px; color: var(--mist); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nw-tip strong { color: var(--ivory); font-size: 15px; }
.nw-tip-date { color: var(--gold-soft); font-weight: 600; }

.fd-closed { opacity: .62; }
.fd-closed .track .fill { background: var(--mist); }
.closed-chip { font-size: 12px; font-weight: 700; color: var(--mist); border: 1px solid var(--lapis-line); padding: 3px 8px; border-radius: 999px; }

/* ---------- Target vs actual ---------- */
.seg-large { background: var(--c-large); } .seg-mid { background: var(--c-mid); } .seg-small { background: var(--c-small); }
.seg-flexi { background: var(--c-flexi); } .seg-thematic { background: var(--c-thematic); } .seg-intl { background: var(--c-intl); }
.seg-fd { background: var(--c-fd); } .seg-debtfund { background: var(--c-debtfund); }
.seg-gold { background: var(--c-gold); } .seg-silver { background: var(--c-silver); }
.seg-cash { background: var(--c-cash); } .seg-other { background: var(--c-other); }
.seg-unclassified { background: repeating-linear-gradient(135deg, #3a4a6c 0 6px, #2b3956 6px 12px); }

.compare { padding: clamp(18px, 3vw, 28px); display: grid; gap: 22px; box-shadow: none; }
.compare-bars { display: grid; gap: 22px; }
.compare-pair { display: grid; gap: 8px; }
.compare-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 14px; }
.compare-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.compare-label small { margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--mist); }
.compare-label .person-avatar { width: 24px; height: 24px; font-size: 12px; }
.compare-pair:nth-child(2) .person-avatar { background: var(--jade); }
.person-avatar-ghost { background: transparent !important; color: var(--ink-soft); border: 1.5px solid currentColor; }

.stack-bar { display: flex; height: 30px; border-radius: 8px; overflow: hidden; background: rgba(8, 15, 30, .55); gap: 2px; }
.stack-bar .seg { display: flex; align-items: center; justify-content: center; min-width: 3px; font-size: 11px; font-weight: 700; color: #0b1424; white-space: nowrap; overflow: hidden; transition: width .35s ease; }
.seg-large, .seg-flexi, .seg-unclassified { color: #fff !important; }
.stack-empty { align-items: center; justify-content: center; border: 1px dashed var(--lapis-line); background: none; font-size: 13px; color: var(--mist); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--ink-soft); }
.legend:empty { display: none; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend strong { color: var(--ivory); }
.seg-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }

.gaps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.gap-card { padding: 20px 22px; display: grid; gap: 14px; box-shadow: none; align-content: start; }
.gaps-empty { margin: 0; color: var(--mist); font-size: 14px; }
.gap-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.gap-table th, .gap-table td { padding: 9px 6px; border-bottom: 1px solid var(--lapis-line); text-align: right; vertical-align: middle; font-variant-numeric: tabular-nums; }
.gap-table tr:last-child th, .gap-table tr:last-child td { border-bottom: 0; }
.gap-table thead th { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mist); }
.gap-table th:first-child { text-align: left; font-weight: 600; }
.gap-table tbody th { display: flex; align-items: center; gap: 8px; }
.gap-action { white-space: nowrap; }
.gap-action .amt { justify-items: end; vertical-align: middle; }
.gap-add, .gap-over { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-right: 6px; vertical-align: middle; }
.gap-add { color: var(--jade); }
.gap-over { color: var(--coral); }

/* Target editor */
.sheet-wide { width: min(760px, calc(100vw - 24px)); }
.stack-bar-preview { height: 18px; border-radius: 999px; }
.legend-compact { font-size: 12px; gap: 6px 14px; }
.target-total-row { display: flex; align-items: baseline; gap: 12px; }
.target-total-row .sheet-copy { flex: 1; margin: 0; }
.target-total { font-size: 15px; color: var(--coral); white-space: nowrap; }
.target-total.is-done { color: var(--jade); }
.target-rows { display: grid; gap: 4px; max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.target-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) 96px; align-items: center; gap: 16px; padding: 6px 0; }
.target-name { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.target-child .target-name { padding-left: 26px; font-size: 14px; color: var(--ink-soft); }
.target-toggle { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 700; text-align: left; }
.chevron { display: inline-block; width: 16px; color: var(--mist); font-size: 18px; line-height: 1; transition: transform .2s; }
.target-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.target-group-bar { height: 6px; border-radius: 999px; background: rgba(8, 15, 30, .6); overflow: hidden; }
.target-group-bar span { display: block; height: 100%; width: 0; background: var(--gold); border-radius: inherit; }
.target-group-sum { text-align: right; padding-right: 26px; font-variant-numeric: tabular-nums; }
.target-row input[type="range"] { width: 100%; accent-color: var(--gold); }
.target-input { position: relative; }
.target-input input { width: 100%; padding: 9px 26px 9px 10px; border-radius: 10px; background: rgba(8, 15, 30, .55); border: 1px solid var(--lapis-line); color: var(--ivory); font: 600 15px/1.2 var(--sans); text-align: right; font-variant-numeric: tabular-nums; }
.target-input input:focus { outline: none; border-color: var(--gold); }
.target-input span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--mist); font-size: 13px; }
.button-small.button-quiet { padding: 9px 16px; }
#target-save:disabled { cursor: not-allowed; }

/* ---------- Dialogs ---------- */
.sheet { width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; border: 1px solid var(--lapis-line); border-radius: var(--radius); background: var(--night-2); color: var(--ivory); box-shadow: 0 40px 120px rgba(0, 0, 0, .6); }
.sheet::backdrop { background: rgba(4, 8, 16, .7); backdrop-filter: blur(4px); }
.sheet-form { padding: clamp(22px, 4vw, 34px); display: grid; gap: 16px; }
.sheet-form > * { min-width: 0; }
.sheet-title { margin: 0; font: 400 28px/1.1 var(--serif); }
.sheet-copy { margin: -8px 0 0; font-size: 14px; color: var(--mist); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.field-label i { font-style: normal; opacity: .7; }
.field select { width: 100%; padding: 14px 16px; border-radius: var(--radius-sm); background: rgba(8, 15, 30, .55); border: 1px solid var(--lapis-line); color: var(--ivory); font: 500 16px/1.2 var(--sans); }
.field input[type="date"] { color-scheme: dark; }
.duration { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.duration legend { grid-column: 1 / -1; padding: 0; margin-bottom: 8px; }
.duration label { position: relative; }
.duration input { padding-right: 34px; }
.duration span { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--mist); pointer-events: none; }
.form-check { margin: 0; font-size: 13px; color: var(--jade); }
.form-check:empty { display: none; }
.form-check.is-warning { color: var(--coral); }
.sheet-actions { display: flex; align-items: center; gap: 10px; }
.sheet .auth-error { text-align: left; }

.footer { padding: 24px; text-align: center; color: var(--mist); font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-chart { height: 130px; }
  .summary { grid-template-columns: minmax(0, 1fr); }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fd-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gaps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .hero-title { font-size: 44px; }
  .hero-points { display: none; }
  .user-chip { padding-right: 5px; }
  .user-email { display: none; }
  .brand-name { font-size: 20px; }
  .auth { padding: 24px 16px; gap: 28px; }
  .home { padding-left: 16px; padding-right: 16px; }
  .topbar { gap: 8px; padding-left: 16px; padding-right: 16px; }
  .tabs { margin-left: 0; }
  .tab { padding: 7px 10px; }
  .tab-soon { display: none; }
  .brand-name, .topbar .demo-badge { display: none; }
  .people, .cash-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .cash-rows { grid-template-columns: minmax(0, 1fr); }
  .ranges { width: 100%; justify-content: space-between; }
  .compare-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .compare-label small { margin-left: 6px; }
  .gaps { grid-template-columns: minmax(0, 1fr); }
  .target-row { grid-template-columns: minmax(0, 1fr) 84px; gap: 6px 12px; }
  .target-row input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
  .target-group .target-group-bar { display: none; }
  .target-group-sum { padding-right: 22px; }
  .sheet-actions { flex-wrap: wrap; }
  .sheet-actions .topbar-spacer { display: none; }
  .sheet-actions .button { flex: 1 1 auto; padding-left: 12px; padding-right: 12px; }
  .target-total-row { flex-wrap: wrap; }
  .ranges .filter { min-width: 0; flex: 1; padding: 6px 0; }
  .fd-timeline { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .fd-timeline span:last-child { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition: none !important; }
  .chart-line { stroke-dashoffset: 0; }
}
