/* Coinli — design tokens + components. Light by default, dark via OS or toggle. */
:root {
  --bg: #f6f5f2;
  --sidebar: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f3f2ee;
  --border: #e8e6e0;
  --text: #1c1c1e;
  --muted: #62615d;
  --faint: #9a9892;
  --accent: #d52b1e;
  --accent-soft: #fdecea;
  --accent-text: #c01f13;
  --pos: #15803d;
  --neg: #dc2626;
  --warn: #d97706;
  --income: #22a06b;
  --expense: #ff7a45;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 2px 6px rgba(20, 20, 20, .03);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111214; --sidebar: #15161a; --surface: #1b1c20; --surface-2: #24252a; --border: #2d2e34;
    --text: #f2f2f3; --muted: #a8a8b0; --faint: #72727b;
    --accent: #e3342a; --accent-soft: rgba(227, 52, 42, .16); --accent-text: #ff6f63;
    --pos: #4ade80; --neg: #f87171; --warn: #fbbf24; --income: #34c585; --expense: #ff8a5c;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111214; --sidebar: #15161a; --surface: #1b1c20; --surface-2: #24252a; --border: #2d2e34;
  --text: #f2f2f3; --muted: #a8a8b0; --faint: #72727b;
  --accent: #e3342a; --accent-soft: rgba(227, 52, 42, .16); --accent-text: #ff6f63;
  --pos: #4ade80; --neg: #f87171; --warn: #fbbf24; --income: #34c585; --expense: #ff8a5c;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; }
.num, .kpi-value, .bl-amt, .txn-amt, td.r { font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); } .faint { color: var(--faint); }

/* ---------- shell ---------- */
.app { --sidebar-w: 236px; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar-resizer { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 10; touch-action: none; }
.sidebar-resizer::after { content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 2px; background: transparent; transition: background .15s; }
.sidebar-resizer:hover::after, .sidebar-resizer:focus-visible::after, body.resizing .sidebar-resizer::after { background: var(--accent); }
.sidebar-resizer:focus-visible { outline: none; }
body.resizing, body.resizing * { cursor: col-resize !important; user-select: none; }
.nav a > span:not(.badge), .nav-btn > span, .brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--sidebar); border-right: 1px solid var(--border);
  padding: 18px 12px; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; text-decoration: none; }
.logo { width: 36px; height: 36px; display: inline-flex; flex-shrink: 0; }
.logo svg, .logo img { width: 100%; height: 100%; }
.logo img { object-fit: cover; border-radius: 9px; background: #fff; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav a, .nav-btn {
  display: flex; align-items: center; gap: 11px; padding: 10px 10px; border-radius: 7px;
  color: var(--muted); text-decoration: none; font-weight: 500; border: 0; background: none; cursor: pointer; width: 100%; text-align: left;
  font-size: 15.5px;
}
.nav a:hover, .nav-btn:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav svg, .nav-btn svg { width: 18px; height: 18px; flex: none; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); padding: 18px 10px 6px; font-weight: 600; }
.badge { margin-left: auto; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.profile-wrap { position: relative; border-top: 1px solid var(--border); padding-top: 8px; }
.profile {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px; width: 100%;
  border: 0; background: none; border-radius: 10px; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.profile:hover, .profile[aria-expanded="true"] { background: var(--surface-2); }
.profile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.profile-text { flex: 1; min-width: 0; }
.profile b { display: block; font-size: 13px; }
.profile-text span { display: block; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile .chev { width: 16px; height: 16px; color: var(--faint); flex: none; }
.profile.login b { color: var(--accent-text); }
.avatar.ghost { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.avatar svg { width: 16px; height: 16px; }
.profile-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .18);
}
.pm-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.pm-head b { display: block; font-size: 13px; }
.pm-head span { font-size: 12px; color: var(--faint); }
.profile-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; color: var(--neg); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.profile-menu button:hover, .profile-menu button:focus-visible { background: var(--surface-2); outline: none; }
.profile-menu svg { width: 16px; height: 16px; }
body.logged-out .nav, body.logged-out .add-btn, body.logged-out .tabbar, body.logged-out .mobile-top .icon-btn.primary { display: none !important; }
.signed-out { min-height: 70vh; display: grid; place-items: center; }
.signed-out-card { max-width: 420px; width: 100%; text-align: center; padding: 36px 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.signed-out-card .logo { width: 52px; height: 52px; }
.signed-out-card h1 { font-size: 22px; text-wrap: balance; }
.signed-out-card .sub { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); }
.signed-out-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.switch-auth { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); }
.sheet .sheet-logout { color: var(--neg); border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; border-radius: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: #1f2a44; color: #fff; font-weight: 600; font-size: 12px; flex: none; }

.main { padding: 28px 32px 56px; min-width: 0; width: 100%; max-width: 1380px; margin: 0 auto; position: relative; } /* centred in the space next to the menu */
.mobile-top { display: none; }
.lang-corner { position: absolute; top: 28px; right: 32px; z-index: 5; }
#view > .page-head { padding-right: 120px; }
.corner-controls { display: flex; align-items: center; gap: 8px; }
.lang-switch button { font-weight: 600; font-size: 12px; letter-spacing: .04em; padding: 5px 10px; }
.cur-switch select { font-weight: 600; font-size: 12.5px; letter-spacing: .03em; }
.field .input-affix.wide input[name] { padding-left: 46px; }

/* ---------- page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
h1 { font-size: 26px; letter-spacing: -.02em; margin: 0; font-weight: 700; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
.sub { color: var(--faint); font-size: 12.5px; margin: 6px 0 0; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- controls ---------- */
.period { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-label { font-weight: 600; font-size: 13.5px; min-width: 150px; text-align: center; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--border); background: var(--surface); border-radius: 7px; color: var(--text); cursor: pointer;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: .4; cursor: default; }
.select-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); background: var(--surface); border-radius: 7px; color: var(--text);
}
.select-pill svg { width: 15px; height: 15px; color: var(--muted); }
.select-pill select, .select-pill input { border: 0; background: transparent; font: inherit; font-size: 13px; color: inherit; outline: none; min-width: 0; }
.select-pill select { cursor: pointer; }
/* Native dropdown lists don't inherit a transparent background, so give options explicit theme colors */
select option, select optgroup { background: var(--surface); color: var(--text); }
.select-pill.grow { flex: 1 1 220px; }
.select-pill.grow input { width: 100%; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(.96); }
.btn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.link { color: var(--accent-text); text-decoration: none; font-size: 13px; font-weight: 500; }
.link:hover { text-decoration: underline; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 0 10px; height: 34px; border-radius: 7px; background: var(--surface-2); }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--income); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 5px 12px; border-radius: 7px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }

/* ---------- layout ---------- */
.grid { display: grid; gap: 16px; }
#view > * + * { margin-top: 16px; }
#view > .page-head { margin-bottom: 4px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head .hint { font-size: 12.5px; color: var(--faint); margin-top: 3px; }

.kpi-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.kpi-label .sw { width: 9px; height: 9px; border-radius: 3px; }
.kpi-value { font-size: 25px; font-weight: 650; letter-spacing: -.02em; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { font-size: 12px; color: var(--faint); margin-top: 6px; }
.big-number { font-size: 34px; font-weight: 700; letter-spacing: -.03em; }

/* ---------- charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; overflow: visible; }
.gl { stroke: var(--border); stroke-width: 1; }
.ax { fill: var(--faint); font-size: 11px; font-family: inherit; }
.ln { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.bar { transition: opacity .15s; }
.bar:hover { opacity: .8; }
.bar.dim { opacity: .3; }
.hover-line { stroke: var(--faint); stroke-dasharray: 3 3; }
.hover-dot { fill: var(--surface); stroke-width: 2.5; }
.arc { fill: none; transition: opacity .15s; }
.arc:hover { opacity: .8; }

.donut-wrap { position: relative; width: 100%; margin: 0 auto; aspect-ratio: 1; }
.donut-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .14)); }
.donut-side .arc { filter: brightness(.68) saturate(1.1); }
.arc-deco { pointer-events: none; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.dc-label { font-size: 12.5px; color: var(--muted); }
.dc-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i, .sw { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }

.breakdown { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 32px; align-items: start; }
.barlist { display: flex; flex-direction: column; gap: 14px; }
.bl-row { border-radius: 8px; }
.bl-row.clickable { cursor: pointer; margin: -6px -8px; padding: 6px 8px; }
.bl-row.clickable:hover { background: var(--surface-2); }
.bl-top { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.bl-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.bl-sub { color: var(--faint); font-weight: 400; }
.bl-amt { font-weight: 600; }
.bl-pct { color: var(--faint); font-size: 12px; width: 44px; text-align: right; }
.bl-track, .progress { height: 5px; border-radius: 99px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
.bl-track i, .progress i { display: block; height: 100%; border-radius: 99px; }
.progress.lg { height: 8px; }
.progress i { background: var(--income); }
.progress.warn i { background: var(--warn); }
.progress.over i { background: var(--neg); }

/* ---------- transactions ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.list-summary { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.day-head { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; padding: 14px 4px 6px; border-bottom: 1px solid var(--border); }
.day-head:first-child { padding-top: 0; }
.txn { display: grid; grid-template-columns: 36px minmax(0, 1.5fr) minmax(0, 1fr) 110px 28px; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.txn.compact { grid-template-columns: 36px minmax(0, 1.5fr) minmax(0, 1fr) 100px; }
.txn:last-child { border-bottom: 0; }
.txn-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; background: color-mix(in srgb, var(--c) 14%, transparent); }
.txn-merchant { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.txn.unreviewed .txn-merchant::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.txn-meta { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-amt { text-align: right; font-weight: 600; }
.txn-amt.pos { color: var(--pos); }
.pill { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cat-select { font: inherit; font-size: 12.5px; color: var(--text); background: var(--surface-2); border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; max-width: 100%; cursor: pointer; }
.cat-select:hover { border-color: var(--border); }
.review-btn { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.review-btn svg { width: 14px; height: 14px; }
.review-btn:hover { color: var(--pos); border-color: var(--pos); }
.review-btn.done { visibility: hidden; }
.load-more { display: flex; justify-content: center; padding-top: 16px; }
.empty { text-align: center; padding: 40px 12px; color: var(--faint); }

/* ---------- simple rows (accounts, bills, budget) ---------- */
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
/* In narrow columns the amount wraps below instead of squeezing the name to a few letters */
.row { flex-wrap: wrap; }
.row-main { flex: 1; min-width: 110px; }
.row-amt { margin-left: auto; }
.row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12px; color: var(--faint); }
.row-amt { font-weight: 600; text-align: right; white-space: nowrap; }
.inst { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.spark { width: 80px; height: 28px; flex: none; }
.inst svg { width: 17px; height: 17px; }
.card-spend { width: 180px; flex: none; text-align: right; }
.card-spend .progress { margin: 6px 0 4px; }
@media (max-width: 520px) { .card-spend { width: 120px; } .card-spend .row-sub { display: none; } }
.group-total { font-weight: 600; font-size: 15px; }

.bud-head, .bud-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 112px 100px 110px; gap: 12px; align-items: center; }
.bud-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 0 0 8px; border-bottom: 1px solid var(--border); }
.bud-group { padding: 14px 0 6px; font-weight: 600; display: grid; grid-template-columns: minmax(0, 1.6fr) 112px 100px 110px; gap: 12px; border-bottom: 1px solid var(--border); }
.bud-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.bud-row:last-child { border-bottom: 0; }
.bud-name { min-width: 0; }
.bud-name .row-title { font-size: 13.5px; }
.r { text-align: right; }
.budget-input { width: 100%; text-align: right; font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums; }
.budget-input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.stat-line { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 8px; margin-top: 16px; flex-wrap: wrap; }
.stat-line > :last-child { margin-left: auto; white-space: nowrap; }
.stat-line:first-child { margin-top: 0; }
.stat-line b { font-size: 18px; letter-spacing: -.01em; }
.split-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 3px; margin-top: 10px; }
.split-bar i { display: block; height: 100%; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 720px; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 600; padding: 0 10px 10px; border-bottom: 1px solid var(--border); }
th.r { text-align: right; }
td { padding: 12px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.ticker { display: inline-grid; place-items: center; min-width: 48px; height: 28px; padding: 0 6px; border-radius: 7px; font-weight: 700; font-size: 11.5px; color: #fff; margin-right: 10px; vertical-align: middle; }
.holding { display: flex; align-items: center; }
.holding .row-sub { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* ---------- mobile chrome ---------- */
.tabbar { display: none; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; display: flex; align-items: flex-end; }
.sheet-backdrop[hidden] { display: none; }
.sheet { width: 100%; background: var(--surface); border-radius: 18px 18px 0 0; padding: 12px 12px calc(20px + env(safe-area-inset-bottom)); }
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 99px; background: var(--border); margin: 0 auto 12px; }

#tip {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  background: var(--text); color: var(--bg); font-size: 12px; padding: 7px 10px; border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18); max-width: 240px;
}
#tip b { display: block; font-weight: 600; margin-bottom: 1px; }

/* ---------- add flow: modal, forms, toast ---------- */
.add-btn { width: 100%; justify-content: center; margin-bottom: 14px; height: 38px; }
.plus-icon { display: inline-flex; }
.plus-icon svg { width: 16px; height: 16px; }
.icon-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(15, 16, 20, .45); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal {
  width: min(660px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25); padding: 22px; animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: .5; } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { font-size: 18px; letter-spacing: -.01em; text-wrap: balance; }
.modal-head .sub { margin-top: 4px; }
.add-section { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 600; margin: 18px 0 8px; }
.add-section:first-of-type { margin-top: 0; }
.add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.add-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left;
  padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
}
.add-option:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: var(--surface-2); }
.add-option:focus-visible, .inst-tile:focus-visible, .icon-btn:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.add-text b { display: block; font-size: 13.5px; font-weight: 600; }
.add-text span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.add-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); }
.add-ico svg { width: 18px; height: 18px; }

.form { display: flex; flex-direction: column; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: auto; }
.field-label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.field-label em { font-style: normal; color: var(--faint); font-weight: 400; }
.field-hint { font-size: 12px; color: var(--faint); line-height: 1.4; }
.field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px; width: 100%; min-width: 0;
}
.field input[type=file] { padding: 7px 9px; font-size: 13px; }
.field textarea { min-height: 110px; resize: vertical; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.input-affix { position: relative; }
.input-affix span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.field .input-affix input[name] { padding-left: 24px; font-variant-numeric: tabular-nums; }
.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.seg-radio { align-self: flex-start; flex-wrap: wrap; }
.seg-radio label { position: relative; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span { display: block; padding: 5px 14px; border-radius: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg-radio input:checked + span { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--accent); }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-text); font: inherit; font-weight: 500; cursor: pointer; text-decoration: underline; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 16px; border-top: 1px solid var(--border); }
.form-error { margin-right: auto; color: var(--neg); font-size: 13px; }

.inst-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.inst-tile { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; text-align: left; font-weight: 500; font-size: 13px; min-width: 0; }
.inst-tile:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: var(--surface-2); }
.inst-tile .inst { width: 30px; height: 30px; font-size: 12px; }
.secure-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); margin-top: 14px; }
.secure-note svg { width: 14px; height: 14px; flex: none; }
.connect-logos { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 8px 0 18px; }
.connect-logos .inst, .connect-logos .logo { width: 52px; height: 52px; font-size: 20px; }
.connect-logos i { width: 36px; border-top: 2px dashed var(--border); }
.connect-list { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.connect-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; }
.connect-list svg { width: 16px; height: 16px; color: var(--income); flex: none; margin-top: 2px; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
#toast svg { width: 16px; height: 16px; color: var(--income); flex: none; }
#toast a { color: var(--accent); font-weight: 600; text-decoration: none; margin-left: 4px; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdown { grid-template-columns: 200px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 960px) {
  .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .lang-corner { display: none; }
  .mobile-top .head-actions { gap: 6px; }
  .mobile-top .cur-switch { padding: 0 6px; }
  .mobile-top .cur-switch svg { display: none; }
  .mobile-top .lang-switch button { padding: 5px 8px; }
  #view > .page-head { padding-right: 0; }
  .mobile-top .brand { padding: 4px 0; }
  h1 { font-size: 23px; }
  .kpi-value { font-size: 21px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .breakdown { grid-template-columns: minmax(0, 1fr); }
  .breakdown .donut-wrap { max-width: 220px; }
  .period-label { min-width: 0; }
  .txn, .txn.compact { grid-template-columns: 36px minmax(0, 1fr) auto; row-gap: 4px; }
  .txn-cat { grid-column: 2 / 4; grid-row: 2; }
  .txn .review-btn { display: none; }
  .bud-head, .bud-row, .bud-group { grid-template-columns: minmax(0, 1fr) 84px 78px; }
  .bud-head > :nth-child(4), .bud-row > :nth-child(4), .bud-group > :nth-child(4) { display: none; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0;
    font-size: 10.5px; color: var(--muted); text-decoration: none; border: 0; background: none; cursor: pointer; position: relative;
  }
  .tabbar svg { width: 21px; height: 21px; }
  .tabbar .active { color: var(--accent-text); }
  .tabbar .dot { position: absolute; top: 0; left: calc(50% + 6px); background: var(--accent); color: #fff; font-size: 9.5px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; }
}
@media (max-width: 860px) {
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .add-grid, .inst-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 420px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .add-option { padding: 12px; }
  .kpis { gap: 10px; }
  .kpi-value { font-size: 19px; }
}

/* ---------- footer & legal ---------- */
.site-footer {
  margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
  font-size: 12px; color: var(--faint);
}
.footer-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ch-flag { display: inline-flex; flex: none; }
.ch-flag svg { width: 16px; height: 16px; display: block; border-radius: 2px; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links .link-btn { color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500; }
.footer-links .link-btn:hover { color: var(--text); text-decoration: underline; }
.legal { max-height: 55vh; overflow-y: auto; padding-right: 4px; }
.legal h3 { font-size: 13.5px; margin: 16px 0 4px; }
.legal h3:first-child { margin-top: 0; }
.legal p { margin: 0; font-size: 13.5px; color: var(--muted); max-width: 65ch; line-height: 1.5; }
.legal-note { display: inline-block; font-size: 11.5px; font-weight: 600; letter-spacing: .03em; color: var(--accent-text); background: var(--accent-soft); padding: 3px 8px; border-radius: 99px; margin-bottom: 12px; }

/* ---------- selectable accounts ---------- */
.acct-row { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; transition: background .15s, opacity .15s; }
.acct-row:hover { background: var(--surface-2); }
.acct-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.excluded-label { color: var(--accent-text); font-weight: 600; }

/* ---------- money-flow (Sankey) chart ---------- */
.sk-link { opacity: .34; transition: opacity .15s; }
.sk-link:hover { opacity: .6; }
.sk-node { cursor: default; }
.sk-label { fill: var(--text); font-family: inherit; font-weight: 500; pointer-events: none; }
.sk-pill { fill: var(--surface); opacity: .82; pointer-events: none; }

/* ---------- edit / remove account ---------- */
.danger-zone {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--neg) 35%, var(--border)); border-radius: 10px;
}
.danger-zone b { display: block; font-size: 13.5px; }
.danger-zone span { font-size: 12.5px; color: var(--muted); }
.btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 40%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--neg) 10%, var(--surface)); }
.btn.danger.solid { background: var(--neg); border-color: var(--neg); color: #fff; }
.confirm-text { margin: 0 0 18px; color: var(--muted); font-size: 14px; max-width: 60ch; line-height: 1.5; }

/* ---------- Inversor Inteligente ---------- */
.brand { white-space: normal; line-height: 1.15; font-size: 16px; }
#view > .section-head { margin-top: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.section-head h2 { font-size: 19px; letter-spacing: -.01em; }
.section-head .sub { margin-top: 4px; }
.stack > .section-head { border-bottom: 0; padding-bottom: 0; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 6px; }
.icon-btn.sm svg { width: 14px; height: 14px; }
.pill-held { background: color-mix(in srgb, var(--income) 14%, transparent); color: var(--pos); font-weight: 600; font-size: 11px; vertical-align: middle; }
.pill-featured { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.watch-trend { display: inline-flex; align-items: center; gap: 8px; }
.watch-trend .spark { width: 64px; }
.post { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--faint); }
.post h3 { font-size: 17px; margin: 10px 0 6px; letter-spacing: -.01em; text-wrap: balance; }
.post h3.featured { font-size: 22px; }
.post p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 68ch; }
.post-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
#f-c-message { font-family: inherit; font-size: 14px; min-height: 140px; }
.sent { text-align: center; padding: 28px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sent h3 { margin: 0; font-size: 18px; }
.sent p { margin: 0 0 6px; max-width: 46ch; }
.sent-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--income) 15%, transparent); color: var(--pos); }
.sent-icon svg { width: 22px; height: 22px; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 500; }
.faq p { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; max-width: 65ch; }
.community { display: flex; flex-direction: column; gap: 12px; }
.community-head { display: flex; align-items: center; gap: 12px; }
.community-head h3 { margin: 0; font-size: 15.5px; }
.community-head .faint { font-size: 12.5px; }
.community-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 21px; flex: none; background: color-mix(in srgb, var(--c) 16%, transparent); }
.community p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; flex: 1; }
.community-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
.rules li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--muted); }
.rules li b { color: var(--text); }
.members-top { margin-bottom: 14px; }
.chart-note { font-size: 12px; margin-top: 8px; }
.community-foot .community-btn { background: var(--c); border-color: var(--c); color: #fff; width: 100%; justify-content: center; text-decoration: none; }
.community-foot .community-btn:hover { filter: brightness(1.08); }
.community-note { width: 100%; text-align: center; padding: 9px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text); background: color-mix(in srgb, var(--c) 14%, transparent); }
.rules svg { width: 16px; height: 16px; color: var(--pos); flex: none; margin-top: 2px; }
@media (max-width: 860px) { .rules { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Contacto: ideas form ---------- */
.idea-card { padding: 28px 32px; }
.eyebrow { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); }
.idea-title { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 12px 0 10px; text-wrap: balance; }
.idea-intro { margin: 0 0 22px; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.idea-form { display: flex; flex-direction: column; gap: 16px; }
.idea-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
#f-i-idea { font-family: inherit; font-size: 14px; min-height: 130px; }
.idea-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.idea-send { height: 40px; padding: 0 20px; }
.idea-quota { font-size: 12.5px; color: var(--faint); }
.idea-quota b { color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 560px) {
  .idea-card { padding: 22px 18px; }
  .idea-title { font-size: 24px; }
  .idea-fields { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Substack: post buttons ---------- */
.seg-wrap { flex-wrap: wrap; }
.post-year h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 20px 0 10px; }
.post-year:first-of-type h3 { margin-top: 8px; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 10px; }
.post-btn {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px; min-width: 0;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); text-decoration: none;
  transition: border-color .15s, background .15s;
}
.post-btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); background: var(--surface-2); }
.post-btn:hover .post-btn-go { color: var(--accent-text); }
.post-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-thumb { width: 120px; height: 80px; border-radius: 7px; object-fit: cover; flex: none; background: var(--surface-2); display: block; }
.post-thumb-empty { display: grid; place-items: center; }
.post-thumb-empty svg { width: 30px; height: 30px; }
.post-btn-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.post-btn-meta { font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.post-btn b { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-btn-sub { font-size: 12.5px; color: var(--muted); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-btn-go { color: var(--faint); flex: none; padding-top: 2px; transition: color .15s; }
.post-btn-go svg { width: 14px; height: 14px; }
.kind { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.kind svg { width: 11px; height: 11px; }
.kind-paid { color: var(--accent-text); }
.kind-podcast { color: #8b5cf6; }

/* Pages without the currency selector don't need to keep room for it */
body.no-currency #view > .page-head { padding-right: 0; }

/* Watchlist quality rating (Potencial) */
.rating { display: inline-flex; align-items: center; gap: 8px; cursor: help; white-space: nowrap; }
.rating b { font-size: 13px; min-width: 26px; text-align: right; }
.rating-dots { display: inline-flex; gap: 3px; }
.rating-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.rating-dots i.na { background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.rating-good b { color: var(--pos); } .rating-good .rating-dots i.on { background: var(--pos); }
.rating-mid b { color: #d97706; } .rating-mid .rating-dots i.on { background: #d97706; }
.rating-low b { color: var(--neg); } .rating-low .rating-dots i.on { background: var(--neg); }
.rating-legend { margin: 14px 2px 0; font-size: 12px; line-height: 1.5; color: var(--faint); }

/* Watchlist company icons */
.co-logo { width: 32px; height: 32px; margin-right: 12px; border-radius: 8px; flex: none; object-fit: contain; background: #fff; padding: 3px; box-shadow: inset 0 0 0 1px var(--border); }
.row-sub .sym { font-weight: 600; color: var(--text); }

/* Dashboard: one screen summarising Cartera360 (no page scroll on desktop) */
.chart-fill { flex: 1; min-height: 120px; }
.dash { display: flex; flex-direction: column; gap: 14px; }
.dash .page-head { margin-bottom: 0; }
.dash .grid.kpis { gap: 14px; }
.dash .kpis .card { padding: 14px 18px; }
.dash .kpi-value { font-size: 23px; margin-top: 6px; }
.dash-row { display: grid; gap: 14px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.dash-row-3 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.1fr) minmax(0, 1.1fr); }
.dash-row > .card { display: flex; flex-direction: column; min-height: 260px; padding: 16px 18px; overflow: hidden; }
.dash-row .card-head { margin-bottom: 10px; }
.dash-bars { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 8px; }
.dash-alloc { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dash-split { height: 12px; margin: 2px 0 6px; }
.dash-alloc-list { flex: 1; display: flex; flex-direction: column; justify-content: space-around; font-size: 13px; }
.dash-alloc-list .stat-line { margin-top: 0; flex-wrap: nowrap; }
.dash-alloc-list .stat-line > span:first-child { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-pos-list { display: flex; flex-direction: column; justify-content: space-between; flex: 1; min-height: 0; }
.dash-pos { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; }
.dash-pos .ticker { margin: 0; min-width: 46px; height: 22px; font-size: 10.5px; }
.dash-pos-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.dash-pos .num:last-child { width: 52px; text-align: right; font-size: 12px; }
@media (min-width: 1181px) and (min-height: 600px) {
  body.route-dashboard .main { height: 100vh; padding-bottom: 20px; display: flex; flex-direction: column; overflow: hidden; }
  body.route-dashboard #view { flex: 1; min-height: 0; }
  body.route-dashboard .site-footer { display: none; }
  .dash { height: 100%; }
  .dash-row { flex: 1; min-height: 0; }
  .dash-row > .card { min-height: 0; }
}
@media (max-width: 1180px) { .dash-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dash-row-3 > :first-child { grid-column: 1 / -1; } }
@media (max-width: 860px) { .dash-row, .dash-row-3 { grid-template-columns: minmax(0, 1fr); } .dash-row-3 > :first-child { grid-column: auto; } }

/* Watchlist: wide table with ratios; the security column stays visible while scrolling sideways */
.watch-table th, .watch-table td { white-space: nowrap; }
.watch-table td, .watch-table th { padding-left: 8px; padding-right: 8px; font-size: 13px; }
.watch-table th:first-child, .watch-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.watch-table th:first-child, .watch-table td:first-child { width: var(--valor-w, 306px); min-width: var(--valor-w, 306px); max-width: var(--valor-w, 306px); }
.watch-table .holding > div:last-child { min-width: 0; }
.watch-table .holding .row-sub, .watch-table .holding .row-title { max-width: calc(var(--valor-w, 306px) - 60px); overflow: hidden; text-overflow: ellipsis; }
.th-valor { position: relative; }
.col-resizer { position: absolute; top: 0; right: -4px; width: 9px; height: 100%; cursor: col-resize; z-index: 2; touch-action: none; }
.col-resizer::after { content: ''; position: absolute; top: 20%; bottom: 20%; left: 4px; width: 2px; border-radius: 2px; background: var(--border); }
.col-resizer:hover::after, .col-resizer:focus-visible::after, body.resizing .col-resizer::after { background: var(--accent); }

/* Watchlist column picker */
.col-picker { position: relative; }
.col-picker summary { list-style: none; cursor: pointer; gap: 6px; }
.col-picker summary::-webkit-details-marker { display: none; }
.col-picker summary svg { width: 15px; height: 15px; }
.col-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px; padding: 8px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,.25)); }
.col-menu label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; font-size: 13.5px; cursor: pointer; }
.col-menu label:hover { background: var(--surface-2); }
.col-menu input { accent-color: var(--accent); width: 15px; height: 15px; }
.col-menu .link-btn { margin-top: 4px; padding: 7px 8px; text-align: left; border-top: 1px solid var(--border); border-radius: 0; }

/* Paid content: lock in the menu + paywall */
.nav-lock { margin-left: -5px; display: inline-flex; color: var(--faint); } /* right after the label, also when the menu is widened */
.nav .nav-lock svg { width: 14px; height: 14px; }
.nav-lock.locked { color: #d97706; }
.paywall { max-width: 480px; }
.paywall-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: color-mix(in srgb, #d97706 16%, transparent); color: #d97706; }
.paywall-icon svg { width: 26px; height: 26px; }

/* Logged-out card: one button, same as the landing's 'Entrar al panel' */
.signed-out-cta { height: 48px; padding: 0 30px; font-size: 15.5px; }

/* "Sincronizado" with a green tick (page subtitles) */
.synced { display: inline-flex; align-items: center; gap: 4px; color: var(--pos); font-weight: 500; vertical-align: -2px; }
.synced svg { width: 14px; height: 14px; stroke-width: 2.6; }

/* Watchlist categories: coloured label + filter */
.sector-tag { color: color-mix(in srgb, var(--c) 82%, var(--text)); font-weight: 500; }
.picker-row { display: flex; gap: 8px; align-items: center; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cat-picker .col-menu { min-width: 290px; }
.cat-picker .col-menu label { white-space: nowrap; }
.cat-picker .col-menu label span:not(.cat-count) { flex: 1; }
.cat-count { font-size: 12px; }
.cat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; border-top: 1px solid var(--border); }
.cat-foot .link-btn { border-top: 0; margin-top: 0; }
.cat-foot .faint { font-size: 12px; padding-right: 8px; }
.cat-picker summary.filtered { border-color: var(--accent); color: var(--accent-text); }

.watch-table th.th-sorted { color: var(--text); }

/* Sortable watchlist headers */
.sort-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.sort-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.sort-arrow { font-size: 11px; opacity: .45; }
.th-sorted .sort-arrow { opacity: 1; color: var(--accent-text); }
.sort-btn:hover .sort-arrow { opacity: 1; }

/* Cartera360 summary: total, today, accumulated gain (large), 30-day change */
.cartera-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .75fr) minmax(0, 1.25fr) minmax(0, 1fr); gap: 0; padding: 0; margin-bottom: 8px; }
.cs-item { padding: 13px 20px; min-width: 0; }
.cartera-summary .kpi-value { margin-top: 4px; font-size: clamp(18px, 1.75vw, 25px); }
.cartera-summary .kpi-foot { margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-item + .cs-item { border-left: 1px solid var(--border); }
.cartera-summary .kpi-foot .pos, .cartera-summary .kpi-foot .neg, .cartera-summary .kpi-foot.pos, .cartera-summary .kpi-foot.neg { font-weight: 600; }
@media (max-width: 1180px) {
  .cartera-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cs-item:nth-child(odd) { border-left: 0; }
  .cs-item:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* Rentabilidad: same height as the Distribución card next to it; the chart fills it */
.span-2:has(> .perf-card) { display: flex; }
.perf-card { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.perf-card .chart-fill { min-height: 260px; }

/* Menu: sub-item under Cartera360 (Trades) */
.nav-group { display: flex; flex-direction: column; }
.nav-subs { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .18s ease, opacity .18s ease; }
.nav-subs-inner { overflow: hidden; min-height: 0; display: flex; flex-direction: column; } /* one grid child, so 0fr collapses every sub-item */
.nav-group:hover .nav-subs, .nav-group:focus-within .nav-subs, .nav-group.open .nav-subs { grid-template-rows: 1fr; opacity: 1; }
.nav-group:not(:hover):not(:focus-within):not(.open) .nav-subs a { padding-top: 0; padding-bottom: 0; visibility: hidden; }
.nav a.nav-sub { padding-left: 39px; margin-top: 2px; font-size: 14px; position: relative; transition: padding .18s ease; }
.nav a.nav-sub::before { content: ''; position: absolute; left: 19px; top: 50%; width: 10px; height: 1px; background: var(--border); }
.nav a.parent-active { color: var(--text); }
/* Trades */
.trade-type { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.trade-type.buy { background: color-mix(in srgb, #22c55e 16%, transparent); color: #16a34a; } /* buys green, sells orange: never red */
.trade-type.sell { background: color-mix(in srgb, #f97316 16%, transparent); color: #ea580c; }
.trade-ret { color: #ea580c; font-weight: 600; }
.trade-amt.sell { color: #ea580c; }
[data-theme="dark"] .trade-type.buy { color: #4ade80; } [data-theme="dark"] .trade-type.sell, [data-theme="dark"] .trade-ret, [data-theme="dark"] .trade-amt.sell { color: #fb923c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .trade-type.buy { color: #4ade80; } :root:not([data-theme="light"]) .trade-type.sell, :root:not([data-theme="light"]) .trade-ret, :root:not([data-theme="light"]) .trade-amt.sell { color: #fb923c; } }

.cs-pct-inline { font-size: .62em; font-weight: 600; letter-spacing: 0; }

/* Calculadora */
.calc-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.calc-form .calc-field { margin: 0; grid-column: auto; display: flex; flex-direction: column; gap: 6px; }
.calc-form input { width: 100%; }
.calc-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
@media (max-width: 860px) { .calc-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } .calc-kpis { grid-template-columns: minmax(0, 1fr); } }

/* Calculadora: tabs */
.calc-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.calc-tab { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 99px; padding: 8px 13px; font: inherit; font-size: 13.5px; white-space: nowrap; font-weight: 600; cursor: pointer; }
.calc-tab:hover { color: var(--text); }
.calc-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.calc-form-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dg-intro { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; line-height: 1.55; max-width: 80ch; }
/* Diagnóstico */
.dg-privacy { border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 8px 8px 0; padding: 10px 14px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.dg-privacy b { color: var(--text); }
.dg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dg-form { display: flex; flex-direction: column; gap: 14px; }
.dg-group { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); margin-top: 6px; }
.dg-field .field-hint { font-size: 12px; color: var(--faint); }
.dg-card { position: sticky; top: 16px; }
.dg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-size: 15px; }
.dg-logo { width: 30px; height: 30px; display: inline-flex; }
.dg-logo img { width: 100%; height: 100%; border-radius: 8px; background: #fff; }
.dg-net { font-size: 40px; font-weight: 700; letter-spacing: -.03em; margin: 4px 0 10px; }
.dg-have { display: flex; gap: 28px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.dg-have span { display: block; font-size: 12px; color: var(--faint); }
.dg-have b { font-size: 14px; }
.dg-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.dg-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--faint); }
.dg-dot.good { background: var(--pos); } .dg-dot.mid { background: var(--warn); } .dg-dot.bad { background: var(--neg); } .dg-dot.info { background: #3b82f6; }
.dg-main { flex: 1; min-width: 0; }
.dg-main b { display: block; font-size: 14px; }
.dg-main span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.dg-val { font-weight: 700; font-size: 15px; white-space: nowrap; }
.dg-select { font: inherit; font-size: 12.5px; font-weight: 600; color: var(--accent-text); background: none; border: 0; border-bottom: 1px dashed var(--accent-text); padding: 0 2px; cursor: pointer; }
.dg-step { margin-top: 16px; background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 10px; padding: 14px 16px; }
.dg-step span { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; color: var(--accent-text); }
.dg-step p { margin: 6px 0 0; font-size: 14px; line-height: 1.5; }
@media (max-width: 960px) { .dg-grid { grid-template-columns: minmax(0, 1fr); } .dg-card { position: static; } .calc-form-3 { grid-template-columns: minmax(0, 1fr); } }

/* La regla del 4% */
.fire-form { display: flex; flex-direction: column; gap: 18px; }
.fire-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.fire-num { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-text); font-weight: 700; }
.fire-num input { width: 96px; text-align: right; font: inherit; color: inherit; background: transparent; border: 0; border-bottom: 1px dashed transparent; padding: 2px 0; -moz-appearance: textfield; }
.fire-num input::-webkit-outer-spin-button, .fire-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fire-num input:hover, .fire-num input:focus { border-bottom-color: var(--accent-text); outline: none; }
.fire-num em { font-style: normal; }
.fire-field input[type=range] { width: 100%; margin-top: 10px; accent-color: var(--accent); }
.fire-card { text-align: center; padding: 26px 22px; }
.fire-label { font-size: 13px; color: var(--muted); }
.fire-goal { font-size: 44px; font-weight: 700; letter-spacing: -.03em; color: var(--accent-text); margin: 4px 0 14px; }
.fire-left-label { font-size: 11.5px; font-weight: 700; letter-spacing: .12em; color: var(--faint); }
.fire-left { font-size: 22px; font-weight: 700; margin-top: 2px; }
.fire-when { font-size: 16px; font-weight: 700; color: var(--pos); margin-top: 2px; }
.fire-track { height: 8px; border-radius: 99px; background: var(--surface-2); margin: 20px 0 8px; overflow: hidden; }
.fire-track i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.fire-prog { font-size: 13px; color: var(--muted); }
.fire-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); text-align: left; font-size: 12.5px; }
.fire-sum div { display: flex; justify-content: space-between; gap: 8px; }
.fire-sum span { color: var(--muted); }
.fire-note { margin-top: 16px; }

/* Simulador de patrimonio */
.wl-cats { display: flex; flex-direction: column; gap: 8px; }
.wl-cat { display: grid; grid-template-columns: 38px minmax(0, 1fr) minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.wl-cat input[type=color] { width: 38px; height: 38px; padding: 3px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); cursor: pointer; }
.wl-add { align-self: flex-start; margin-top: 2px; }
.wl-facts { display: flex; gap: 26px; padding-bottom: 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.wl-facts span { display: block; font-size: 12px; color: var(--faint); }
.wl-facts b { font-size: 14px; }
.wl-donut { max-width: 210px; margin: 18px auto 10px; }
.wl-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.wl-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* Simulador: category name/amount inputs share the form input look */
.wl-cat input[type=text], .wl-cat input[type=number] {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px; padding: 9px 11px; width: 100%; min-width: 0;
}
.wl-cat input[type=text]:focus, .wl-cat input[type=number]:focus { outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }

/* Calculadora FIRE */
.fc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.fc-col { display: flex; flex-direction: column; gap: 16px; }
.fc-card h3 { margin: 2px 0 14px; font-size: 18px; text-align: center; }
.fc-eyebrow { text-align: center; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; color: var(--accent-text); }
.fc-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; }
.fc-in { display: inline-flex; align-items: center; gap: 6px; }
.fc-in input, .fc-select { width: 150px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; text-align: right; }
.fc-select { text-align: left; width: 182px; }
.fc-in em { font-style: normal; color: var(--faint); min-width: 22px; }
.fc-hint { font-style: normal; color: var(--faint); cursor: help; }
.fc-slide { display: grid; grid-template-columns: auto 52px minmax(0, 1fr); align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.fc-slide input[type=range] { width: 100%; accent-color: var(--accent); }
.fc-cashbar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.fc-cashbar i { display: block; height: 100%; background: var(--faint); }
.fc-asset { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fc-asset > b { font-size: 14px; }
.fc-eff { margin: 12px 0 6px; font-size: 14px; }
.fc-band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; margin: 16px 0; padding: 22px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.fc-band b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.fc-band .fc-age b { font-size: 42px; }
.fc-band span { font-size: 13px; color: var(--muted); }
.fc-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; font-size: 12.5px; }
.fc-chips span { background: var(--surface-2); border-radius: 99px; padding: 4px 10px; color: var(--muted); }
tr.fc-hit td { background: color-mix(in srgb, var(--pos) 12%, transparent); font-weight: 600; }
@media (max-width: 960px) { .fc-grid, .fc-band { grid-template-columns: minmax(0, 1fr); } .fc-band { gap: 12px; } }

/* Salario neto */
.sl-gross { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--border); }
.sl-gross b { color: var(--text); }
.sl-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 12px; }
.sl-pay.one { grid-template-columns: 1fr; }
.sl-pay div, .sl-take { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.sl-pay span, .sl-take span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--faint); }
.sl-pay b { font-size: 18px; }
.sl-take b { display: block; font-size: 17px; color: var(--neg); }
.sl-take em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.sl-wedge { margin: 10px 0; font-size: 13px; color: var(--muted); }
.sl-rows > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.sl-rows span { color: var(--muted); }
.sl-steps .sl-step { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.sl-steps .sl-step.total { font-weight: 700; }
.sl-steps p { color: var(--muted); font-size: 13.5px; line-height: 1.55; margin: 12px 0 0; }

.calc-soon { text-align: center; padding: 48px 24px; }
.calc-soon h2 { margin: 0 0 8px; }
.calc-soon p { margin: 0; color: var(--muted); }

/* Calculadora de presupuesto */
.bd-field .input-affix span { left: 12px; }
.bd-pct { font-weight: 700; color: var(--accent-text); }
.bd-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 8px; vertical-align: 0; }
.bd-total { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 14px; }
.bd-total b { text-align: right; font-size: 18px; }
.bd-total em { grid-column: 1 / -1; text-align: right; font-style: normal; font-size: 12.5px; color: var(--muted); }
.bd-total em.pos { color: var(--pos); } .bd-total em.neg { color: var(--neg); }
.bd-rules { display: flex; flex-wrap: wrap; }
.bd-rule b { display: block; font-size: 15px; }
.bd-rule span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--accent-text); margin-top: 3px; }
.bd-rule p { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.bd-targets { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13.5px; }
.bd-targets div { display: flex; align-items: center; gap: 8px; }
.bd-targets i { width: 9px; height: 9px; border-radius: 3px; }
.bd-targets b { margin-left: auto; }
.bd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 11.5px; font-weight: 700; letter-spacing: .1em; color: var(--muted); margin-bottom: 14px; }
.bd-verdict { padding: 4px 10px; border-radius: 99px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
.bd-verdict.good { background: color-mix(in srgb, var(--pos) 16%, transparent); color: var(--pos); }
.bd-verdict.mid { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.bd-verdict.bad { background: color-mix(in srgb, var(--neg) 16%, transparent); color: var(--neg); }
.bd-bars { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 12.5px; color: var(--muted); }
.bd-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; margin-bottom: 6px; }
.bd-bar i { display: block; height: 100%; }
.bd-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.bd-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.bd-st { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 8px; border-radius: 99px; }
.bd-st.good { background: color-mix(in srgb, var(--pos) 14%, transparent); color: var(--pos); }
.bd-st.bad { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.bd-msg { margin: 14px 0 0; font-size: 14px; line-height: 1.55; }
#bud-result { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }

.bd-field input { width: 100%; font: inherit; font-size: 15px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-top: 6px; }
.bd-field input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); }
.bd-field .input-affix span { top: calc(50% + 3px); }

/* Fondo de emergencia */
.ef-seg { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.ef-seg .seg { display: flex; flex-wrap: wrap; }
.ef-check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.ef-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.ef-comfort { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ef-comfort button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; }
.ef-comfort button span { font-size: 11px; opacity: .8; }
.ef-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ef-why { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.ef-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ef-chips span { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.ef-chips span.neg { background: color-mix(in srgb, var(--pos) 14%, transparent); color: var(--pos); }
.ef-cmp { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; line-height: 1.5; }
.ef-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.ef-kpis div, .ef-fast div { background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.ef-kpis span { display: block; font-size: 11.5px; color: var(--faint); }
.ef-kpis b { font-size: 15px; }
.ef-fast { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.ef-fast > span, .ef-mss > span { grid-column: 1 / -1; font-size: 11px; font-weight: 700; letter-spacing: .1em; color: var(--faint); }
.ef-fast em { display: block; font-style: normal; font-size: 12px; color: var(--muted); }
.ef-chart-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin: 4px 0 6px; }
.ef-chart-head span { color: var(--faint); font-size: 12px; }
.ef-mss { margin-top: 12px; }
.ef-mss > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.ef-ms { border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; font-size: 12px; }
.ef-ms b { display: block; font-size: 15px; }
.ef-ms span { display: block; color: var(--muted); }
.ef-ms em { display: block; font-style: normal; color: var(--faint); margin-top: 2px; }
.ef-ms.done { border-color: var(--pos); }
.ef-ms.done em { color: var(--pos); }

/* Simulador Monte Carlo */
.mc-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.mc-mode { display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; }
.mc-mode svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--muted); }
.mc-mode b { display: block; font-size: 14px; }
.mc-mode em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.mc-mode.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.mc-mode.on svg { color: var(--accent-text); }
.mc-results { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.mc-runs { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--faint); border: 1px solid var(--border); border-radius: 6px; padding: 3px 7px; }
.mc-pcts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.mc-pcts div, .mc-totals div { background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.mc-pcts span, .mc-totals span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--faint); }
.mc-pcts b, .mc-totals b { font-size: 16px; }
.mc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.mc-legend i { display: inline-block; width: 16px; height: 8px; margin-right: 6px; vertical-align: 0; border-radius: 2px; }
.mc-legend i.band { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.mc-legend i.med { background: var(--accent); height: 3px; }
.mc-legend i.naive { border-top: 2px dashed var(--muted); height: 0; }
.mc-legend i.tgt { border-top: 2px dashed var(--pos); height: 0; }
.mc-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 860px) { .mc-modes { grid-template-columns: minmax(0, 1fr); } }

/* Punto de cruce */
.cx-ratio { margin: 10px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.mc-legend i.cx-mine { background: var(--muted); height: 3px; }
.cx-ms { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cx-ms div { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.cx-ms i { font-style: normal; width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.cx-ms span { flex: 1; font-size: 13.5px; }
.cx-ms b { font-size: 14px; }
.cx-note { margin: 10px 0 0; }
.cx-levers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.cx-levers div { background: var(--surface-2); border-radius: 10px; padding: 9px 12px; border: 1px solid transparent; }
.cx-levers div.on { border-color: var(--accent); }
.cx-levers span { display: block; font-size: 12px; color: var(--muted); }
.cx-levers b { font-size: 16px; }
.cx-toggle { margin-top: 12px; }
.cx-table { margin-top: 10px; max-height: 360px; overflow: auto; }
.cx-table tr.cx-hit td { color: var(--accent-text); font-weight: 700; }

/* Solapamiento de ETFs */
.ov-pickers { margin-bottom: 16px; }
.ov-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: center; margin-top: 8px; }
.ov-pick { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ov-pick > span { font-size: 13px; color: var(--muted); }
.ov-pick select.dg-select { width: 100%; font-size: 14.5px; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; }
.ov-pick select.dg-select:focus { outline: none; border-color: var(--accent); }
.ov-pick em { font-style: normal; font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-vs { border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); border-radius: 999px; width: 44px; height: 44px; font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; }
.ov-vs:hover { color: var(--text); border-color: var(--accent); }
.ov-bars { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.ov-bar { display: grid; grid-template-columns: 56px minmax(0, 1fr) 44px; gap: 10px; align-items: center; font-size: 13px; }
.ov-bar > div { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ov-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.ov-bar b { text-align: right; }
.ov-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ov-msg { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; line-height: 1.5; }
.ov-msg.bad { background: color-mix(in srgb, var(--neg) 10%, var(--surface)); }
.ov-msg.good { background: color-mix(in srgb, var(--pos) 10%, var(--surface)); }
.ov-note { margin: 10px 0 4px; font-size: 13px; }
.ov-matrix-card { margin-top: 16px; }
.ov-matrix { border-collapse: separate; border-spacing: 4px; font-size: 12.5px; margin-top: 6px; }
.ov-matrix th { font-weight: 700; color: var(--muted); padding: 4px 6px; text-align: center; }
.ov-matrix tbody th { text-align: left; }
.ov-matrix td { padding: 0; }
.ov-self { text-align: center; color: var(--faint); }
.ov-cell { width: 100%; min-width: 52px; padding: 8px 4px; border: 1px solid transparent; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; color: var(--text);
  background: color-mix(in srgb, var(--accent) calc(var(--o) * 85%), var(--surface-2)); }
.ov-cell:hover, .ov-cell.on { border-color: var(--text); }
.ov-scale { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.ov-scale i { width: 120px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--surface-2), var(--accent)); }
@media (max-width: 640px) { .ov-row { grid-template-columns: minmax(0, 1fr); } .ov-vs { justify-self: center; } .ov-kpis { grid-template-columns: 1fr 1fr; } }
table.ov-top, table.ov-cost { min-width: 0; }
table.ov-matrix { min-width: 560px; width: 100%; }

/* Calculadora de hipoteca */
.mg-loan { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-top: 4px; }
.mg-loan span { font-size: 13px; color: var(--muted); flex: 1; }
.mg-loan b { font-size: 17px; }
.mg-loan em { font-style: normal; font-size: 12px; color: var(--faint); }
.mg-date { width: 100%; font: inherit; font-size: 14.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color-scheme: light dark; }
.mg-opt { font-size: 10.5px; color: var(--faint); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; margin-left: 6px; letter-spacing: .06em; }
.mg-extra-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
.mg-extra-row .ef-seg { margin-bottom: 14px; }
.mg-stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; margin: 12px 0 8px; }
.mg-parts { display: flex; flex-direction: column; gap: 4px; }
.mg-parts div { display: flex; justify-content: space-between; font-size: 13.5px; }
.mg-parts i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 8px; }
.mg-kpis { margin-top: 12px; }
.mg-kpis em { display: block; font-style: normal; font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.mc-legend i.mg-princ { background: var(--pos); height: 3px; }
.mc-legend i.mg-int { border-top: 2px dashed var(--warn); height: 0; }
.mg-table { max-height: 420px; }
.ov-msg.mid { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.mg-region.dg-select { width: 100%; font-size: 14.5px; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; }
.mg-buy { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.mg-buy div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 2px; }
.mg-buy em { font-style: normal; color: var(--faint); font-size: 12px; margin-left: 4px; }
.mg-buy-sum { border-top: 1px solid var(--border); font-weight: 600; }
.mg-buy-total { border-top: 1px solid var(--border); margin-top: 2px; padding-top: 10px !important; font-size: 15px; }
.mg-buy-total b { color: var(--accent-text); font-size: 18px; }
.mg-buy-note { color: var(--muted); font-size: 12.5px; border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 8px !important; }
.rb-kpis { margin-top: 12px; }
.rb-kpis b.pos { color: var(--pos); } .rb-kpis b.neg { color: var(--neg); }
.community-count { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 15px; color: var(--muted); margin-top: auto; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--c) 10%, var(--surface-2)); }
.community-count svg { width: 22px; height: 22px; color: var(--c); flex: none; }
.community-count b { color: var(--text); font-size: 24px; line-height: 1; margin-right: 2px; }
.community-join { display: block; text-align: center; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--c); text-decoration: none; }
.community-join:hover { text-decoration: underline; }
@media (min-width: 961px) { .lang-corner:not([hidden]) { display: flex; flex-direction: column; align-items: flex-end; } }
.fx-note { display: flex; flex-direction: column; align-items: flex-end; margin-top: 5px; font-size: 10.5px; line-height: 1.35; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fx-note em { font-style: normal; opacity: .85; }

/* Pilar 3a */
.calc-tab .flag-ch { width: 14px; height: 14px; vertical-align: -2px; margin-right: 6px; border-radius: 3px; }
.p3-tbl { min-width: 0; margin-top: 10px; font-size: 13px; }
.p3-tbl tr.p3-total td { font-weight: 700; border-top: 1px solid var(--border); }
.p3-kpis { margin-top: 12px; }
.p3-kpis em { display: block; font-style: normal; font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.p3-max { padding: 3px 9px; font-size: 11px; font-weight: 700; letter-spacing: .05em; }
.p3-adv-toggle { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.p3-adv-toggle .dg-group { margin: 0; }
.p3-chev { margin-left: auto; font-size: 18px; color: var(--muted); }
.mc-legend i.p3-paid { background: #d52b1e; height: 3px; }
.calc-tab.on .flag-ch { box-shadow: 0 0 0 1.5px #fff; }
.row-sub .isin { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* Dashboard · Fear & Greed */
.dash-row-top { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 1.05fr); }
.fng-pair { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fng { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-width: 0; background: var(--surface-2); border-radius: 12px; padding: 8px 6px 6px; }
.fng-title { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.fng-gauge { width: 100%; max-width: 130px; height: auto; margin-top: 4px; }
.fng-val { font-size: 24px; font-weight: 700; line-height: 1; margin-top: 2px; }
.fng-label { font-size: 12.5px; font-weight: 700; margin-top: 4px; }
.fng-prev { display: flex; gap: 8px; margin-top: 8px; font-size: 11px; }
.fng-prev span { display: flex; flex-direction: column; align-items: center; }
.fng-prev em { font-style: normal; color: var(--faint); }
.fng-src { margin-top: 6px; font-size: 10.5px; color: var(--faint); text-decoration: none; }
.fng-src:hover { text-decoration: underline; }
@media (max-width: 1180px) { .dash-row-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dash-row-top > :first-child { grid-column: 1 / -1; } }
@media (max-width: 860px) { .dash-row-top { grid-template-columns: minmax(0, 1fr); } .dash-row-top > :first-child { grid-column: auto; } }

/* Dividendos */
.div-row { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.div-payers { display: flex; flex-direction: column; gap: 6px; }
.div-payer { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.div-payer .ticker { margin: 0; min-width: 46px; height: 22px; font-size: 10.5px; }
.div-payer .co-logo { width: 22px; height: 22px; }
.div-payer-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.div-payer-name b { color: var(--text); margin-right: 4px; }
@media (max-width: 860px) { .div-row { grid-template-columns: minmax(0, 1fr); } }
.div-table tr.div-off td { opacity: .62; }
.div-badge { display: inline-block; font-size: 10.5px; font-weight: 700; color: #b45309; background: color-mix(in srgb, #f59e0b 16%, transparent); border-radius: 6px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.dash-row-bottom { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 860px) { .dash-row-bottom { grid-template-columns: minmax(0, 1fr); } }
.dash .perf-card .chart-fill { min-height: 0; }
/* Dashboard · sentiment in the KPI row */
.fng-kpi { display: flex; flex-direction: column; }
.fng-mini-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; flex: 1; align-items: center; }
.fng-mini { display: flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; }
.fng-mini .fng-gauge { width: 54px; max-width: 54px; flex: none; margin: 0; }
.fng-mini > div { min-width: 0; line-height: 1.15; }
.fng-mini-t { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.fng-mini b { font-size: 20px; }
.fng-mini-l { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.fng-mini-s { display: block; font-size: 10px; color: var(--faint); }
@media (min-width: 1181px) { .dash .grid.kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr); } }
@media (max-width: 1180px) { .dash .grid.kpis.dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .dash .grid.kpis.dash-kpis { grid-template-columns: minmax(0, 1fr); } }
.fng-mini-pair { gap: 14px; }
.fng-mini .fng-gauge { width: 50px; max-width: 50px; }
.fng-mini-v { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.fng-mini-v b { font-size: 22px; line-height: 1.1; }
.dash-row-full { grid-template-columns: minmax(0, 1fr); }
.dash-row-bottom3 { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .dash-row-bottom3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dash-row-bottom3 > :first-child { grid-column: 1 / -1; } }
@media (max-width: 860px) { .dash-row-bottom3 { grid-template-columns: minmax(0, 1fr); } .dash-row-bottom3 > :first-child { grid-column: auto; } }
/* Rentabilidad (full width) a bit lower than the row below */
@media (min-width: 1181px) and (min-height: 600px) { .dash-row.dash-row-full { flex: 0.8; } .dash-row.dash-row-bottom3 { flex: 1.2; } }
.dash-row-full > .card { min-height: 220px; }
/* Dashboard · Patrimonio: net worth chart on top, assets below */
.nw-card .nw-chart { flex: 1.15; min-height: 0; display: flex; }
.nw-card .nw-chart .chart-fill { min-height: 110px; }
.nw-card .nw-bars { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; align-content: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
@media (max-width: 860px) { .nw-card .nw-bars { grid-template-columns: minmax(0, 1fr); } }
/* Dashboard · Principales posiciones (dynamic) */
.dash-pos-card .card-head { flex-wrap: wrap; gap: 8px; }
.dash-pos-card .seg button { padding: 4px 9px; font-size: 12px; }
a.dash-pos { color: inherit; text-decoration: none; border-radius: 10px; padding: 5px 6px; margin: 0 -6px; transition: background .15s ease, transform .15s ease; }
a.dash-pos:hover { background: var(--surface-2); transform: translateX(2px); }
.dash-pos-logo { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.dash-pos .ticker { min-width: 46px; height: 26px; }
.dash-pos-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dash-pos-main .dash-pos-name { color: var(--text); font-size: 13px; }
.dash-pos-main .dash-pos-name b { font-weight: 600; }
.dash-pos-sub { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.dash-pos-w { flex: 1; height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: block; }
.dash-pos-w i { display: block; height: 100%; border-radius: 99px; }
.dash-pos-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; white-space: nowrap; }
.dash-pos-right b { font-size: 13px; }
.dash-pos .num:last-child { width: auto; }

/* Fiscalidad */
.tax-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tax-post { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; color: inherit; text-decoration: none; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.tax-post:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.tax-thumb { aspect-ratio: 16 / 10; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.tax-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tax-thumb svg { width: 40px; height: 40px; color: var(--faint); }
.tax-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.tax-meta { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tax-title { font-size: 15.5px; line-height: 1.35; }
.tax-sub { font-size: 13px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Rentabilidad chart: live header, draw-in animation, glow, pulsing last point, contribution markers */
.perf-live { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: -2px 0 6px; min-height: 30px; }
.perf-live-v { font-size: 22px; font-weight: 700; letter-spacing: -.01em; transition: color .15s ease; }
.perf-live-g { font-size: 13.5px; font-weight: 700; }
.perf-live-d { font-size: 12px; color: var(--faint); }
.perf-live.hovering .perf-live-v { color: #a78bfa; }
.ln-glow { filter: drop-shadow(0 0 6px color-mix(in srgb, #8b5cf6 55%, transparent)); }
.ln-anim { stroke-dasharray: 1; stroke-dashoffset: 1; animation: ln-draw 1.3s cubic-bezier(.25,.8,.25,1) forwards; }
@keyframes ln-draw { to { stroke-dashoffset: 0; } }
.area-anim { opacity: 0; animation: area-in .9s ease .45s forwards; }
@keyframes area-in { to { opacity: 1; } }
.fade-in { opacity: 0; animation: area-in .5s ease 1.1s forwards; }
.pulse-ring { fill: none; stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pulse-ring 1.8s ease-out infinite; }
@keyframes pulse-ring { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(3); opacity: 0; } }
.ln-marker text { font-size: 10.5px; }
@media (prefers-reduced-motion: reduce) { .pulse-ring { animation: none; opacity: 0; } }
.ln-marker text { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.ln-marker { cursor: pointer; outline: none; }
.ln-marker .mk-pop { display: none; }
.ln-marker.open .mk-pop { display: inline; }
.ln-marker:hover .mk-diamond, .ln-marker.open .mk-diamond, .ln-marker:focus-visible .mk-diamond { stroke: var(--text); stroke-width: 2; }
.ln-marker .mk-pop rect { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .25)); }
.closed-tag { display: block; width: fit-content; margin-top: 4px; padding: 1px 7px; border-radius: 99px; font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); }
.post-year .tax-grid { margin-top: 10px; }
.tax-thumb svg, .tax-thumb img[src=''] { width: 48px; height: 48px; }
/* Subscribers cannot edit: owner-only controls are hidden (and blocked in app.js) */
body.not-owner [data-action="add"], body.not-owner [data-action="watch-remove"], body.not-owner [data-action="edit-acct"],
body.not-owner [data-action^="acct-delete"], body.not-owner [data-action="review-all"], body.not-owner [data-action="toggle-review"],
body.not-owner [data-action="review"], body.not-owner [data-action="csv-sample"], body.not-owner [data-action="connect-inst"] { display: none !important; }

/* Cartera360 · stock performance bars (Distribución box, second view) */
.pb-list { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.pb-row { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 6px; height: 14px; font-size: 10.5px; }
.pb-sym { color: var(--muted); font-weight: 600; text-align: right; white-space: nowrap; }
.pb-track { position: relative; height: 12px; }
.pb-zero { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--text); opacity: .6; }
.pb-bar { position: absolute; top: 0; height: 100%; border-radius: 2px; transform-origin: left; animation: pb-in .6s ease both; }
.pb-bar b { position: absolute; top: 50%; transform: translateY(-50%); font-size: 9.5px; font-weight: 700; white-space: nowrap; }
.pb-out { position: absolute; top: 50%; transform: translateY(-50%); font-size: 9.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pb-row:hover .pb-bar { filter: brightness(1.15); }
@keyframes pb-in { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
.pb-legend { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 10px; font-size: 10.5px; color: var(--muted); }
.pb-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
@media (prefers-reduced-motion: reduce) { .pb-bar { animation: none; } }
.pb-out.neg { color: var(--muted); }

/* Moving background ("video" feel without a video file): blurred colour blobs drifting slowly behind the content.
   Strong on the landing, subtle in the panel (only shows between the opaque cards). Off with reduced motion. */
.bg-motion { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; --bg-op: .16; }
body.landing .bg-motion { --bg-op: .42; }
.bg-motion i { position: absolute; width: 58vmax; height: 58vmax; border-radius: 50%; filter: blur(70px); opacity: var(--bg-op); will-change: transform; }
.bg-motion i:nth-child(1) { background: radial-gradient(circle, #e5484d 0%, transparent 65%); top: -18vmax; left: -12vmax; animation: bg-drift-a 26s ease-in-out infinite alternate; }
.bg-motion i:nth-child(2) { background: radial-gradient(circle, #8b5cf6 0%, transparent 65%); bottom: -22vmax; right: -14vmax; animation: bg-drift-b 32s ease-in-out infinite alternate; }
.bg-motion i:nth-child(3) { background: radial-gradient(circle, #2f7de1 0%, transparent 65%); top: 30%; left: 40%; width: 44vmax; height: 44vmax; animation: bg-drift-c 38s ease-in-out infinite alternate; }
.bg-motion i:nth-child(4) { background: radial-gradient(circle, #f59e0b 0%, transparent 65%); top: 55%; left: -10vmax; width: 36vmax; height: 36vmax; opacity: calc(var(--bg-op) * .7); animation: bg-drift-d 44s ease-in-out infinite alternate; }
@keyframes bg-drift-a { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(28vw, 18vh) scale(1.15); } 100% { transform: translate(12vw, 42vh) scale(.95); } }
@keyframes bg-drift-b { 0% { transform: translate(0, 0) scale(1.05); } 50% { transform: translate(-30vw, -22vh) scale(.9); } 100% { transform: translate(-12vw, -40vh) scale(1.12); } }
@keyframes bg-drift-c { 0% { transform: translate(0, 0) scale(.9); } 50% { transform: translate(-25vw, 15vh) scale(1.2); } 100% { transform: translate(18vw, -20vh) scale(1); } }
@keyframes bg-drift-d { 0% { transform: translate(0, 0); } 50% { transform: translate(40vw, -25vh); } 100% { transform: translate(70vw, 10vh); } }
.app, body.landing .l-hero { position: relative; z-index: 1; }
:root[data-theme="light"] .bg-motion { --bg-op: .12; } :root[data-theme="light"] body.landing .bg-motion { --bg-op: .3; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .bg-motion { --bg-op: .12; } :root:not([data-theme="dark"]) body.landing .bg-motion { --bg-op: .3; } }
@media (prefers-reduced-motion: reduce) { .bg-motion i { animation: none; } }
/* Hide balances (privacy) */
.profile-row { display: flex; align-items: center; gap: 4px; }
.profile-row .profile { flex: 1; min-width: 0; }
.bal-toggle { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.bal-toggle svg { width: 17px; height: 17px; }
.bal-toggle:hover { background: var(--surface-2); color: var(--text); }
.bal-toggle.on { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.page-head h1 .bal-toggle { display: inline-grid; vertical-align: middle; margin-left: 6px; width: 32px; height: 32px; }
.idea-to { font-size: 12.5px; color: var(--muted); }
.idea-to b { color: var(--text); font-weight: 600; }
.idea-honey { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.idea-error { color: var(--neg); font-size: 13px; margin: 0 0 10px; }
/* Contact: ideas received (author only) */
.inbox-card { margin-top: 18px; }
.inbox { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.inbox-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface); }
.inbox-item.done { opacity: .6; }
.inbox-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13.5px; }
.inbox-head .link { margin-left: auto; font-size: 12.5px; }
.inbox-item p { margin: 8px 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.inbox-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inbox-actions .btn { padding: 5px 10px; font-size: 12.5px; }
.legal-date { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.fng-mini-pair { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.fng-sep { align-self: stretch; width: 1px; margin: 4px 0; background: var(--border); }
.yf-link { display: inline-flex; align-items: center; gap: 3px; color: #7e1fff; font-weight: 600; text-decoration: none; white-space: nowrap; }
.yf-link svg { width: 11px; height: 11px; }
.yf-link:hover { text-decoration: underline; }
:root[data-theme="dark"] .yf-link { color: #b48cff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .yf-link { color: #b48cff; } }
.notice-box { padding: 36px 20px 28px; }
.notice-box h3 { margin: 4px 0 0; font-size: 19px; }
.notice-box p { max-width: 34ch; margin: 0 0 8px; line-height: 1.5; }
/* Account windows (login, sign-up, reset, notices): always centred, also on phones (no bottom sheet) */
@media (max-width: 860px) {
  .modal-backdrop.centered { place-items: center; padding: 16px; }
  .modal-backdrop.centered .modal { max-width: 440px; border-radius: 16px; padding: 20px 18px; }
}
/* Password requirements: grey until met, then green with a tick */
.pw-rules { grid-column: 1 / -1; list-style: none; margin: -4px 0 2px; padding: 0; display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); }
.pw-rules li { display: flex; align-items: center; gap: 7px; transition: color .15s; }
.pw-rules svg { width: 14px; height: 14px; flex: none; padding: 2px; border-radius: 50%; border: 1.5px solid currentColor; fill: none; stroke: currentColor; stroke-width: 3; opacity: .45; transition: opacity .15s, background .15s; }
.pw-rules li.ok { color: var(--pos); }
.pw-rules li.ok svg { opacity: 1; background: color-mix(in srgb, var(--pos) 15%, transparent); }

/* ============================================================ Mobile design (phones, up to 640px)
   Not just the desktop squeezed: tables turn into cards, the Cartera360 section gets its own switcher,
   the calculators become a swipeable strip and the bottom bar only shows a lock where something is locked. */
.m-subnav { display: none; }
@media (max-width: 640px) {
  /* Tables -> one card per row (labels come from the column headers, see cardTables in app.js) */
  .table-wrap:has(> table.m-cards) { overflow: visible; margin: 0; padding: 0; }
  table.m-cards { min-width: 0; display: block; }
  table.m-cards thead { display: none; }
  table.m-cards tbody, table.m-cards tfoot { display: grid; gap: 10px; }
  table.m-cards tfoot { margin-top: 10px; }
  table.m-cards tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
  table.m-cards td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; font-size: 14px; }
  table.m-cards td.r { text-align: left; }
  table.m-cards td:has(.holding), table.m-cards td:has(.row-title) { grid-column: 1 / -1; order: -1; }
  table.m-cards td[data-label]:not(:has(.holding))::before { content: attr(data-label); display: block; margin-bottom: 3px;
    font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
  table.m-cards td:empty { display: none; }
  table.m-cards td .row-sub { font-size: 12px; }
  table.m-cards td { width: auto !important; min-width: 0 !important; max-width: none !important; white-space: normal; }
  table.m-cards .holding { min-width: 0; }
  table.m-cards td:not(:has(.holding)) { white-space: normal; overflow-wrap: normal; word-break: normal; font-size: 13.5px; }
  table.m-cards td[data-label]:not(:has(.holding))::before { white-space: normal; }
  table.m-cards .holding > div { min-width: 0; flex: 1; }
  table.m-cards .row-title { white-space: normal; overflow-wrap: anywhere; }
  table.m-cards td svg.spark, table.m-cards td canvas { max-width: 100%; }

  /* Cartera360 section switcher: Positions · Trades · Dividends */
  .m-subnav { display: flex; gap: 4px; padding: 4px; margin: 0 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
  .m-subnav a { flex: 1; text-align: center; padding: 8px 6px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); text-decoration: none; }
  .m-subnav a.on { background: var(--accent); color: #fff; }

  /* Bottom bar: the paid-section lock is a tiny badge at the top right of the icon (out of the flow: the bar keeps its height) */
  .tabbar a { position: relative; }
  .tabbar .nav-lock { position: absolute; top: 3px; left: calc(50% + 7px); margin: 0; line-height: 0; display: block; }
  .tabbar .nav-lock svg { width: 10px; height: 10px; stroke-width: 2.4; }

  /* Calculators: one swipeable row instead of 14 wrapped buttons */
  .calc-tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .calc-tabs::-webkit-scrollbar { display: none; }
  .calc-tab { flex: none; scroll-snap-align: center; }

  /* Figures never cut off */
  .kpi-value, .cartera-summary .kpi-value { white-space: normal; overflow: visible; text-overflow: clip; font-size: 20px; }
  .kpi-foot, .cartera-summary .kpi-foot { white-space: normal; }
}
/* Rentabilidad chart: while hovering, the part right of the cursor is shaded (grey) and the left stays in colour */
.scrub-dim { display: none; }
.scrubbing .scrub-dim { display: inline; }
.dim-area { fill: color-mix(in srgb, var(--muted) 10%, transparent); }
.dim-ln { stroke: var(--muted); opacity: .35; }
.scrubbing .pulse-ring, .scrubbing .pulse-ring + circle { opacity: .25; }
.post-tag-picker .col-menu { left: 0; right: auto; }
