:root {
    color-scheme: light;
    --navy: #17243b;
    --navy-soft: #263754;
    --ink: #17243b;
    --muted: #7c8799;
    --muted-dark: #657184;
    --paper: #f5f7fb;
    --white: #fff;
    --line: #e8ecf2;
    --green: #15966a;
    --green-soft: #e7f6ef;
    --red: #dc6d63;
    --red-soft: #fff0ed;
    --blue: #4a78d0;
    --blue-soft: #edf3ff;
    --amber: #d59a3c;
    --amber-soft: #fff6e6;
    --shadow: 0 12px 32px rgba(31, 50, 79, .055);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.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; }

.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--navy); text-decoration: none; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 17px; font-weight: 700; letter-spacing: -.04em; }
.brand strong { font-weight: 800; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(140deg, #337be8, #668ce1 55%, #344e7b); box-shadow: 0 6px 15px rgba(74, 120, 208, .25); font-size: 20px; font-weight: 700; }
.brand-light { color: #fff; }

.auth-page { min-height: 100vh; background: #fff; }
.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(390px, .91fr) minmax(490px, 1.09fr); }
.auth-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; min-height: 100vh; padding: 42px clamp(36px, 6.1vw, 92px); color: #fff; background: radial-gradient(ellipse at 12% 98%, rgba(70, 120, 202, .38), transparent 45%), linear-gradient(147deg, #17243b 1%, #243755 61%, #324e78); }
.auth-story::before, .auth-story::after { position: absolute; width: 390px; height: 390px; border: 1px solid rgba(255, 255, 255, .075); border-radius: 50%; content: ''; pointer-events: none; }
.auth-story::before { right: -195px; bottom: -55px; box-shadow: 0 0 0 42px rgba(255, 255, 255, .025), 0 0 0 84px rgba(255, 255, 255, .02); }
.auth-story::after { top: 20%; right: -260px; width: 500px; height: 500px; }
.story-copy { position: relative; z-index: 1; max-width: 480px; margin: 60px 0 45px; }
.eyebrow { margin: 0 0 11px; color: #6985bd; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.auth-story .eyebrow { color: #a8c2f2; }
.story-copy h1 { max-width: 470px; margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; font-size: clamp(34px, 4.25vw, 55px); font-weight: 600; letter-spacing: -.06em; line-height: 1.13; }
.story-copy > p:not(.eyebrow) { max-width: 425px; margin: 23px 0 0; color: rgba(255,255,255,.72); font-size: 15px; line-height: 1.8; }
.story-points { display: grid; gap: 17px; margin-top: 46px; color: rgba(255,255,255,.9); font-size: 13px; }
.story-points span { display: flex; align-items: center; gap: 13px; }
.story-points b { color: #9cbaf0; font-size: 10px; letter-spacing: .08em; }
.auth-copyright { position: relative; z-index: 1; color: rgba(255,255,255,.53); font-size: 11px; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 48px 32px; }
.brand-mobile { display: none; }
.auth-card { width: min(420px, 100%); padding: 8px 0; }
.auth-card h2 { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 31px; letter-spacing: -.055em; }
.auth-subtitle { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.form-stack { display: grid; gap: 19px; margin-top: 31px; }
.form-stack label, .transaction-form label, .category-form label, .budget-form label { display: grid; gap: 8px; color: #39475d; font-size: 12px; font-weight: 700; }
.form-stack input, .transaction-form input, .transaction-form select, .category-form input:not([type=color]), .category-form select, .budget-form input, .budget-form select, .table-filters input, .table-filters select { width: 100%; min-width: 0; min-height: 46px; padding: 0 13px; border: 1px solid #e1e6ef; border-radius: 9px; outline: 0; color: var(--ink); background: #fff; font-size: 13px; font-weight: 500; transition: border-color .16s, box-shadow .16s; }
.form-stack input:focus, .transaction-form input:focus, .transaction-form select:focus, .category-form input:focus, .category-form select:focus, .budget-form input:focus, .budget-form select:focus, .table-filters input:focus, .table-filters select:focus { border-color: #7295da; box-shadow: 0 0 0 3px rgba(74, 120, 208, .11); }
.form-stack small { color: var(--muted); font-size: 11px; font-weight: 400; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border: 1px solid transparent; border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 800; text-decoration: none; transition: transform .15s, filter .15s, box-shadow .15s; }
.button:hover { transform: translateY(-1px); filter: brightness(1.025); }
.button-primary { color: #fff; background: linear-gradient(125deg, #3477df, #5a82d2); box-shadow: 0 6px 14px rgba(68, 116, 206, .19); }
.button-secondary { border-color: #e2e7f0; color: #3c4e6c; background: #fff; }
.button-wide { width: 100%; min-height: 49px; margin-top: 3px; font-size: 13px; }
.button-small { min-height: 38px; padding: 0 13px; }
.auth-switch { margin: 22px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.auth-switch a, .auth-terms a { color: #3c70c8; font-weight: 700; text-decoration: none; }
.auth-terms { margin: 18px auto 0; color: var(--muted); font-size: 11px; line-height: 1.7; text-align: center; }
.trial-callout { display: flex; align-items: center; gap: 13px; margin-top: 28px; padding: 16px; border: 1px solid #e9eef7; border-radius: 11px; background: #f8faff; }
.trial-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #4d78cb; background: #eaf1ff; }
.trial-callout div { display: grid; gap: 4px; flex: 1; }
.trial-callout strong { font-size: 12px; }
.trial-callout span:not(.trial-icon) { color: var(--muted); font-size: 10px; }
.trial-callout > a { color: #4777cf; font-size: 21px; text-decoration: none; }
.auth-footer { margin: 26px 0 0; color: #97a0af; font-size: 10px; text-align: center; }
.alert { padding: 12px 15px; border: 1px solid transparent; border-radius: 9px; font-size: 12px; line-height: 1.5; }
.auth-card .alert { margin-top: 19px; }
.alert-error { border-color: #f6d3cf; color: #a43d35; background: #fff4f2; }
.alert-success { border-color: #cce9dc; color: #16754f; background: #effaf4; }
.expired-card { width: min(490px, calc(100% - 32px)); margin: 10vh auto; padding: 40px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow); }
.expired-card h1 { margin: 0 0 12px; font: 700 28px 'Segoe UI', system-ui, sans-serif; letter-spacing: -.04em; }
.expired-card p:not(.eyebrow) { color: var(--muted-dark); font-size: 13px; line-height: 1.8; }
.expired-icon { display: grid; width: 42px; height: 42px; margin-bottom: 23px; place-items: center; border-radius: 50%; color: #4f75bd; background: #edf3ff; }

.app-page { min-height: 100vh; background: var(--paper); }
.app-shell { display: grid; min-height: calc(100vh - 39px); grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 29px 18px 18px; border-right: 1px solid #e9edf3; background: #fff; }
.sidebar > .brand { padding: 0 10px; }
.workspace-label { margin: 45px 12px 13px; color: #9da7b5; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.side-nav { display: grid; gap: 5px; }
.side-nav a { display: flex; min-height: 45px; align-items: center; gap: 12px; padding: 0 12px; border-radius: 9px; color: #697589; font-size: 12px; font-weight: 600; text-decoration: none; transition: color .15s, background .15s; }
.side-nav a:hover { color: var(--navy); background: #f6f8fc; }
.side-nav a.active { color: #356ac2; background: #edf3ff; font-weight: 800; }
.nav-icon { display: grid; width: 22px; height: 22px; place-items: center; font-size: 19px; line-height: 1; }
.sidebar-bottom { display: grid; gap: 17px; margin-top: auto; }
.trial-mini { display: grid; gap: 8px; padding: 14px; border: 1px solid #e5ebf5; border-radius: 11px; background: #f8faff; }
.trial-mini > span { color: var(--muted); font-size: 10px; }
.trial-mini > strong { color: #334968; font-size: 12px; }
.trial-meter, .progress-track { overflow: hidden; height: 5px; border-radius: 20px; background: #edf0f5; }
.trial-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #5282d5, #70a0ea); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 3px 4px; }
.avatar { display: grid; width: 35px; height: 35px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #456fb9; background: #eaf0fc; font-size: 13px; font-weight: 800; }
.user-name { overflow: hidden; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.user-name small { display: block; overflow: hidden; max-width: 165px; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 500; text-overflow: ellipsis; }
.sidebar-bottom form { margin: 0; }
.logout-button { display: flex; width: 100%; justify-content: space-between; padding: 10px 5px; border: 0; border-top: 1px solid #edf0f5; color: #788397; background: transparent; cursor: pointer; font-size: 11px; }
.logout-button:hover { color: #bd5149; }
.main-area { min-width: 0; }
.topbar { display: flex; min-height: 100px; align-items: center; justify-content: space-between; gap: 22px; padding: 17px clamp(24px, 4vw, 58px); border-bottom: 1px solid #e9edf3; background: #fff; }
.topbar-context { margin: 0 0 5px; color: #909aaa; font-size: 10px; }
.topbar h1 { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 21px; font-weight: 700; letter-spacing: -.045em; }
.topbar-actions { display: flex; align-items: center; gap: 13px; }
.month-picker { display: flex; align-items: center; gap: 8px; }
.month-picker label { color: #8994a4; font-size: 10px; }
.month-picker select { width: 166px; min-height: 39px; padding: 0 9px; border: 1px solid #e6eaf1; border-radius: 8px; color: #3d4a5d; background: #fff; font-size: 11px; }
.top-add { min-height: 39px; padding: 0 12px; font-size: 11px; }
.top-add span { font-size: 18px; font-weight: 400; }
.content-wrap { width: min(1450px, 100%); margin: 0 auto; padding: 29px clamp(22px, 4vw, 58px) 48px; }
.content-wrap > .alert { margin: 0 0 18px; }
.welcome-row, .page-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.welcome-row h2, .page-intro h2 { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; font-size: clamp(20px, 2vw, 25px); font-weight: 700; letter-spacing: -.05em; }
.welcome-row .eyebrow, .page-intro .eyebrow { margin-bottom: 7px; }
.welcome-row .muted, .page-intro > div > p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0 0 17px; }
.metric-card { min-width: 0; padding: 17px 19px 16px; border: 1px solid #eaedf2; border-radius: 13px; background: #fff; box-shadow: 0 3px 12px rgba(31, 50, 79, .018); }
.metric-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #7a8596; font-size: 10px; font-weight: 600; }
.metric-icon { display: grid; width: 29px; height: 29px; place-items: center; border-radius: 9px; font-size: 15px; }
.icon-green { color: var(--green); background: var(--green-soft); }
.icon-coral { color: var(--red); background: var(--red-soft); }
.icon-blue { color: var(--blue); background: var(--blue-soft); }
.icon-amber { color: var(--amber); background: var(--amber-soft); }
.metric-card > strong { display: block; overflow: hidden; margin-top: 13px; font-family: 'Segoe UI', system-ui, sans-serif; font-size: clamp(17px, 1.9vw, 23px); font-weight: 800; letter-spacing: -.05em; text-overflow: ellipsis; white-space: nowrap; }
.metric-card > small { display: block; margin-top: 6px; color: #99a2af; font-size: 10px; }
.positive { color: var(--green) !important; }
.negative { color: #cf5e56 !important; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, .95fr); gap: 16px; margin-bottom: 17px; }
.panel { min-width: 0; margin-bottom: 17px; padding: 21px 22px; border: 1px solid #eaedf2; border-radius: 13px; background: #fff; box-shadow: 0 3px 12px rgba(31, 50, 79, .018); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; }
.panel-heading h3 { margin: 0; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; font-weight: 800; letter-spacing: -.025em; }
.panel-heading p { margin: 5px 0 0; color: #959eab; font-size: 10px; }
.panel-heading > .text-link { flex: 0 0 auto; }
.trend-panel { margin-bottom: 0; padding-bottom: 12px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; color: #8290a1; font-size: 9px; }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.chart-legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.chart-legend .legend-expense { background: #e88c7f; }
.trend-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: #eef1f5; stroke-width: 1; }
.chart-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-income { stroke: #20a97c; }
.chart-expense { stroke: #e88c7f; }
.chart-dot { stroke: #fff; stroke-width: 2; }
.chart-dot-income { fill: #20a97c; }
.chart-dot-expense { fill: #e88c7f; }
.chart-label { fill: #97a1af; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 9px; }
.category-panel { display: flex; flex-direction: column; margin-bottom: 0; }
.category-bars { display: grid; gap: 16px; margin: 4px 0 auto; }
.category-bar-row { display: grid; gap: 7px; }
.category-bar-caption { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; }
.category-bar-caption > span { display: flex; min-width: 0; align-items: center; gap: 7px; color: #657184; }
.category-bar-caption > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-bar-caption strong { color: #334057; font-size: 10px; white-space: nowrap; }
.category-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--category-color, #94a3b8); }
.progress-track i { display: block; height: 100%; border-radius: inherit; background: var(--category-color, #6287ce); }
.panel-bottom-link { margin-top: 17px; padding-top: 14px; border-top: 1px solid #f0f2f6; }
.text-link { color: #4c77c5; font-size: 10px; font-weight: 700; text-decoration: none; }
.text-link:hover { color: #2e5fae; text-decoration: underline; text-underline-offset: 3px; }
.recent-panel { margin-bottom: 0; }
.table-wrap { overflow-x: auto; width: 100%; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; white-space: nowrap; }
.data-table th { padding: 11px 10px; border-bottom: 1px solid #edf0f4; color: #98a1ae; font-size: 9px; font-weight: 700; text-align: left; }
.data-table td { height: 53px; padding: 9px 10px; border-bottom: 1px solid #f1f3f6; color: #687588; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table td:first-child, .data-table th:first-child { padding-left: 2px; }
.data-table td strong { color: #344158; font-size: 10px; font-weight: 700; }
.align-right { text-align: right !important; }
.transaction-symbol { display: inline-grid; width: 28px; height: 28px; margin-right: 9px; place-items: center; border-radius: 9px; font-size: 15px; vertical-align: middle; }
.symbol-income { color: var(--green); background: #eaf7f0; }
.symbol-expense { color: #d56f65; background: #fff0ed; }
.category-chip { display: inline-flex; align-items: center; gap: 6px; }
.status-pill { display: inline-block; padding: 5px 8px; border-radius: 20px; font-size: 9px; font-weight: 700; }
.status-paid { color: #25835e; background: #eaf7f0; }
.status-pending { color: #a87318; background: #fff5e4; }
.amount { color: #cd665c !important; font-size: 10px; font-weight: 800; }
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 37px 16px; text-align: center; }
.empty-state > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; color: #6284c4; background: #eef3fc; font-size: 19px; }
.empty-state > strong { color: #354259; font-size: 12px; }
.empty-state > p { max-width: 330px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.empty-state > .button { margin-top: 8px; }
.compact-empty { padding: 26px 12px; }
.compact-empty > span { width: 34px; height: 34px; font-size: 16px; }

.page-intro { margin-bottom: 20px; }
.form-panel { scroll-margin-top: 18px; }
.form-panel > .panel-heading { margin-bottom: 20px; }
.transaction-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 13px; }
.transaction-form input, .transaction-form select, .category-form input:not([type=color]), .category-form select, .budget-form input, .budget-form select { min-height: 42px; border-radius: 8px; font-size: 11px; }
.transaction-form select, .category-form select, .budget-form select { cursor: pointer; }
.money-input { display: flex; min-height: 42px; align-items: center; overflow: hidden; border: 1px solid #e1e6ef; border-radius: 8px; background: #fff; }
.money-input:focus-within { border-color: #7295da; box-shadow: 0 0 0 3px rgba(74, 120, 208, .11); }
.money-input > span { padding: 0 0 0 12px; color: #8994a4; font-size: 11px; font-weight: 600; }
.money-input input { min-width: 0; border: 0; box-shadow: none !important; }
.form-wide { grid-column: span 2; }
.form-submit { display: flex; grid-column: 1 / -1; align-items: center; gap: 12px; margin-top: 3px; }
.form-submit > span { color: #9aa3b0; font-size: 9px; }
.list-panel { padding-bottom: 8px; }
.table-filters { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.table-filters input, .table-filters select { min-height: 38px; font-size: 10px; }
.table-filters select { width: auto; min-width: 132px; }
.search-input { position: relative; display: flex; width: min(290px, 100%); align-items: center; }
.search-input > span { position: absolute; left: 11px; color: #929eae; font-size: 19px; }
.search-input > input { padding-left: 32px; }
.clear-filter { color: #8190a4; font-size: 10px; text-decoration: none; }
.transaction-name { display: inline-grid; gap: 3px; vertical-align: middle; }
.transaction-name small { max-width: 220px; overflow: hidden; color: #9aa3af; font-size: 9px; text-overflow: ellipsis; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.row-actions form { margin: 0; }
.icon-action { display: grid; width: 27px; height: 27px; place-items: center; border: 0; border-radius: 7px; color: #72809a; background: transparent; cursor: pointer; font-size: 14px; text-decoration: none; }
.icon-action:hover { color: #3d6fc5; background: #eef3fc; }
.danger-action:hover { color: #c4534a; background: #fff0ed; }
.category-form { display: grid; grid-template-columns: minmax(170px, 1.5fr) minmax(140px, 1fr) 80px auto; align-items: end; gap: 13px; }
.category-form .color-input { width: 42px; height: 42px; padding: 4px; border: 1px solid #e1e6ef; border-radius: 9px; background: #fff; cursor: pointer; }
.category-list-panel { padding-bottom: 9px; }
.category-list { display: grid; }
.category-list-item { display: flex; min-height: 59px; align-items: center; gap: 11px; border-bottom: 1px solid #f0f2f6; }
.category-list-item:last-child { border-bottom: 0; }
.category-avatar { display: inline-grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--category-color, #64748b); background: color-mix(in srgb, var(--category-color, #64748b) 12%, white); font-size: 14px; }
.category-list-item > strong { flex: 1; color: #3b475a; font-size: 11px; }
.category-type-label { padding: 5px 8px; border-radius: 20px; color: #78869a; background: #f4f6f9; font-size: 9px; }
.category-list-item form { margin: 0; }
.delete-link { padding: 0; border: 0; color: #bd6259; background: transparent; cursor: pointer; }
.budget-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: 13px; }
.budget-list { display: grid; gap: 22px; }
.budget-item { padding: 2px 0 4px; }
.budget-caption { display: flex; align-items: center; gap: 10px; }
.budget-caption > div { display: grid; flex: 1; gap: 4px; }
.budget-caption > div strong { color: #374359; font-size: 11px; }
.budget-caption > div small { color: #8b96a5; font-size: 9px; }
.budget-percent { color: #62728c; font-size: 11px; font-weight: 800; }
.budget-percent.over-budget { color: #c75048; }
.budget-track { height: 7px; margin-top: 11px; }
.budget-track i { background: var(--category-color, #6287ce); }
.budget-track i.over-budget { background: #df7066; }
.budget-foot { display: flex; justify-content: space-between; margin-top: 7px; color: #929cab; font-size: 9px; }
.budget-foot strong { color: #526075; font-size: 9px; }
.report-metrics { margin-bottom: 18px; }
.report-panel { margin-bottom: 17px; }
.report-category-list { display: grid; }
.report-category-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #f0f2f6; }
.report-category-row:last-child { border-bottom: 0; }
.report-category-info { display: grid; flex: 1; gap: 9px; }
.report-category-info > div:first-child { display: flex; justify-content: space-between; gap: 9px; }
.report-category-info strong { color: #3d485c; font-size: 11px; }
.report-category-info span { color: #929cab; font-size: 9px; }
.report-category-info .progress-track { height: 5px; }
.report-category-amount { display: grid; gap: 4px; justify-items: end; }
.report-category-amount strong { color: #39465b; font-size: 11px; }
.report-category-amount small { color: #98a1ae; font-size: 9px; }
.app-footer { display: flex; min-height: 39px; align-items: center; justify-content: center; gap: 7px; padding: 9px; color: #98a1af; font-size: 9px; }

@media (max-width: 1120px) {
    .app-shell { grid-template-columns: 218px minmax(0, 1fr); }
    .sidebar { padding-right: 13px; padding-left: 13px; }
    .dashboard-grid { grid-template-columns: minmax(0, 1.35fr) minmax(260px, .9fr); }
    .content-wrap { padding-right: 25px; padding-left: 25px; }
    .topbar { padding-right: 25px; padding-left: 25px; }
    .transaction-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .auth-layout { grid-template-columns: minmax(300px, .85fr) minmax(400px, 1.15fr); }
    .auth-story { padding: 35px 32px; }
    .story-copy h1 { font-size: 38px; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; z-index: 3; height: auto; padding: 12px 18px 0; border-right: 0; border-bottom: 1px solid #e9edf3; }
    .sidebar > .brand { width: fit-content; padding: 0; }
    .sidebar .brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 17px; }
    .workspace-label, .sidebar-bottom { display: none; }
    .side-nav { display: flex; gap: 3px; overflow-x: auto; margin: 10px -5px 0; scrollbar-width: none; }
    .side-nav::-webkit-scrollbar { display: none; }
    .side-nav a { min-width: max-content; min-height: 40px; padding: 0 10px; font-size: 10px; }
    .side-nav .nav-icon { width: 17px; font-size: 16px; }
    .topbar { min-height: 82px; }
    .dashboard-grid { grid-template-columns: minmax(0, 1.2fr) minmax(235px, .8fr); }
}
@media (max-width: 640px) {
    .auth-layout { display: block; }
    .auth-story { display: none; }
    .auth-main { min-height: 100vh; justify-content: flex-start; padding: 29px 22px 24px; }
    .brand-mobile { display: inline-flex; align-self: flex-start; margin-bottom: 48px; }
    .auth-card { width: min(420px, 100%); margin: auto 0; }
    .auth-card h2 { font-size: 27px; }
    .auth-footer { margin-top: 36px; }
    .expired-card { padding: 30px 24px; }
    .topbar { align-items: flex-start; padding: 14px 16px; }
    .topbar-context { font-size: 9px; }
    .topbar h1 { font-size: 18px; }
    .topbar-actions { flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
    .month-picker { gap: 5px; }
    .month-picker label { display: none; }
    .month-picker select { width: 143px; min-height: 32px; font-size: 10px; }
    .top-add { min-height: 34px; padding: 0 9px; font-size: 9px; }
    .content-wrap { padding: 22px 14px 35px; }
    .welcome-row, .page-intro { align-items: flex-start; }
    .welcome-row h2, .page-intro h2 { font-size: 19px; }
    .welcome-row .button, .page-intro .button { flex: 0 0 auto; min-height: 36px; padding: 0 10px; font-size: 9px; }
    .welcome-row .muted, .page-intro > div > p:not(.eyebrow) { max-width: 390px; font-size: 10px; line-height: 1.6; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .metric-card { padding: 13px; border-radius: 11px; }
    .metric-card > strong { font-size: 18px; }
    .metric-head { font-size: 9px; }
    .metric-icon { width: 25px; height: 25px; font-size: 13px; }
    .dashboard-grid { grid-template-columns: 1fr; gap: 13px; }
    .panel { margin-bottom: 13px; padding: 17px 14px; border-radius: 11px; }
    .panel-heading { gap: 9px; }
    .panel-heading h3 { font-size: 13px; }
    .chart-legend { gap: 7px; font-size: 8px; }
    .recent-panel { padding-right: 10px; padding-left: 10px; }
    .recent-panel > .panel-heading { padding: 0 4px; }
    .recent-panel > .panel-heading > .text-link { font-size: 9px; }
    .data-table th { padding-right: 8px; padding-left: 8px; }
    .data-table td { padding-right: 8px; padding-left: 8px; }
    .transaction-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 9px; }
    .transaction-form label { font-size: 10px; }
    .form-wide { grid-column: 1 / -1; }
    .form-submit { align-items: flex-start; flex-direction: column; }
    .table-filters { flex-wrap: wrap; }
    .search-input { width: 100%; }
    .table-filters select { flex: 1; min-width: 120px; }
    .category-form, .budget-form { grid-template-columns: 1fr 1fr; }
    .category-form > label:first-of-type { grid-column: 1 / -1; }
    .category-form > button, .budget-form > button { width: 100%; }
    .category-list-item { gap: 8px; }
    .category-list-item > .category-type-label { display: none; }
    .category-list-item > .text-link, .category-list-item .delete-link { font-size: 9px; }
    .report-category-row { gap: 8px; }
    .report-category-info > div:first-child span { display: none; }
    .report-category-amount strong { font-size: 10px; }
    .app-footer { flex-wrap: wrap; font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
