:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0b0d12;
  --surface: #12151c;
  --surface-2: #171b24;
  --surface-3: #1d222d;
  --surface-hover: #202631;
  --border: #252b37;
  --border-strong: #343c4c;
  --text: #f4f6fb;
  --text-2: #c7ceda;
  --muted: #8d97a9;
  --muted-2: #667084;
  --accent: #8b5cf6;
  --accent-hover: #9d74f8;
  --accent-soft: rgba(139, 92, 246, .14);
  --accent-border: rgba(139, 92, 246, .32);
  --green: #35d07f;
  --green-soft: rgba(53, 208, 127, .12);
  --red: #ff627d;
  --red-soft: rgba(255, 98, 125, .12);
  --amber: #f7b955;
  --amber-soft: rgba(247, 185, 85, .12);
  --blue: #5fb5ff;
  --blue-soft: rgba(95, 181, 255, .12);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --shadow: 0 24px 80px rgba(0, 0, 0, .28);
  --sidebar: 244px;
}

:root[data-accent="blue"] { --accent: #4f8df7; --accent-hover: #69a0ff; --accent-soft: rgba(79, 141, 247, .14); --accent-border: rgba(79, 141, 247, .32); }
:root[data-accent="emerald"] { --accent: #20b982; --accent-hover: #35ca94; --accent-soft: rgba(32, 185, 130, .14); --accent-border: rgba(32, 185, 130, .32); }
:root[data-accent="amber"] { --accent: #e99a2c; --accent-hover: #f2aa43; --accent-soft: rgba(233, 154, 44, .14); --accent-border: rgba(233, 154, 44, .32); }
:root[data-accent="rose"] { --accent: #ed5c83; --accent-hover: #f27698; --accent-soft: rgba(237, 92, 131, .14); --accent-border: rgba(237, 92, 131, .32); }

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --bg: #f3f5f8;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --surface-3: #eef1f5;
    --surface-hover: #f0f3f7;
    --border: #e0e5ec;
    --border-strong: #cfd6e0;
    --text: #151922;
    --text-2: #3a4351;
    --muted: #6f7887;
    --muted-2: #929baa;
    --shadow: 0 18px 60px rgba(30, 40, 60, .10);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef1f5;
  --surface-hover: #f0f3f7;
  --border: #e0e5ec;
  --border-strong: #cfd6e0;
  --text: #151922;
  --text-2: #3a4351;
  --muted: #6f7887;
  --muted-2: #929baa;
  --shadow: 0 18px 60px rgba(30, 40, 60, .10);
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { min-width: 320px; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: inherit; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }
.hidden { display: none !important; }
.positive { color: var(--green) !important; }
.negative { color: var(--red) !important; }
.muted-copy { color: var(--muted); font-size: 14px; line-height: 1.55; }
.desktop-only { display: inline-flex; }
.desktop-value { display: inline-flex; }

.app-shell { min-height: 100vh; }
.desktop-sidebar {
  position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar); padding: 18px 14px;
  display: flex; flex-direction: column; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-right: 1px solid var(--border); backdrop-filter: blur(20px);
}
.app-brand { width: 100%; min-height: 58px; border: 0; background: transparent; display: flex; align-items: center; gap: 12px; padding: 8px; text-align: left; border-radius: 14px; }
.app-brand:hover { background: var(--surface-2); }
.brand-symbol { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: white; background: var(--accent); box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 26%, transparent); }
.brand-symbol .icon { width: 22px; height: 22px; }
.app-brand span:last-child { min-width: 0; }
.app-brand b, .app-brand small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-brand b { font-size: 15px; font-weight: 700; }
.app-brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.desktop-nav { display: grid; gap: 5px; margin-top: 22px; }
.desktop-nav button { min-height: 46px; padding: 0 13px; border: 1px solid transparent; border-radius: 12px; display: flex; align-items: center; gap: 12px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; text-align: left; }
.desktop-nav button:hover { color: var(--text); background: var(--surface-2); }
.desktop-nav button.active { color: var(--text); background: var(--accent-soft); border-color: var(--accent-border); }
.desktop-nav button.active .icon { color: var(--accent); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 10px; }
.sync-pill, .profile-row { width: 100%; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 9px 10px; text-align: left; }
.sync-pill:hover, .profile-row:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.sync-pill > i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.sync-pill > span, .profile-row > span:nth-child(2) { flex: 1; min-width: 0; }
.sync-pill b, .sync-pill small, .profile-row b, .profile-row small { display: block; }
.sync-pill b, .profile-row b { font-size: 12px; }
.sync-pill small, .profile-row small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.sync-pill > .icon, .profile-row > .icon { width: 17px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 800; }

.app-main { min-height: 100vh; margin-left: var(--sidebar); }
.mobile-header, .mobile-nav { display: none; }
.page-container { width: min(1440px, 100%); margin: 0 auto; padding: 28px 32px 80px; }
.page-header { min-height: 62px; margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.page-header h1 { margin: 0; font-size: 27px; letter-spacing: -.035em; line-height: 1.15; }
.page-header p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 10px; }

.primary-button, .secondary-button, .danger-button, .text-button, .filter-button, .period-button, .refresh-label {
  min-height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; font-size: 13px; font-weight: 700;
}
.primary-button { border: 1px solid transparent; color: white; background: var(--accent); box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 18%, transparent); }
.primary-button:hover { background: var(--accent-hover); }
.secondary-button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
.secondary-button:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.danger-button { border: 1px solid color-mix(in srgb, var(--red) 35%, transparent); background: var(--red-soft); color: var(--red); }
.text-button { min-height: 40px; padding: 0 4px; border: 0; background: transparent; color: var(--accent); }
.text-button:hover { color: var(--accent-hover); }
.danger-text { color: var(--red); }
.icon-button { width: 44px; min-width: 44px; height: 44px; flex: 0 0 44px; padding: 0; border: 1px solid var(--border); border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); }
.icon-button:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.icon-button.danger { color: var(--red); }

.dashboard-period-row { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.period-button { min-width: 220px; justify-content: flex-start; border: 1px solid var(--border); background: var(--surface); padding: 8px 12px; text-align: left; }
.period-button:hover { border-color: var(--border-strong); }
.period-button > span { flex: 1; }
.period-button b, .period-button small { display: block; }
.period-button b { font-size: 13px; }
.period-button small { margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 500; }
.period-button > .icon:last-child { width: 16px; color: var(--muted); }
.refresh-label { margin-left: auto; min-height: 36px; padding: 0 4px; border: 0; background: transparent; color: var(--muted); font-weight: 500; font-size: 12px; }
.refresh-label .icon { width: 16px; }

.surface { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.surface-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 12px; }
.surface-header > div > span, .surface-header > div > h2 { display: block; }
.surface-header > div > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.surface-header h2 { margin: 3px 0 0; font-size: 17px; letter-spacing: -.02em; }
.surface-header > small { color: var(--muted); font-size: 12px; }

.hero-card { min-height: 380px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--accent) 4%, var(--surface))); display: grid; grid-template-columns: minmax(240px, .42fr) minmax(0, 1fr); overflow: hidden; }
.hero-copy { padding: 30px 20px 26px 28px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--border); }
.hero-copy > span { color: var(--muted); font-size: 13px; font-weight: 600; }
.hero-copy > strong { margin-top: 10px; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.055em; line-height: 1.05; }
.hero-comparison { margin: 18px 0 0; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.hero-comparison .icon { width: 17px; }
.hero-comparison.up b, .hero-comparison.up .icon { color: var(--green); }
.hero-comparison.down b, .hero-comparison.down .icon { color: var(--red); }
.hero-chart { min-width: 0; padding: 18px 18px 8px; }

.chart-switch { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin: 0 0 10px 8px; }
.chart-switch button { min-height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
.chart-switch button:hover { color: var(--text); background: var(--surface-2); }
.chart-switch button.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-border); }
.chart-scroll { position: relative; width: 100%; overflow: hidden; }
.line-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--border); stroke-width: 1; opacity: .7; }
.chart-grid text, .chart-labels text { fill: var(--muted-2); font-size: 10px; }
.zero-line { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 4 5; }
.chart-area { fill: url(#areaFill); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-point .hit { fill: transparent; cursor: pointer; }
.chart-point .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 3; transition: .15s ease; }
.chart-point:hover .dot, .chart-point:focus .dot { r: 6; fill: var(--accent); }
.chart-empty { min-height: 220px; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.chart-tooltip { position: absolute; z-index: 2; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-3); box-shadow: var(--shadow); font-size: 12px; pointer-events: none; }

.metrics-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.metric-card { min-height: 145px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); text-align: left; display: flex; flex-direction: column; }
.metric-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.metric-card.accent { background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--accent) 7%, var(--surface))); }
.metric-card.green { background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--green) 5%, var(--surface))); }
.metric-card.red { background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--red) 5%, var(--surface))); }
.metric-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.metric-icon .icon { width: 16px; }
.metric-card > strong { margin: 16px 0 12px; font-size: 22px; letter-spacing: -.035em; }
.metric-foot { margin-top: auto; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; }
.metric-foot .icon { width: 15px; }
.metric-foot.up b { color: var(--green); }
.metric-foot.down b { color: var(--red); }
.metric-foot small { margin-left: 2px; }
.metric-foot > .icon:last-child { margin-left: auto; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 14px; margin-top: 14px; }
.impact-list, .rank-list, .expense-list, .operation-compact-list { padding: 0 12px 12px; }
.impact-row, .rank-row, .expense-row, .operation-compact { width: 100%; min-height: 58px; border: 0; border-top: 1px solid var(--border); background: transparent; display: flex; align-items: center; gap: 11px; padding: 9px 8px; text-align: left; }
.impact-row:first-child, .rank-row:first-child, .expense-row:first-child, .operation-compact:first-child { border-top: 0; }
.impact-row:hover, .rank-row:hover, .expense-row:hover, .operation-compact:hover { background: var(--surface-2); border-radius: 10px; }
.impact-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.impact-dot.negative { background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
.impact-row > span:nth-child(2), .rank-content, .expense-row > span:nth-child(2), .operation-copy { flex: 1; min-width: 0; }
.impact-row b, .impact-row small, .rank-row b, .rank-row small, .expense-row b, .expense-row small, .operation-compact b, .operation-compact small { display: block; }
.impact-row b, .rank-row b, .expense-row b, .operation-compact b { font-size: 13px; }
.impact-row small, .rank-row small, .expense-row small, .operation-compact small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.impact-row > strong { font-size: 13px; }
.impact-row > .icon, .operation-compact > .icon { width: 16px; color: var(--muted-2); }
.rank-index { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 800; }
.rank-content { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.rank-content > strong { font-size: 13px; }
.rank-content > i { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.rank-content > i > em { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.category-icon, .operation-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); font-size: 15px; flex: 0 0 auto; }
.operation-icon.positive { background: var(--green-soft); }
.operation-icon.negative { background: var(--red-soft); }
.expense-row > strong { font-size: 13px; color: var(--red); }
.expense-row > span:nth-child(2) > i { display: block; height: 5px; margin-top: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.expense-row > span:nth-child(2) > i em { display: block; height: 100%; border-radius: inherit; background: var(--red); }
.operation-amount { font-size: 13px; font-weight: 750; white-space: nowrap; }
.assets-surface, .recent-surface { margin-top: 14px; }
.assets-preview { width: 100%; min-height: 110px; border: 0; background: transparent; display: flex; align-items: center; gap: 20px; padding: 20px; text-align: left; }
.assets-preview:hover { background: var(--surface-2); border-radius: inherit; }
.assets-total { min-width: 240px; }
.assets-total small, .assets-total strong { display: block; }
.assets-total small { color: var(--muted); font-size: 12px; }
.assets-total strong { margin-top: 6px; font-size: 24px; letter-spacing: -.04em; }
.asset-chips { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.asset-chips i { min-width: 82px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); font-style: normal; }
.asset-chips b, .asset-chips small { display: block; }
.asset-chips b { font-size: 11px; }
.asset-chips small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.assets-preview > .icon { color: var(--muted); }

.confidence-badge { margin-top: 14px; min-height: 48px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 12px; }
.confidence-badge.good { border-color: color-mix(in srgb, var(--green) 25%, var(--border)); background: var(--green-soft); }
.confidence-badge.warning { border-color: color-mix(in srgb, var(--amber) 25%, var(--border)); background: var(--amber-soft); }
.confidence-badge .icon { width: 18px; color: var(--muted); }
.confidence-badge.good .icon { color: var(--green); }
.confidence-badge.warning .icon { color: var(--amber); }
.confidence-badge.compact { margin: 0; }

.analytics-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.analytics-tabs { margin-left: auto; display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.analytics-tabs button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 650; }
.analytics-tabs button:hover { color: var(--text); background: var(--surface-2); }
.analytics-tabs button.active { color: var(--text); background: var(--surface-3); }
.analytics-stack { display: grid; gap: 14px; }
.analytics-chart-surface { padding-bottom: 10px; }
.analytics-chart-surface .chart-switch { padding: 0 12px; }
.analytics-chart-surface .chart-scroll { padding: 0 8px; }
.analytics-two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.heatmap-surface { padding-bottom: 18px; }
.heatmap-wrap { padding: 6px 20px 0; overflow: hidden; }
.heatmap-grid { display: grid; grid-template-columns: 38px repeat(6, minmax(24px, 1fr)); gap: 6px; align-items: center; }
.heat-label, .heat-day { color: var(--muted); font-size: 10px; }
.heat-label { text-align: center; }
.heat-day { text-align: right; padding-right: 4px; }
.heat-cell { min-width: 0; min-height: 32px; border: 1px solid color-mix(in srgb, var(--green) calc(var(--heat) * 28%), var(--border)); border-radius: 7px; background: color-mix(in srgb, var(--green) calc(var(--heat) * 75%), var(--surface-3)); }
.heat-cell.negative { border-color: color-mix(in srgb, var(--red) calc(var(--heat) * 28%), var(--border)); background: color-mix(in srgb, var(--red) calc(var(--heat) * 75%), var(--surface-3)); }
.heat-legend { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.heat-legend i { width: 18px; height: 8px; border-radius: 3px; background: var(--green-soft); }
.heat-legend i:nth-of-type(2) { background: color-mix(in srgb, var(--green) 30%, var(--surface)); }
.heat-legend i:nth-of-type(3) { background: color-mix(in srgb, var(--green) 55%, var(--surface)); }
.heat-legend i:nth-of-type(4) { background: color-mix(in srgb, var(--green) 80%, var(--surface)); }

.pnl-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pnl-summary-grid > div { min-height: 120px; padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); display: flex; flex-direction: column; }
.pnl-summary-grid > div.accent { border-color: var(--accent-border); background: var(--accent-soft); }
.pnl-summary-grid span { color: var(--muted); font-size: 12px; }
.pnl-summary-grid strong { margin-top: 13px; font-size: 20px; letter-spacing: -.03em; }
.pnl-summary-grid small { margin-top: auto; padding-top: 10px; color: var(--muted); font-size: 11px; }
.pnl-statement { padding-bottom: 16px; }
.pnl-equation { margin: 0 20px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pnl-equation > div { min-height: 48px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--border); font-size: 13px; }
.pnl-equation > div:first-child { border-top: 0; }
.pnl-equation > div.minus b { color: var(--red); }
.pnl-equation > div.subtotal { background: var(--surface-2); font-weight: 700; }
.pnl-equation > div.total { background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.pnl-detail-head, .source-breakdown-head { min-height: 38px; padding: 0 14px; display: grid; align-items: center; gap: 12px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.pnl-detail-head { grid-template-columns: minmax(200px, 1fr) 130px 130px 140px 20px; }
.pnl-detail-row { width: 100%; min-height: 62px; padding: 8px 14px; border: 0; border-top: 1px solid var(--border); background: transparent; display: grid; grid-template-columns: minmax(200px, 1fr) 130px 130px 140px 20px; gap: 12px; align-items: center; text-align: left; font-size: 12px; }
.pnl-detail-row:first-child { border-top: 0; }
.pnl-detail-row:hover { background: var(--surface-2); }
.pnl-detail-row > span:first-child { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; gap: 2px 9px; align-items: center; }
.pnl-detail-row > span:first-child i { grid-row: 1 / 3; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); font-style: normal; }
.pnl-detail-row b, .pnl-detail-row small { display: block; }
.pnl-detail-row small { color: var(--muted); font-size: 10px; }
.pnl-detail-row > .icon { width: 16px; color: var(--muted); }

.cashflow-grid { padding: 0 16px 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cashflow-card { min-height: 180px; padding: 15px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); text-align: left; }
.cashflow-card:hover { border-color: var(--border-strong); }
.cashflow-card > span { display: flex; justify-content: space-between; align-items: center; }
.cashflow-card > span b { font-size: 14px; }
.cashflow-card > span small { color: var(--muted); font-size: 10px; }
.cashflow-card > div { margin-top: 15px; display: flex; justify-content: space-between; }
.cashflow-card > div small { color: var(--muted); }
.cashflow-card > div strong { font-size: 13px; }
.cashflow-card footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.quality-explanation { padding: 16px; }
.quality-explanation > div, .asset-help > div { display: flex; align-items: flex-start; gap: 11px; }
.quality-explanation .icon, .asset-help .icon { color: var(--accent); }
.quality-explanation b, .quality-explanation p, .asset-help b, .asset-help p { display: block; }
.quality-explanation b, .asset-help b { font-size: 13px; }
.quality-explanation p, .asset-help p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.source-selector { display: flex; gap: 7px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.source-selector::-webkit-scrollbar { display: none; }
.source-selector button { min-height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--muted); white-space: nowrap; font-size: 12px; font-weight: 650; }
.source-selector button.active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.source-hero-v3, .expense-hero { min-height: 155px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--accent) 7%, var(--surface))); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.source-hero-v3 span, .source-hero-v3 strong, .source-hero-v3 small, .expense-hero span, .expense-hero strong, .expense-hero small { display: block; }
.source-hero-v3 span, .expense-hero span { color: var(--muted); font-size: 12px; }
.source-hero-v3 strong, .expense-hero strong { margin-top: 7px; font-size: 30px; letter-spacing: -.045em; }
.source-hero-v3 small, .expense-hero small { margin-top: 6px; color: var(--muted); font-size: 12px; }
.expense-hero > .icon { width: 54px; height: 54px; color: var(--red); opacity: .8; }
.source-breakdown-head { grid-template-columns: minmax(220px, 1fr) 90px 90px 140px 20px; }
.source-breakdown-row { width: 100%; min-height: 62px; padding: 8px 14px; border: 0; border-top: 1px solid var(--border); background: transparent; display: grid; grid-template-columns: minmax(220px, 1fr) 90px 90px 140px 20px; gap: 12px; align-items: center; text-align: left; font-size: 12px; }
.source-breakdown-row:hover { background: var(--surface-2); }
.source-breakdown-row b, .source-breakdown-row small { display: block; }
.source-breakdown-row small { color: var(--muted); margin-top: 3px; font-size: 10px; }
.source-breakdown-row > .icon { width: 16px; color: var(--muted); }
.insight-list { padding: 0 12px 12px; }
.insight-list > button { width: 100%; min-height: 62px; padding: 8px; border: 0; border-top: 1px solid var(--border); background: transparent; display: flex; align-items: center; gap: 11px; text-align: left; }
.insight-list > button:first-child { border-top: 0; }
.insight-list > button:hover { background: var(--surface-2); border-radius: 10px; }
.insight-number { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: 11px; font-weight: 800; }
.insight-list > button > span:nth-child(2) { flex: 1; }
.insight-list b, .insight-list small { display: block; }
.insight-list b { font-size: 13px; }
.insight-list small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.insight-list strong { color: var(--red); font-size: 13px; }
.insight-list .icon { width: 16px; color: var(--muted); }

.operations-toolbar { display: grid; grid-template-columns: auto minmax(260px, 1fr) auto; gap: 10px; align-items: center; margin-bottom: 12px; }
.search-field { min-height: 46px; padding: 0 11px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); display: flex; align-items: center; gap: 8px; }
.search-field .icon { width: 18px; color: var(--muted); }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font-size: 13px; }
.search-field input::placeholder { color: var(--muted-2); }
.search-field button { width: 40px; min-width: 40px; height: 40px; padding: 0; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; }
.search-field button .icon { width: 16px; }
.filter-button { border: 1px solid var(--border); background: var(--surface); }
.filter-button.active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.filter-button b { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; display: grid; place-items: center; background: var(--accent); color: white; font-size: 10px; }
.saved-views { display: flex; gap: 7px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.saved-views::-webkit-scrollbar { display: none; }
.saved-views button { min-height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 11px; font-weight: 650; }
.saved-views button:hover { color: var(--text); border-color: var(--border-strong); }
.saved-views button.add-view { color: var(--accent); border-style: dashed; }
.saved-views button i { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-style: normal; }
.operations-surface { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.operations-summary { min-height: 54px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.operations-summary span { color: var(--muted); font-size: 12px; }
.operations-summary span b { color: var(--text); }
.operations-summary select { min-height: 40px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text); padding: 0 9px; font-size: 11px; }
.operation-table-head { min-height: 38px; padding: 0 14px; display: grid; grid-template-columns: minmax(260px, 1fr) 130px 170px 150px 20px; gap: 12px; align-items: center; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.operation-table-row { width: 100%; min-height: 70px; padding: 7px 14px; border: 0; border-top: 1px solid var(--border); background: transparent; display: grid; grid-template-columns: minmax(260px, 1fr) 130px 170px 150px 20px; gap: 12px; align-items: center; text-align: left; }
.operation-table-row:first-child { border-top: 0; }
.operation-table-row:hover { background: var(--surface-2); }
.operation-table-row > span b, .operation-table-row > span small { display: block; }
.operation-table-row > span b { font-size: 12px; }
.operation-table-row > span small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.op-title-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.op-title-cell > span:last-child { min-width: 0; }
.op-title-cell b, .op-title-cell small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operation-table-row > .icon { width: 16px; color: var(--muted); }
.operation-mobile-list { display: none; }
.pagination { min-height: 62px; padding: 9px 14px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: center; gap: 16px; }
.pagination span { color: var(--muted); font-size: 11px; }

.assets-hero-v3 { min-height: 180px; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--accent) 8%, var(--surface))); display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.assets-hero-v3 span, .assets-hero-v3 strong, .assets-hero-v3 small { display: block; }
.assets-hero-v3 span { color: var(--muted); font-size: 13px; }
.assets-hero-v3 strong { margin-top: 8px; font-size: 38px; letter-spacing: -.05em; }
.assets-hero-v3 small { margin-top: 7px; color: var(--muted); font-size: 12px; }
.asset-hero-rate { min-width: 190px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.asset-hero-rate b { margin-top: 6px; font-size: 20px; }
.asset-grid-v3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.asset-card-v3 { min-height: 210px; padding: 17px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); text-align: left; display: flex; flex-direction: column; }
.asset-card-v3:hover { border-color: var(--border-strong); background: var(--surface-2); }
.asset-card-top { display: flex; align-items: center; gap: 10px; }
.asset-card-top > span:nth-child(2) { flex: 1; }
.asset-card-top b, .asset-card-top small { display: block; }
.asset-card-top b { font-size: 13px; }
.asset-card-top small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.asset-card-top > .icon { width: 16px; color: var(--muted); }
.asset-logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 15px; font-weight: 850; }
.asset-logo.rub { background: var(--blue-soft); color: var(--blue); }
.asset-logo.xbox { background: var(--green-soft); color: var(--green); }
.asset-card-v3 > strong { margin-top: 22px; font-size: 24px; letter-spacing: -.04em; }
.asset-equivalent { margin-top: 5px; color: var(--muted); font-size: 12px; }
.asset-share { margin-top: auto; padding-top: 18px; }
.asset-share > i { display: block; height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.asset-share > i em { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.asset-share small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.asset-help { margin-top: 14px; padding: 16px; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; background: rgba(0, 0, 0, .58); backdrop-filter: blur(5px); animation: fadeIn .16s ease; }
.modal-panel { position: fixed; z-index: 101; left: 50%; bottom: 0; width: min(620px, calc(100% - 24px)); max-height: min(90vh, 900px); border: 1px solid var(--border); border-bottom: 0; border-radius: 22px 22px 0 0; background: var(--surface); box-shadow: var(--shadow); transform: translateX(-50%); display: flex; flex-direction: column; animation: slideUp .22s ease; overflow: hidden; }
.modal-panel.wide { width: min(820px, calc(100% - 24px)); }
.modal-panel.full { width: min(1100px, calc(100% - 24px)); }
.modal-header { min-height: 70px; padding: 14px 17px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.modal-header h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 18px; overflow-y: auto; overscroll-behavior: contain; }
.modal-footer { min-height: 68px; padding: 11px 17px calc(11px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 9px; background: color-mix(in srgb, var(--surface) 94%, transparent); }
.modal-footer.split { justify-content: flex-start; }
.modal-footer.split > span { flex: 1; }

.quick-periods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.quick-periods button { min-height: 42px; padding: 0 9px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 650; }
.quick-periods button.active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.form-grid { display: grid; gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
.field { min-width: 0; display: block; margin-top: 12px; }
.field:first-child { margin-top: 0; }
.field > span { display: block; margin-bottom: 7px; color: var(--text-2); font-size: 12px; font-weight: 650; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); color: var(--text); padding: 10px 12px; font-size: 14px; }
.field textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.date-input-wrap { width: 100%; min-width: 0; min-height: 46px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); padding: 10px 12px; }
.date-input-wrap input { display: block; width: 100%; min-width: 0; min-height: 0; border: 0; border-radius: 0; background: transparent; padding: 0; color: var(--text); }
.period-summary { margin-top: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; gap: 10px; }
.period-summary .icon { color: var(--accent); }
.period-summary b, .period-summary small { display: block; }
.period-summary b { font-size: 12px; }
.period-summary small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.operation-type-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.operation-type-tabs button { min-height: 60px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 11px; font-weight: 700; }
.operation-type-tabs button .icon { width: 19px; }
.operation-type-tabs button.active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.template-strip { margin-top: 12px; display: flex; align-items: center; gap: 7px; overflow-x: auto; scrollbar-width: none; }
.template-strip > span { color: var(--muted); font-size: 11px; }
.template-strip button { min-height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: 11px; }
.template-strip button .icon { width: 15px; }
.create-modal-body .form-grid { margin-top: 6px; }
.field-wide { grid-column: span 1; }
.advanced-toggle { width: 100%; min-height: 58px; margin-top: 12px; padding: 9px 12px; border: 1px dashed var(--border-strong); border-radius: 12px; background: transparent; display: flex; align-items: center; gap: 10px; text-align: left; }
.advanced-toggle > span { flex: 1; }
.advanced-toggle b, .advanced-toggle small { display: block; }
.advanced-toggle b { font-size: 12px; }
.advanced-toggle small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.advanced-toggle .icon { color: var(--muted); }
.deductions-section { margin-top: 14px; padding: 13px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-label b, .section-label small { display: block; }
.section-label b { font-size: 12px; }
.section-label small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.deduction-row { margin-top: 9px; display: grid; grid-template-columns: minmax(160px, 1fr) minmax(100px, .7fr) 44px; gap: 8px; }
.deduction-row select, .deduction-row input { min-width: 0; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); padding: 0 10px; }
.deduction-empty { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.switch-row { min-height: 58px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; gap: 10px; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--accent); }
.switch-row b, .switch-row small { display: block; }
.switch-row b { font-size: 12px; }
.switch-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.transfer-grid { margin-top: 12px; display: grid; grid-template-columns: 1fr 44px 1fr; gap: 10px; align-items: center; }
.transfer-arrow { display: grid; place-items: center; color: var(--accent); }
.create-preview-placeholder, .create-preview { min-height: 70px; margin-top: 15px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: 13px; background: var(--surface-2); display: flex; align-items: center; gap: 10px; color: var(--muted); }
.create-preview-placeholder b, .create-preview-placeholder small { display: block; }
.create-preview-placeholder b { color: var(--text-2); font-size: 12px; }
.create-preview-placeholder small { margin-top: 3px; font-size: 10px; }
.create-preview { display: grid; grid-template-columns: minmax(160px, .7fr) minmax(220px, 1fr); align-items: stretch; color: var(--text); border-style: solid; border-color: var(--accent-border); background: var(--accent-soft); }
.preview-result, .preview-movements { padding: 10px; }
.preview-result span, .preview-result strong, .preview-result small { display: block; }
.preview-result span { color: var(--muted); font-size: 11px; }
.preview-result strong { margin-top: 6px; font-size: 22px; }
.preview-result small { margin-top: 6px; color: var(--muted); font-size: 10px; }
.preview-movements { border-left: 1px solid var(--accent-border); }
.preview-movements > div { min-height: 30px; display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 11px; }
.preview-movements p { color: var(--muted); font-size: 11px; }
.formula-warning { grid-column: 1 / -1; padding: 10px; border-radius: 10px; background: var(--amber-soft); display: flex; gap: 9px; color: var(--amber); }
.formula-warning b, .formula-warning small { display: block; }
.formula-warning b { font-size: 11px; }
.formula-warning small { margin-top: 3px; color: var(--text-2); font-size: 10px; }

.detail-result { min-height: 145px; padding: 20px; border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(145deg, var(--surface-2), color-mix(in srgb, var(--accent) 8%, var(--surface-2))); display: flex; flex-direction: column; justify-content: center; }
.detail-result span, .detail-result strong, .detail-result small { display: block; }
.detail-result span { color: var(--muted); font-size: 12px; }
.detail-result strong { margin-top: 8px; font-size: 32px; letter-spacing: -.045em; }
.detail-result small { margin-top: 7px; color: var(--muted); font-size: 11px; }
.detail-meta-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.detail-meta-grid > div { min-height: 74px; padding: 11px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.detail-meta-grid span, .detail-meta-grid b { display: block; }
.detail-meta-grid span { color: var(--muted); font-size: 10px; }
.detail-meta-grid b { margin-top: 7px; font-size: 12px; }
.detail-section { margin-top: 18px; }
.detail-section h3 { margin: 0 0 9px; font-size: 13px; }
.unit-economics { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.unit-economics > div { min-height: 44px; padding: 0 12px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.unit-economics > div:first-child { border-top: 0; }
.unit-economics > div.total { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.detail-movements { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.detail-movements > div { min-height: 58px; padding: 8px 11px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.detail-movements > div:first-child { border-top: 0; }
.movement-direction, .ledger-direction { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--green-soft); font-weight: 800; }
.movement-direction.negative, .ledger-direction.negative { background: var(--red-soft); }
.detail-movements > div > span:nth-child(2) { flex: 1; }
.detail-movements b, .detail-movements small { display: block; }
.detail-movements b { font-size: 12px; }
.detail-movements small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.detail-movements strong { font-size: 12px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list span { padding: 6px 9px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
.detail-comment { margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.source-reference { margin-top: 16px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.source-reference code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reverse-summary { min-height: 64px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; gap: 10px; }
.reverse-summary .icon { color: var(--red); }
.reverse-summary b, .reverse-summary small { display: block; }
.reverse-summary b { font-size: 12px; }
.reverse-summary small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.warning-callout { margin-top: 12px; padding: 11px; border: 1px solid color-mix(in srgb, var(--amber) 24%, var(--border)); border-radius: 12px; background: var(--amber-soft); display: flex; gap: 9px; color: var(--amber); font-size: 11px; line-height: 1.5; }

.asset-ledger-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.asset-ledger-tabs button { min-height: 38px; padding: 0 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 11px; }
.asset-ledger-tabs button.active { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.asset-ledger-list { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.ledger-row { min-height: 62px; padding: 8px 11px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.ledger-row:first-child { border-top: 0; }
.ledger-row > span:nth-child(2) { flex: 1; min-width: 0; }
.ledger-row b, .ledger-row small { display: block; }
.ledger-row b { font-size: 12px; }
.ledger-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.ledger-row strong { font-size: 12px; white-space: nowrap; }

.settings-section { padding: 16px 0; border-top: 1px solid var(--border); }
.settings-section:first-child { padding-top: 0; border-top: 0; }
.settings-section h3 { margin: 0 0 10px; font-size: 14px; }
.quality-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.quality-grid > div { min-height: 70px; padding: 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.quality-grid span, .quality-grid b { display: block; }
.quality-grid span { color: var(--muted); font-size: 10px; }
.quality-grid b { margin-top: 7px; font-size: 14px; }
.settings-actions { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.settings-actions > button { width: 100%; min-height: 62px; padding: 8px 11px; border: 0; border-top: 1px solid var(--border); background: transparent; display: flex; align-items: center; gap: 10px; text-align: left; }
.settings-actions > button:first-child { border-top: 0; }
.settings-actions > button:hover { background: var(--surface-2); }
.settings-actions > button > .icon:first-child { color: var(--accent); }
.settings-actions > button > span { flex: 1; }
.settings-actions b, .settings-actions small { display: block; }
.settings-actions b { font-size: 12px; }
.settings-actions small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.settings-actions > button > .icon:last-child { width: 16px; color: var(--muted); }
.category-manager-list, .template-manager-list { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.category-manager-list > div, .template-manager-list > div { min-height: 58px; padding: 8px 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.category-manager-list > div:first-child, .template-manager-list > div:first-child { border-top: 0; }
.category-manager-list > div > span:nth-child(2), .template-manager-list > div > span:nth-child(2) { flex: 1; }
.category-manager-list b, .category-manager-list small, .template-manager-list b, .template-manager-list small { display: block; }
.category-manager-list b, .template-manager-list b { font-size: 12px; }
.category-manager-list small, .template-manager-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.template-manager-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.inline-create { margin-top: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
.inline-create h3 { margin: 0; font-size: 13px; }
.inline-create .primary-button { margin-top: 12px; }

.empty-state, .error-state { min-height: 220px; padding: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state > .icon, .error-state > .icon { width: 34px; height: 34px; color: var(--muted); }
.error-state > .icon { color: var(--red); }
.empty-state h3, .error-state h3 { margin: 12px 0 0; font-size: 15px; }
.empty-state p, .error-state p { max-width: 440px; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.empty-state button, .error-state button { margin-top: 14px; }

.skeleton-wrap { display: grid; gap: 12px; }
.skeleton-wrap.dashboard { grid-template-columns: repeat(4, 1fr); }
.skeleton-wrap.dashboard .skeleton-block:first-child { grid-column: 1 / -1; min-height: 380px; }
.skeleton-wrap.list { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface); }
.skeleton-block { min-height: 130px; border-radius: 15px; background: linear-gradient(90deg, var(--surface) 20%, var(--surface-2) 45%, var(--surface) 70%); background-size: 220% 100%; animation: shimmer 1.4s infinite; }
.skeleton-wrap.list .skeleton-block { min-height: 56px; }
.skeleton-wrap.cards { grid-template-columns: repeat(3, 1fr); }
.boot-screen { min-height: 100vh; padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.boot-logo { width: 54px; height: 54px; border-radius: 17px; display: grid; place-items: center; background: var(--accent); color: white; }
.boot-logo .icon { width: 28px; height: 28px; }
.boot-screen h1 { margin: 16px 0 0; font-size: 22px; }
.boot-screen p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.boot-screen small { margin-top: 8px; color: var(--muted); font-size: 11px; }
.boot-screen > i { width: 72px; height: 3px; margin-top: 20px; border-radius: 99px; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: pulse 1.2s infinite; }
.boot-screen.error .boot-logo { background: var(--red-soft); color: var(--red); }
.toast-root { position: fixed; z-index: 200; top: calc(12px + env(safe-area-inset-top)); right: 12px; width: min(360px, calc(100% - 24px)); display: grid; gap: 8px; pointer-events: none; }
.toast { min-height: 50px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-3); box-shadow: var(--shadow); display: flex; align-items: center; gap: 9px; font-size: 12px; animation: toastIn .2s ease; }
.toast .icon { color: var(--green); }
.toast.error .icon { color: var(--red); }
.toast.info .icon { color: var(--blue); }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -20% 0; } }
@keyframes pulse { 0%, 100% { opacity: .4; transform: scaleX(.7); } 50% { opacity: 1; transform: scaleX(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translate(-50%, 24px); opacity: .4; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1100px) {
  :root { --sidebar: 214px; }
  .page-container { padding-left: 22px; padding-right: 22px; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .asset-grid-v3 { grid-template-columns: repeat(2, 1fr); }
  .cashflow-grid { grid-template-columns: repeat(2, 1fr); }
  .operation-table-head, .operation-table-row { grid-template-columns: minmax(220px, 1fr) 115px 145px 135px 18px; }
  .pnl-detail-head, .pnl-detail-row { grid-template-columns: minmax(180px, 1fr) 110px 110px 130px 18px; }
}

@media (max-width: 820px) {
  .desktop-sidebar { display: none; }
  .app-main { margin-left: 0; }
  .mobile-header { position: sticky; z-index: 25; top: 0; min-height: calc(58px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(18px); }
  .mobile-brand { min-height: 48px; padding: 0; border: 0; background: transparent; display: flex; align-items: center; gap: 9px; font-size: 15px; }
  .mobile-brand .brand-symbol { width: 32px; height: 32px; border-radius: 10px; }
  .mobile-brand .brand-symbol .icon { width: 18px; height: 18px; }
  .mobile-actions { display: flex; gap: 5px; }
  .mobile-actions .icon-button { width: 40px; height: 40px; border: 0; background: transparent; }
  .avatar-button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 800; }
  .mobile-nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; min-height: calc(66px + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(20px); }
  .mobile-nav > button { min-width: 0; min-height: 52px; border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 10px; font-weight: 650; }
  .mobile-nav > button .icon { width: 20px; height: 20px; }
  .mobile-nav > button.active { color: var(--accent); }
  .mobile-nav .nav-create { width: 52px; height: 52px; min-height: 52px; justify-self: center; align-self: start; margin-top: -17px; border-radius: 17px; background: var(--accent); color: white; box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 30%, transparent); }
  .mobile-nav .nav-create .icon { width: 25px; height: 25px; }
  .page-container { padding: 18px 14px calc(92px + env(safe-area-inset-bottom)); }
  .page-header { min-height: 46px; margin-bottom: 14px; align-items: center; }
  .page-header h1 { font-size: 22px; }
  .page-header p { font-size: 12px; }
  .page-header .primary-button { min-height: 40px; padding: 0 11px; font-size: 12px; }
  .desktop-only { display: none !important; }
  .dashboard-period-row { margin-bottom: 10px; }
  .period-button { min-width: 0; flex: 1; }
  .refresh-label { display: none; }
  .hero-card { min-height: 0; display: block; }
  .hero-copy { min-height: 152px; padding: 22px 18px 10px; border-right: 0; }
  .hero-copy > strong { font-size: 34px; }
  .hero-comparison { margin-top: 12px; }
  .hero-chart { padding: 0 4px 4px; }
  .chart-switch { margin: 0 8px 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chart-switch::-webkit-scrollbar { display: none; }
  .chart-switch button { white-space: nowrap; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
  .metric-card { min-height: 126px; padding: 13px; }
  .metric-card > strong { margin: 13px 0 10px; font-size: 18px; }
  .metric-foot small { display: none; }
  .dashboard-grid { margin-top: 10px; gap: 10px; }
  .assets-surface, .recent-surface { margin-top: 10px; }
  .assets-preview { min-height: 0; display: grid; grid-template-columns: 1fr 18px; gap: 12px; padding: 16px; }
  .assets-total { min-width: 0; }
  .assets-total strong { font-size: 21px; }
  .asset-chips { grid-column: 1 / -1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .asset-chips::-webkit-scrollbar { display: none; }
  .asset-chips i { min-width: 76px; }
  .surface-header { padding: 16px 15px 10px; }
  .surface-header h2 { font-size: 15px; }
  .surface-header > small { display: none; }
  .impact-list, .rank-list, .expense-list, .operation-compact-list { padding: 0 8px 8px; }
  .confidence-badge { margin-top: 10px; }
  .analytics-toolbar { display: block; }
  .analytics-toolbar .period-button { width: 100%; }
  .analytics-tabs { margin: 9px 0 0; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .analytics-tabs::-webkit-scrollbar { display: none; }
  .analytics-tabs button { white-space: nowrap; }
  .analytics-two-columns { grid-template-columns: 1fr; gap: 10px; }
  .analytics-stack { gap: 10px; }
  .heatmap-wrap { padding: 4px 10px 0; }
  .heatmap-grid { grid-template-columns: 28px repeat(6, 1fr); gap: 4px; }
  .heat-cell { min-height: 28px; }
  .pnl-summary-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .pnl-summary-grid > div { min-height: 108px; padding: 13px; }
  .pnl-summary-grid strong { font-size: 17px; }
  .pnl-detail-head, .source-breakdown-head { display: none; }
  .pnl-detail-row, .source-breakdown-row { min-height: 66px; padding: 9px 12px; grid-template-columns: minmax(0, 1fr) auto 16px; gap: 10px; }
  .pnl-detail-row > span:first-child { grid-template-columns: 34px minmax(0, 1fr); }
  .pnl-detail-row .desktop-value, .source-breakdown-row > span:nth-child(2), .source-breakdown-row > span:nth-child(3) { display: none; }
  .pnl-detail-row > span:nth-child(4) { font-size: 12px; }
  .source-breakdown-row > strong { font-size: 12px; }
  .cashflow-grid { grid-template-columns: 1fr; padding: 0 10px 10px; }
  .source-hero-v3, .expense-hero { min-height: 132px; padding: 18px; }
  .source-hero-v3 strong, .expense-hero strong { font-size: 25px; }
  .operations-toolbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .operations-toolbar .period-button { grid-column: 1 / -1; width: 100%; }
  .filter-button span { display: none; }
  .filter-button { min-width: 46px; padding: 0 10px; }
  .operation-table-head, .operation-table-list { display: none; }
  .operation-mobile-list { display: block; padding: 6px; }
  .operation-card-mobile { width: 100%; min-height: 78px; padding: 10px; border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; }
  .operation-card-mobile:first-child { border-top: 0; }
  .operation-card-mobile:hover { background: var(--surface-2); border-radius: 11px; }
  .operation-card-head { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 9px; align-items: center; }
  .operation-card-head > span:nth-child(2) { min-width: 0; }
  .operation-card-head b, .operation-card-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .operation-card-head b { font-size: 13px; }
  .operation-card-head small { margin-top: 3px; color: var(--muted); font-size: 10px; }
  .operation-card-head strong { font-size: 12px; white-space: nowrap; }
  .operation-card-meta { margin: 7px 0 0 45px; display: flex; gap: 6px; overflow: hidden; }
  .operation-card-meta i { padding: 3px 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-style: normal; font-size: 11px; white-space: nowrap; }
  .assets-hero-v3 { min-height: 150px; padding: 19px; }
  .assets-hero-v3 strong { font-size: 30px; }
  .asset-hero-rate { min-width: 150px; }
  .asset-grid-v3 { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
  .asset-card-v3 { min-height: 180px; padding: 14px; }
  .asset-card-v3 > strong { margin-top: 18px; font-size: 20px; }
  .modal-panel, .modal-panel.wide, .modal-panel.full { width: 100%; max-height: 93vh; border-left: 0; border-right: 0; }
  .modal-header { min-height: 64px; }
  .modal-body { padding: 14px; }
  .modal-footer { padding-left: 12px; padding-right: 12px; }
  .modal-footer .primary-button, .modal-footer .secondary-button, .modal-footer .danger-button { flex: 1; }
  .modal-footer.split { flex-wrap: wrap; }
  .modal-footer.split > span { display: none; }
  .quick-periods { grid-template-columns: repeat(2, 1fr); }
  .form-grid.three, .form-grid.four { grid-template-columns: repeat(2, 1fr); }
  .detail-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .create-preview { grid-template-columns: 1fr; }
  .preview-movements { border-left: 0; border-top: 1px solid var(--accent-border); }
  .quality-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .page-container { padding-left: 12px; padding-right: 12px; }
  .page-header p { max-width: 230px; }
  .page-header .primary-button .icon { margin: 0; }
  .page-header .primary-button { width: 42px; padding: 0; font-size: 0; }
  .metrics-row { gap: 7px; }
  .metric-card { min-height: 119px; padding: 12px; }
  .metric-top { font-size: 11px; }
  .metric-icon { width: 27px; height: 27px; }
  .metric-card > strong { font-size: 16px; }
  .metric-foot { font-size: 11px; }
  .hero-copy > strong { font-size: 30px; }
  .chart-grid text, .chart-labels text { font-size: 9px; }
  .asset-chips i:nth-child(n+4) { display: none; }
  .analytics-tabs button { padding: 0 10px; }
  .pnl-equation { margin: 0 12px; }
  .assets-hero-v3 { display: block; }
  .asset-hero-rate { margin-top: 15px; min-width: 0; }
  .asset-grid-v3 { grid-template-columns: 1fr; }
  .asset-card-v3 { min-height: 170px; }
  .form-grid.two, .form-grid.three, .form-grid.four { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .operation-type-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .operation-type-tabs button { min-height: 54px; font-size: 10px; }
  .deduction-row { grid-template-columns: minmax(0, 1fr) minmax(90px, .7fr) 44px; }
  .transfer-grid { grid-template-columns: 1fr; }
  .transfer-arrow { transform: rotate(90deg); }
  .detail-result strong { font-size: 27px; }
  .modal-footer { flex-wrap: wrap; }
  .modal-footer .text-button { width: 100%; justify-content: flex-start; }
  .toast-root { top: auto; bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .page-header h1 { font-size: 20px; }
  .hero-copy { padding-left: 15px; padding-right: 15px; }
  .hero-copy > strong { font-size: 27px; }
  .metric-card > strong { font-size: 15px; }
  .metric-top { gap: 5px; }
  .metric-icon { display: none; }
  .heatmap-grid { gap: 3px; }
  .heat-cell { min-height: 25px; }
  .operation-type-tabs button span { display: none; }
  .operation-type-tabs button .icon { width: 22px; height: 22px; }
}
.asset-account-section { margin-bottom: 18px; }
.asset-account-list { border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.asset-account-list > div { min-height: 58px; padding: 9px 11px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.asset-account-list > div:first-child { border-top: 0; }
.asset-account-list b, .asset-account-list small { display: block; }
.asset-account-list b { font-size: 12px; }
.asset-account-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.asset-account-list strong { font-size: 13px; white-space: nowrap; }
.asset-history-section .section-label { margin-bottom: 8px; }
