/* Hisab — calm money UI. Dark by default, light theme via [data-theme=light]. */
:root {
  /* saizul.com design language: Apple palette, SF Pro, liquid glass */
  --bg: #f5f5f7; --bg2: #ebebf0;
  --card: rgba(255,255,255,.5); --card-solid: #ffffff; --line: rgba(0,0,0,.07); --line2: rgba(0,0,0,.12);
  --text: #1d1d1f; --muted: #6e6e73; --faint: #86868b;
  --lime: #34c759; --teal: #0071e3; --blue: #0071e3; --rose: #ff375f; --amber: #ff9f0a;
  --pos: #1a9f4a; --neg: #e5304f;
  --accent: #0071e3; --accent-ink: #ffffff;
  --grad: linear-gradient(120deg, #0071e3 0%, #5e5ce6 55%, #bf5af2 100%);
  --shadow: 0 12px 40px -12px rgba(16,40,90,.18);
  --ease: cubic-bezier(.22,.8,.2,1);
  --r: 24px; --r-sm: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Hind Siliguri", system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light;
}
[data-theme=dark] {
  --bg: #000000; --bg2: #1d1d1f;
  --card: rgba(255,255,255,.07); --card-solid: #1c1c1e; --line: rgba(255,255,255,.1); --line2: rgba(255,255,255,.18);
  --text: #f5f5f7; --muted: #a1a1a6; --faint: #6e6e73;
  --lime: #30d158; --teal: #2997ff; --blue: #2997ff; --rose: #ff6482; --amber: #ffb340;
  --pos: #30d158; --neg: #ff6482;
  --accent: #2997ff; --accent-ink: #ffffff;
  --shadow: 0 20px 50px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.47; letter-spacing: -.011em; -webkit-font-smoothing: antialiased; min-height: 100vh; transition: background .5s var(--ease), color .5s var(--ease); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: inherit; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.num, b.num { font-family: var(--mono); font-feature-settings: "tnum"; letter-spacing: -.02em; }

/* Soft colour fields behind the glass (glass needs something to refract) */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(80px); animation: drift 28s var(--ease) infinite alternate; }
.aurora i:nth-child(1) { width: 52vmax; height: 52vmax; background: radial-gradient(circle, rgba(0,113,227,.28), transparent 65%); top: -20vmax; left: -14vmax; }
.aurora i:nth-child(2) { width: 46vmax; height: 46vmax; background: radial-gradient(circle, rgba(191,90,242,.24), transparent 65%); bottom: -20vmax; right: -12vmax; animation-delay: -9s; }
.aurora i:nth-child(3) { width: 34vmax; height: 34vmax; background: radial-gradient(circle, rgba(52,199,89,.18), transparent 65%); top: 34%; left: 40%; animation-delay: -16s; }
[data-theme=dark] .aurora i { opacity: .7; }
@keyframes drift { to { transform: translate(5vmax, 4vmax) scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .aurora i { animation: none; } * { transition: none !important; animation: none !important; } }

/* Liquid glass (same recipe as saizul.com) */
.glass { position: relative; background: linear-gradient(145deg, rgba(255,255,255,.62), rgba(255,255,255,.26) 55%, rgba(255,255,255,.4));
  backdrop-filter: blur(20px) saturate(200%) brightness(1.04); -webkit-backdrop-filter: blur(20px) saturate(200%) brightness(1.04);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: inset 1.5px 1.5px 0 rgba(255,255,255,.95), inset -1px -1px 0 rgba(255,255,255,.45), inset 10px 12px 24px -14px rgba(255,255,255,.9),
    inset -12px -14px 26px -16px rgba(120,150,220,.3), 0 12px 40px -12px rgba(16,40,90,.16);
  transition: transform .5s var(--ease), box-shadow .5s var(--ease); }
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(300px circle at var(--gx, 25%) var(--gy, 0%), rgba(255,255,255,.75), rgba(255,255,255,.1) 40%, transparent 62%); mix-blend-mode: soft-light; }
.glass > * { position: relative; }
[data-theme=dark] .glass { background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.03) 55%, rgba(255,255,255,.07)); border-color: rgba(255,255,255,.14);
  box-shadow: inset 1.5px 1.5px 0 rgba(255,255,255,.22), inset -1px -1px 0 rgba(255,255,255,.08), 0 20px 50px -20px rgba(0,0,0,.7); }
[data-theme=dark] .glass::before { background: radial-gradient(300px circle at var(--gx, 25%) var(--gy, 0%), rgba(255,255,255,.12), transparent 50%); mix-blend-mode: normal; }
.glass-pill { background: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.7); backdrop-filter: blur(12px) saturate(210%); -webkit-backdrop-filter: blur(12px) saturate(210%); border-radius: 999px;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.9), 0 4px 16px -6px rgba(16,40,90,.14); }
[data-theme=dark] .glass-pill { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); box-shadow: none; }
.stat.glass:hover, .card.glass:hover { box-shadow: inset 1.5px 1.5px 0 rgba(255,255,255,.95), inset -1px -1px 0 rgba(255,255,255,.45), inset 10px 12px 24px -14px rgba(255,255,255,.9), 0 18px 50px -14px rgba(16,40,90,.22); }
.stat.glass:hover { transform: translateY(-2px); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line2); background: transparent; border-radius: 999px; padding: 10px 18px; font-weight: 600; transition: transform .3s var(--ease), background .3s, box-shadow .3s, filter .3s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 8px 22px -8px rgba(0,113,227,.55); }
.btn.primary:hover { transform: translateY(-1px); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { padding: 10px; }
.btn.ghost:hover, .icon-btn:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.btn.wide { width: 100%; padding: 13px; font-size: 16px; }
.btn.danger { background: var(--rose); color: #fff; border-color: transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; background: transparent; border-radius: 999px; color: var(--text); }
.icon-btn.glass-pill { border: 1px solid var(--line); }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand .logo img { width: 32px; height: 32px; display: block; filter: drop-shadow(0 6px 16px rgba(0,113,227,.3)); }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.brand.big { font-size: 22px; } .brand.big .logo img { width: 44px; height: 44px; }

/* View switching (the page shell is static; JS decides what to show) */
body.is-loading #loginView, body.is-loading #appView, body.is-login #appView, body.is-app #loginView { display: none; }
body.is-loading::after { content: ""; position: fixed; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--teal); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.remember { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px !important; font-size: 13.5px; cursor: pointer; }
.login-form .remember { display: flex; justify-content: flex-start; color: var(--muted); }
.login-form .remember input { width: 16px; height: 16px; padding: 0; flex: none; accent-color: var(--blue); box-shadow: none; }
/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); border-radius: 28px; padding: 34px 30px; }
.login-card h1 { font-size: 30px; letter-spacing: -.03em; margin: 28px 0 4px; }
.login-form { display: grid; gap: 14px; margin-top: 22px; }
.login-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.login-form input, .field input, .field select, .field textarea { background: color-mix(in srgb, var(--text) 5%, transparent); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; outline: none; transition: border-color .2s, box-shadow .2s; width: 100%; }
.login-form input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 18%, transparent); }
.demo-hint { margin-top: 16px; padding: 12px 14px; border-radius: var(--r-sm); background: rgba(0,113,227,.08); border: 1px dashed rgba(0,113,227,.35); font-size: 14px; }
.demo-hint code { font-family: var(--mono); background: color-mix(in srgb, var(--text) 10%, transparent); padding: 1px 6px; border-radius: 6px; }
.alert { margin-top: 14px; padding: 11px 14px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--rose) 14%, transparent); color: var(--rose); font-size: 14px; }
.fine { margin: 22px 0 0; font-size: 12.5px; color: var(--faint); text-align: center; }

/* App header */
.demo-bar { text-align: center; font-size: 13px; padding: 8px 16px; color: #fff; background: var(--grad); }
.demo-bar a { font-weight: 600; }
.top { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 14px clamp(16px, 3vw, 36px); background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.month-nav { display: flex; align-items: center; padding: 3px; }
.month-label { border: 0; background: none; font-weight: 700; font-size: 15px; min-width: 150px; padding: 8px 6px; letter-spacing: -.01em; }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 40px; color: var(--muted); }
.search input { background: none; border: 0; outline: none; width: 170px; color: var(--text); }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: 50px; min-width: 250px; border-radius: 18px; padding: 6px; display: grid; background: color-mix(in srgb, var(--card-solid) 88%, transparent) !important; transform-origin: top right; animation: menuIn .28s var(--ease); }
@keyframes menuIn { from { opacity: 0; transform: scale(.94) translateY(-6px); } }
.menu[hidden] { display: none; }
.menu button { text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.menu button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.menu .danger { color: var(--rose); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); gap: 24px; padding: 24px clamp(16px, 3vw, 36px) 60px; max-width: 1440px; margin: 0 auto; align-items: start; }
.col-left { display: grid; gap: 18px; min-width: 0; }
.col-right { align-self: stretch; }
.col-right .sticky { position: sticky; top: 92px; display: grid; gap: 16px; max-height: calc(100vh - 110px); grid-template-rows: minmax(0, 1fr) auto; }
.card { border-radius: var(--r); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 17px; margin: 0; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.card-head h3 { font-size: 14px; margin: 0; color: var(--muted); font-weight: 600; }
.card-head.sub { margin: 22px 0 10px; }
.count { font-size: 12px; font-weight: 600; color: var(--muted); background: color-mix(in srgb, var(--text) 7%, transparent); padding: 2px 8px; border-radius: 999px; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { border-radius: 18px; padding: 14px 16px; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 500; display: block; }
.stat b { font-family: var(--mono); font-size: 19px; display: block; margin-top: 4px; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat em { font-style: normal; font-size: 12px; color: var(--faint); }
.stat em.up { color: var(--neg); } .stat em.down { color: var(--pos); }

/* Quick add */
.quick { display: grid; grid-template-columns: minmax(0, 1fr) 130px 150px 150px auto; gap: 8px; padding: 8px; border-radius: 18px; }
.quick input, .quick select, .inc-add input { background: color-mix(in srgb, var(--text) 5%, transparent); border: 1px solid transparent; border-radius: 12px; padding: 11px 12px; outline: none; min-width: 0; transition: border-color .2s, background .2s; }
.quick input:focus, .quick select:focus, .inc-add input:focus { border-color: var(--teal); background: color-mix(in srgb, var(--text) 8%, transparent); }
.quick .q-title input { width: 100%; font-weight: 500; }
.q-amt { position: relative; }
.q-amt .cur { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.q-amt input { width: 100%; padding-left: 28px !important; font-family: var(--mono); }
/* Combobox (type-ahead dropdown) */
.combo-field { position: relative; display: block; min-width: 0; }
.combo-field input { width: 100%; padding-left: 40px !important; padding-right: 34px !important; text-overflow: ellipsis; }
.combo-field .cat-ic { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; pointer-events: none; transition: background .3s var(--ease); }
.combo-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; background: none; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.combo-btn:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.combo-btn svg { width: 16px; height: 16px; }
.combo-panel { position: fixed; z-index: 90; overflow-y: auto; overscroll-behavior: contain; padding: 6px; border-radius: 16px;
  background: var(--card-solid);
  border: 1px solid var(--line2); box-shadow: 0 18px 48px -14px rgba(16,40,90,.32); animation: comboIn .22s var(--ease); scrollbar-width: thin; }
@keyframes comboIn { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.combo-head { font-size: 11.5px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; padding: 6px 10px 4px; }
.combo-opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; min-height: 40px; border-radius: 10px; cursor: pointer; font-size: 14.5px; color: var(--text); }
.combo-opt .ci { width: 22px; text-align: center; flex: none; }
.combo-opt .cl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-opt .cl b { color: var(--blue); font-weight: 700; }
.combo-opt small { color: var(--faint); font-size: 12px; white-space: nowrap; }
.combo-opt.on, .combo-opt:hover { background: rgba(0,113,227,.1); }
.combo-opt.new { color: var(--blue); font-weight: 600; }
@media (max-width: 560px) { .combo-opt { min-height: 46px; font-size: 15.5px; } .combo-panel { border-radius: 18px; } }
.quick input[type=date], .inc-add input[type=date] { font-size: 13.5px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: -6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; transition: background .2s, border-color .2s; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.on { background: color-mix(in srgb, var(--text) 12%, transparent); border-color: var(--line2); }
.chip small { color: var(--muted); font-family: var(--mono); }

/* Expense list */
.seg { display: inline-flex; background: color-mix(in srgb, var(--text) 6%, transparent); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--muted); font-weight: 600; transition: background .35s var(--ease), color .35s, box-shadow .35s; }
.seg button.on { background: var(--card-solid); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.day { margin-bottom: 10px; }
.day-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); padding: 10px 6px 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.day-head b { font-family: var(--mono); color: var(--text); font-weight: 600; text-transform: none; }
.row { transition: background .3s var(--ease), transform .3s var(--ease); display: grid; grid-template-columns: 38px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 14px; transition: background .15s; cursor: pointer; }
.row:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.row .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-size: 17px; }
.row .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .c { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .a { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
.row .del { opacity: 0; width: 30px; height: 30px; }
.row:hover .del, .row:focus-within .del { opacity: .7; }
.row .del:hover { opacity: 1; color: var(--rose); }
.row.flash { animation: flash 1.2s ease; }
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes flash { 0%, 40% { background: rgba(0,113,227,.12); } }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* Insights */
.insight-grid { display: grid; grid-template-columns: 170px 1fr; gap: 24px; align-items: center; }
.donut-wrap { position: relative; width: 170px; height: 170px; }
.donut-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-wrap circle { transition: stroke-dasharray .6s ease, stroke-dashoffset .6s ease; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-center b { font-family: var(--mono); font-size: 18px; }
.donut-center span { font-size: 12px; color: var(--muted); }
.cat-bars { display: grid; gap: 10px; }
.cbar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13.5px; }
.cbar .track { grid-column: 1 / -1; height: 7px; background: color-mix(in srgb, var(--text) 7%, transparent); border-radius: 99px; overflow: hidden; }
.cbar .track i { display: block; height: 100%; border-radius: 99px; transition: width .6s ease; }
.cbar b { font-family: var(--mono); font-weight: 600; font-size: 13px; }
.cbar small { color: var(--muted); }
.daily { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.daily .bar { flex: 1; min-width: 0; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #5e5ce6, #0071e3); opacity: .55; position: relative; transition: height .5s ease; min-height: 3px; }
.daily .bar.today { background: var(--grad); opacity: 1; }
.daily .bar:hover { opacity: 1; }
.daily .bar.over { background: var(--rose); opacity: .7; }
.daily .bar.future { background: color-mix(in srgb, var(--text) 8%, transparent); opacity: 1; }
.daily .bar:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--card-solid); border: 1px solid var(--line2); padding: 4px 8px; border-radius: 8px; font-size: 12px; white-space: nowrap; z-index: 3; font-family: var(--mono); }
.daily-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 6px; font-family: var(--mono); }
.trend { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 130px; }
.tm { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; cursor: pointer; }
.tm .bars { display: flex; gap: 4px; align-items: flex-end; justify-content: center; }
.tm .bars i { width: 14px; border-radius: 5px 5px 2px 2px; transition: height .5s ease; min-height: 2px; }
.tm .bars i.in { background: linear-gradient(180deg, #34c759, #1a9f4a); }
.tm .bars i.ex { background: linear-gradient(180deg, #5e5ce6, #0071e3); }
.tm span { text-align: center; font-size: 12px; color: var(--muted); }
.tm.cur span { color: var(--text); font-weight: 700; }

/* Income */
.income-card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.inc-add { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 6px; margin-bottom: 10px; }
.inc-add input[type=date] { display: none; }
.inc-add.more { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; }
.inc-add.more input[type=date] { display: block; grid-column: 1 / -1; grid-row: 2; }
.inc-list { overflow: auto; min-height: 60px; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.inc { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 10px 8px; border-radius: 12px; cursor: pointer; border-bottom: 1px dashed var(--line); }
.inc:last-child { border-bottom: 0; }
.inc:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.inc .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inc .d { font-size: 12px; color: var(--muted); }
.inc .a { font-family: var(--mono); font-weight: 600; color: var(--pos); }
.inc .del { opacity: 0; width: 28px; height: 28px; }
.inc:hover .del { opacity: .7; }
.inc-empty { text-align: center; color: var(--muted); padding: 16px 6px; font-size: 14px; }
.inc-empty button { margin-top: 10px; }

/* Summary (sticky hero) — saizul.com blue→indigo→violet gradient with a glass sheen */
.summary { position: relative; color: #fff; background: var(--grad); box-shadow: 0 24px 60px -22px rgba(94,92,230,.6), inset 1.5px 1.5px 0 rgba(255,255,255,.35); overflow: hidden; transition: background .6s var(--ease), box-shadow .6s var(--ease); }
.summary::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 90% at 100% 0%, rgba(255,255,255,.35), transparent 55%), radial-gradient(60% 60% at 0% 100%, rgba(255,255,255,.12), transparent 60%); pointer-events: none; }
.summary > * { position: relative; }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; font-weight: 500; font-size: 14px; opacity: .92; }
.sum-row b { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.summary .pos, .summary .neg { color: #fff; }
.sum-divider { height: 1px; background: rgba(255,255,255,.28); margin: 10px 0; }
.sum-balance { display: flex; flex-direction: column; }
.sum-balance span { font-size: 13px; font-weight: 600; opacity: .8; }
.sum-balance b { font-family: var(--font); font-weight: 700; font-size: clamp(32px, 3.3vw, 44px); letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.summary.negative { background: linear-gradient(120deg, #ff375f 0%, #ff6b4a 60%, #ff9f0a 100%); box-shadow: 0 24px 60px -22px rgba(255,55,95,.55); }
.meter { height: 7px; background: rgba(255,255,255,.25); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.meter i { display: block; height: 100%; width: 0; background: #fff; border-radius: 99px; transition: width .9s var(--ease); }
.sum-foot { font-size: 12.5px; margin-top: 8px; font-weight: 500; opacity: .85; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* Mobile summary + fab */
.mobile-sum, .fab { display: none; }

/* Dialog */
dialog { border-radius: 22px; padding: 0; width: min(440px, calc(100vw - 32px)); color: var(--text); background: var(--card-solid); border: 1px solid var(--line2); }
dialog::backdrop { background: rgba(0,0,0,.25); backdrop-filter: blur(8px) saturate(150%); -webkit-backdrop-filter: blur(8px) saturate(150%); }
dialog[open] { animation: pop .45s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.dlg { padding: 22px; display: grid; gap: 14px; }
.dlg h3 { margin: 0; font-size: 19px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.field textarea { resize: vertical; min-height: 64px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.dlg-actions .r { display: flex; gap: 8px; margin-left: auto; }
.kbd-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
kbd { font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line2); background: color-mix(in srgb, var(--text) 6%, transparent); }

/* Toasts */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 14px; background: var(--card-solid); border: 1px solid var(--line2); border-radius: 14px; padding: 10px 12px 10px 16px; box-shadow: var(--shadow); font-size: 14px; animation: pop .25s ease; }
.toast button { border: 0; background: rgba(0,113,227,.14); color: var(--blue) !important; color: var(--text); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.toast.err { border-color: color-mix(in srgb, var(--rose) 60%, transparent); }

/* Responsive */
@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick { grid-template-columns: minmax(0, 1fr) 120px; }
  .quick .q-cat, .quick input[type=date] { grid-row: 2; }
  .quick .q-cat { grid-column: 1; } .quick input[type=date] { grid-column: 2; }
  .quick .btn { grid-column: 1 / -1; grid-row: 3; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-bottom: 120px; }
  .col-right { order: -1; }
  .col-right .sticky { position: static; max-height: none; grid-template-rows: auto; }
  .inc-list { max-height: 260px; }
  .summary { display: none; }
  .top { grid-template-columns: auto 1fr auto; }
  .search { display: none; }
  .month-nav { justify-self: center; }
  .month-label { min-width: 0; }
  .mobile-sum { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 30; border-radius: 20px; padding: 12px 14px; color: #fff; background: var(--grad); box-shadow: 0 16px 40px -12px rgba(94,92,230,.55); }
  .mobile-sum.negative { background: linear-gradient(120deg, #ff375f, #ff6b4a 60%, #ff9f0a); }
  .mobile-sum div { display: grid; text-align: center; }
  .mobile-sum span { font-size: 11px; font-weight: 600; opacity: .7; }
  .mobile-sum b { font-family: var(--mono); font-size: 15px; letter-spacing: -.03em; }
  .mobile-sum div:last-child b { font-size: 17px; }
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 80px); width: 56px; height: 56px; border-radius: 18px; border: 0; z-index: 31; background: var(--accent); color: var(--accent-ink); box-shadow: 0 14px 30px -10px rgba(0,113,227,.6); }
  .fab svg { width: 24px; height: 24px; }
  .toasts { bottom: 104px; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .brand > span:last-child { display: none; }
  .top { padding: 10px 12px; gap: 8px; }
  .month-label { font-size: 14px; padding: 8px 2px; }
  .layout { padding: 14px 12px 120px; gap: 14px; }
  .card { padding: 16px; }
  .stats { gap: 8px; }
  .stat { padding: 12px; } .stat b { font-size: 16px; }
  .insight-grid { grid-template-columns: 1fr; justify-items: center; }
  .cat-bars { width: 100%; }
  .row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; }
  .row .ic { width: 34px; height: 34px; }
  .row .del { display: none; }
  .two { grid-template-columns: 1fr; }
  .trend .tm .bars i { width: 10px; }
}

/* Smooth transitions: view fade, month change slide, staggered reveal */
#loginView, #appView { animation: viewIn .7s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; } }  /* opacity only: a transform here would break position:fixed children */
.swap-l .col-left > *, .swap-l .inc-list { animation: slideL .5s var(--ease) both; }
.swap-r .col-left > *, .swap-r .inc-list { animation: slideR .5s var(--ease) both; }
@keyframes slideL { from { opacity: 0; transform: translateX(-18px); } }
@keyframes slideR { from { opacity: 0; transform: translateX(18px); } }
.reveal { animation: rise .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.chip { transition: background .35s var(--ease), border-color .35s, transform .35s var(--ease); }
.chip:hover { transform: translateY(-1px); }
.icon-btn { transition: background .3s var(--ease), transform .3s var(--ease); }
.icon-btn:active { transform: scale(.92); }
.chip.on { background: var(--accent); color: #fff; border-color: transparent; }
.chip.on small { color: rgba(255,255,255,.8); }
.chip { background: rgba(255,255,255,.55); }
[data-theme=dark] .chip { background: var(--card); }
