/* ============================================================
   Mudra portal — styles
   ============================================================ */
:root {
  --bg: #0b0c0a;
  --panel: #121310;
  --panel-2: #181914;
  --panel-3: #1f201a;
  --line: rgba(243, 239, 230, 0.08);
  --line-strong: rgba(243, 239, 230, 0.16);
  --text: #f3efe6;
  --muted: #a39d8f;
  --faint: #6f6a5f;
  --gold: #c9a46a;
  --gold-2: #e3c48a;
  --gold-ink: #0b0c0a;
  --gold-soft: rgba(201, 164, 106, 0.12);
  --gain: #6fcf97;
  --loss: #e5735f;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 10px 30px -12px rgba(0,0,0,0.6);
  --shadow-lg: 0 30px 80px -20px rgba(0,0,0,0.75);
  --glass: rgba(18, 19, 16, 0.78);
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-w: 252px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3efe6;
  --panel: #fbf9f4;
  --panel-2: #f6f2e9;
  --panel-3: #ece6d9;
  --line: rgba(11, 12, 10, 0.09);
  --line-strong: rgba(11, 12, 10, 0.18);
  --text: #16170f;
  --muted: #6b6558;
  --faint: #9a9384;
  --gold: #a8823f;
  --gold-2: #8f6c2f;
  --gold-ink: #fbf9f4;
  --gold-soft: rgba(168, 130, 63, 0.12);
  --gain: #2f8f5b;
  --loss: #c4513b;
  --shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 10px 30px -18px rgba(60,45,20,0.35);
  --shadow-lg: 0 30px 80px -20px rgba(60,45,20,0.35);
  --glass: rgba(251, 249, 244, 0.82);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  transition: background .25s var(--ease), color .25s var(--ease);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--gain); }
.neg { color: var(--loss); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.gold { color: var(--gold-2); }
[data-theme="light"] .gold { color: var(--gold); }
.hidden { display: none !important; }
svg.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Logo (single place; swap freely) ---------- */
.logo { display: inline-flex; align-items: baseline; gap: 3px; font-family: var(--sans); font-weight: 500; font-size: 22px; letter-spacing: -0.02em; color: var(--text); }
.logo-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px rgba(201,164,106,.7); transform: translateY(-1px); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg) 100%);
  padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 4px;
}
.sidebar .logo { padding: 2px 12px 22px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 10px; color: var(--muted);
  transition: background .18s var(--ease), color .18s var(--ease);
  position: relative;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--gold-soft); color: var(--text); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav-item .nav-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.nav-item .nav-title { font-weight: 500; font-size: 14px; }
.nav-item .nav-sub { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.nav-item .nav-sub b { font-weight: 500; color: var(--text); }
.nav-item.big { padding: 12px; }
.nav-divider { height: 1px; background: var(--line); margin: 12px 8px; }
.nav-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 4px 12px; }
.sidebar-foot { margin-top: auto; padding: 14px 12px 0; font-size: 11.5px; color: var(--faint); line-height: 1.5; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
  padding: 14px 32px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .logo { display: none; }
.entity-select, .ccy-select {
  appearance: none; -webkit-appearance: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 32px 8px 12px; font-weight: 500; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a39d8f' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  transition: border-color .18s var(--ease);
}
.entity-select:hover, .ccy-select:hover { border-color: var(--line-strong); }
.search { position: relative; flex: 1; max-width: 460px; }
.search input {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px 9px 36px; outline: none; transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--glass);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 360px; overflow: auto;
}
.search-results button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-align: left; }
.search-results button:hover, .search-results button.kb { background: var(--panel-3); }
.search-results .sr-meta { margin-left: auto; color: var(--muted); font-size: 12px; }
.search-empty { padding: 12px; color: var(--muted); }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--muted);
  border: 1px solid var(--line); background: var(--panel); transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); }
.icon-btn.spinning svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold)); color: #1a160e; box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--gold-soft);
}
.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px; border: 1px solid rgba(201,164,106,.35); color: var(--gold-2); background: var(--gold-soft); white-space: nowrap;
}
[data-theme="light"] .badge { color: var(--gold); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.neutral { color: var(--muted); border-color: var(--line-strong); background: transparent; }

.content { padding: 28px 32px 80px; max-width: 1480px; width: 100%; margin: 0 auto; animation: fadeUp .28s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Page headers ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-family: var(--serif); font-weight: 500; font-size: 40px; line-height: 1.05; margin: 0; letter-spacing: -0.01em; }
.page-sub { color: var(--muted); margin-top: 6px; }
.page-total { font-family: var(--sans); font-size: 26px; font-weight: 500; }
.head-right { text-align: right; }
.head-right .actions { justify-content: flex-end; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px;
  font-weight: 500; font-size: 13.5px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text);
  transition: transform .15s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #17130b; border-color: transparent; box-shadow: 0 6px 20px -8px rgba(201,164,106,.6); }
.btn.primary:hover { box-shadow: 0 8px 26px -6px rgba(201,164,106,.75); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.danger { color: var(--loss); }
.btn.danger.solid { background: var(--loss); color: #1a0f0b; border-color: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.link-btn { color: var(--gold-2); font-weight: 500; font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase; padding: 4px 0; transition: opacity .15s; }
[data-theme="light"] .link-btn { color: var(--gold); }
.link-btn:hover { opacity: .8; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, color-mix(in srgb, var(--panel) 70%, var(--bg)) 100%);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 13px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; display: flex; align-items: center; gap: 8px; }
.card-big { font-size: 22px; font-weight: 500; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Dashboard hero ---------- */
.hero { padding: 6px 0 22px; position: relative; }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-num-wrap { position: relative; display: inline-block; margin: 8px 0 10px; }
.hero-num {
  font-family: var(--serif); font-weight: 500; font-size: clamp(54px, 7vw, 92px); line-height: 1; letter-spacing: -0.02em;
  color: var(--text); text-shadow: 0 0 40px rgba(201,164,106,.28), 0 0 90px rgba(201,164,106,.12); cursor: default;
  font-variant-numeric: lining-nums tabular-nums;
}
[data-theme="light"] .hero-num { text-shadow: 0 0 40px rgba(168,130,63,.18); }
.hero-num .ccy { color: var(--gold-2); font-size: .62em; margin-right: 4px; vertical-align: .18em; }
[data-theme="light"] .hero-num .ccy { color: var(--gold); }
.hero-changes { display: flex; gap: 28px; flex-wrap: wrap; }
.chg { display: flex; align-items: baseline; gap: 10px; }
.chg .lbl { font-size: 11px; letter-spacing: .14em; color: var(--muted); font-weight: 500; }
.chg .v { font-size: 16px; font-weight: 500; }
.chg .p { font-size: 13px; padding: 2px 7px; border-radius: 6px; background: var(--panel-2); }
.popover {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 30; width: 340px; padding: 16px;
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .18s var(--ease), transform .18s var(--ease), visibility .18s;
}
.hero-num-wrap:hover .popover, .hero-num-wrap.open .popover { opacity: 1; visibility: visible; transform: none; }
.pop-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 13.5px; }
.pop-row .muted { font-size: 13px; }
.pop-sep { height: 1px; background: var(--line); margin: 8px 0; }
.pop-title { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 4px 0 4px; }

/* category row */
.cat-row { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 14px; margin: 0 -2px 10px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.cat-row::-webkit-scrollbar { height: 6px; } .cat-row::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.cat-card {
  flex: 0 0 190px; scroll-snap-align: start; text-align: left; padding: 16px; border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(160deg, var(--panel-2), var(--panel)); box-shadow: var(--shadow);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.cat-card:hover { transform: translateY(-2px); border-color: rgba(201,164,106,.4); }
.cat-card .cat-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-2); margin-bottom: 14px; }
[data-theme="light"] .cat-card .cat-ic { color: var(--gold); }
.cat-card .cat-name { color: var(--muted); font-size: 12.5px; }
.cat-card .cat-val { font-size: 19px; font-weight: 500; margin-top: 2px; }
.cat-card .cat-meta { font-size: 12px; margin-top: 4px; color: var(--faint); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 352px; gap: 18px; align-items: start; }
.chart-box { position: relative; height: 240px; }
.chart-box.h-sm { height: 190px; }
.chart-box.h-lg { height: 320px; }
.chart-box.h-donut { height: 200px; }
.chart-fallback { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 13px; border: 1px dashed var(--line-strong); border-radius: 10px; }

/* legend */
.legend { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.legend-row { display: grid; grid-template-columns: 10px minmax(0,1fr) auto 48px; gap: 10px; align-items: center; font-size: 13px; }
.legend-row .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend-row .pc { text-align: right; color: var(--muted); }

/* mini list */
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 10px 6px; border-radius: 10px; transition: background .15s var(--ease); text-align: left; width: 100%; }
.mini-row:hover { background: var(--panel-2); }
.mini-row .r { text-align: right; }
.mini-row .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* logos */
.lg {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff; flex: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); letter-spacing: -.02em;
}
.lg.round { border-radius: 50%; }
.lg.xl { width: 52px; height: 52px; font-size: 18px; border-radius: 14px; }

/* goals / progress */
.goal { padding: 12px 0; border-bottom: 1px solid var(--line); }
.goal:last-child { border-bottom: 0; padding-bottom: 0; }
.goal-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.goal-name { font-weight: 500; }
.bar { height: 6px; border-radius: 4px; background: var(--panel-3); overflow: hidden; margin: 8px 0 6px; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transition: width .6s var(--ease); }
.goal-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* review card */
.review { border-color: rgba(201,164,106,.32); background: linear-gradient(160deg, rgba(201,164,106,.10), var(--panel) 60%); }
.review-items { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.review-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--panel-2); font-size: 13px; }
.review-item .ri-txt { flex: 1; min-width: 0; }
.review-item .ri-txt div:last-child { color: var(--muted); font-size: 12px; }

/* rating ring */
.ring-wrap { position: relative; width: 168px; height: 168px; flex: none; }
.ring-wrap.sm { width: 92px; height: 92px; }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { stroke: var(--panel-3); }
.ring-val { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-score { font-family: var(--serif); font-size: 52px; line-height: 1; font-weight: 500; }
.ring-wrap.sm .ring-score { font-size: 30px; }
.ring-of { font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.subscore { display: grid; grid-template-columns: minmax(0,1fr) 44px; gap: 4px 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.subscore:last-child { border-bottom: 0; }
.subscore .ss-name { font-weight: 500; }
.subscore .ss-score { text-align: right; font-weight: 600; }
.subscore .bar { grid-column: 1 / -1; margin: 2px 0; }
.subscore .ss-rule { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.subscore .ss-measure { grid-column: 1 / -1; font-size: 12.5px; }

.insight { display: flex; gap: 14px; }
.insight .in-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--gold-soft); color: var(--gold-2); }
[data-theme="light"] .insight .in-ic { color: var(--gold); }
.insight.warn .in-ic { background: rgba(229,115,95,.12); color: var(--loss); }
.insight.good .in-ic { background: rgba(111,207,151,.12); color: var(--gain); }
.insight h4 { margin: 0 0 4px; font-size: 15px; font-weight: 500; }
.insight p { margin: 0; color: var(--muted); font-size: 13px; }

.opp { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.opp:last-child { border-bottom: 0; }
.opp h4 { margin: 0 0 3px; font-size: 14.5px; font-weight: 500; }
.opp p { margin: 0; font-size: 13px; color: var(--muted); }
.opp .impact { text-align: right; }
.opp .impact div:first-child { font-weight: 500; }
.opp .impact div:last-child { font-size: 11.5px; color: var(--muted); }
.tag { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--panel-3); color: var(--muted); letter-spacing: .04em; }

/* ---------- Sections (assets / debts) ---------- */
.sec { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin-bottom: 14px; box-shadow: var(--shadow); overflow: hidden; }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; user-select: none; transition: background .15s var(--ease); }
.sec-head:hover { background: var(--panel-2); }
.sec-head .chev { transition: transform .22s var(--ease); color: var(--muted); }
.sec.collapsed .chev { transform: rotate(-90deg); }
.sec-name { font-weight: 500; font-size: 15px; }
.sec-count { color: var(--faint); font-size: 12.5px; }
.sec-total { margin-left: auto; font-weight: 500; font-size: 15px; }
.sec-body-wrap { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .25s var(--ease); }
.sec.collapsed .sec-body-wrap { grid-template-rows: 0fr; }
.sec-body { overflow: hidden; min-height: 0; }
.trow {
  display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(90px, 1fr) minmax(110px, 1fr) minmax(110px, 1fr) 40px;
  gap: 12px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line); transition: background .15s var(--ease);
}
.trow.debt { grid-template-columns: minmax(0, 2.4fr) minmax(90px, 1fr) minmax(110px, 1fr) 40px; }
.trow.th { font-size: 11px; letter-spacing: .12em; color: var(--faint); text-transform: uppercase; padding-top: 9px; padding-bottom: 9px; font-weight: 500; }
.trow:not(.th):hover { background: var(--panel-2); }
.trow.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 40% { background: var(--gold-soft); } 100% { background: transparent; } }
.trow .r { text-align: right; }
.asset-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.asset-cell .an { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-cell .as { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-cell > div { min-width: 0; }
.sub-num { font-size: 12px; color: var(--muted); }
.dots { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.dots:hover { background: var(--panel-3); color: var(--text); }
.sec-foot { padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.new-section { width: 100%; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 16px; color: var(--gold-2); font-weight: 500; letter-spacing: .08em; font-size: 12.5px; transition: border-color .18s, background .18s; }
[data-theme="light"] .new-section { color: var(--gold); }
.new-section:hover { border-color: var(--gold); background: var(--gold-soft); }
.empty { padding: 26px 18px; text-align: center; color: var(--muted); }
.empty-big { padding: 60px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-big h3 { font-family: var(--serif); font-size: 30px; font-weight: 500; margin: 0 0 6px; color: var(--text); }

/* data table (brokerage holdings, perf) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
table.dt { width: 100%; border-collapse: collapse; min-width: 860px; }
table.dt.compact { min-width: 0; }
.dt th { text-align: right; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 500; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dt td { text-align: right; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dt th:first-child, .dt td:first-child { text-align: left; }
.dt tbody tr { transition: background .15s var(--ease); }
.dt tbody tr:hover { background: var(--panel-2); }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.weight-bar { display: inline-flex; align-items: center; gap: 8px; }
.weight-bar i { display: inline-block; height: 4px; border-radius: 2px; background: var(--gold); opacity: .8; }

/* brokerage cards */
.broker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.broker-card { text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 14px; }
.broker-card:hover { transform: translateY(-2px); border-color: rgba(201,164,106,.4); }
.broker-card .bc-top { display: flex; gap: 12px; align-items: center; }
.broker-card .bc-name { font-weight: 500; font-size: 15px; }
.broker-card .bc-sub { font-size: 12px; color: var(--muted); }
.broker-card .bc-val { font-size: 24px; font-weight: 500; }
.broker-card .bc-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }
.broker-card.add { border-style: dashed; align-items: center; justify-content: center; color: var(--gold-2); min-height: 180px; background: transparent; }
[data-theme="light"] .broker-card.add { color: var(--gold); }
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.stat .k { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 500; margin-top: 4px; }
.stat .s { font-size: 12.5px; margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-bottom: 14px; font-size: 13px; }
.back:hover { color: var(--text); }

/* ---------- Tabs with sliding gold underline ---------- */
.tabs { position: relative; display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.small { margin-bottom: 12px; }
.tab { padding: 9px 12px 11px; color: var(--muted); font-weight: 500; font-size: 13.5px; transition: color .18s var(--ease); white-space: nowrap; }
.tabs.small .tab { padding: 6px 9px 9px; font-size: 12.5px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab-ink { position: absolute; bottom: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); box-shadow: 0 0 10px rgba(201,164,106,.6); transition: left .22s var(--ease), width .22s var(--ease); left: 0; width: 0; }

/* ---------- Markets ---------- */
.ticker { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin-bottom: 18px; position: relative; mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.ticker-track { display: flex; gap: 34px; padding: 12px 18px; width: max-content; animation: marquee 40s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.tk { display: flex; gap: 8px; align-items: baseline; white-space: nowrap; font-size: 13px; }
.tk b { font-weight: 500; }
.idx-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.idx .idx-name { color: var(--muted); font-size: 12.5px; }
.idx .idx-val { font-size: 21px; font-weight: 500; margin: 2px 0; }
.idx svg { width: 100%; height: 40px; margin-top: 8px; }
.news-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: 0; }
.news-item > .badge { align-self: start; }
.news-item h4 { margin: 0 0 6px; font-weight: 500; font-size: 14.5px; }
.news-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--panel-3); color: var(--muted); font-weight: 500; }
.chip.held { background: var(--gold-soft); color: var(--gold-2); }
[data-theme="light"] .chip.held { color: var(--gold); }

/* ---------- Fast forward ---------- */
.ff-cards { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.ff-card .k { font-size: 12px; letter-spacing: .14em; color: var(--muted); font-weight: 500; }
.ff-card .v { font-size: 22px; font-weight: 500; margin: 6px 0 2px; }
.ff-card .s { font-size: 12px; color: var(--muted); }
.ff-layout { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 18px; align-items: start; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.field .hint { font-size: 11.5px; color: var(--faint); }
.input, select.input, textarea.input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.input.err { border-color: var(--loss); }
textarea.input { min-height: 130px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-err { color: var(--loss); font-size: 12.5px; min-height: 18px; }
input[type="range"] { width: 100%; accent-color: var(--gold); }
.inline-input { display: flex; align-items: center; gap: 8px; }
.inline-input .input { padding: 8px 10px; }
.toggle-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle-row input { accent-color: var(--gold); width: 16px; height: 16px; }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: none; }
.modal-root.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,5,4,.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s var(--ease); }
[data-theme="light"] .modal-backdrop { background: rgba(60,50,30,.25); }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--glass); backdrop-filter: blur(26px) saturate(1.2); -webkit-backdrop-filter: blur(26px) saturate(1.2);
  border: 1px solid var(--line-strong); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 26px; animation: pop .22s var(--ease);
}
.modal.sm { width: min(460px, calc(100vw - 32px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes fade { from { opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { font-family: var(--serif); font-weight: 500; font-size: 30px; margin: 0; line-height: 1.1; }
.modal-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.cat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.tile {
  text-align: left; padding: 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); display: flex; flex-direction: column; gap: 10px;
  transition: border-color .18s var(--ease), transform .18s var(--ease), background .18s var(--ease); min-height: 132px;
}
.tile:hover { border-color: var(--gold); transform: translateY(-2px); background: var(--panel-3); }
.tile .t-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-2); }
[data-theme="light"] .tile .t-ic { color: var(--gold); }
.tile .t-name { font-weight: 500; font-size: 14.5px; }
.tile .t-desc { font-size: 12px; color: var(--muted); }
.tile .badge { align-self: flex-start; margin-top: auto; }
.logo-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; max-height: 380px; overflow: auto; padding: 2px; }
.logo-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); transition: border-color .18s, transform .18s; text-align: center; font-size: 12.5px; }
.logo-tile:hover { border-color: var(--gold); transform: translateY(-2px); }
.logo-tile .lt-c { font-size: 11px; color: var(--muted); }
.connect-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 6px 10px 4px; }
.connect-box p { color: var(--muted); max-width: 520px; margin: 0; }
.connect-steps { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; width: 100%; margin: 12px 0; text-align: left; }
.connect-steps div { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 12px; font-size: 12.5px; color: var(--muted); }
.connect-steps b { display: block; color: var(--text); margin-bottom: 4px; font-weight: 500; }
.csv-preview { max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0 12px; }
.csv-preview table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.csv-preview td, .csv-preview th { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.csv-preview td:first-child, .csv-preview th:first-child { text-align: left; }

/* dropdown menu */
.dropdown {
  position: fixed; z-index: 120; min-width: 180px; padding: 6px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow-lg); animation: fade .15s var(--ease);
}
.dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; font-size: 13.5px; }
.dropdown button:hover { background: var(--panel-3); }
.dropdown button.danger { color: var(--loss); }
.dropdown .dd-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.dropdown .dd-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 6px 10px 2px; }

/* toast */
.toast-root { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--glass); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop2 .22s var(--ease); display: flex; gap: 8px; align-items: center; }
.toast .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
@keyframes pop2 { from { opacity: 0; transform: translateY(8px); } }

/* sample banner */
.sample-banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid rgba(201,164,106,.25); background: var(--gold-soft); border-radius: 12px; margin-bottom: 20px; font-size: 13px; flex-wrap: wrap; }
.sample-banner .sb-txt { flex: 1; min-width: 220px; color: var(--muted); }
.sample-banner .sb-txt b { color: var(--text); font-weight: 500; }

/* ownership */
.member-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; margin-bottom: 18px; }
.own-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 2.6fr) 120px; gap: 18px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.own-row:hover { background: var(--panel-2); }
.own-sliders { display: grid; gap: 6px; }
.own-slider { display: grid; grid-template-columns: 70px minmax(0,1fr) 44px 92px; gap: 10px; align-items: center; font-size: 12.5px; }
.own-slider .pct { text-align: right; font-weight: 500; }
.own-slider .amt { text-align: right; color: var(--muted); }

/* bottom bar (mobile) */
.bottom-bar { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1240px) {
  .dash-grid { grid-template-columns: minmax(0,1fr); }
  .rail { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
  .ff-cards { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .idx-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 980px) {
  .ff-layout { grid-template-columns: minmax(0,1fr); }
  .grid-3 { grid-template-columns: minmax(0,1fr); }
  .stat-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .sidebar { display: none; }
  .topbar { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
  .topbar .logo { display: inline-flex; font-size: 20px; margin-right: auto; }
  .topbar .entity-select { order: 9; max-width: 140px; padding-right: 26px; font-size: 13px; }
  .topbar .search { order: 10; flex: 1 1 calc(100% - 160px); max-width: none; }
  .topbar .icon-btn, .topbar .avatar { width: 34px; height: 34px; }
  .topbar .ccy-select { padding: 7px 26px 7px 10px; font-size: 13px; background-position: right 9px center; }
  .sample-banner { padding: 10px 12px; font-size: 12.5px; gap: 8px; }
  .sample-banner > .badge { display: none; }
  .sample-banner .sb-txt { min-width: 0; flex-basis: 100%; }
  .topbar .sample-top { display: none; }
  .topbar-spacer { display: none; }
  .content { padding: 18px 14px 110px; }
  .page-title { font-size: 32px; }
  .head-right { text-align: left; width: 100%; }
  .head-right .actions { justify-content: flex-start; }
  .grid-2, .rail { grid-template-columns: minmax(0,1fr); }
  .cat-tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .logo-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .connect-steps { grid-template-columns: minmax(0,1fr); }
  .form-grid { grid-template-columns: minmax(0,1fr); }
  .ff-cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .trow { grid-template-columns: minmax(0, 1fr) minmax(86px, auto) 34px; padding: 11px 12px; }
  .trow .c-cost, .trow .c-ret { display: none; }
  .trow.debt { grid-template-columns: minmax(0, 1fr) minmax(86px, auto) 34px; }
  .trow.debt .c-rate { display: none; }
  .sec-head { padding: 13px 12px; }
  .own-row { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .modal { padding: 20px; top: auto; bottom: 0; transform: translateX(-50%); border-radius: 18px 18px 0 0; width: 100vw; max-height: 90vh; animation: sheet .25s var(--ease); }
  @keyframes sheet { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
  .popover { width: min(320px, calc(100vw - 40px)); }
  .bottom-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; overflow-x: auto; scrollbar-width: none;
    background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line-strong);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-bar::-webkit-scrollbar { display: none; }
  .bb-item { flex: 1 0 70px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px; border-radius: 10px; color: var(--muted); font-size: 10.5px; position: relative; transition: color .15s; }
  .bb-item.active { color: var(--gold-2); }
  [data-theme="light"] .bb-item.active { color: var(--gold); }
  .bb-item.active::after { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 2px; background: var(--gold); }
  .toast-root { bottom: 90px; }
  .hero-changes { gap: 14px; }
  .opp { grid-template-columns: minmax(0,1fr) auto; }
  .opp > .tag { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
