:root {
  --navy: #18364b;
  --navy-soft: #2c5267;
  --blue: #9ec9d4;
  --blue-deep: #6ea5b5;
  --blue-pale: #dfeff1;
  --cream: #f7f1e7;
  --cream-deep: #e9dece;
  --white: #fffdf9;
  --ink: #22333e;
  --muted: #6e7c82;
  --green: #356c5d;
  --green-pale: #e1eee8;
  --gold: #a86e2d;
  --gold-pale: #f5ead7;
  --red: #a04e45;
  --red-pale: #f5e3df;
  --line: #d8dfdc;
  --shadow: 0 18px 50px rgba(28, 52, 66, 0.09);
  --radius: 20px;
  --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html { background: var(--cream); color: var(--ink); font-family: var(--font-sans); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--cream); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.offline-banner { position: fixed; z-index: 1000; inset: 0 0 auto; padding: 9px 18px; background: var(--gold); color: white; text-align: center; font-size: .82rem; font-weight: 700; }

.brand { display: flex; align-items: center; gap: 11px; color: var(--navy); }
.brand > span:last-child { display: flex; flex-direction: column; line-height: .9; }
.brand strong { font: 700 1.65rem/1 var(--font-display); letter-spacing: -.04em; }
.brand small { margin-top: 6px; font-size: .67rem; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; }
.brand-mark { position: relative; display: grid; width: 45px; height: 45px; place-items: center; overflow: hidden; border: 2px solid var(--navy); border-radius: 50% 50% 46% 54%; background: var(--blue); color: var(--navy); font: 700 1.55rem/1 var(--font-display); }
.brand-mark::after { content: ""; position: absolute; width: 60px; height: 7px; bottom: 5px; left: -4px; transform: rotate(-8deg); background: var(--white); border-top: 1px solid var(--navy); }
.brand-mark span { transform: translateY(-3px); }
.sneaker { position: absolute; right: 3px; bottom: 3px; width: 16px; height: 7px; z-index: 2; border: 1.5px solid var(--navy); border-radius: 70% 25% 35% 25%; background: var(--white); transform: rotate(-7deg); }
.sneaker::before { content: ""; position: absolute; top: -4px; left: 2px; width: 8px; height: 5px; border-left: 2px solid var(--navy); transform: skewX(-30deg); }

.login-view { position: relative; min-height: 100vh; min-height: 100svh; display: grid; place-items: center; overflow: hidden; padding: 30px 18px; background: var(--blue); }
.login-view::before { content: ""; position: absolute; inset: 0; opacity: .24; background-size: 42px 42px; background-image: linear-gradient(90deg, rgba(255,255,255,.55) 1px, transparent 1px), linear-gradient(rgba(255,255,255,.55) 1px, transparent 1px); }
.login-decoration { position: absolute; border: 2px solid rgba(24,54,75,.16); background: var(--cream); }
.decoration-one { width: 260px; height: 260px; left: -110px; top: -75px; border-radius: 49% 51% 63% 37%; transform: rotate(16deg); }
.decoration-two { width: 200px; height: 200px; right: -75px; bottom: -80px; border-radius: 61% 39% 52% 48%; background: var(--navy); opacity: .15; }
.login-card { position: relative; width: min(100%, 520px); padding: clamp(28px, 6vw, 52px); border: 1px solid rgba(24,54,75,.16); border-radius: 28px; background: rgba(255,253,249,.97); box-shadow: 0 28px 90px rgba(24,54,75,.2); }
.brand-login { margin-bottom: 44px; }
.login-card h1 { max-width: 390px; margin: 6px 0 14px; color: var(--navy); font: 700 clamp(2.3rem, 9vw, 4rem)/.98 var(--font-display); letter-spacing: -.055em; }
.login-copy { max-width: 410px; margin: 0 0 31px; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.eyebrow { margin: 0 0 7px; color: var(--blue-deep); font-size: .68rem; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.stack-form { display: grid; gap: 9px; }
.stack-form label, .modal label, .settings-panel > label { color: var(--navy); font-size: .82rem; font-weight: 800; }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #c8d1cf; border-radius: 11px; outline: none; background: var(--white); color: var(--ink); padding: 11px 13px; transition: border-color .16s, box-shadow .16s; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-deep); box-shadow: 0 0 0 3px rgba(110,165,181,.17); }
.button { display: inline-flex; min-height: 43px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 11px; padding: 9px 16px; font-size: .8rem; font-weight: 850; line-height: 1.2; transition: transform .15s, background .15s, border .15s; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--navy); color: white; }
.button-primary:hover { background: #0f2b3d; }
.button-outline { border-color: #b7c5c7; background: var(--white); color: var(--navy); }
.button-outline:hover { border-color: var(--blue-deep); background: var(--blue-pale); }
.button-quiet { background: transparent; color: var(--navy); }
.button-danger { background: var(--red-pale); border-color: #dfb5ae; color: var(--red); }
.form-message { min-height: 19px; margin: 3px 0 0; color: var(--red); font-size: .78rem; }
.setup-message { margin: 4px 0 0; padding: 11px; border-radius: 9px; background: var(--gold-pale); color: #72501d; font-size: .78rem; line-height: 1.45; }
.login-footnote { margin: 25px 0 0; color: var(--muted); font-size: .72rem; }
.lock-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--green); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; display: flex; width: 230px; flex-direction: column; border-right: 1px solid rgba(24,54,75,.09); background: var(--blue-pale); padding: 26px 18px 20px; }
.sidebar-brand { padding: 0 10px 28px; }
.main-nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 12px; border: 0; border-radius: 11px; background: transparent; color: var(--navy-soft); padding: 11px 13px; text-align: left; font-size: .84rem; font-weight: 780; }
.nav-item span { display: grid; width: 23px; height: 23px; place-items: center; color: var(--blue-deep); font-size: 1.05rem; }
.nav-item:hover { background: rgba(255,255,255,.56); }
.nav-item.is-active { background: var(--white); color: var(--navy); box-shadow: 0 7px 20px rgba(24,54,75,.06); }
.sidebar-note { margin-top: auto; padding: 16px 13px; border: 1px solid rgba(24,54,75,.1); border-radius: 14px; background: rgba(255,255,255,.48); }
.sidebar-note p { margin: 9px 0 0; color: var(--muted); font-size: .69rem; line-height: 1.5; }
.sidebar-note strong { color: var(--navy); }
.mini-sneaker { display: block; position: relative; width: 34px; height: 14px; border: 2px solid var(--navy); border-radius: 65% 25% 35% 25%; background: var(--white); }
.mini-sneaker::before { content: ""; position: absolute; top: -7px; left: 5px; width: 16px; height: 8px; border-left: 4px solid var(--blue-deep); transform: skewX(-28deg); }
.logout-button { align-self: flex-start; margin: 12px 8px 0; padding-inline: 6px; color: var(--muted); }
.content { min-height: 100vh; margin-left: 230px; padding: 41px clamp(24px, 4vw, 58px) 70px; }
.view { display: none; max-width: 1320px; margin: 0 auto; animation: reveal .2s ease-out; }
.view.is-visible { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(3px); } }
.mobile-header, .bottom-nav { display: none; }

.page-header { display: flex; min-height: 75px; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.page-header h1 { margin: 0; color: var(--navy); font: 700 clamp(2.15rem, 4vw, 3.5rem)/1 var(--font-display); letter-spacing: -.05em; }
.page-header p:not(.eyebrow) { margin: 9px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.dashboard-header { align-items: center; }
.dashboard-header h1 { font-size: clamp(2.15rem, 4vw, 3.25rem); }
.decision-card { position: relative; overflow: hidden; min-height: 176px; margin-bottom: 15px; border: 1px solid #9fc6ba; border-radius: var(--radius); background: var(--green-pale); padding: clamp(24px, 4vw, 40px); box-shadow: var(--shadow); }
.decision-card::after { content: ""; position: absolute; width: 170px; height: 170px; right: -45px; bottom: -72px; border: 28px solid rgba(53,108,93,.08); border-radius: 50%; }
.decision-card.action { border-color: #d1af7a; background: var(--gold-pale); }
.decision-card.urgent { border-color: #d6a39a; background: var(--red-pale); }
.decision-top { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; color: var(--green); font-size: .73rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.decision-card.action .decision-top { color: var(--gold); }
.decision-card.urgent .decision-top { color: var(--red); }
.decision-icon { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: var(--green); color: white; font-size: .74rem; }
.decision-card.action .decision-icon { background: var(--gold); }
.decision-card.urgent .decision-icon { background: var(--red); }
.decision-card h2 { position: relative; z-index: 1; max-width: 890px; margin: 0; color: var(--navy); font: 700 clamp(1.8rem, 4vw, 3.2rem)/1.08 var(--font-display); letter-spacing: -.045em; }
.decision-card > p { position: relative; z-index: 1; max-width: 800px; margin: 14px 0 0; color: var(--navy-soft); font-size: .88rem; line-height: 1.6; }
.transfer-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.transfer-chip { border: 1px solid rgba(24,54,75,.15); border-radius: 999px; background: rgba(255,255,255,.6); padding: 8px 12px; color: var(--navy); font-size: .75rem; font-weight: 800; }

.summary-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 15px; }
.stat-card { min-height: 116px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); padding: 18px; }
.stat-card span { display: block; min-height: 27px; color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 4px; color: var(--navy); font: 700 clamp(1.5rem, 2.7vw, 2.2rem)/1 var(--font-display); letter-spacing: -.04em; }
.stat-card small { display: block; margin-top: 8px; color: var(--muted); font-size: .67rem; line-height: 1.35; }

.dashboard-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 15px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 22px; box-shadow: 0 10px 35px rgba(24,54,75,.035); }
.panel-wide { grid-column: 1 / -1; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; color: var(--navy); font: 700 1.35rem/1.1 var(--font-display); letter-spacing: -.03em; }
.text-button { border: 0; background: transparent; color: var(--blue-deep); padding: 3px; font-size: .74rem; font-weight: 850; }
.account-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mini-account { position: relative; overflow: hidden; min-height: 142px; border: 1px solid #dbe2df; border-radius: 14px; background: #fbfaf6; padding: 15px; }
.mini-account::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--blue); }
.mini-account.spending::before { background: #d5a36b; }
.mini-account .account-name { min-height: 34px; color: var(--muted); font-size: .68rem; font-weight: 800; line-height: 1.35; }
.mini-account strong { display: block; margin-top: 7px; color: var(--navy); font: 700 1.52rem/1 var(--font-display); letter-spacing: -.035em; }
.mini-account small { display: block; margin-top: 8px; color: var(--muted); font-size: .64rem; line-height: 1.35; }
.mini-account .text-button { position: absolute; right: 10px; bottom: 10px; }
.warning-list { display: grid; gap: 10px; }
.warning { display: grid; grid-template-columns: 10px 1fr; gap: 11px; border-radius: 12px; background: var(--cream); padding: 12px 13px; }
.warning > i { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--gold); }
.warning.urgent > i { background: var(--red); }
.warning.good > i { background: var(--green); }
.warning strong { display: block; color: var(--navy); font-size: .76rem; }
.warning p { margin: 3px 0 0; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.segmented { display: flex; border: 1px solid #d7dfdc; border-radius: 9px; background: var(--cream); padding: 2px; }
.segmented button { min-width: 37px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); padding: 5px 8px; font-size: .65rem; font-weight: 800; }
.segmented button.is-active { background: var(--white); color: var(--navy); box-shadow: 0 2px 7px rgba(24,54,75,.08); }
.timeline { display: grid; max-height: 315px; overflow: auto; }
.timeline-item { display: grid; grid-template-columns: 47px 1fr auto; gap: 12px; align-items: center; border-bottom: 1px solid #edf0ec; padding: 10px 2px; }
.timeline-item:last-child { border-bottom: 0; }
.date-badge { text-align: center; color: var(--muted); font-size: .59rem; font-weight: 850; text-transform: uppercase; }
.date-badge strong { display: block; color: var(--navy); font: 700 1.25rem/1 var(--font-display); }
.timeline-item h3 { margin: 0; color: var(--ink); font-size: .76rem; }
.timeline-item p { margin: 3px 0 0; color: var(--muted); font-size: .64rem; }
.timeline-amount { color: var(--navy); font-size: .78rem; font-weight: 850; white-space: nowrap; }
.timeline-amount.income { color: var(--green); }
.empty-state { padding: 28px 10px; color: var(--muted); text-align: center; font-size: .78rem; }
.calculation-details { margin-top: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,253,249,.62); }
.calculation-details summary { padding: 15px 18px; color: var(--navy); font-size: .76rem; font-weight: 850; cursor: pointer; }
.calculation-details > div { display: grid; gap: 8px; padding: 0 18px 18px; }
.calculation-line { border-left: 3px solid var(--blue); padding: 9px 12px; color: var(--muted); font-size: .72rem; line-height: 1.55; }

.accounts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.account-card { position: relative; min-height: 290px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 24px; }
.account-card::after { content: ""; position: absolute; width: 130px; height: 130px; right: -58px; top: -58px; border: 18px solid var(--blue-pale); border-radius: 50%; }
.account-card-header { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 15px; }
.account-card h2 { margin: 0; color: var(--navy); font: 700 1.38rem/1.15 var(--font-display); }
.account-ending { margin-top: 5px; color: var(--muted); font-size: .68rem; }
.account-balance { margin: 25px 0 5px; color: var(--navy); font: 700 clamp(2.15rem, 5vw, 3.2rem)/1 var(--font-display); letter-spacing: -.05em; }
.balance-basis { color: var(--muted); font-size: .67rem; }
.account-purpose { min-height: 50px; margin: 18px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.rule-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag { border-radius: 999px; background: var(--blue-pale); color: var(--navy-soft); padding: 6px 9px; font-size: .61rem; font-weight: 800; }
.tag.cream { background: var(--cream); }
.account-actions { display: flex; gap: 8px; margin-top: 20px; }
.account-actions .button { flex: 1; }

.subnav { display: flex; gap: 4px; margin: -4px 0 17px; border-bottom: 1px solid var(--line); }
.subnav button { border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); padding: 10px 18px 12px; font-size: .76rem; font-weight: 850; }
.subnav button.is-active { border-color: var(--blue-deep); color: var(--navy); }
.plan-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.plan-toolbar p { margin: 0; color: var(--muted); font-size: .74rem; }
.record-list { display: grid; gap: 9px; }
.record-card { display: grid; grid-template-columns: minmax(160px, 1.4fr) .8fr .8fr .8fr auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: var(--white); padding: 16px 17px; }
.record-card.inactive { opacity: .58; }
.record-primary strong { display: block; color: var(--navy); font-size: .82rem; }
.record-primary small, .record-cell small { display: block; margin-top: 4px; color: var(--muted); font-size: .63rem; line-height: 1.35; }
.record-cell span { display: block; color: var(--ink); font-size: .75rem; font-weight: 750; }
.record-actions { display: flex; gap: 5px; }
.icon-button { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border: 1px solid #d6dfdc; border-radius: 9px; background: var(--white); color: var(--navy); font-size: 1.15rem; }

.correction-card { display: grid; grid-template-columns: auto minmax(190px, .8fr) minmax(260px, 1.4fr) auto; gap: 15px; align-items: center; margin-bottom: 20px; border: 1px solid #a8cbd3; border-radius: var(--radius); background: var(--blue-pale); padding: 20px; }
.correction-card label { color: var(--navy); font: 700 1.05rem/1.2 var(--font-display); }
.correction-card p { margin: 5px 0 0; color: var(--muted); font-size: .67rem; line-height: 1.4; }
.correction-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--navy); color: white; }
.correction-card textarea { min-height: 65px; }
.memory-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.memory-toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .7rem; font-weight: 750; }
.memory-toolbar select { width: auto; min-height: 37px; padding-block: 7px; }
.memory-toolbar > span { color: var(--muted); font-size: .68rem; }
.memory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.memory-card { min-height: 190px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; background: var(--white); padding: 18px; }
.memory-card.inactive { opacity: .58; }
.memory-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.memory-category { border-radius: 999px; background: var(--cream); color: var(--navy-soft); padding: 5px 8px; font-size: .57rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.memory-status { color: var(--green); font-size: .6rem; font-weight: 800; }
.memory-card h2 { margin: 14px 0 7px; color: var(--navy); font: 700 1.06rem/1.25 var(--font-display); }
.memory-card p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.52; }
.memory-applied { margin-top: 10px !important; border-left: 2px solid var(--blue); padding-left: 8px; font-size: .62rem !important; }
.memory-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 13px; }
.memory-foot small { color: var(--muted); font-size: .59rem; }

.table-panel { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .74rem; }
th { background: var(--blue-pale); color: var(--navy); padding: 13px 16px; text-align: left; font-size: .62rem; letter-spacing: .06em; text-transform: uppercase; }
td { border-top: 1px solid #edf0ec; padding: 13px 16px; color: var(--ink); white-space: nowrap; }
td:last-child { width: 40%; color: var(--muted); white-space: normal; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.settings-panel, .backup-panel { display: flex; flex-direction: column; gap: 15px; }
.settings-panel > label { display: grid; gap: 6px; }
.settings-panel label > span, .modal label > span { color: var(--muted); font-size: .64rem; font-weight: 500; }
.settings-panel fieldset { margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.settings-panel legend { color: var(--navy); padding: 0 5px; font-size: .75rem; font-weight: 850; }
.settings-panel fieldset > p { margin: 1px 0 11px; color: var(--muted); font-size: .64rem; line-height: 1.4; }
.priority-list { display: grid; gap: 5px; }
.priority-item { display: grid; grid-template-columns: 25px 1fr auto; align-items: center; gap: 8px; border-radius: 9px; background: var(--cream); padding: 8px 9px; }
.priority-item > b { color: var(--blue-deep); text-align: center; font-size: .68rem; }
.priority-item span { color: var(--navy); font-size: .7rem; font-weight: 750; }
.priority-arrows { display: flex; gap: 3px; }
.priority-arrows button { width: 27px; height: 27px; border: 1px solid #d5ddda; border-radius: 7px; background: var(--white); color: var(--navy); }
.backup-action { display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid #edf0ec; padding: 4px 0 15px; }
.backup-action:last-child { border-bottom: 0; }
.backup-action strong { color: var(--navy); font-size: .78rem; }
.backup-action p { margin: 4px 0 0; color: var(--muted); font-size: .64rem; line-height: 1.4; }
.danger-zone { margin-top: auto; border-radius: 12px; background: var(--red-pale); padding: 13px; }
.security-panel { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; background: var(--navy); color: white; }
.security-panel h2 { margin: 0; color: white; font: 700 1.35rem/1.2 var(--font-display); }
.security-panel p:last-child { max-width: 850px; margin: 8px 0 0; color: #c9d7dc; font-size: .72rem; line-height: 1.55; }
.security-icon { display: grid; width: 48px; height: 48px; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; color: var(--blue); font-size: 1.35rem; }

.modal { width: min(94vw, 610px); max-height: min(90vh, 830px); border: 0; border-radius: 20px; background: var(--white); color: var(--ink); padding: 0; box-shadow: 0 30px 100px rgba(15,42,58,.32); }
.modal-wide { width: min(94vw, 780px); }
.modal::backdrop { background: rgba(14,40,55,.52); backdrop-filter: blur(3px); }
.modal form { display: grid; gap: 14px; padding: 24px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.modal-header h2 { margin: 0; color: var(--navy); font: 700 1.65rem/1 var(--font-display); }
.modal label { display: grid; gap: 6px; }
.modal-account-name { margin: -5px 0 3px; color: var(--muted); font-size: .72rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.money-input { position: relative; }
.money-input b { position: absolute; z-index: 1; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.money-input input { padding-left: 28px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
label.check { display: flex; min-height: 45px; flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: .69rem; line-height: 1.35; }
label.check input { width: 17px; min-height: 17px; flex: 0 0 auto; accent-color: var(--navy); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid #edf0ec; padding-top: 16px; }
.danger-message { border-radius: 11px; background: var(--red-pale); color: var(--red); padding: 13px; }
.danger-message strong { font-size: .8rem; }
.danger-message p { margin: 4px 0 0; font-size: .68rem; line-height: 1.45; }

.loading { position: fixed; z-index: 999; inset: 0; display: grid; place-items: center; background: rgba(247,241,231,.58); backdrop-filter: blur(2px); }
.loader { width: 42px; height: 42px; border: 4px solid var(--blue-pale); border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 1100; right: 24px; bottom: 24px; max-width: min(380px, calc(100vw - 36px)); transform: translateY(20px); border-radius: 12px; background: var(--navy); color: white; padding: 12px 15px; opacity: 0; pointer-events: none; box-shadow: var(--shadow); font-size: .75rem; line-height: 1.45; transition: opacity .2s, transform .2s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--red); }

@media (max-width: 1080px) {
  .summary-stats { grid-template-columns: repeat(2, 1fr); }
  .account-strip { grid-template-columns: repeat(2, 1fr); }
  .memory-grid { grid-template-columns: repeat(2, 1fr); }
  .correction-card { grid-template-columns: auto 1fr auto; }
  .correction-card textarea { grid-column: 1 / 3; }
  .record-card { grid-template-columns: 1.3fr .8fr .8fr auto; }
  .record-card .record-cell:nth-of-type(3) { display: none; }
}

@media (max-width: 780px) {
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .mobile-header { position: sticky; z-index: 30; top: 0; display: flex; height: 70px; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(24,54,75,.09); background: rgba(223,239,241,.95); padding: 10px 16px; backdrop-filter: blur(12px); }
  .mobile-header .brand strong { font-size: 1.25rem; }
  .mobile-header .brand small { font-size: .5rem; }
  .mobile-header .brand-mark { width: 38px; height: 38px; }
  .mobile-header-actions { display: flex; align-items: flex-end; flex-direction: column; gap: 3px; }
  .sync-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .64rem; font-weight: 750; }
  .sync-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
  .mobile-logout { border: 0; background: transparent; color: var(--navy-soft); padding: 1px 0; font-size: .58rem; font-weight: 800; }
  .content { margin-left: 0; padding: 22px 15px 35px; }
  .bottom-nav { position: fixed; z-index: 50; inset: auto 0 0; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid rgba(24,54,75,.12); background: rgba(255,253,249,.97); padding: 7px 4px calc(6px + env(safe-area-inset-bottom)); backdrop-filter: blur(14px); }
  .bottom-nav button { display: grid; gap: 3px; place-items: center; border: 0; background: transparent; color: var(--muted); padding: 2px; font-size: .54rem; font-weight: 750; }
  .bottom-nav span { font-size: 1.06rem; }
  .bottom-nav button.is-active { color: var(--navy); }
  .page-header { min-height: 0; align-items: flex-start; margin-bottom: 20px; }
  .page-header h1 { font-size: 2.15rem; }
  .page-header > .button { min-height: 38px; padding-inline: 11px; }
  .page-actions { max-width: 154px; }
  .page-actions .button { min-height: 36px; width: 100%; padding: 7px 9px; font-size: .65rem; }
  .dashboard-header .button { display: none; }
  .decision-card { min-height: 185px; padding: 23px 20px; }
  .decision-card h2 { font-size: 2rem; }
  .decision-card > p { font-size: .78rem; }
  .summary-stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { min-height: 105px; padding: 14px; }
  .stat-card strong { font-size: 1.55rem; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel-wide { grid-column: auto; }
  .panel { padding: 17px; }
  .account-strip { display: flex; margin-right: -17px; overflow-x: auto; padding-right: 17px; scroll-snap-type: x mandatory; }
  .mini-account { min-width: 192px; scroll-snap-align: start; }
  .schedule-heading { align-items: center; }
  .accounts-grid, .settings-grid { grid-template-columns: 1fr; }
  .account-card { min-height: 0; padding: 20px; }
  .account-balance { font-size: 2.45rem; }
  .security-panel { grid-column: auto; }
  .record-card { grid-template-columns: 1fr auto; gap: 10px; }
  .record-card .record-cell { display: none; }
  .record-primary small { max-width: 250px; }
  .correction-card { grid-template-columns: auto 1fr; padding: 17px; }
  .correction-card textarea { grid-column: 1 / -1; }
  .correction-card .button { grid-column: 1 / -1; }
  .memory-grid { grid-template-columns: 1fr; }
  .memory-card { min-height: 168px; }
  .table-panel { margin-inline: -1px; }
  table { min-width: 720px; }
  .form-grid, .form-grid.three, .check-grid { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; }
  .modal form { padding: 20px; }
  .toast { right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
  .login-card { padding: 28px 22px; }
  .brand-login { margin-bottom: 35px; }
  .password-row { grid-template-columns: 1fr; }
  .password-row .button { width: 100%; }
  .summary-stats { grid-template-columns: 1fr 1fr; }
  .stat-card span { min-height: 32px; }
  .page-header { gap: 10px; }
  .page-header > .button { font-size: .68rem; }
  .subnav button { flex: 1; padding-inline: 8px; }
  .backup-action { align-items: flex-start; flex-direction: column; }
  .backup-action .button { width: 100%; }
}

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