:root {
  --crimson: #ad0024;
  --crimson-dark: #8c001d;
  --navy: #10254d;
  --navy-dark: #0a1a36;
  --background: #f4f5f7;
  --surface: #fff;
  --text: #202b3f;
  --muted: #687286;
  --line: #e4e7ed;
  --rose: #fbf0f2;
  --blue-soft: #edf2fa;
  --green: #286448;
  --green-soft: #edf5f0;
  --amber: #835a12;
  --radius: 15px;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 3px solid #b17000; outline-offset: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
h1, h2, h3, p { margin: 0; }
button { border: 0; }
.skip-link { position: fixed; left: 20px; top: -100px; background: white; color: var(--navy); padding: 14px; z-index: 20; }
.skip-link:focus { top: 10px; }

.topbar { height: 96px; background: var(--crimson); color: white; display: flex; justify-content: space-between; align-items: center; padding: 0 34px; gap: 24px; }
.brand { display: flex; gap: 16px; align-items: center; min-width: 0; }
.brand-mark { background: white; color: var(--crimson); width: 53px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font: 39px Georgia, serif; }
.brand-mark span { color: var(--navy); }
.brand strong { font: 23px Georgia, "Times New Roman", serif; letter-spacing: .1px; }
.brand-number { opacity: .75; font-size: 18px; }
.brand small { display: block; font-size: 11px; opacity: .83; margin-top: 5px; letter-spacing: .5px; }
.topbar-right { display: flex; gap: 25px; align-items: center; }
.local-badge { font-size: 12px; display: flex; gap: 8px; align-items: center; opacity: .9; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.help-button { padding: 10px 14px; min-height: 44px; border: 1px solid #ffffff40; border-radius: 8px; color: white; background: #ffffff0c; white-space: nowrap; }
.help-button:hover { background: #ffffff20; }
.help-button span { border: 1px solid #ffffffa0; border-radius: 50%; padding: 0 5px; margin-right: 7px; }
.avatar { border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; background: #ffffff23; border: 1px solid #ffffff38; font-size: 11px; font-weight: 600; }

.app-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: calc(100vh - 96px); }
.sidebar { background: white; border-right: 1px solid var(--line); padding: 32px 17px 20px; display: flex; flex-direction: column; }
.sidebar-label { font-size: 10px; letter-spacing: 1.7px; color: var(--muted); margin: 0 17px 20px; font-weight: 600; }
nav { display: grid; gap: 8px; }
nav a { display: flex; align-items: center; min-height: 44px; padding: 12px 15px; gap: 14px; border-radius: 9px; font-weight: 500; color: #59657a; }
nav a:hover { background: #f7f8fa; color: var(--navy); }
nav a.active { color: var(--crimson); background: var(--rose); font-weight: 600; }
nav .mobile-guide-link { display: none; }
.nav-icon { font-size: 22px; line-height: 1; font-weight: 400; width: 24px; text-align: center; }
.sidebar-bottom { margin-top: auto; padding-top: 55px; }
.sidebar-note { padding: 21px 16px; background: #f6f7fa; border: 1px solid var(--line); border-radius: 12px; }
.note-symbol { display: block; color: var(--crimson); font-size: 25px; margin-bottom: 8px; }
.sidebar-note h3 { font-family: Georgia, serif; font-size: 17px; font-weight: 400; color: var(--navy); }
.sidebar-note p { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.8; }
.guide-link { display: flex; gap: 12px; padding: 23px 12px 17px; color: var(--muted); font-size: 12px; }
.guide-link.active { color: var(--crimson); }
.course-label { font-size: 9px; color: var(--muted); letter-spacing: 1.5px; padding: 0 12px; }
main { width: 100%; max-width: 1580px; margin: 0 auto; padding: 31px 36px 18px; min-width: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 20px; margin-bottom: 26px; }
.eyebrow { font-size: 9px; font-weight: 700; letter-spacing: 1.8px; color: var(--muted); margin-bottom: 5px; }
h1 { color: var(--navy); font: 34px Georgia, serif; letter-spacing: -.8px; }
.heading-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; max-width: 100%; }
.month-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.month-controls .month-arrow { min-width: 44px; padding: 5px 10px; font-size: 25px; line-height: 1; }
.record-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.month-picker { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.month-picker input { padding: 10px 9px; border-radius: 8px; border: 1px solid var(--line); background: white; color: var(--navy); font-size: 12px; min-height: 44px; min-width: 0; }
.button { padding: 11px 17px; border-radius: 8px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; transition: background .15s; }
.button.primary { color: white; background: var(--crimson); }
.button.primary:hover { background: var(--crimson-dark); }
.button.secondary { color: var(--navy); background: white; border: 1px solid #d7dce5; }
.button.secondary:hover { background: var(--blue-soft); }
.button.light { background: white; color: var(--navy); }
.button.light:hover { background: var(--blue-soft); }
.text-button { color: var(--crimson); background: none; padding: 7px 0; font-weight: 600; font-size: 12px; }
.text-button:hover { text-decoration: underline; }
.icon-button { height: 44px; width: 44px; flex-shrink: 0; border-radius: 8px; color: var(--muted); background: #f4f5f7; font-size: 23px; }
.icon-button:hover { color: var(--crimson); }

.hero { background: var(--navy); color: white; border-radius: var(--radius); padding: 27px 32px; display: flex; align-items: center; justify-content: space-between; gap: 28px; position: relative; overflow: hidden; margin-bottom: 22px; }
.hero::after { content: ""; width: 320px; height: 320px; border: 1px solid #ffffff10; border-radius: 50%; position: absolute; right: -65px; top: -115px; pointer-events: none; }
.hero .eyebrow { color: #b4c4df; font-size: 9px; }
.hero h2 { font: 31px/1.2 Georgia, serif; margin: 9px 0 10px; letter-spacing: -.3px; }
.hero p:not(.eyebrow) { color: #c3cee0; font-size: 12px; max-width: 440px; line-height: 1.8; }
.hero-aside { border-left: 1px solid #ffffff30; min-width: 200px; padding-left: 29px; position: relative; z-index: 1; }
.hero-aside small { color: #b8c6dc; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
.hero-aside strong { display: block; font: 31px Georgia, serif; margin: 6px 0; }
.hero-aside .hero-caption { font-size: 11px; color: #c3cee0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 23px; }
.stat { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.stat-label { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stat-icon { height: 28px; width: 28px; flex-shrink: 0; border-radius: 8px; display: grid; place-items: center; background: var(--blue-soft); color: var(--navy); font-size: 17px; }
.stat-icon.red { background: var(--rose); color: var(--crimson); }
.stat strong { display: block; font-size: clamp(21px, 2.05vw, 30px); font-weight: 600; letter-spacing: -.9px; color: var(--navy); margin: 10px 0 5px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 10px; color: var(--muted); }
.positive { color: var(--green) !important; }
.negative { color: var(--crimson) !important; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 22px; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 21px 23px 0; gap: 12px; }
.panel h2, .section-title { color: var(--navy); font-size: 16px; font-weight: 600; }
.panel-subtitle { font-size: 11px; color: var(--muted); margin-top: 4px; }
.panel-body { padding: 20px 23px 24px; }
.dashboard-wide { grid-column: 1 / -1; }
.category-line { margin-bottom: 20px; }
.category-line:last-child { margin-bottom: 0; }
.category-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; margin-bottom: 9px; }
.category-top strong { font-size: 11px; color: var(--navy); font-weight: 600; white-space: nowrap; }
.category-top small { font-size: 10px; color: var(--muted); font-weight: 400; }
.category-name { display: flex; align-items: center; gap: 9px; }
.category-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--navy); display: inline-block; flex-shrink: 0; }
.category-dot.tone-1 { background: var(--crimson); }
.category-dot.tone-2 { background: #6a81a4; }
.category-dot.tone-3 { background: #bf8793; }
.category-dot.tone-4 { background: #9caac0; }
.category-dot.tone-5 { background: #657780; }
progress { display: block; width: 100%; height: 6px; appearance: none; border: 0; border-radius: 8px; overflow: hidden; background: #edf0f5; color: var(--navy); }
progress::-webkit-progress-bar { background: #edf0f5; border-radius: 8px; }
progress::-webkit-progress-value { background: var(--navy); border-radius: 8px; }
progress::-moz-progress-bar { background: var(--navy); border-radius: 8px; }
progress.over { color: var(--crimson); }
progress.over::-webkit-progress-value { background: var(--crimson); }
progress.over::-moz-progress-bar { background: var(--crimson); }
.budget-caption { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 9px; color: var(--muted); font-size: 10px; }
.pill { border-radius: 5px; background: var(--blue-soft); color: var(--navy); padding: 4px 7px; font-size: 10px; display: inline-block; }
.pill.over { background: var(--rose); color: var(--crimson); }
.pill.good { background: var(--green-soft); color: var(--green); }
.pill.warn { background: #faf3e7; color: var(--amber); }
.donut-area { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 6px 0 16px; }
.donut { width: 148px; height: 148px; border-radius: 50%; background: var(--chart-fill, #edf0f5); position: relative; flex: 0 0 auto; }
.donut::before { content: ""; position: absolute; inset: 19px; background: white; border-radius: 50%; }
.donut-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-label strong { font-size: 19px; letter-spacing: -.5px; color: var(--navy); }
.donut-label small { font-size: 9px; color: var(--muted); margin-top: 4px; }
.chart-legend { display: grid; gap: 11px; font-size: 10px; }
.chart-legend li { display: flex; gap: 7px; align-items: center; }
.chart-legend ul { padding: 0; margin: 0; list-style: none; display: grid; gap: 11px; }
.insight { background: #f6f8fb; border: 1px solid #edf0f5; padding: 11px 13px; border-radius: 8px; font-size: 11px; color: #59687c; line-height: 1.7; }
.insight strong { color: var(--navy); font-weight: 600; }
.goal-preview { display: flex; justify-content: space-between; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.goal-preview:last-child { border-bottom: 0; padding-bottom: 0; }
.goal-preview:first-child { padding-top: 0; }
.goal-preview-content { flex: 1; min-width: 0; }
.goal-icon { width: 36px; height: 36px; background: var(--blue-soft); color: var(--navy); border-radius: 10px; display: grid; place-items: center; font-size: 20px; }
.goal-preview h3 { font-size: 12px; color: var(--navy); margin-bottom: 4px; }
.goal-preview p { font-size: 10px; color: var(--muted); margin-bottom: 10px; }
.goal-preview .goal-percent { font-size: 13px; color: var(--navy); font-weight: 600; }

.table-scroll { position: relative; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 600; background: #fafbfc; }
th, td { padding: 14px 23px; border-bottom: 1px solid #eef0f4; }
td { font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcfd; }
.transaction-description { font-size: 12px; font-weight: 600; color: var(--navy); white-space: normal; overflow-wrap: anywhere; min-width: 150px; max-width: 280px; }
.transaction-merchant { color: var(--muted); font-size: 10px; margin-top: 3px; white-space: normal; }
.transaction-note { max-width: 280px; color: var(--muted); font-size: 11px; margin-top: 5px; white-space: normal; overflow-wrap: anywhere; }
.amount { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.row-actions { display: flex; gap: 12px; justify-content: flex-end; }
.row-actions button { background: none; color: var(--muted); font-size: 11px; padding: 6px 0; }
.row-actions button:hover { color: var(--crimson); text-decoration: underline; }
.table-panel .panel-heading { padding-bottom: 20px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 18px 23px; border-bottom: 1px solid var(--line); }
.toolbar label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; }
.toolbar input, .toolbar select { padding: 9px 11px; border-radius: 7px; border: 1px solid var(--line); color: var(--text); background: white; min-height: 38px; }
.toolbar .search-input { flex: 1; min-width: 180px; }
.toolbar .search-input input { width: 100%; }
.toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.filter-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; padding: 15px 23px; color: var(--muted); font-size: 12px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.filter-summary strong { color: var(--navy); font-variant-numeric: tabular-nums; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 23px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination .count-label { padding: 0; border: 0; }
.count-label { color: var(--muted); font-size: 11px; padding: 15px 23px; border-top: 1px solid var(--line); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 16px; }
.section-header p { color: var(--muted); font-size: 12px; margin-top: 5px; }
.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.budget-card, .goal-card { padding: 23px; }
.budget-card h2, .goal-card h2 { font-size: 16px; color: var(--navy); overflow-wrap: anywhere; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 22px; }
.budget-amount { color: var(--navy); font-size: 27px; font-weight: 600; letter-spacing: -.5px; }
.budget-amount small { font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.budget-card progress, .goal-card progress { margin-top: 18px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; border-top: 1px solid var(--line); padding-top: 13px; margin-top: 21px; }
.goal-card .card-actions { justify-content: space-between; align-items: center; }
.due-date { color: var(--muted); font-size: 11px; margin-top: 8px; }
.contribution-list { list-style: none; padding: 0; margin: 10px 0 0; max-height: 150px; overflow-y: auto; }
.contribution-list li { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: 7px 0; gap: 8px; font-size: 10px; }
.contribution-list button { padding: 5px; color: var(--crimson); background: none; font-size: 10px; }
.goal-card details { margin-top: 16px; font-size: 11px; color: var(--muted); }
.goal-card summary { cursor: pointer; }

.empty-state { padding: 35px 23px; text-align: center; }
.empty-symbol { display: grid; place-items: center; width: 49px; height: 49px; border-radius: 50%; background: var(--blue-soft); color: var(--navy); font-size: 23px; margin: 0 auto 13px; }
.empty-state h3 { color: var(--navy); font-size: 15px; margin-bottom: 7px; }
.empty-state p { font-size: 12px; color: var(--muted); max-width: 370px; margin: 0 auto 16px; line-height: 1.8; }
.welcome-strip { padding: 15px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: white; border: 1px dashed #c7cedc; border-radius: 10px; margin-bottom: 22px; }
.welcome-strip strong { display: block; font-size: 12px; color: var(--navy); }
.welcome-strip p { font-size: 11px; color: var(--muted); margin-top: 3px; }
.sample-banner { background: #edf2fa; color: var(--navy); border: 1px solid #dce4f1; border-radius: 8px; padding: 9px 14px; margin-bottom: 16px; font-size: 11px; font-weight: 600; }
.sample-banner span { font-weight: 400; margin-left: 12px; }
.error-banner { background: var(--rose); color: var(--crimson); border: 1px solid #efcbd3; padding: 16px; border-radius: 8px; margin-bottom: 18px; }
#retry-connection { margin-bottom: 18px; }
.loading-state { padding: 100px 20px; text-align: center; color: var(--muted); }
.loading-dot { display: inline-block; width: 8px; height: 8px; background: var(--crimson); border-radius: 50%; margin-right: 8px; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; font-size: 10px; color: var(--muted); padding: 27px 0 8px; }
.page-footer span:first-child { font-weight: 600; color: var(--navy); }

.report-controls { padding: 18px 22px; margin-bottom: 22px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; }
.report-controls label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.report-controls input, .report-controls select { border: 1px solid var(--line); background: white; border-radius: 7px; padding: 9px; color: var(--navy); }
.report-period { color: var(--muted); font-size: 12px; }
.bar-chart { height: 210px; display: flex; align-items: stretch; gap: 12px; padding: 10px 0 0; overflow-x: auto; }
.bar-group { flex: 1; min-width: 36px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.bar-stack { display: flex; align-items: flex-end; gap: 4px; height: 162px; width: 100%; max-width: 44px; }
.bar { width: 50%; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--navy); height: var(--bar-height, 0%); }
.bar.expense { background: var(--crimson); }
.bar-group small { font-size: 9px; color: var(--muted); padding-top: 10px; white-space: nowrap; }
.chart-key { display: flex; gap: 17px; font-size: 10px; color: var(--muted); }
.chart-key span { display: flex; align-items: center; gap: 7px; }
.report-table { margin-top: 22px; }
.guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.guide-card { padding: 27px; }
.guide-card h2 { font: 23px Georgia, serif; margin-bottom: 15px; }
.guide-card p { font-size: 13px; color: var(--muted); line-height: 1.9; margin: 10px 0; }
.guide-card ol { padding-left: 20px; color: var(--muted); font-size: 13px; }
.guide-card li { margin: 12px 0; padding-left: 5px; }
.guide-card strong { color: var(--navy); }

dialog { border: 0; border-radius: 18px; padding: 28px; width: min(510px, calc(100% - 32px)); max-height: 90vh; color: var(--text); box-shadow: 0 24px 100px #10254d35; }
dialog::backdrop { background: #0a1a3685; backdrop-filter: blur(3px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; }
.dialog-heading h2 { font: 28px Georgia, serif; color: var(--navy); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.field { display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: var(--navy); font-weight: 600; }
.field.full { grid-column: 1 / -1; }
.field input, .field select, .field textarea { padding: 11px 12px; border: 1px solid #d9dfe8; border-radius: 8px; width: 100%; min-width: 0; background: white; color: var(--text); font-weight: 400; }
.field textarea { resize: vertical; min-height: 80px; }
.field small, .form-hint { font-size: 11px; font-weight: 400; color: var(--muted); line-height: 1.7; }
.form-hint { margin-top: 16px; }
.confirm-copy { font-size: 14px; color: var(--muted); line-height: 1.9; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding-top: 23px; margin-top: 23px; border-top: 1px solid var(--line); }
.discard-confirm { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: var(--amber); background: #faf3e7; border: 1px solid #ead9b9; border-radius: 8px; padding: 12px; margin-top: 16px; font-size: 12px; }
.discard-confirm .text-button { min-height: 44px; }
.form-error { font-size: 12px; color: var(--crimson); background: var(--rose); padding: 12px; border-radius: 8px; margin-top: 16px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: white; padding: 14px 22px; border-radius: 10px; box-shadow: 0 8px 35px #10254d30; z-index: 30; max-width: calc(100% - 32px); font-size: 13px; }

.signed-out .sidebar, .signed-out .page-heading, .signed-out .local-badge, .signed-out .help-button, .signed-out #sample-banner { display: none; }
.signed-out .app-shell { display: block; }
.signed-out main { max-width: 750px; }
.auth-panel { max-width: 470px; margin: 35px auto 70px; padding: 32px; }
.auth-panel h1 { margin-bottom: 12px; }
.standalone-form { margin-top: 22px; }
.standalone-form > .button, .standalone-form > .text-button { margin-top: 20px; margin-right: 18px; }
.setup-panel { margin-bottom: 24px; }
.setup-panel .standalone-form { max-width: 900px; }
.form-section-title { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 20px; margin-top: 8px; font-size: 15px; color: var(--navy); }
.allocation-panel { margin-top: 22px; }
.allocation-panel table { margin-top: 16px; }
.report-note { margin-bottom: 22px; }
.sidebar-note { display: none; }
.hero h2 { font-family: "Segoe UI", Arial, sans-serif; font-size: 25px; font-weight: 600; }
.hero { padding: 25px 28px; }
.guide-card h2 { font-family: "Segoe UI", Arial, sans-serif; font-size: 18px; font-weight: 600; }

@media (min-width: 1650px) { main { padding-top: 40px; } .hero { padding: 35px; } .hero h2 { font-size: 38px; } }
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 195px minmax(0, 1fr); }
  main { padding: 26px 23px 16px; }
  .sidebar { padding-left: 11px; padding-right: 11px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .donut-area { flex-direction: column; gap: 20px; }
  .chart-legend ul { grid-template-columns: 1fr 1fr; gap: 8px 16px; }
  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { padding: 15px; }
  .stat strong { font-size: 23px; }
  .local-badge { display: none; }
}

@media (max-width: 850px) {
  .topbar { padding: 0 20px; height: 83px; }
  .brand strong { font-size: 20px; }
  .brand-mark { width: 43px; height: 46px; font-size: 32px; }
  .topbar-right { gap: 12px; }
  .app-shell { display: block; }
  .sidebar { padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-label, .sidebar-bottom { display: none; }
  nav { display: flex; overflow-x: auto; gap: 5px; }
  nav a { white-space: nowrap; padding: 11px 12px; font-size: 12px; gap: 8px; }
  nav .mobile-guide-link { display: flex; }
  .nav-icon { font-size: 19px; width: 20px; }
  main { padding: 25px 20px 12px; }
  .page-heading { gap: 16px; flex-wrap: wrap; }
  .heading-actions { flex-wrap: wrap; }
  .hero { padding: 25px; }
  .hero h2 { font-size: 29px; }
  .stats-grid { gap: 10px; }
  .stat strong { font-size: 21px; }
  .stat-icon { display: none; }
}
@media (max-width: 600px) {
  .topbar { padding: 14px 16px; min-height: 83px; height: auto; gap: 12px; }
  .brand { gap: 10px; }
  .brand > span:last-child { min-width: 0; }
  .brand strong { font-size: 18px; }
  .brand-number { font-size: 16px; }
  .brand small { font-size: 9px; letter-spacing: .1px; }
  .help-button[data-route="guide"] { display: none; }
  #logout { padding: 10px 12px; }
  .topbar-right { flex-shrink: 0; }
  .avatar { width: 30px; height: 30px; font-size: 9px; }
  main { padding: 24px 16px 12px; }
  h1 { font-size: 30px; }
  .heading-actions { width: 100%; justify-content: space-between; gap: 8px; }
  .heading-actions .button { padding: 10px 12px; }
  .month-controls, .record-actions { width: 100%; }
  .record-actions .button { flex: 1 1 auto; }
  .month-picker { font-size: 0; gap: 0; }
  .month-picker input { font-size: 12px; padding: 9px 6px; max-width: 155px; }
  .hero { padding: 24px; display: block; }
  .hero h2 { font-size: 30px; }
  .hero-aside { margin-top: 23px; padding: 18px 0 0; border-left: 0; border-top: 1px solid #ffffff25; }
  .hero-aside strong { display: inline-block; margin-right: 14px; font-size: 26px; }
  .hero-aside small { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat { padding: 16px; }
  .stat strong { font-size: 24px; }
  .dashboard-grid, .cards-grid, .guide-grid { grid-template-columns: 1fr; }
  .donut-area { flex-direction: row; gap: 20px; }
  .chart-legend ul { grid-template-columns: 1fr; }
  .dashboard-wide { grid-column: auto; }
  .panel-heading { padding: 20px 18px 0; }
  .panel-body { padding: 20px 18px; }
  th, td { padding: 12px 18px; }
  .welcome-strip { align-items: flex-start; flex-direction: column; gap: 10px; }
  .sample-banner span { display: block; margin: 3px 0 0; }
  .section-header { align-items: flex-start; }
  .section-header .button { flex-shrink: 0; }
  .toolbar { padding: 16px; gap: 10px; }
  .toolbar .search-input { flex-basis: 100%; }
  .toolbar label { flex-wrap: wrap; }
  .toolbar input, .toolbar select { min-height: 44px; max-width: 100%; }
  .toolbar-actions { width: 100%; }
  .filter-summary, .pagination { padding: 16px; }
  .row-actions button, .contribution-list button, .card-actions .text-button { min-height: 44px; padding-left: 6px; padding-right: 6px; }
  .row-actions { gap: 6px; }
  .transactions-table { white-space: normal; }
  .transactions-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .transactions-table tbody, .transactions-table tr, .transactions-table td { display: block; }
  .transactions-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
  .transactions-table td { padding: 0; border: 0; }
  .transactions-table td:first-child { grid-column: 1 / -1; margin-bottom: 6px; }
  .transactions-table td:nth-child(2) { grid-column: 1; grid-row: 2; }
  .transactions-table td:nth-child(3) { grid-column: 1; grid-row: 3; color: var(--muted); }
  .transactions-table td.amount { grid-column: 2; grid-row: 2 / 4; align-self: center; font-weight: 600; font-size: 14px; }
  .transactions-table td:last-child { grid-column: 1 / -1; }
  .transactions-table .row-actions { justify-content: flex-start; }
  .transactions-table .transaction-description, .transactions-table .transaction-note { max-width: none; min-width: 0; }
  .section-header { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  dialog { padding: 23px; }
  .dialog-actions .button { flex: 1 1 auto; }
  .bar-chart { gap: 7px; }
  .page-footer { font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
