:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #101735;
  --muted: #6b7280;
  --line: #e6e9f2;
  --brand: #312e81;
  --brand-2: #4338ca;
  --accent: #06b6d4;
  --accent-2: #22d3ee;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 16px;
  --shadow: 0 10px 30px -12px rgba(31, 41, 55, 0.18);
  --topbar: rgba(244,246,251,.88);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1020;
  --surface: #141b2e;
  --ink: #edf2ff;
  --muted: #9ba8c2;
  --line: #29334a;
  --brand: #818cf8;
  --brand-2: #6366f1;
  --shadow: 0 12px 32px -16px rgba(0,0,0,.7);
  --topbar: rgba(11,16,32,.88);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

#root { min-height: 100vh; }
.boot-screen { min-height:100vh; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:8px; color:var(--muted); font-size:13px; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cbd3e3; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aab4ca; border: 2px solid transparent; background-clip: content-box; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--brand-2) 24%, var(--line)); }
.overview-insights { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(260px,.85fr); gap: 18px; margin-top: 20px; }
.insight-chart,.month-summary { padding: 21px; }
.section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.section-head h3 { margin:0; font-size:15px; font-weight:800; }
.section-head span:not(.badge) { display:block; margin-top:4px; font-size:12px; color:var(--muted); }
.summary-pair { display:flex; gap:36px; margin-top:20px; }
.summary-pair span,.summary-line span { display:block; color:var(--muted); font-size:12px; }
.summary-pair strong { display:block; font-size:20px; margin-top:4px; }
.positive { color:var(--green) !important; }
.chart-bars { height:112px; display:flex; align-items:flex-end; gap:9px; margin-top:17px; padding-bottom:18px; border-bottom:1px solid var(--line); }
.chart-column { height:100%; flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:6px; }
.chart-column i { display:block; width:min(100%,22px); border-radius:6px 6px 2px 2px; background:linear-gradient(180deg,#67e8f9,#4f46e5); opacity:.82; transition:height .5s cubic-bezier(.2,.8,.2,1),opacity .2s; }
.chart-column:hover i { opacity:1; }
.chart-column small { color:var(--muted); font-size:9px; }
.summary-line { display:flex; justify-content:space-between; align-items:center; padding:12px 0; border-bottom:1px solid var(--line); font-size:13px; }
.summary-line b { font-size:13px; }
.summary-line small { color:var(--muted); font-weight:500; font-size:11px; }
.goal-track { height:7px; border-radius:999px; background:var(--line); margin-top:13px; overflow:hidden; }
.goal-track i { height:100%; display:block; border-radius:inherit; background:linear-gradient(90deg,#34d399,#06b6d4); transition:width .6s ease; }
.hero-quiet { background:rgba(255,255,255,.12); color:#fff; }
.signed-out-screen { min-height:100vh; display:grid; place-items:center; padding:24px; }
.signed-out-card { width:min(100%,420px); padding:34px; text-align:center; }
.signed-out-card > :first-child { justify-content:center; }
.signed-out-check { width:54px; height:54px; display:grid; place-items:center; margin:28px auto 14px; border-radius:50%; background:#d1fae5; color:#047857; font-size:27px; font-weight:800; }
.signed-out-card h1 { margin:0; font-size:24px; }
.signed-out-card p { margin:9px 0 18px; color:var(--muted); font-size:14px; line-height:1.55; }
.password-wrap { position:relative; }
.password-wrap .input { padding-right:44px; }
.password-wrap button { position:absolute; right:7px; top:5px; width:34px; height:34px; border:0; background:transparent; color:var(--muted); display:grid; place-items:center; }
.top-menu-btn { display:none !important; }
.notification-row { background:var(--surface); color:var(--ink); transition:background .15s ease; }
.notification-row.unread { background:#f8faff; }
.notification-row:hover { background:#f1f5ff; }

:root[data-theme="dark"] body { background:var(--bg); color:var(--ink); }
:root[data-theme="dark"] .card { background:var(--surface); border-color:var(--line); }
:root[data-theme="dark"] .input { background:#0d1425; color:var(--ink); border-color:var(--line); }
:root[data-theme="dark"] .btn-ghost { background:#182139; color:var(--ink); border-color:var(--line); }
:root[data-theme="dark"] .chip:not(.active) { background:#1d2941 !important; color:#c4cde0 !important; }
:root[data-theme="dark"] .mobile-nav { background:#141b2e !important; }
:root[data-theme="dark"] .nav-link { color:#c7d0e8; }
:root[data-theme="dark"] .notification-row.unread { background:#1a2540; }
:root[data-theme="dark"] .notification-row:hover { background:#202c48; }
:root[data-theme="dark"] .card:not([style*="linear-gradient"]) { background:var(--surface) !important; }
:root[data-theme="dark"] .card:not([style*="linear-gradient"]) p,
:root[data-theme="dark"] .card:not([style*="linear-gradient"]) div { border-color:var(--line); }
:root[data-theme="dark"] .input::placeholder { color:#77839d; }
:root[data-theme="dark"] select option { background:#141b2e; color:#edf2ff; }

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(67, 56, 202, .12); }
.input::placeholder { color: #9ca3af; }
label.field-label { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 11px 18px; font-size: 14px; font-weight: 600;
  transition: transform .08s ease, background .15s, box-shadow .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 8px 20px -8px rgba(49,46,129,.55); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 26px -8px rgba(49,46,129,.6); filter: brightness(1.03); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover:not(:disabled) { background: #f8fafc; }
.btn-accent { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #083344; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-indigo { background: #e0e7ff; color: #4338ca; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-cyan { background: #cffafe; color: #0e7490; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; background: #f1f5f9; color: #475569; border: 1px solid transparent; cursor: pointer; transition: all .12s; }
.chip:hover { background: #e2e8f0; }
.chip.active { background: var(--brand); color: #fff; }

.fade-in { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.balance-count { animation: balanceReveal .65s ease both; }
@keyframes balanceReveal { from { opacity:.55; transform:translateY(4px); } to { opacity:1; transform:none; } }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 13.5px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; max-width: 320px; animation: slideUp .2s ease; }
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Sidebar */
.sidebar { display:flex; background: linear-gradient(180deg, #151a3d, #171b3f); color: #cdd3ee; }
.mobile-nav { display:none; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; font-size: 13.5px; font-weight: 600; color: #aeb6dd; transition: background .12s, color .12s; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link.active { background: linear-gradient(90deg, rgba(34,211,238,.18), rgba(34,211,238,.04)); color: #fff; box-shadow: inset 2px 0 0 var(--accent-2); }

.auth-bg {
  position: relative;
  background: radial-gradient(at top left, #4338ca 0%, transparent 45%),
              radial-gradient(at bottom right, #0891b2 0%, transparent 45%),
              linear-gradient(160deg, #0b1030, #121741);
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  .top-menu-btn { display: inline-flex !important; }
  .topbar { padding: 12px 16px !important; gap: 9px !important; }
  .overview-insights { grid-template-columns: 1fr; }
  main { padding: 20px 18px 110px !important; }
}
@media (min-width: 861px) {
  .mobile-nav { display: none; }
}

@media (max-width: 520px) {
  .topbar > div:first-of-type div:last-child { font-size:14px !important; }
  .topbar .btn-sm { padding:7px 9px; }
  .overview-insights .card { padding:17px; }
  .summary-pair { gap:20px; }
  .auth-bg { flex-direction:column; }
  .auth-bg > div:first-child { flex:0 0 auto !important; min-height:265px; padding:68px 26px 24px !important; }
  .auth-bg > div:first-child > div:first-child { top:18px !important; left:26px !important; }
  .auth-bg > div:first-child h1 { font-size:28px !important; }
  .auth-bg > div:first-child p { font-size:13px !important; }
  .auth-bg > div:last-child { flex:1 0 auto !important; border-radius:24px 24px 0 0 !important; padding:30px 24px !important; }
}

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