:root {
  color-scheme: dark;
  --bg: #0a111d;
  --panel: #111b2a;
  --panel-2: #162234;
  --line: #263449;
  --text: #f4f7fb;
  --muted: #91a0b5;
  --accent: #d9ff6f;
  --accent-dark: #203313;
  --danger: #ff897d;
  --positive: #8ee3bd;
  --shadow: 0 28px 80px rgba(0, 0, 0, .32);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .17em; margin: 0 0 .4rem; }
.muted { color: var(--muted); }
.brand-mark { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--accent); color: #0a111d; font-weight: 900; font-size: 1.5rem; box-shadow: 0 12px 40px rgba(217, 255, 111, .18); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 1rem; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at 80% 15%, rgba(115, 151, 255, .14), transparent 28%), radial-gradient(circle at 20% 80%, rgba(217, 255, 111, .1), transparent 24%), var(--bg); }
.login-card { width: min(520px, 100%); background: rgba(17, 27, 42, .88); border: 1px solid var(--line); border-radius: 28px; padding: clamp(2rem, 6vw, 4rem); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.login-card .brand-mark { margin-bottom: 2.5rem; }
.login-card h1 { font-size: clamp(2.25rem, 7vw, 4rem); line-height: 1.02; letter-spacing: -.055em; margin: .8rem 0 1.4rem; }
.login-copy { line-height: 1.65; font-size: 1rem; }
.security-note { color: #6f7f95; font-size: .78rem; margin: 1.1rem 0 0; text-align: center; }
.button { border: 0; border-radius: 12px; padding: .8rem 1.15rem; font-weight: 750; transition: .18s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(1.05); }
.button-primary { background: var(--accent); color: #0a111d; }
.button-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.button-ghost { background: transparent; color: var(--muted); }
.button-large { width: 100%; padding: 1rem; margin-top: 1.3rem; }
.text-button { background: none; color: var(--muted); border: 0; padding: .4rem; }
.text-button:hover { color: var(--accent); }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 1.5rem; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { border-right: 1px solid var(--line); padding: 1.5rem 1rem; display: flex; flex-direction: column; position: sticky; height: 100vh; top: 0; background: #0c1522; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 900; font-size: 1.25rem; margin: 0 .6rem 3rem; }
.sidebar nav { display: grid; gap: .4rem; }
.nav-item { border: 0; background: transparent; color: var(--muted); text-align: left; padding: .85rem 1rem; border-radius: 12px; font-weight: 650; display: flex; gap: .8rem; }
.nav-item.active, .nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { box-shadow: inset 3px 0 var(--accent); }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: 1rem; }
.user-chip { display: flex; gap: .75rem; align-items: center; overflow: hidden; }
.user-chip div:last-child { overflow: hidden; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: var(--muted); font-size: .7rem; margin-top: .2rem; }
.avatar { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: #273d5e; display: grid; place-items: center; }
.main-column { min-width: 0; }
.topbar { min-height: 104px; display: flex; align-items: center; gap: 1rem; padding: 1.5rem clamp(1.25rem, 4vw, 3rem); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(10, 17, 29, .91); backdrop-filter: blur(16px); z-index: 3; }
.topbar h2 { margin: 0; font-size: 1.55rem; letter-spacing: -.03em; }
.topbar .button { margin-left: auto; }
.menu-button { display: none; }
.content-panel { padding: 2rem clamp(1.25rem, 4vw, 3rem) 4rem; }
.metrics-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 1rem; }
.metric-card, .card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; }
.metric-card { padding: 1.35rem; min-height: 145px; display: flex; flex-direction: column; }
.metric-card span, .metric-card small { color: var(--muted); }
.metric-card strong { font-size: clamp(1.5rem, 2.5vw, 2.1rem); letter-spacing: -.045em; margin: auto 0 .35rem; }
.metric-card small { font-size: .75rem; }
.net-worth { background: linear-gradient(140deg, #1d304b, #111b2a); }
.accent-card { background: var(--accent-dark); border-color: #42592d; }
.accent-card strong { color: var(--accent); }
.dashboard-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1rem; margin-top: 1rem; }
.card { padding: 1.35rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.card-header h3, .modal-header h3 { margin: 0; font-size: 1.25rem; }
.transaction-row, .account-row { display: flex; align-items: center; gap: .85rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.transaction-row:first-child, .account-row:first-child { border-top: 0; }
.transaction-icon, .account-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: #1c2a3e; color: var(--muted); flex: 0 0 38px; }
.transaction-row .details, .account-row .details { min-width: 0; flex: 1; }
.details strong, .details small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.details small { color: var(--muted); margin-top: .2rem; font-size: .73rem; }
.amount { font-weight: 800; white-space: nowrap; }
.amount.expense { color: var(--danger); }
.amount.income { color: var(--positive); }
.amount.transfer { color: var(--muted); }
.empty-state { color: var(--muted); padding: 1.5rem 0; }
.full-card { min-height: 400px; }
.section-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.4rem; }
.accounts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.account-tile { min-height: 175px; padding: 1.3rem; border-radius: 18px; background: linear-gradient(145deg, #18273b, #111b2a); border: 1px solid var(--line); display: flex; flex-direction: column; }
.account-tile .account-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; }
.account-tile h4 { margin: 1.2rem 0 .3rem; }
.account-tile strong { font-size: 1.5rem; margin-top: auto; }
.account-tile small { color: var(--muted); }
.loading { min-height: 60vh; display: grid; place-items: center; align-content: center; color: var(--muted); }
.loading span { width: 38px; height: 38px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.modal { width: min(560px, calc(100% - 2rem)); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; color: var(--text); padding: 0; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(3, 8, 14, .78); backdrop-filter: blur(5px); }
.modal form { padding: 1.6rem; display: grid; gap: 1rem; }
.modal-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: .2rem; }
.modal label { color: var(--muted); font-size: .78rem; font-weight: 650; display: grid; gap: .45rem; }
.modal input, .modal select { width: 100%; color: var(--text); background: #0d1725; border: 1px solid var(--line); border-radius: 11px; padding: .78rem; outline: none; }
.modal input:focus, .modal select:focus { border-color: #607b35; box-shadow: 0 0 0 3px rgba(217, 255, 111, .08); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: #0d1725; padding: .25rem; border-radius: 12px; }
.segment { border: 0; background: transparent; color: var(--muted); padding: .65rem; border-radius: 9px; }
.segment.active { background: var(--panel-2); color: var(--text); }
.optional { font-weight: 400; color: #66758a; }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 10; background: var(--text); color: #0a111d; border-radius: 12px; padding: .85rem 1rem; box-shadow: var(--shadow); transform: translateY(140%); transition: .25s; max-width: min(390px, calc(100% - 2rem)); }
.toast.show { transform: translateY(0); }
.toast.error { background: var(--danger); }
@media (max-width: 1050px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .accounts-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 240px; z-index: 6; transition: left .2s; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .menu-button { display: block; }
  .topbar { min-height: 88px; padding: 1rem; }
  .topbar .eyebrow { display: none; }
  .topbar .button { font-size: 0; padding: .75rem; }
  .topbar .button::first-letter { font-size: 1rem; }
  .content-panel { padding: 1rem; }
  .metrics-grid, .dashboard-grid, .accounts-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 120px; }
  .form-row { grid-template-columns: 1fr; }
}

