:root {
  --bg: #f5f6f3;
  --surface: #fffefa;
  --surface-soft: #f8faf7;
  --ink: #18332e;
  --ink-2: #405953;
  --muted: #7b8d87;
  --line: #e1e7e3;
  --line-strong: #ced9d4;
  --brand: #17493f;
  --brand-2: #2b7968;
  --brand-3: #4b9481;
  --mint: #dff1ea;
  --mint-soft: #eff8f4;
  --orange: #d86f4b;
  --orange-soft: #fff1eb;
  --blue: #497f96;
  --blue-soft: #edf5f8;
  --gold: #96723b;
  --gold-soft: #f8f1e4;
  --danger: #b74c3a;
  --danger-soft: #fff0ed;
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(19,48,42,.025), 0 10px 30px rgba(19,48,42,.045);
  --shadow: 0 22px 56px rgba(19,48,42,.095);
}

* { box-sizing: border-box; }
html { min-width: 320px; color-scheme: light; background: var(--bg); }
body { min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--ink); background: radial-gradient(circle at 86% 4%,rgba(80,139,122,.055),transparent 28%),var(--bg); font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; font-weight: 450; line-height: 1.45; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid rgba(38,115,97,.25); outline-offset: 2px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font-size: 20px; font-weight: 780; letter-spacing: -.35px; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; border: 1.5px solid currentColor; border-radius: 12px; font-size: 15px; font-weight: 850; transform: rotate(-5deg); }
.brand-light { color: #f4fffb; }
.eyebrow, .card-label { margin: 0 0 8px; color: var(--brand-2); font-size: 9px; font-weight: 800; letter-spacing: 1.9px; text-transform: uppercase; }

.toast { position: fixed; z-index: 120; left: 50%; top: 20px; max-width: calc(100% - 32px); padding: 12px 18px; border: 1px solid rgba(255,255,255,.15); border-radius: 999px; color: #fff; background: rgba(15,48,41,.94); box-shadow: 0 15px 40px rgba(8,30,25,.25); opacity: 0; transform: translate(-50%,-80px); transition: .25s ease; backdrop-filter: blur(12px); font-size: 13px; font-weight: 700; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

/* Authentication */
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(460px,1.05fr) minmax(420px,.95fr); background: var(--surface); }
.auth-visual { position: relative; min-height: 100vh; overflow: hidden; padding: 46px 54px; color: #fff; background: linear-gradient(145deg,#0f302a 0%,#16463c 55%,#286c5b 100%); isolation: isolate; }
.auth-visual::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .13; background-image: linear-gradient(rgba(255,255,255,.15) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.15) 1px,transparent 1px); background-size: 52px 52px; mask-image: linear-gradient(to bottom right,#000,transparent 75%); }
.auth-copy { position: absolute; z-index: 2; left: clamp(54px,8vw,130px); top: 39%; }
.auth-copy p { margin: 0; color: #9fd6c8; font-size: 10px; font-weight: 800; letter-spacing: 3px; }
.auth-copy h1 { margin: 20px 0; font-family: "Noto Serif KR", Georgia, serif; font-size: clamp(42px,4vw,66px); font-weight: 600; line-height: 1.17; letter-spacing: -3px; }
.auth-copy > span { color: #bad3cc; font-size: 13px; }
.auth-orbit { position: absolute; z-index: -1; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; }
.orbit-one { width: 560px; height: 560px; right: -220px; bottom: -200px; }
.orbit-two { width: 210px; height: 210px; right: 9%; top: 12%; background: rgba(255,255,255,.025); }
.auth-panel { display: grid; place-items: center; padding: 48px; background: linear-gradient(180deg,#fff,#fbfcfa); }
.auth-box { width: min(390px,100%); }
.mobile-brand { display: none; }
.auth-box h2 { margin: 7px 0 13px; font-family: "Noto Serif KR", Georgia, serif; font-size: 38px; line-height: 1.3; letter-spacing: -1.8px; }
.subcopy { margin: 0 0 30px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.auth-form, .dialog-card { display: grid; gap: 16px; }

label { display: grid; gap: 8px; min-width: 0; color: var(--ink-2); font-size: 12px; font-weight: 750; }
input, select { width: 100%; min-width: 0; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--surface); outline: none; transition: border-color .16s,box-shadow .16s,background .16s; }
input::placeholder { color: #9ba9a5; }
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus { border-color: var(--brand-3); box-shadow: 0 0 0 4px rgba(62,141,121,.1); background: #fff; }
.primary-btn { min-height: 50px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 19px; border: 0; border-radius: var(--radius-sm); color: #fff; background: var(--brand); box-shadow: 0 8px 20px rgba(21,63,55,.16); font-size: 13px; font-weight: 800; transition: transform .15s,background .15s,box-shadow .15s; }
.primary-btn:hover { background: #0f332c; box-shadow: 0 11px 24px rgba(21,63,55,.22); transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.auth-form .primary-btn { margin-top: 6px; }
.form-error { min-height: 17px; margin: -5px 0; color: var(--danger); font-size: 11px; }

/* App shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0,1fr); }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 236px; display: flex; flex-direction: column; padding: 30px 18px 23px; color: #dcebe6; background: linear-gradient(165deg,#163f37 0%,#10342d 72%,#0d2d27 100%); box-shadow: inset -1px 0 rgba(255,255,255,.035); }
.sidebar .brand { padding: 0 9px; color: #fff; }
.main-nav { display: grid; gap: 5px; margin-top: 44px; }
.nav-item { height: 47px; display: flex; align-items: center; gap: 12px; padding: 0 13px; border: 1px solid transparent; border-radius: 12px; color: #afc9c1; background: transparent; text-align: left; font-size: 12px; font-weight: 650; letter-spacing: -.1px; transition: .16s; }
.nav-item > span { width: 24px; display: grid; place-items: center; font-size: 18px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; border-color: rgba(255,255,255,.09); background: linear-gradient(90deg,rgba(142,210,191,.18),rgba(255,255,255,.075)); box-shadow: inset 3px 0 #8bd5bf; }
.privacy-note { display: flex; align-items: flex-start; gap: 10px; margin-top: auto; padding: 15px 12px; border: 1px solid rgba(255,255,255,.09); border-radius: 12px; color: #9ed2c3; background: rgba(255,255,255,.045); }
.privacy-note > span { margin-top: 1px; font-size: 10px; }
.privacy-note div { display: grid; gap: 3px; }
.privacy-note b { color: #d7ece6; font-size: 10px; }
.privacy-note small { color: #84aaa0; font-size: 9px; }
.lock-btn { min-height: 42px; margin-top: 8px; padding: 0 12px; border: 0; border-radius: 9px; color: #86aaa1; background: transparent; text-align: left; font-size: 11px; }
.lock-btn:hover { color: #fff; background: rgba(255,255,255,.06); }

.workspace { grid-column: 2; min-width: 0; }
.offline-banner { position: fixed; z-index: 70; left: 236px; right: 0; top: 0; min-height: 34px; display: flex; align-items: center; justify-content: center; padding: 7px 16px; color: #704f24; background: #fff1d8; border-bottom: 1px solid #ecd5a9; font-size: 10px; font-weight: 750; text-align: center; }
.topbar { position: sticky; z-index: 20; top: 0; height: 84px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(26px,4.2vw,66px); border-bottom: 1px solid rgba(210,220,216,.75); background: rgba(245,246,243,.88); backdrop-filter: blur(20px) saturate(1.1); }
.topbar p { margin: 0 0 4px; color: var(--muted); font-size: 10px; }
.topbar h2 { margin: 0; font-size: 18px; font-weight: 760; letter-spacing: -.45px; }
.header-add { min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border: 0; border-radius: 10px; color: #fff; background: var(--brand); box-shadow: 0 6px 16px rgba(21,63,55,.15); font-size: 12px; font-weight: 800; }
.header-add:hover { background: var(--brand-2); }
.header-add span { font-size: 18px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.pwa-install-banner { position: relative; z-index: 15; min-height: 68px; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 13px; margin: 18px clamp(26px,4.2vw,66px) 0; padding: 11px 14px; border: 1px solid #cee1d9; border-radius: 16px; color: var(--brand); background: linear-gradient(110deg,#eff8f4,#fffefa); box-shadow: 0 9px 24px rgba(21,63,55,.07); }
.pwa-install-banner[hidden] { display: none; }
.install-app-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: var(--brand); font-family: var(--serif); font-size: 23px; font-weight: 800; }
.install-banner-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-banner-copy strong { font-size: 12px; letter-spacing: -.2px; }
.install-banner-copy span { color: var(--muted); font-size: 10px; }
.install-banner-primary { min-height: 36px; padding: 0 15px; border: 0; border-radius: 9px; color: #fff; background: var(--brand); font-size: 10px; font-weight: 800; white-space: nowrap; }
.install-banner-dismiss { width: 32px; height: 32px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 19px; }
.sync-status { min-height: 32px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,254,250,.75); font-size: 9px; font-weight: 700; white-space: nowrap; }
.sync-status i { width: 7px; height: 7px; border-radius: 50%; background: #94a49f; box-shadow: 0 0 0 3px rgba(148,164,159,.13); }
.sync-status.synced { color: var(--brand-2); border-color: #cfe3db; background: var(--mint-soft); }
.sync-status.synced i { background: #42a384; box-shadow: 0 0 0 3px rgba(66,163,132,.13); }
.sync-status.syncing i { background: #d0a549; animation: sync-pulse 1s ease infinite; }
.sync-status.pending,.sync-status.offline { color: #8d662c; border-color: #e9d8b6; background: #fff7e9; }
.sync-status.pending i,.sync-status.offline i { background: #d39b3b; }
@keyframes sync-pulse { 50% { opacity: .35; transform: scale(.7); } }
.icon-btn { border: 0; color: var(--ink); background: transparent; }
.menu-btn { display: none; }

.page { display: none; width: 100%; max-width: 1420px; margin: 0 auto; padding: 40px clamp(26px,4.2vw,66px) 76px; }
.active-page { display: block; animation: page-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }

/* Dashboard */
.hero-card { position: relative; min-height: 192px; display: flex; align-items: flex-end; justify-content: space-between; overflow: hidden; padding: 36px 40px; border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius-lg); color: #fff; background: linear-gradient(118deg,#17483e 0%,#205f51 62%,#347e6b 100%); box-shadow: 0 20px 48px rgba(21,63,55,.17); isolation: isolate; }
.hero-card::before { content: ""; position: absolute; z-index: -1; inset: 0; opacity: .13; background-image: radial-gradient(circle at 80% 30%,#fff 0 1px,transparent 1.5px); background-size: 17px 17px; mask-image: linear-gradient(90deg,transparent,#000); }
.hero-card::after { content: ""; position: absolute; z-index: -1; width: 360px; height: 360px; right: -90px; top: -230px; border: 1px solid rgba(255,255,255,.2); border-radius: 50%; box-shadow: 0 0 0 55px rgba(255,255,255,.025); }
.hero-card .card-label { color: #9fd6c7; }
.hero-card h3 { margin: 7px 0 9px; font-size: clamp(36px,4vw,50px); font-weight: 760; letter-spacing: -2.1px; }
.hero-caption { margin: 0; color: #b8d5cd; font-size: 11px; }
.hero-actions { position: relative; z-index: 1; }
.hero-actions button { min-height: 42px; padding: 0 15px; border: 1px solid rgba(255,255,255,.17); border-radius: 10px; color: #e6f5f0; background: rgba(255,255,255,.09); font-size: 11px; font-weight: 750; }
.hero-actions button:hover { background: rgba(255,255,255,.15); }
.hero-actions span { margin-left: 8px; }

.summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin: 15px 0; }
.summary-card { min-width: 0; display: flex; align-items: center; gap: 14px; padding: 20px; border: 1px solid rgba(214,224,219,.92); border-radius: var(--radius); background: linear-gradient(145deg,#fffefa,#fbfcfa); box-shadow: var(--shadow-sm); }
.summary-icon { flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; font-size: 17px; }
.income .summary-icon { color: var(--brand-2); background: var(--mint); }
.expense .summary-icon { color: var(--orange); background: var(--orange-soft); }
.saving .summary-icon { color: var(--blue); background: var(--blue-soft); }
.assets .summary-icon { color: var(--gold); background: var(--gold-soft); }
.summary-card > div:last-child { min-width: 0; }
.summary-card p { margin: 0 0 6px; color: var(--muted); font-size: 9px; font-weight: 650; letter-spacing: .05px; }
.summary-card strong { display: block; overflow: hidden; color: var(--ink); font-size: clamp(17px,1.5vw,22px); font-weight: 760; letter-spacing: -.75px; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-grid, .financial-grid { display: grid; grid-template-columns: minmax(0,1.08fr) minmax(0,.92fr); gap: 14px; }
.financial-grid { grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 14px; }
.panel { min-width: 0; border: 1px solid rgba(214,224,219,.94); border-radius: var(--radius); background: linear-gradient(160deg,#fffefa 0%,#ffffff 100%); box-shadow: var(--shadow-sm); }
.spending-panel, .recent-panel { min-height: 318px; padding: 25px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.panel-head h3 { margin: 0; font-size: 16px; font-weight: 760; letter-spacing: -.45px; }
.panel-head > span { color: var(--muted); font-size: 10px; }
.text-btn { min-height: 32px; flex: 0 0 auto; padding: 0 8px; border: 0; border-radius: 7px; color: var(--brand-2); background: transparent; font-size: 10px; font-weight: 750; }
.text-btn:hover { background: var(--mint-soft); }
.category-chart { display: grid; gap: 17px; margin-top: 26px; }
.bar-row { display: grid; grid-template-columns: 74px minmax(50px,1fr) 78px; align-items: center; gap: 11px; color: var(--ink-2); font-size: 10px; }
.bar-row b { overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf1ef; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--brand-3); }
.bar-row:nth-child(2) .bar-fill { background: #74a997; }
.bar-row:nth-child(3) .bar-fill { background: #d49870; }
.bar-row:nth-child(4) .bar-fill { background: #6f92a2; }
.bar-row em { color: var(--muted); font-style: normal; text-align: right; }

.transaction-list { margin-top: 12px; }
.tx-item { min-width: 0; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 11px; min-height: 53px; padding: 8px 0; border-bottom: 1px solid #edf1ef; }
.tx-item:last-child { border-bottom: 0; }
.tx-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--brand-2); background: var(--mint-soft); font-size: 13px; }
.tx-main { min-width: 0; display: grid; gap: 4px; }
.tx-main > b { overflow: hidden; font-size: 11px; font-weight: 730; letter-spacing: -.15px; text-overflow: ellipsis; white-space: nowrap; }
.tx-main small { overflow: hidden; color: #8c9b97; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.tx-amount { color: var(--ink); font-size: 11px; font-weight: 720; letter-spacing: -.2px; white-space: nowrap; }
.tx-amount.expense { color: var(--orange); }
.tx-amount.income { color: var(--brand-2); }
.empty { min-height: 180px; display: grid; place-items: center; color: #93a29e; text-align: center; font-size: 11px; line-height: 1.6; }
.empty span { display: block; margin-bottom: 8px; color: #b7c5c1; font-size: 24px; }

.statement-panel { padding: 25px; }
.statement-lines { display: grid; margin-top: 16px; }
.statement-lines > div { min-height: 42px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf1ef; color: var(--muted); font-size: 11px; }
.statement-lines strong { color: var(--ink); font-size: 14px; font-weight: 800; }
.statement-lines .statement-total { min-height: 52px; margin-top: 4px; border: 0; color: var(--ink); font-weight: 800; }
.statement-lines .statement-total strong { font-size: 20px; }
.balance-badge { padding: 5px 9px; border-radius: 99px; color: var(--brand-2) !important; background: var(--mint-soft); font-weight: 750; }
.balance-badge.unbalanced { color: var(--danger) !important; background: var(--danger-soft); }
.account-balance-list { display: grid; gap: 7px; margin-top: 11px; padding-top: 13px; border-top: 1px dashed var(--line-strong); }
.mini-account-row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 9px; }
.mini-account-row b { color: var(--ink-2); }

/* Quick entry */
.entry-layout { max-width: 1060px; display: grid; grid-template-columns: minmax(250px,.7fr) minmax(480px,1.3fr); align-items: start; gap: clamp(40px,7vw,96px); margin: 15px auto 0; }
.entry-intro { position: sticky; top: 120px; padding-top: 37px; }
.entry-intro h2, .section-heading h2 { margin: 7px 0 17px; font-size: clamp(30px,3vw,39px); font-weight: 760; line-height: 1.28; letter-spacing: -1.65px; }
.entry-intro > p:last-child { color: var(--muted); font-size: 12px; line-height: 1.8; }
.entry-card { display: grid; gap: 20px; padding: 30px; border: 1px solid rgba(211,222,217,.95); border-radius: var(--radius-lg); background: linear-gradient(160deg,#fffefa,#ffffff); box-shadow: var(--shadow); }
.segmented { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: #eef2f0; }
.type-btn { min-height: 39px; padding: 0 6px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 800; transition: .15s; }
.type-btn:hover { color: var(--ink); }
.type-btn.active { color: #fff; background: var(--brand); box-shadow: 0 4px 12px rgba(21,63,55,.16); }
.amount-field { padding: 17px 20px; border: 1px solid #e7ece9; border-radius: 14px; background: var(--surface-soft); }
.amount-field > span { color: var(--muted); font-size: 9px; }
.amount-field > div { display: flex; align-items: center; gap: 9px; }
.amount-field b { color: var(--ink-2); font-size: 24px; }
.amount-field input { min-height: 47px; padding: 0; border: 0; box-shadow: none; background: transparent; font-size: 35px; font-weight: 740; letter-spacing: -1.2px; }
.amount-field input:focus { box-shadow: none; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.entry-card label > span { font-size: 10px; }
.entry-card label small { color: #97a6a2; font-weight: 500; }
.entry-preview { min-height: 44px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; padding: 9px 12px; border: 1px solid #dceae4; border-radius: 11px; color: var(--ink-2); background: var(--mint-soft); text-align: center; font-size: 9px; }
.entry-preview b { color: var(--brand); }
.entry-preview .arrow { padding: 0 7px; color: #8ca39c; }
.save-btn { margin-top: 2px; }

/* History */
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.section-heading h2 { margin: 3px 0 0; }
.primary-btn.compact { min-height: 42px; display: inline-flex; padding: 0 16px; }
.filters { display: grid; grid-template-columns: minmax(180px,1fr) 170px 170px; gap: 9px; padding: 12px; margin-bottom: 13px; background: rgba(255,254,250,.9); }
.filters input, .filters select { min-height: 42px; border-color: transparent; background: var(--surface-soft); }
.history-panel { overflow: hidden; }
.history-list { min-height: 340px; }
.history-row { min-width: 0; min-height: 78px; display: grid; grid-template-columns: 70px 40px minmax(230px,1fr) 70px 112px 34px; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid #edf1ef; transition: background .14s; }
.history-row:last-child { border-bottom: 0; }
.history-row:hover { background: #f8fbf9; }
.history-date { color: #8b9b96; font-size: 9px; letter-spacing: .2px; }
.history-category { width: fit-content; padding: 5px 8px; border-radius: 999px; color: #667b74; background: #f0f4f2; font-size: 8px; font-weight: 700; }
.history-main { min-width: 0; }
.history-title { min-width: 0; display: flex; align-items: center; gap: 9px; }
.history-title b { min-width: 0; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 750; letter-spacing: -.25px; text-overflow: ellipsis; white-space: nowrap; }
.edit-btn, .delete-btn { flex: 0 0 auto; min-height: 34px; border: 0; border-radius: 9px; font-size: 10px; font-weight: 800; transition: .14s; }
.edit-btn { min-width: 70px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 0 12px; color: #fff; background: linear-gradient(135deg,var(--brand-2),#378b77); box-shadow: 0 5px 13px rgba(38,115,97,.18); }
.edit-btn:hover { background: var(--brand); transform: translateY(-1px); }
.delete-btn { width: 34px; color: #9caaa6; background: transparent; font-size: 17px; }
.delete-btn:hover { color: var(--danger); background: var(--danger-soft); }

/* Settings */
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.settings-card { min-height: 178px; display: flex; align-items: flex-start; gap: 16px; padding: 24px; }
.settings-icon { flex: 0 0 42px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--brand-2); background: var(--mint-soft); font-size: 16px; }
.settings-card > div:last-child { min-width: 0; }
.settings-card h3 { margin: 1px 0 8px; font-size: 15px; font-weight: 850; }
.settings-card p { max-width: 430px; margin: 0 0 17px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.outline-btn, .danger-btn { min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--brand-2); background: var(--surface); font-size: 10px; font-weight: 800; transition: .14s; }
.outline-btn:hover { border-color: var(--brand-3); background: var(--mint-soft); }
.danger-btn { color: var(--danger); border-color: #ecc8c0; }
.danger-btn:hover { background: var(--danger-soft); }
.button-row { display: flex; gap: 7px; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }
.file-btn input { display: none; }
.account-manager-card { grid-column: 1/-1; }
.account-manager-content { width: 100%; }
.account-form { display: grid; grid-template-columns: minmax(180px,1fr) 150px auto; gap: 8px; margin-bottom: 17px; }
.account-form input, .account-form select { min-height: 40px; }
.account-list { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.account-item { min-width: 0; min-height: 41px; display: grid; grid-template-columns: 52px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 0 9px; border: 1px solid #e8eeeb; border-radius: 10px; background: var(--surface-soft); }
.account-type-chip { padding: 4px 6px; border-radius: 6px; color: var(--brand-2); background: var(--mint); font-size: 8px; font-weight: 800; text-align: center; }
.account-item b { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.account-toggle { min-height: 28px; padding: 0 6px; border: 0; border-radius: 6px; color: var(--brand-2); background: transparent; font-size: 8px; font-weight: 750; }
.account-toggle:hover { background: #e5efeb; }
.account-item.inactive { opacity: .5; }
.about-line { display: flex; justify-content: space-between; margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); color: #91a09c; font-size: 9px; }

/* Dialogs */
dialog { width: min(460px,calc(100% - 28px)); max-height: 90vh; padding: 0; overflow: hidden; border: 0; border-radius: 20px; color: var(--ink); background: var(--surface); box-shadow: 0 30px 100px rgba(6,35,29,.35); }
dialog::backdrop { background: rgba(7,30,25,.58); backdrop-filter: blur(5px); }
.dialog-card { position: relative; max-height: 90vh; overflow: auto; padding: 29px; }
.dialog-card h2 { margin: 0 0 8px; font-size: 24px; font-weight: 850; letter-spacing: -.8px; }
.dialog-close { position: absolute; right: 16px; top: 14px; width: 36px; height: 36px; border: 0; border-radius: 9px; color: var(--muted); background: var(--surface-soft); font-size: 21px; }
.dialog-close:hover { color: var(--ink); background: #edf2ef; }
.edit-dialog-card { max-height: 88vh; }

.bottom-nav { display: none; }

@media (max-width: 1180px) {
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .account-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .history-row { grid-template-columns: 48px 36px minmax(200px,1fr) 100px 34px; }
  .history-category { display: none; }
}

@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 28px; }
  .mobile-brand { display: flex; margin-bottom: 58px; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: 15px 0 45px rgba(5,31,25,.2); }
  .sidebar.open { transform: translateX(0); }
  .workspace { padding-bottom: 74px; }
  .topbar { height: 76px; padding: 0 18px; }
  .offline-banner { left: 0; }
  .menu-btn { display: block; margin-right: 10px; }
  .topbar > div { margin-right: auto; }
  .header-add { width: 42px; padding: 0; justify-content: center; font-size: 0; }
  .header-add span { font-size: 19px; }
  .topbar-actions { gap: 8px; }
  .pwa-install-banner { grid-template-columns: auto 1fr auto; gap: 10px; margin: 12px 16px 0; padding: 10px 11px; border-radius: 14px; }
  .install-app-icon { width: 38px; height: 38px; border-radius: 10px; font-size: 20px; }
  .install-banner-copy span { display: none; }
  .install-banner-primary { min-height: 34px; padding: 0 12px; }
  .install-banner-dismiss { position: absolute; top: -8px; right: -7px; width: 24px; height: 24px; color: #fff; background: #63766f; font-size: 15px; }
  .sync-status { width: 31px; min-height: 31px; justify-content: center; padding: 0; }
  .sync-status > span { display: none; }
  .page { padding: 23px 16px 45px; }
  .hero-card { min-height: 170px; padding: 27px 24px; border-radius: 20px; }
  .hero-actions { display: none; }
  .dashboard-grid, .financial-grid { grid-template-columns: 1fr; }
  .entry-layout { grid-template-columns: 1fr; gap: 15px; margin-top: 0; }
  .entry-intro { position: static; padding: 0 3px; }
  .entry-intro h2 { font-size: 28px; }
  .entry-intro > p:last-child { display: none; }
  .entry-card { padding: 21px; border-radius: 18px; }
  .settings-grid { grid-template-columns: 1fr; }
  .account-manager-card { grid-column: auto; }
  .account-list { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 36px minmax(0,1fr) auto 34px; gap: 9px; padding: 10px 12px; }
  .history-date, .history-category { display: none; }
  .history-title { gap: 7px; }
  .edit-btn { min-width: 62px; padding: 0 8px; }
  .bottom-nav { position: fixed; z-index: 25; inset: auto 0 0; height: calc(66px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid rgba(210,220,216,.9); background: rgba(255,255,255,.94); backdrop-filter: blur(16px); }
  .mobile-nav { display: grid; place-items: center; align-content: center; gap: 3px; border: 0; color: #82938e; background: transparent; font-size: 8px; font-weight: 750; }
  .mobile-nav > span { font-size: 16px; }
  .mobile-nav.active { color: var(--brand-2); }
  .add-mobile > span { width: 44px; height: 44px; display: grid; place-items: center; margin-top: -24px; border: 5px solid var(--bg); border-radius: 15px; color: #fff; background: var(--brand); box-shadow: 0 8px 18px rgba(21,63,55,.2); font-size: 20px; }
}

@media (max-width: 560px) {
  .auth-box h2 { font-size: 31px; }
  .mobile-brand { margin-bottom: 48px; }
  .summary-grid { gap: 8px; }
  .summary-card { gap: 9px; padding: 14px 12px; }
  .summary-icon { flex-basis: 34px; width: 34px; height: 34px; border-radius: 10px; }
  .summary-card strong { font-size: 15px; }
  .spending-panel, .recent-panel, .statement-panel { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .segmented { grid-template-columns: repeat(2,1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input:first-child { grid-column: 1/-1; }
  .history-row { grid-template-columns: 34px minmax(0,1fr) 32px; }
  .history-row > .tx-amount { grid-column: 2; margin-top: -7px; font-size: 10px; }
  .history-row > .delete-btn { grid-column: 3; grid-row: 1/3; }
  .history-title { align-items: flex-start; flex-direction: column; gap: 5px; }
  .edit-btn { min-width: 70px; min-height: 30px; }
  .account-form { grid-template-columns: 1fr; }
  .settings-card { padding: 20px; }
  .section-heading h2 { font-size: 30px; }
  .primary-btn.compact { font-size: 11px; }
  .dialog-card { padding: 25px 20px; }
}

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