:root {
  color-scheme: dark;
  --canvas: #101411;
  --surface: #181e1a;
  --surface-elevated: #202721;
  --surface-soft: #151a17;
  --text: #f2f6f3;
  --muted: #97a39c;
  --border: #2b342e;
  --accent: #22c983;
  --accent-ink: #07120d;
  --accent-soft: rgba(34, 201, 131, .13);
  --positive: #22c983;
  --negative: #c83f56;
  --warning-text: #eaa144;
  --warning-graphic: #be7410;
  --info: #4e8ed8;
  --shadow: 0 18px 55px rgba(0, 0, 0, .18);
  --radius: 18px;
  --space: 24px;
  --sidebar: 244px;
  --focus: 0 0 0 3px rgba(34, 201, 131, .35);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}

html[data-theme="light"] {
  color-scheme: light;
  --canvas: #f2f5f2;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #e9efeb;
  --text: #142019;
  --muted: #66766e;
  --border: #d9e1dc;
  --accent: #0f7a50;
  --accent-ink: #ffffff;
  --accent-soft: rgba(15, 122, 80, .10);
  --positive: #0f7a50;
  --warning-text: #9b5c00;
  --shadow: 0 18px 45px rgba(26, 53, 39, .08);
  --focus: 0 0 0 3px rgba(15, 122, 80, .25);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--text); min-width: 320px; }
button, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--focus); }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 28px 18px 20px; background: var(--surface-soft); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 760; letter-spacing: -.02em; padding: 0 8px 28px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 18px; }
.side-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 13px; border-radius: 12px; color: var(--muted); font-weight: 620; font-size: 14px; }
.nav-item span { width: 20px; text-align: center; font-size: 18px; }
.nav-item:hover, .nav-item.active { color: var(--text); background: var(--accent-soft); }
.nav-item.active { color: var(--accent); }
.nav-section { margin: 28px 0 12px; }
.nav-section > p { margin: 0 10px 9px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.workspace-card { width: 100%; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 13px; padding: 10px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; text-align: left; cursor: pointer; }
.workspace-avatar, .profile-avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 800; }
.workspace-card strong, .workspace-card small, .profile strong, .profile small { display: block; }
.workspace-card strong, .profile strong { font-size: 13px; }
.workspace-card small, .profile small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.secondary { margin-top: auto; }
.profile { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; border-top: 1px solid var(--border); margin-top: 16px; padding: 18px 5px 0; }
.main { margin-left: var(--sidebar); padding: 38px clamp(24px, 4vw, 62px) 60px; max-width: 1600px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 7px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(28px, 3.2vw, 42px); line-height: 1.08; letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 19px; letter-spacing: -.025em; }
.subtitle { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.staging-badge { display: inline-flex; align-items: center; margin-left: 8px; padding: 4px 7px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 9px; letter-spacing: .04em; vertical-align: middle; }
.top-actions { display: flex; gap: 10px; }
.icon-button, .primary-button, .period-button, .ghost-icon, .theme-tools button { border: 0; color: var(--text); cursor: pointer; }
.icon-button { width: 42px; height: 42px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.notification { position: relative; }
.notification i { position: absolute; top: 10px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.primary-button { min-height: 42px; padding: 0 18px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.primary-button span { margin-right: 8px; font-size: 18px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-grid { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 16px; }
.metric-card { position: relative; padding: 23px; min-height: 184px; overflow: hidden; }
.metric-card.featured { background: linear-gradient(145deg, var(--surface-elevated), var(--surface)); }
.metric-card.featured::after { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; right: -60px; bottom: -85px; background: var(--accent); filter: blur(45px); opacity: .16; }
.card-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; }
.ghost-icon { min-width: 32px; min-height: 32px; display: inline-grid; place-items: center; background: transparent; padding: 4px; color: var(--muted); border-radius: 9px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.positive-bg { background: var(--positive); }
.negative-bg { background: var(--negative); }
.metric-value { display: block; margin-top: 19px; font-size: clamp(26px, 3vw, 36px); line-height: 1; letter-spacing: -.045em; white-space: nowrap; }
.delta { margin: 12px 0 0; font-size: 12px; font-weight: 750; }
.delta span { color: var(--muted); font-weight: 500; margin-left: 5px; }
.positive { color: var(--positive) !important; }
.negative { color: var(--negative) !important; }
.account-strip { display: flex; justify-content: space-between; position: absolute; left: 23px; right: 23px; bottom: 20px; font-size: 11px; color: var(--muted); }
.account-strip strong { color: var(--text); }
.mini-bars { position: absolute; right: 23px; left: 23px; bottom: 20px; height: 31px; display: flex; align-items: end; gap: 5px; opacity: .62; }
.mini-bars i { flex: 1; background: var(--positive); border-radius: 3px 3px 1px 1px; }
.mini-bars i:nth-child(1) { height: 38%; }.mini-bars i:nth-child(2) { height: 52%; }.mini-bars i:nth-child(3) { height: 46%; }.mini-bars i:nth-child(4) { height: 68%; }.mini-bars i:nth-child(5) { height: 58%; }.mini-bars i:nth-child(6) { height: 88%; }
.mini-bars.expense i { background: var(--negative); }.mini-bars.expense i:nth-child(1) { height: 48%; }.mini-bars.expense i:nth-child(2) { height: 42%; }.mini-bars.expense i:nth-child(3) { height: 57%; }.mini-bars.expense i:nth-child(4) { height: 65%; }.mini-bars.expense i:nth-child(5) { height: 52%; }.mini-bars.expense i:nth-child(6) { height: 72%; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); gap: 16px; margin-top: 16px; }
.cashflow-card, .budget-card, .operations-card { padding: 23px; }
.section-heading, .chart-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.period-button { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 10px; padding: 8px 11px; font-size: 11px; }
.chart-summary { margin-top: 24px; }
.chart-summary span { color: var(--muted); font-size: 11px; }
.chart-summary strong { display: block; margin-top: 4px; font-size: 19px; }
.legend { display: flex; gap: 15px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; }
.income-key { background: var(--positive); }.expense-key { background: var(--info); }
.chart { height: 214px; display: grid; grid-template-columns: 48px 1fr; margin-top: 17px; }
.y-labels { display: flex; flex-direction: column; justify-content: space-between; padding: 1px 8px 21px 0; color: var(--muted); font-size: 9px; text-align: right; }
.chart-area { position: relative; display: flex; align-items: end; justify-content: space-around; gap: 12px; padding: 0 10px 21px; }
.grid-lines { position: absolute; inset: 0 0 21px; display: flex; flex-direction: column; justify-content: space-between; }
.grid-lines i { border-top: 1px dashed var(--border); }
.bar-group { position: relative; z-index: 1; height: 100%; flex: 1; display: flex; align-items: end; justify-content: center; gap: 4px; }
.bar-group b, .bar-group em { width: min(15px, 32%); border-radius: 4px 4px 1px 1px; background: var(--positive); opacity: .55; }
.bar-group em { background: var(--info); opacity: .7; }
.bar-group.current b, .bar-group.current em { opacity: 1; }
.bar-group span { position: absolute; bottom: -20px; color: var(--muted); font-size: 9px; }
.budget-card { display: flex; flex-direction: column; }
.donut { width: 150px; aspect-ratio: 1; margin: 25px auto 20px; padding: 15px; border-radius: 50%; background: conic-gradient(var(--accent) 0 67%, var(--surface-soft) 67% 100%); }
.donut::before { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--surface); }
.donut > div { position: absolute; margin: -91px 0 0 20px; width: 80px; text-align: center; }
.donut strong, .donut span { display: block; }.donut strong { font-size: 25px; }.donut span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.budget-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.budget-values > div { padding: 12px; border-radius: 11px; background: var(--surface-soft); }
.budget-values span, .budget-values strong { display: block; }.budget-values span { color: var(--muted); font-size: 9px; }.budget-values strong { margin-top: 5px; font-size: 12px; }
.warning-note { display: flex; gap: 10px; align-items: center; margin-top: 14px; padding: 11px; border-radius: 11px; background: color-mix(in srgb, var(--warning-graphic) 11%, transparent); color: var(--warning-text); }
.warning-note > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid currentColor; font-weight: 900; }
.warning-note p { margin: 0; }.warning-note strong, .warning-note small { display: block; }.warning-note strong { font-size: 10px; }.warning-note small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.operations-card { margin-top: 16px; }
.section-heading a { color: var(--accent); font-size: 12px; font-weight: 750; }
.operation-list { margin-top: 16px; }
.operation { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--border); }
.op-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-soft); color: var(--muted); }
.operation strong, .operation small { display: block; }.operation strong { font-size: 12px; }.operation small { margin-top: 4px; color: var(--muted); font-size: 10px; }.operation > strong { font-size: 13px; }
.bottom-nav, .mobile-add { display: none; }
.theme-tools { position: fixed; right: 18px; bottom: 18px; display: flex; gap: 6px; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); z-index: 50; box-shadow: var(--shadow); }
.theme-tools button { width: 32px; height: 32px; border-radius: 9px; background: transparent; }
.theme-tools button:hover, .theme-tools button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 70; max-width: min(360px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-elevated); color: var(--text); box-shadow: var(--shadow); font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transform: translate(-50%, 14px); transition: opacity .18s ease, transform .18s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.operation.demo-operation { animation: demo-in .22s ease-out; }
@keyframes demo-in { from { opacity: 0; transform: translateY(-6px); } }
html[data-density="compact"] { --space: 16px; }.app-shell { transition: background .2s ease, color .2s ease; }
html[data-contrast="high"] { --border: currentColor; --muted: var(--text); }
html[data-motion="reduced"] *, @media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

@media (max-width: 1020px) {
  :root { --sidebar: 86px; }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; }.brand > span:last-child, .nav-item:not(.active) { font-size: 0; }.nav-item { justify-content: center; padding-inline: 0; }.nav-item span { font-size: 18px; }
  .nav-section > p, .workspace-card > span:not(.workspace-avatar), .workspace-card > span:nth-child(2), .profile > span:nth-child(2), .profile .icon-button { display: none; }
  .workspace-card { display: grid; place-items: center; padding: 9px; }.profile { display: grid; place-items: center; grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }.metric-card.featured { grid-column: 1 / -1; }
  .content-grid { grid-template-columns: 1fr; }.budget-card { display: grid; grid-template-columns: 1fr 180px 1fr; align-items: center; column-gap: 22px; }.budget-card .section-heading { align-self: start; }.budget-card .warning-note { grid-column: 3; }.budget-card .budget-values { grid-column: 3; grid-row: 1; margin-top: 36px; }
}

@media (max-width: 680px) {
  :root { --radius: 16px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 24px 16px 108px; }
  .topbar { margin-bottom: 24px; }.topbar h1 { font-size: 28px; padding-right: 52px; }.topbar .eyebrow, .subtitle { display: none; }.top-actions .notification, .primary-button { display: none; }
  .metric-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }.metric-grid::-webkit-scrollbar { display: none; }.metric-card, .metric-card.featured { min-width: min(88vw, 330px); min-height: 174px; scroll-snap-align: start; }
  .content-grid { display: block; }.cashflow-card, .budget-card, .operations-card { margin-top: 12px; padding: 18px; }.cashflow-card { margin-top: 16px; }.chart { height: 190px; }.chart-summary { align-items: flex-end; }.legend { display: grid; gap: 4px; }
  .budget-card { display: block; }.donut { width: 144px; }.budget-values { margin-top: 0 !important; }.warning-note { margin-top: 12px; }
  .operation:nth-child(n+4) { display: none; }.operation { grid-template-columns: 36px 1fr auto; gap: 9px; }.operation > strong { font-size: 12px; }.operation small { max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bottom-nav { position: fixed; inset: auto 0 0; height: 74px; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; padding: 8px 12px max(8px, env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--border); backdrop-filter: blur(18px); z-index: 40; }
  .bottom-nav a { display: grid; justify-items: center; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 700; }.bottom-nav a span { font-size: 18px; }.bottom-nav a.active { color: var(--accent); }
  .mobile-add { position: fixed; display: grid; place-items: center; right: 18px; bottom: 88px; width: 52px; height: 52px; border: 0; border-radius: 16px; background: var(--accent); color: var(--accent-ink); font-size: 27px; box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 34%, transparent); z-index: 45; }
  .theme-tools { position: absolute; top: 18px; right: 16px; bottom: auto; left: auto; }
  .theme-tools button:not(:first-child) { display: none; }
  .toast { bottom: 150px; }
}
