:root {
  --ink: #172033;
  --ink-soft: #526078;
  --muted: #8b96a9;
  --line: #e6eaf0;
  --line-strong: #d8dee8;
  --canvas: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --navy: #0b1427;
  --navy-2: #121f36;
  --brand: #2e6ff2;
  --brand-soft: #eaf1ff;
  --cyan: #12a8b7;
  --positive: #d94a55;
  --positive-soft: #fff0f1;
  --negative: #079368;
  --negative-soft: #e9f8f2;
  --warning: #d48b13;
  --warning-soft: #fff7e7;
  --purple: #7557d8;
  --shadow: 0 1px 2px rgba(12, 22, 42, .03), 0 10px 30px rgba(12, 22, 42, .055);
  --shadow-lg: 0 24px 70px rgba(4, 13, 31, .20);
  --sidebar: 246px;
  --radius: 16px;
  --radius-sm: 11px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button { border: 0; }
svg { display: block; }
.icon-sprite { position: fixed; width: 0; height: 0; overflow: hidden; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; transform: translateY(-150%); padding: 9px 14px; border-radius: 8px; color: #fff; background: var(--brand); }
.skip-link:focus { transform: none; }
.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

/* Sidebar */
.sidebar {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  color: #c9d2e4;
  background:
    radial-gradient(circle at 35% 0, rgba(49, 102, 205, .18), transparent 28%),
    linear-gradient(180deg, var(--navy), #091121 100%);
  border-right: 1px solid rgba(255,255,255,.05);
}
.sidebar__head { display: flex; align-items: center; height: 88px; padding: 0 22px; border-bottom: 1px solid rgba(255,255,255,.075); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand > span:last-child { display: flex; flex-direction: column; }
.brand strong { color: #fff; font-size: 17px; font-weight: 700; letter-spacing: .08em; }
.brand small { margin-top: 1px; color: #7f8ca5; font-size: 10px; letter-spacing: .16em; }
.brand__mark { display: grid; width: 34px; height: 34px; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 3px; padding: 7px; border-radius: 11px; background: linear-gradient(145deg, #347dff, #1f57ca); box-shadow: 0 7px 18px rgba(43, 108, 240, .28); }
.brand__mark span { border-radius: 3px 3px 1px 1px; background: #fff; opacity: .92; }
.brand__mark span:nth-child(1) { height: 38%; }
.brand__mark span:nth-child(2) { height: 68%; }
.brand__mark span:nth-child(3) { height: 100%; }
.brand__mark--small { width: 27px; height: 27px; padding: 6px; border-radius: 8px; }
.sidebar__close { display: none; margin-left: auto; color: #fff; }
.sidebar__caption { padding: 26px 26px 8px; color: #61708c; font-size: 10px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.nav-list { display: grid; gap: 3px; padding: 0 12px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 13px; min-height: 45px; padding: 0 14px; border-radius: 10px; color: #9da9be; font-weight: 500; transition: color .18s, background .18s, transform .18s; }
.nav-item svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:first-child svg use[href="#i-overview"] { fill: currentColor; stroke: none; }
.nav-item:hover { color: #f2f6ff; background: rgba(255,255,255,.055); }
.nav-item.is-active { color: #fff; background: linear-gradient(90deg, rgba(46,111,242,.30), rgba(46,111,242,.10)); }
.nav-item.is-active::before { position: absolute; left: -12px; width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: #4f88ff; content: ""; }
.nav-item.is-active svg { color: #6f9dff; }
.sidebar__foot { display: grid; gap: 15px; margin-top: auto; padding: 20px 20px 24px; border-top: 1px solid rgba(255,255,255,.075); }
.privacy-chip { display: flex; align-items: center; gap: 10px; }
.privacy-chip > span:last-child { display: flex; flex-direction: column; }
.privacy-chip strong { color: #dbe3f1; font-size: 12px; font-weight: 600; }
.privacy-chip small { color: #6f7d95; font-size: 10px; }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.status-dot--ok { background: #36c692; box-shadow: 0 0 0 4px rgba(54,198,146,.10); }
.status-dot--warn { background: #e2a037; box-shadow: 0 0 0 4px rgba(226,160,55,.11); }
.status-dot--bad { background: #ef6670; box-shadow: 0 0 0 4px rgba(239,102,112,.11); }
.text-button { padding: 0; color: #7d8aa1; background: transparent; font-size: 11px; }
.text-button:hover { color: #fff; }
.sidebar-backdrop { display: none; }

/* Main chrome */
.workspace { grid-column: 2; min-width: 0; }
.mobile-header { display: none; }
.main { width: min(1540px, 100%); min-height: calc(100vh - 54px); margin: 0 auto; padding: 34px 34px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; min-height: 80px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--brand); font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.page-head h1 { margin: 0; color: #111a2c; font-size: clamp(27px, 2.5vw, 36px); line-height: 1.18; letter-spacing: -.035em; }
.page-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-head__actions { display: flex; align-items: center; gap: 10px; }
.as-of { display: flex; min-width: 112px; flex-direction: column; align-items: flex-end; }
.as-of span { color: var(--muted); font-size: 10px; }
.as-of strong { color: var(--ink-soft); font-size: 12px; font-weight: 650; }
.app-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 54px; padding: 0 34px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); font-size: 10px; }

/* Controls */
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; color: var(--ink-soft); background: transparent; }
.icon-button:hover { background: var(--surface-soft); }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button { display: inline-flex; min-height: 39px; align-items: center; justify-content: center; gap: 7px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink-soft); background: var(--surface); font-size: 12px; font-weight: 650; box-shadow: 0 1px 1px rgba(0,0,0,.02); transition: .18s ease; }
.button:hover { border-color: #bdc7d6; box-shadow: 0 5px 14px rgba(17,32,62,.07); transform: translateY(-1px); }
.button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button--primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.button--primary:hover { border-color: #255fd3; background: #255fd3; }
.button--danger { color: #be3a45; background: #fff7f7; border-color: #f3ced1; }
.button--ghost { border-color: transparent; box-shadow: none; }
.button--wide { width: 100%; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 16px; }
.search-box { position: relative; min-width: min(280px, 100%); flex: 1 1 260px; }
.search-box svg { position: absolute; top: 50%; left: 13px; width: 17px; height: 17px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 1.8; }
.field, .select, .search-box input, .textarea { width: 100%; min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: var(--surface); font-size: 12px; transition: border-color .18s, box-shadow .18s; }
.search-box input { padding-left: 40px; }
.textarea { min-height: 110px; padding-top: 11px; resize: vertical; }
.field:focus, .select:focus, .search-box input:focus, .textarea:focus { border-color: #84a9f7; box-shadow: 0 0 0 3px rgba(46,111,242,.10); }
.select { width: auto; min-width: 135px; padding-right: 32px; }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.segmented a, .segmented button { min-height: 32px; padding: 0 12px; border-radius: 7px; color: var(--muted); background: transparent; font-size: 11px; }
.segmented .is-active { color: var(--brand); background: var(--brand-soft); font-weight: 650; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-field { display: grid; gap: 7px; }
.form-field label { color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.form-field small { color: var(--muted); font-size: 10px; }

/* Generic card and grids */
.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--sidebar { grid-template-columns: minmax(0, 1.65fr) minmax(280px, .72fr); }
.stack { display: grid; gap: 16px; }
.section { margin-top: 25px; }
.card { min-width: 0; padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card--flat { box-shadow: none; }
.card--flush { padding: 0; overflow: hidden; }
.card--dark { color: #dbe5f6; background: linear-gradient(145deg, #111e34, #0d1729); border-color: rgba(255,255,255,.04); box-shadow: 0 20px 48px rgba(9,20,40,.16); }
.card--tint { background: linear-gradient(145deg, #f5f8ff, #fff); border-color: #dce6fb; }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.card__head h2, .card__head h3 { margin: 0; color: var(--ink); font-size: 14px; letter-spacing: -.01em; }
.card--dark .card__head h2, .card--dark .card__head h3 { color: #f4f7fc; }
.card__head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.card__action { color: var(--brand); font-size: 11px; font-weight: 650; white-space: nowrap; }
.card__action:hover { text-decoration: underline; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 13px; }
.section-title h2 { margin: 0; font-size: 16px; letter-spacing: -.02em; }
.section-title p { margin: 0; color: var(--muted); font-size: 10px; }

/* KPI */
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { position: relative; min-width: 0; min-height: 134px; padding: 19px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric::after { position: absolute; right: -35px; bottom: -55px; width: 115px; height: 115px; border-radius: 50%; background: radial-gradient(circle, rgba(46,111,242,.06), transparent 67%); content: ""; }
.metric--hero { color: #e7eefb; background: linear-gradient(140deg, #152641, #0c172a); border-color: #1b2a44; }
.metric__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric__label { color: var(--muted); font-size: 11px; font-weight: 550; }
.metric--hero .metric__label { color: #899bb9; }
.metric__badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-size: 9px; font-weight: 700; }
.metric__value { margin-top: 16px; overflow: hidden; color: var(--ink); font-size: clamp(21px, 2vw, 29px); font-weight: 720; line-height: 1; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.metric__value small { margin-right: 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
.metric--hero .metric__value { color: #fff; }
.metric__foot { display: flex; align-items: center; gap: 7px; margin-top: 13px; color: var(--muted); font-size: 10px; }
.metric__change { font-weight: 700; }
.money-positive, .number-positive { color: var(--positive) !important; }
.money-negative, .number-negative { color: var(--negative) !important; }
.metric__spark { position: absolute; right: 12px; bottom: 11px; width: 68px; height: 28px; opacity: .7; }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); padding: 16px 0; }
.summary-strip__item { padding: 0 18px; border-right: 1px solid var(--line); }
.summary-strip__item:last-child { border: 0; }
.summary-strip__item span { display: block; color: var(--muted); font-size: 10px; }
.summary-strip__item strong { display: block; margin-top: 3px; font-size: 15px; }

/* Charts */
.chart { position: relative; width: 100%; min-height: 320px; }
.chart--compact { min-height: 240px; }
.chart--small { min-height: 190px; }
.chart__empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: linear-gradient(180deg, transparent, rgba(244,246,249,.35)); font-size: 11px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.native-donut { min-height: 240px; display: grid; grid-template-rows: minmax(160px, 180px) auto; align-items: center; justify-items: center; }
.native-donut svg { width: min(180px, 100%); height: auto; aspect-ratio: 1; overflow: visible; }
.native-donut__track, .native-donut__arc { fill: none; stroke-width: 24; }
.native-donut__track { stroke: #edf0f5; }
.native-donut__arc { transition: opacity .2s, stroke-width .2s; }
.native-donut__arc:focus, .native-donut__arc:hover { opacity: .82; stroke-width: 28; outline: none; }
.native-donut text { text-anchor: middle; dominant-baseline: middle; fill: var(--muted); font-size: 9px; }
.native-donut .native-donut__total { fill: var(--ink); font-size: 12px; font-weight: 700; }
.native-donut ul { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px 13px; margin: 4px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 9px; }
.native-donut li { display: inline-flex; align-items: center; gap: 5px; }
.native-donut li i { width: 7px; height: 7px; border-radius: 50%; background: var(--legend-color); }
.native-donut li strong { color: var(--ink-soft); }
.native-line { display: block; width: 100%; min-height: 300px; }
.native-line__grid line { stroke: #e9edf3; stroke-dasharray: 4 6; }
.native-line__grid text, .native-line__date { fill: var(--muted); font-size: 10px; }
.native-line__area { fill: url(#market-area); }
.native-line__value, .native-line__cost { fill: none; vector-effect: non-scaling-stroke; }
.native-line__value { stroke: #2e6ff2; stroke-width: 2.5; }
.native-line__cost { stroke: #9aabc4; stroke-width: 1.5; stroke-dasharray: 6 6; }
.native-line__markers circle { fill: #2e6ff2; stroke: #fff; stroke-width: 2; opacity: 0; transition: opacity .2s; }
.native-line:hover .native-line__markers circle, .native-line__markers circle:focus { opacity: 1; outline: none; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.legend-dot--cost { background: #9aabc4; }
.legend-dot--profit { background: var(--positive); }

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; min-width: 720px; border-collapse: collapse; }
.data-table th { height: 44px; padding: 0 14px; color: var(--muted); background: #fbfcfd; border-bottom: 1px solid var(--line); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-align: left; white-space: nowrap; }
.data-table td { height: 60px; padding: 9px 14px; border-bottom: 1px solid #edf0f4; color: var(--ink-soft); font-size: 11px; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table .align-right { text-align: right; }
.data-table .align-center { text-align: center; }
.asset-cell { display: flex; align-items: center; gap: 10px; }
.asset-icon { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 9px; color: var(--brand); background: var(--brand-soft); font-size: 10px; font-weight: 800; }
.asset-icon--purple { color: var(--purple); background: #f0edfb; }
.asset-icon--green { color: var(--negative); background: var(--negative-soft); }
.asset-name { display: flex; min-width: 0; flex-direction: column; }
.asset-name strong { max-width: 260px; overflow: hidden; color: var(--ink); font-size: 11px; font-weight: 650; text-overflow: ellipsis; }
.asset-name small { color: var(--muted); font-size: 9px; }
.tag { display: inline-flex; min-height: 21px; align-items: center; padding: 0 7px; border-radius: 6px; color: var(--ink-soft); background: #f0f3f7; font-size: 9px; font-weight: 600; }
.tag--blue { color: var(--brand); background: var(--brand-soft); }
.tag--red { color: var(--positive); background: var(--positive-soft); }
.tag--green { color: var(--negative); background: var(--negative-soft); }
.tag--amber { color: var(--warning); background: var(--warning-soft); }
.tag--outline { background: transparent; border: 1px solid var(--line); }
.weight-cell { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.weight-bar { width: 54px; height: 4px; overflow: hidden; border-radius: 4px; background: #e9edf3; }
.weight-bar i { display: block; width: var(--weight, 0%); height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4380f8, #6f9dff); }
.table-empty, .empty-state { padding: 46px 20px !important; color: var(--muted) !important; text-align: center !important; }
.empty-state { display: grid; place-items: center; min-height: 180px; border: 1px dashed var(--line-strong); border-radius: 12px; }
.empty-state strong { color: var(--ink-soft); font-size: 12px; }
.empty-state p { margin: 5px 0 0; font-size: 10px; }

/* Lists and allocation */
.allocation-list { display: grid; gap: 15px; }
.allocation-row { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(100px, 2fr) auto; align-items: center; gap: 12px; }
.allocation-row__label { min-width: 0; overflow: hidden; color: var(--ink-soft); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.allocation-row__bar { height: 7px; overflow: hidden; border-radius: 999px; background: #edf1f5; }
.allocation-row__bar i { display: block; width: var(--percent, 0%); height: 100%; border-radius: inherit; background: var(--bar-color, var(--brand)); }
.allocation-row__value { min-width: 54px; color: var(--ink); font-size: 11px; font-weight: 650; text-align: right; }
.rank-list { display: grid; gap: 5px; }
.rank-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 44px; padding: 6px 7px; border-radius: 9px; }
.rank-item:hover { background: var(--surface-soft); }
.rank-item__num { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 7px; color: var(--muted); background: #f1f4f8; font-size: 9px; font-weight: 700; }
.rank-item__main { min-width: 0; }
.rank-item__main strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.rank-item__main small { color: var(--muted); font-size: 9px; }
.rank-item__value { text-align: right; }
.rank-item__value strong { display: block; font-size: 11px; }
.rank-item__value small { color: var(--muted); font-size: 9px; }
.activity-list { display: grid; }
.activity { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 11px 0; border-bottom: 1px solid #edf0f4; }
.activity:last-child { border-bottom: 0; }
.activity .status-dot { margin-top: 5px; }
.activity__main strong { display: block; color: var(--ink-soft); font-size: 11px; }
.activity__main small, .activity time { color: var(--muted); font-size: 9px; }

/* DCA */
.dca-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); box-shadow: var(--shadow); }
.dca-summary__item { padding: 19px; background: var(--surface); }
.dca-summary__item span { display: block; color: var(--muted); font-size: 10px; }
.dca-summary__item strong { display: block; margin-top: 8px; font-size: 20px; letter-spacing: -.025em; }
.plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.plan-card { position: relative; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.plan-card::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--brand); content: ""; }
.plan-card.is-paused::before { background: var(--warning); }
.plan-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.plan-card__name { min-width: 0; }
.plan-card__name h3 { margin: 0; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.plan-card__name p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.plan-card__amount { margin: 23px 0; }
.plan-card__amount span { color: var(--muted); font-size: 9px; }
.plan-card__amount strong { display: block; margin-top: 3px; font-size: 24px; line-height: 1; letter-spacing: -.03em; }
.plan-card__amount small { color: var(--muted); font-size: 10px; font-weight: 500; }
.plan-card__meta { display: grid; grid-template-columns: repeat(3, 1fr); padding-top: 15px; border-top: 1px solid var(--line); }
.plan-card__meta div { padding: 0 10px; border-right: 1px solid var(--line); }
.plan-card__meta div:first-child { padding-left: 0; }
.plan-card__meta div:last-child { padding-right: 0; border: 0; }
.plan-card__meta span, .plan-card__meta strong { display: block; }
.plan-card__meta span { color: var(--muted); font-size: 8px; }
.plan-card__meta strong { margin-top: 3px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

/* Calendar */
.calendar { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.calendar__head { display: grid; grid-template-columns: repeat(7, 1fr); color: var(--muted); background: #fafbfd; border-bottom: 1px solid var(--line); font-size: 9px; text-align: center; }
.calendar__head span { padding: 9px; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-day { position: relative; min-height: 86px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day__num { color: var(--muted); font-size: 9px; }
.calendar-day.is-today .calendar-day__num { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 50%; color: #fff; background: var(--brand); }
.calendar-event { display: block; margin-top: 5px; padding: 3px 5px; overflow: hidden; border-radius: 5px; color: var(--brand); background: var(--brand-soft); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }

/* Risk and performance */
.risk-meter { position: relative; width: 150px; height: 78px; margin: 8px auto; overflow: hidden; }
.risk-meter::before { position: absolute; width: 150px; height: 150px; border-radius: 50%; background: conic-gradient(from 270deg, #24ad7e 0 25%, #e1aa35 25% 38%, #e25c67 38% 50%, #edf0f4 50%); content: ""; }
.risk-meter::after { position: absolute; top: 20px; left: 20px; width: 110px; height: 110px; border-radius: 50%; background: var(--surface); content: ""; }
.risk-meter__value { position: absolute; z-index: 1; inset: auto 0 0; color: var(--ink); font-size: 25px; font-weight: 750; text-align: center; }
.risk-meter__value small { color: var(--muted); font-size: 9px; font-weight: 500; }
.gap-list { display: grid; gap: 14px; }
.gap-row { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(160px, 2fr) 58px; align-items: center; gap: 12px; }
.gap-row__name { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.gap-track { position: relative; height: 8px; border-radius: 8px; background: linear-gradient(90deg, #eef1f5 49.5%, #cbd3df 49.5% 50.5%, #eef1f5 50.5%); }
.gap-track i { position: absolute; top: 1px; left: 50%; width: clamp(3px, calc(var(--gap-size, 0) * 3px), 50%); height: 6px; border-radius: 6px; background: var(--gap-color, var(--brand)); transform-origin: left; }
.gap-row__value { font-size: 10px; font-weight: 700; text-align: right; }
.return-heatmap { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.return-cell { display: grid; min-height: 48px; place-items: center; padding: 5px; border-radius: 8px; color: var(--ink-soft); background: #f2f5f8; text-align: center; }
.return-cell.is-positive { color: #b63b45; background: var(--positive-soft); }
.return-cell.is-negative { color: #087a59; background: var(--negative-soft); }
.return-cell span { display: block; font-size: 8px; opacity: .7; }
.return-cell strong { display: block; font-size: 10px; }

/* Data center and health */
.upload-zone { display: grid; min-height: 210px; place-items: center; padding: 30px; border: 1px dashed #bfcbe0; border-radius: 14px; background: linear-gradient(145deg, #f8fbff, #fff); text-align: center; }
.upload-zone__icon { display: grid; width: 48px; height: 48px; margin: 0 auto 13px; place-items: center; border-radius: 14px; color: var(--brand); background: var(--brand-soft); }
.upload-zone__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.upload-zone h3 { margin: 0; font-size: 13px; }
.upload-zone p { margin: 5px 0 16px; color: var(--muted); font-size: 10px; }
.command-box { position: relative; padding: 16px 44px 16px 16px; overflow-x: auto; border-radius: 10px; color: #c9d7ed; background: #101b2f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; white-space: nowrap; }
.copy-button { position: absolute; top: 8px; right: 8px; padding: 5px 8px; border-radius: 6px; color: #aebbd0; background: rgba(255,255,255,.07); font-size: 8px; }
.health-hero { display: flex; align-items: center; gap: 18px; padding: 24px; border: 1px solid #d7eee6; border-radius: var(--radius); background: linear-gradient(135deg, #edf9f5, #fff); box-shadow: var(--shadow); }
.health-hero__icon { display: grid; width: 50px; height: 50px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--negative); box-shadow: 0 10px 24px rgba(7,147,104,.18); font-size: 20px; }
.health-hero h2 { margin: 0; font-size: 16px; }
.health-hero p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.health-hero__time { margin-left: auto; color: var(--muted); font-size: 9px; text-align: right; }
.health-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.health-item { display: flex; align-items: center; gap: 12px; min-height: 78px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.health-item__icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--negative); background: var(--negative-soft); font-size: 13px; font-weight: 800; }
.health-item strong, .health-item small { display: block; }
.health-item strong { font-size: 11px; }
.health-item small { color: var(--muted); font-size: 9px; }
.key-value-list { display: grid; }
.key-value { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.key-value:last-child { border: 0; }
.key-value span { color: var(--muted); font-size: 10px; }
.key-value strong { font-size: 10px; text-align: right; }
.progress { height: 6px; overflow: hidden; border-radius: 5px; background: #edf0f4; }
.progress i { display: block; width: var(--progress, 0%); height: 100%; border-radius: inherit; background: var(--brand); }

/* Notifications */
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.notice { padding: 11px 14px; border: 1px solid #d9e4fa; border-radius: 10px; color: #315386; background: #f2f7ff; font-size: 11px; }
.notice--success { color: #087451; background: #ecf9f4; border-color: #cfeee2; }
.notice--error { color: #a73740; background: #fff1f2; border-color: #f2d2d5; }
.toast-region { position: fixed; z-index: 100; right: 20px; bottom: calc(20px + var(--safe-bottom)); display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 220px; padding: 11px 14px; border-radius: 10px; color: #fff; background: #17243a; box-shadow: var(--shadow-lg); font-size: 11px; animation: toast-in .25s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Auth */
.auth-body { min-height: 100vh; background: #0b1427; }
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(420px, 1.15fr) minmax(380px, .85fr); }
.auth-visual { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: clamp(36px, 6vw, 78px); overflow: hidden; color: #fff; background: radial-gradient(circle at 18% 12%, rgba(49,111,242,.32), transparent 28%), radial-gradient(circle at 80% 65%, rgba(19,166,181,.15), transparent 32%), #0b1427; }
.auth-visual::after { position: absolute; right: -14%; bottom: -14%; width: 62%; aspect-ratio: 1; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.018), 0 0 0 140px rgba(255,255,255,.012); content: ""; }
.auth-brand { position: relative; z-index: 1; }
.auth-copy { position: relative; z-index: 1; max-width: 590px; }
.auth-copy p:first-child { color: #6492ef; font-size: 10px; font-weight: 800; letter-spacing: .22em; }
.auth-copy h1 { margin: 16px 0 18px; max-width: 560px; font-size: clamp(38px, 5.2vw, 72px); line-height: 1.08; letter-spacing: -.055em; }
.auth-copy > p:last-child { max-width: 460px; color: #8090ab; font-size: 13px; }
.auth-stats { position: relative; z-index: 1; display: flex; gap: 34px; }
.auth-stat strong, .auth-stat span { display: block; }
.auth-stat strong { font-size: 17px; }
.auth-stat span { color: #71809a; font-size: 9px; }
.auth-panel { display: grid; min-height: 100vh; place-items: center; padding: 36px; background: #f7f8fa; }
.login-card { width: min(410px, 100%); padding: 36px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 24px 70px rgba(4,13,31,.12); }
.login-card__head { margin-bottom: 28px; }
.login-card__head h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.login-card__head p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.login-form { display: grid; gap: 16px; }
.login-form .form-field input { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.login-form .form-field input:focus { border-color: #84a9f7; box-shadow: 0 0 0 3px rgba(46,111,242,.1); }
.login-hint { margin: 18px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.errorlist { margin: 0; padding: 8px 11px; border-radius: 8px; color: #a73740; background: #fff1f2; font-size: 10px; list-style: none; }

/* Responsive */
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .app-shell { display: block; }
  .workspace { min-width: 0; }
  .sidebar { width: min(300px, 84vw); transform: translateX(-105%); box-shadow: var(--shadow-lg); transition: transform .24s ease; }
  .sidebar.is-open { transform: none; }
  .sidebar__close { display: inline-grid; }
  .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; display: block; visibility: hidden; opacity: 0; background: rgba(4,10,22,.54); transition: opacity .2s, visibility .2s; }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
  .mobile-header { position: sticky; z-index: 20; top: 0; display: flex; height: 58px; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(16px); }
  .mobile-brand { display: flex; align-items: center; gap: 8px; }
  .mobile-brand strong { font-size: 14px; letter-spacing: .06em; }
  .sync-indicator { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
  .main { padding: 28px 22px 55px; }
  .grid--sidebar { grid-template-columns: 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
}

@media (max-width: 700px) {
  .main { padding: 22px 14px 46px; }
  .page-head { align-items: flex-start; margin-bottom: 20px; }
  .page-head__actions { align-items: flex-end; }
  .page-head .button .button__label { display: none; }
  .page-subtitle { max-width: 230px; }
  .metric-grid, .grid--2, .grid--3, .grid--4, .plan-grid { grid-template-columns: 1fr; }
  .metric-grid { gap: 10px; }
  .metric { min-height: 116px; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); gap: 16px 0; }
  .summary-strip__item:nth-child(2) { border: 0; }
  .dca-summary { grid-template-columns: repeat(2, 1fr); }
  .health-grid { grid-template-columns: 1fr; }
  .calendar-day { min-height: 55px; padding: 5px; }
  .calendar-event { width: 6px; height: 6px; margin: 5px auto 0; padding: 0; border-radius: 50%; color: transparent; }
  .return-heatmap { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .card { padding: 17px; }
  .card--flush { padding: 0; }
  .app-footer { display: grid; padding: 14px; text-align: center; }
  .allocation-row { grid-template-columns: minmax(70px, 1fr) minmax(80px, 1.5fr) auto; gap: 8px; }
  .gap-row { grid-template-columns: 80px minmax(100px, 1fr) 48px; gap: 7px; }
  .auth-panel { padding: 18px; }
  .login-card { padding: 28px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
