:root {
  color-scheme: light;
  --ink: #202b27;
  --muted: #7f8984;
  --line: #e9ede9;
  --paper: #fff;
  --canvas: #f5f7f4;
  --green: #23755e;
  --green-dark: #175c49;
  --green-soft: #e8f3ee;
  --income: #147548;
  --income-soft: #e7f5ec;
  --expense: #b33d32;
  --expense-soft: #fff0ed;
  --shadow: 0 10px 34px rgba(33, 50, 42, .055);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 3; display: flex; width: 232px; flex-direction: column; padding: 26px 16px 18px; border-right: 1px solid var(--line); background: #fff; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 9px 35px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 13px; color: #fff; background: var(--green); font-family: Georgia, serif; font-size: 27px; font-weight: 700; }
.brand b { display: block; font-size: 19px; letter-spacing: -.7px; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.side-nav { display: grid; gap: 5px; }
.nav-item { display: flex; min-height: 43px; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 10px; color: #737e78; background: transparent; text-align: left; }
.nav-item span { width: 18px; font-size: 18px; text-align: center; }
.nav-item.active { color: var(--green); background: var(--green-soft); font-weight: 700; }
.sidebar-bottom { margin-top: auto; }
.sync-card { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; }
.mobile-sync-card { display: none; }
.sync-card b, .sync-card small { display: block; }
.sync-card b { font-size: 11px; }
.sync-card small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.sync-indicator { flex: 0 0 9px; width: 9px; height: 9px; margin-top: 3px; border-radius: 50%; background: #c18a27; box-shadow: 0 0 0 3px #fbf0d9; }
.sync-indicator.online { background: #67b48c; box-shadow: 0 0 0 3px #e9f5ed; }
.sync-indicator.offline, .sync-indicator.error { background: var(--expense); box-shadow: 0 0 0 3px #fce5e1; }
.privacy-note { margin: 10px 4px 0; color: #959d98; font-size: 9px; line-height: 1.5; }
.main { max-width: 1480px; margin-left: 232px; padding: 31px 42px 70px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 11px; }
h1 { margin: 0; font-size: 24px; font-weight: 720; letter-spacing: -.7px; }
h2 { margin: 0; font-size: 15px; letter-spacing: -.2px; }
p { line-height: 1.55; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 6px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 700; text-decoration: none; transition: background .15s, border-color .15s; }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { border-color: var(--line); color: #56635b; background: #fff; }
.button-secondary:hover { border-color: #c8d8cc; background: #fafcfb; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border: 0; border-radius: 50%; color: #855b3f; background: #f6e5d5; font-weight: 750; }
.notice { margin: -9px 0 18px; padding: 11px 14px; border: 1px solid #f0d9ac; border-radius: 10px; color: #684c17; background: #fff9e9; font-size: 12px; line-height: 1.5; }
.notice[hidden] { display: none; }
.view[hidden] { display: none; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.summary-card { min-height: 136px; padding: 18px 19px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.summary-card > span:not(.flow-label) { display: block; color: #77827c; font-size: 11px; }
.summary-card strong { display: block; overflow-wrap: anywhere; margin: 12px 0 6px; font-size: clamp(21px, 2.3vw, 29px); letter-spacing: -.8px; }
.summary-card small { color: var(--muted); font-size: 10px; }
.income-card strong, .income-card .flow-label { color: var(--income); }
.expense-card strong, .expense-card .flow-label { color: var(--expense); }
.flow-label { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .03em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .9fr); gap: 14px; margin-top: 15px; }
.panel { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); }
.panel-heading { display: flex; min-height: 35px; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading p, .report-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.text-button { padding: 3px 0; border: 0; color: var(--green); background: transparent; font-size: 11px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.transaction-list, .category-summary, .settings-list { display: grid; gap: 3px; }
.transaction-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #f0f2f0; }
.table-transaction-item { display: flex; padding: 0; border: 0; }
.transaction-main { display: flex; min-width: 0; align-items: center; gap: 10px; }
.transaction-description { min-width: 0; }
.category-icon { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 12px; background: #f2f6f3; font-size: 18px; }
.transaction-name { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.transaction-sub { overflow: hidden; margin-top: 4px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.transaction-value { text-align: right; font-size: 12px; font-weight: 750; white-space: nowrap; }
.transaction-value.income { color: var(--income); }
.transaction-value.expense { color: var(--expense); }
.category-line { display: grid; grid-template-columns: minmax(78px, .65fr) minmax(45px, 1fr) auto; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid #f0f2f0; }
.category-line-name { overflow: hidden; font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.category-track { height: 7px; overflow: hidden; border-radius: 8px; background: #f0f2f0; }
.category-bar { height: 100%; border-radius: inherit; background: #5aa284; }
.category-line-amount { color: #59655e; font-size: 10px; font-weight: 700; white-space: nowrap; }
.insight-card { margin-top: 14px; padding: 16px 18px; border: 1px solid #e1ebe4; border-radius: 13px; background: #f8fbf8; color: #41554a; font-size: 12px; line-height: 1.6; }
.insight-card b { display: block; margin-bottom: 4px; color: var(--green); font-size: 11px; }
.filters { display: flex; flex-wrap: wrap; gap: 9px; margin: 15px 0; }
.transaction-filters > summary { display: none; }
.search-field { display: flex; min-width: min(290px, 100%); min-height: 40px; flex: 1; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; }
.search-field input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.filters select, .period-field select, .inline-field input, .inline-field select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: 11px; }
.date-filter { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.date-filter input { min-height: 40px; padding: 0 7px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: 10px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 9px 10px; border-bottom: 1px solid var(--line); color: #929b95; font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
td { padding: 11px 10px; border-bottom: 1px solid #f0f2f0; font-size: 11px; }
.amount-cell { text-align: right; }
.tx-amount { text-align: right; font-weight: 750; white-space: nowrap; }
.tx-amount.income { color: var(--income); }
.tx-amount.expense { color: var(--expense); }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-actions button, .settings-row button { min-height: 31px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: #66736b; background: #fff; font-size: 10px; }
.row-actions .delete, .settings-row .delete { color: #a43930; }
.empty-state { padding: 28px 10px; color: var(--muted); text-align: center; }
.report-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.report-heading h2 { font-size: 18px; }
.period-field, .inline-field { display: grid; gap: 6px; color: #657068; font-size: 10px; font-weight: 650; }
.period-field select { min-width: 145px; }
.report-panel { margin-top: 15px; }
.monthly-trend { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; gap: 11px; min-height: 170px; padding: 12px 5px 0; border-bottom: 1px solid var(--line); }
.trend-month { display: grid; min-width: 0; grid-template-rows: 1fr auto; gap: 8px; height: 150px; text-align: center; }
.trend-bars { display: flex; align-items: end; justify-content: center; gap: 5px; height: 100%; border-bottom: 1px solid #eff2ef; }
.trend-bar { width: min(23px, 34%); min-height: 2px; border-radius: 5px 5px 0 0; }
.trend-bar.income { background: #4b9d71; }
.trend-bar.expense { background: #dc806e; }
.trend-month-label { color: var(--muted); font-size: 9px; }
.trend-legend { display: flex; align-items: center; gap: 11px; color: #758078; font-size: 9px; }
.trend-legend span { display: flex; align-items: center; gap: 4px; }
.trend-legend i { width: 8px; height: 8px; border-radius: 3px; background: #4b9d71; }
.trend-legend i.expense { background: #dc806e; }
.settings-panel { align-self: start; }
.settings-page:not([hidden]) { position: fixed; inset: 0; z-index: 8; overflow-y: auto; overscroll-behavior: contain; padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); background: var(--canvas); }
.settings-page > .panel, .settings-page > .report-panel { width: min(100%, 820px); margin-right: auto; margin-left: auto; }
.settings-page > .settings-back { display: block; width: min(100%, 820px); margin: 0 auto 14px; }
.settings-home { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.settings-home-card { display: grid; min-height: 82px; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: #fff; box-shadow: var(--shadow); text-align: left; }
.settings-home-card:hover { border-color: #c8d8cc; background: #fbfdfb; }
.settings-home-card > span:nth-child(2) { display: grid; gap: 5px; }
.settings-home-card b { font-size: 13px; }
.settings-home-card small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.settings-home-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: var(--green); background: var(--green-soft); font-size: 18px; }
.settings-home-arrow { color: var(--muted); font-size: 18px; }
.settings-back { min-height: 34px; margin-bottom: 10px; padding: 0; border: 0; color: var(--green); background: transparent; font-size: 12px; font-weight: 700; }
.settings-panel .inline-field { margin-bottom: 12px; }
.settings-row { display: flex; min-height: 47px; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid #f0f2f0; }
.settings-row-main { display: flex; min-width: 0; align-items: center; gap: 8px; }
.settings-row-icon, .wallet-mark { display: grid; flex: 0 0 31px; width: 31px; height: 31px; place-items: center; border-radius: 9px; color: #fff; background: #657c6f; font-size: 10px; font-weight: 800; }
.settings-row-icon:not(.person-mark) { border-radius: 0; color: inherit; background: transparent; }
.wallet-mark.cash { background: #278350; }
.wallet-mark.bank { background: #405c86; }
.wallet-mark.vcb { background: #08783f; }
.wallet-mark.tcb { background: #cf303b; }
.wallet-mark.mb, .wallet-mark.bidv { background: #2469a5; }
.wallet-mark.acb { background: #1680bd; }
.wallet-mark.vpb { background: #28874a; }
.wallet-mark.ctg { background: #145b9d; }
.wallet-mark.momo { background: #a50077; }
.wallet-mark.zalopay { background: #146de1; }
.wallet-mark.shopeepay { background: #e84b2c; }
.wallet-mark.vnpay { background: #2860a8; }
.wallet-mark.visa { background: #173b70; }
.settings-row-label { overflow: hidden; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.settings-row-sub { margin-top: 3px; color: var(--muted); font-size: 9px; }
.settings-row-actions { display: flex; flex: 0 0 auto; gap: 4px; }
.editor-form { display: grid; gap: 10px; margin-top: 13px; padding: 12px; border: 1px solid #e4ece6; border-radius: 11px; background: #f8fbf8; }
.editor-form .inline-field { font-size: 10px; }
.editor-form input, .editor-form select { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.form-actions { display: flex; justify-content: flex-end; gap: 7px; }
.form-actions .button { min-height: 37px; font-size: 10px; }
.google-panel { margin-top: 14px; }
.provider-mark { display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid #e4e9e4; border-radius: 9px; color: #4285f4; font-weight: 800; }
.privacy-copy, .helper-text { color: #707c75; font-size: 10px; line-height: 1.6; }
.privacy-copy code { padding: 2px 4px; border-radius: 4px; background: #f2f5f2; }
.google-panel > .inline-field { max-width: 510px; }
.google-panel > .inline-field input { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; }
.google-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.link-sheet-form { display: flex; max-width: 700px; align-items: end; gap: 9px; margin-top: 13px; }
.link-sheet-form .inline-field { flex: 1; }
.link-sheet-form input { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; }
.helper-text { margin-bottom: 0; }
.conflict-list { display: grid; gap: 8px; }
.conflict-card { padding: 11px; border: 1px solid #f0d9ac; border-radius: 9px; background: #fffaf0; font-size: 10px; }
.conflict-card p { margin: 0 0 8px; }
.conflict-actions { display: flex; gap: 6px; }
#entry-wallet-field[hidden], #entry-debt-funding[hidden], #entry-debt-person-field[hidden] { display: none; }
.debt-funding-option { display: grid; gap: 10px; padding: 11px; border: 1px solid #e4ece6; border-radius: 10px; background: #f8fbf8; }
.debt-funding-option > label:first-child { display: flex; align-items: center; gap: 8px; color: #56635b; font-size: 11px; font-weight: 700; }
.debt-funding-option input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--green); }
.overview-debt-panel { margin-top: 14px; }
.overview-debt-section { margin-top: 18px; }
.overview-debt-section .panel-heading { margin-bottom: 8px; }
.overview-debt-section h3 { margin: 0; font-size: 13px; }
.debt-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 15px; }
.overview-debt-panel .summary-card { min-height: 100px; padding: 13px 15px; }
.overview-debt-panel .summary-card strong { margin: 8px 0 4px; font-size: clamp(19px, 2vw, 25px); }
.debt-account-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 10px; }
.debt-account { padding: 13px; border: 1px solid #edf0ed; border-radius: 11px; background: #fcfdfc; }
.debt-account-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.debt-account-heading b { font-size: 13px; }
.debt-account-heading strong { font-size: 12px; }
.debt-account-heading .expense { color: var(--expense); }
.debt-account-heading .income { color: var(--income); }
.debt-account-gross { margin: 7px 0 10px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.debt-history-item button { min-height: 31px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: #56635b; background: #fff; font-size: 10px; }
.debt-history-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid #f0f2f0; }
.debt-history-item b, .debt-history-item small { display: block; }
.debt-history-item b { font-size: 11px; }
.debt-history-item small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.debt-history-item strong { font-size: 11px; white-space: nowrap; }
.debt-history-item .delete { color: #a43930; }
.person-mark { color: var(--green); background: var(--green-soft); }
.recurring-reminder-panel { margin-top: 15px; border-color: #f0d9ac; background: #fffdf7; }
.budget-list, .recurring-rule-list, .recurring-due-list { display: grid; gap: 9px; }
.budget-card, .recurring-card, .recurring-due-card { padding: 13px; border: 1px solid #edf0ed; border-radius: 11px; background: #fcfdfc; }
.budget-heading, .recurring-card-heading, .recurring-due-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.budget-category, .recurring-card-name, .recurring-due-name { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; }
.budget-category-list { margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.budget-category-picker { min-width: 0; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.budget-category-picker legend { padding: 0 4px; color: #56635b; font-size: 10px; font-weight: 700; }
.budget-category-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; max-height: 190px; overflow-y: auto; margin-top: 8px; }
.budget-category-option { display: flex; min-width: 0; align-items: center; gap: 7px; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: #fff; font-size: 10px; }
.budget-category-option input { flex: 0 0 auto; width: 15px; min-height: 15px; margin: 0; accent-color: var(--green); }
.budget-category-option:has(input:disabled) { opacity: .5; }
.budget-status { color: #657068; font-size: 10px; font-weight: 700; }
.budget-status.warning { color: #a36308; }
.budget-status.over { color: var(--expense); }
.budget-track { height: 8px; overflow: hidden; margin: 11px 0 7px; border-radius: 8px; background: #edf1ed; }
.budget-progress { height: 100%; border-radius: inherit; background: #5aa284; }
.budget-progress.warning { background: #dfaa43; }
.budget-progress.over { background: var(--expense); }
.budget-meta, .recurring-card-meta, .recurring-due-meta { color: var(--muted); font-size: 10px; line-height: 1.5; }
.planning-actions, .recurring-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.planning-actions button, .recurring-card-actions button, .recurring-due-card button { min-height: 31px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; color: #56635b; background: #fff; font-size: 10px; }
.planning-actions .delete, .recurring-card-actions .delete { color: #a43930; }
.recurring-due-card { border-color: #f0d9ac; background: #fffaf0; }
.recurring-due-card .recurring-due-heading { margin-bottom: 5px; }
.recurring-due-card .recurring-due-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.recurring-due-card .confirm-recurring { border-color: var(--green); color: #fff; background: var(--green); }
.reminder-frequency { display: grid; grid-template-columns: minmax(190px, 280px) minmax(0, 1fr); align-items: end; gap: 15px; margin-bottom: 13px; }
.reminder-frequency .helper-text { margin: 0; }
.planning-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
.planning-form .form-actions { grid-column: 1 / -1; }
.recurring-card-actions { margin-top: 9px; }
.dialog { width: min(470px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 0; border: 0; border-radius: 17px; box-shadow: 0 24px 80px #152b2240; }
.dialog::backdrop { background: #18251f70; backdrop-filter: blur(3px); }
.categories-dialog { width: min(560px, calc(100% - 24px)); }
.categories-dialog-content { display: grid; gap: 12px; padding: 18px 20px 20px; }
.categories-dialog-content > .inline-field { font-size: 12px; }
.category-manager-list { max-height: min(42dvh, 360px); overflow-y: auto; padding: 0 3px; }
.category-manager-list .settings-row { min-height: 44px; }
.category-manager-list .settings-row-icon { flex: 0 0 30px; width: 30px; height: 30px; }
.category-manager-list .settings-row-label { font-size: 13px; }
.category-manager-list .settings-row button { min-height: 35px; font-size: 11px; }
.categories-dialog .editor-form { margin-top: 0; }
.calculator-dialog { position: fixed; inset: auto 10px max(10px, env(safe-area-inset-bottom)); width: min(460px, calc(100% - 20px)); max-width: 460px; max-height: none; margin: 0 auto; padding: 14px; overflow: visible; border: 1px solid #dfe8e1; border-radius: 18px; background: #fff; box-shadow: 0 12px 48px #152b2240; }
.calculator-dialog[open] { display: grid; gap: 10px; }
.calculator-dialog::backdrop { background: #18251f38; backdrop-filter: blur(1px); }
.calculator-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.calculator-heading h2 { font-size: 16px; }
.calculator-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.calculator-done { min-height: 38px; padding: 0 14px; border: 1px solid #cddfd2; border-radius: 9px; color: var(--green-dark); background: var(--green-soft); font-size: 13px; font-weight: 750; }
.calculator-readout { display: grid; gap: 2px; min-height: 56px; justify-items: end; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8faf8; }
.calculator-readout > div { max-width: 100%; overflow: hidden; color: var(--ink); font-size: 21px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.calculator-readout output { color: var(--green); font-size: 12px; font-weight: 700; }
.calculator-readout output.invalid { color: var(--expense); }
.money-calculator-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.money-calculator-keys button { min-height: 46px; border: 1px solid #e4ece6; border-radius: 9px; color: #3d4a43; background: #fff; font-size: 17px; font-weight: 650; touch-action: manipulation; }
.money-calculator-keys button.operator { color: var(--green); background: #f1f7f3; }
.money-calculator-keys button:active { background: var(--green-soft); }
.dialog-form { display: grid; gap: 13px; padding: 19px 21px 21px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { font-size: 17px; }
.icon-button { width: 31px; height: 31px; border: 0; border-radius: 8px; color: #77827c; background: #f4f6f4; font-size: 20px; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; border-radius: 10px; background: #f3f6f3; }
.type-switch button { min-height: 39px; border: 0; border-radius: 8px; color: #657068; background: transparent; font-size: 12px; font-weight: 700; }
.type-switch button.active.expense { color: var(--expense); background: #fff; }
.type-switch button.active.income { color: var(--income); background: #fff; }
.field { display: grid; gap: 6px; color: #56635b; font-size: 10px; font-weight: 650; }
.field input, .field select { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #e4e9e4; border-radius: 9px; outline: 0; color: var(--ink); background: #fff; font-size: 12px; }
.field input:focus, .field select:focus, .inline-field input:focus { border-color: #83b9a3; box-shadow: 0 0 0 3px #e5f2eb; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.submit-entry { min-height: 48px; margin-top: 2px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; max-width: min(440px, calc(100vw - 30px)); padding: 12px 16px; border-radius: 10px; color: #fff; background: #253b32; box-shadow: var(--shadow); opacity: 0; transform: translateY(9px); transition: .18s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-nav, .mobile-quickbar { display: none; }
@media (max-width: 1080px) { .main { padding-right: 25px; padding-left: 25px; } .dashboard-grid { grid-template-columns: minmax(0, 1.15fr) minmax(245px, .85fr); } }
@media (max-width: 800px) {
  .sidebar { display: none; }
  .main { max-width: 740px; margin: 0 auto; padding: 22px 19px 150px; }
  .mobile-sync-card { display: flex; margin: -10px 0 16px; padding: 9px 11px; }
  .mobile-sync-card b { font-size: 11px; }
  .mobile-sync-card small { font-size: 10px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-home { grid-template-columns: 1fr; }
  .mobile-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 5; display: flex; height: calc(69px + env(safe-area-inset-bottom)); align-items: center; justify-content: space-around; padding: 0 5px env(safe-area-inset-bottom); border-top: 1px solid #dce6df; background: #ffffffed; backdrop-filter: blur(12px); }
  .mobile-nav button { display: grid; justify-items: center; gap: 3px; min-width: 48px; padding: 6px 4px; border: 0; border-radius: 11px; color: #5f6c64; background: transparent; font-size: 10px; line-height: 1.1; }
  .mobile-nav button span { font-size: 20px; }
  .mobile-nav button.active { color: var(--green-dark); background: var(--green-soft); box-shadow: inset 0 0 0 1px #cfe3d8; font-weight: 800; }
  .mobile-quickbar { position: fixed; right: 0; bottom: calc(69px + env(safe-area-inset-bottom)); left: 0; z-index: 6; display: block; padding: 8px 14px; border-top: 1px solid var(--line); background: #ffffffed; backdrop-filter: blur(12px); }
  .mobile-quickbar .button { width: 100%; min-height: 50px; }
}
@media (max-width: 520px) {
  body { font-size: 15px; }
  .main { padding: 18px 13px 155px; }
  .topbar { margin-bottom: 18px; }
  h1 { font-size: 23px; }
  .eyebrow { font-size: 12px; }
  .top-actions .button { min-height: 42px; padding: 0 10px; font-size: 12px; }
  .top-actions .button span { display: none; }
  .summary-grid { gap: 7px; }
  .summary-card { min-height: 118px; padding: 12px 9px; border-radius: 12px; }
  .summary-card > span:not(.flow-label) { font-size: 10px; line-height: 1.4; }
  .summary-card strong { margin: 9px 0 4px; font-size: clamp(15px, 4.8vw, 20px); letter-spacing: -.5px; }
  .summary-card small { font-size: 9px; }
  .panel { padding: 14px 12px; }
  .panel-heading h2, .report-heading h2 { font-size: 16px; }
  .panel-heading p, .report-heading p { font-size: 12px; }
  .text-button { font-size: 12px; }
  .sync-card b { font-size: 13px; }
  .sync-card small { font-size: 12px; }
  .settings-row-label { font-size: 13px; }
  .settings-row-sub { font-size: 11px; }
  .inline-field, .editor-form .inline-field { font-size: 12px; }
  .editor-form input, .editor-form select, .inline-field input, .inline-field select { min-height: 44px; font-size: 15px; }
  .form-actions .button { min-height: 43px; font-size: 12px; }
  .helper-text, .privacy-copy { font-size: 12px; }
  .debt-history-item button { min-height: 40px; font-size: 12px; }
  .debt-history-item b, .debt-history-item strong { font-size: 13px; }
  .debt-history-item small { font-size: 11px; }
  .budget-status, .budget-category-picker legend { font-size: 12px; }
  .budget-category-option { min-height: 40px; font-size: 12px; }
  .categories-dialog-content { gap: 10px; padding: 14px; }
  .category-manager-list { max-height: 36dvh; }
  .transaction-filters { margin: 12px 0; }
  .transaction-filters > summary { display: block; width: fit-content; padding: 9px 13px; border: 1px solid #cddfd2; border-radius: 10px; color: var(--green-dark); background: var(--green-soft); font-size: 13px; font-weight: 750; cursor: pointer; }
  .filters { flex-direction: column; gap: 8px; margin: 10px 0 2px; }
  .search-field, .filters select { width: 100%; min-height: 46px; font-size: 14px; }
  .search-field input { font-size: 14px; }
  .date-filter { justify-content: space-between; }
  .date-filter { min-height: 42px; font-size: 12px; }
  .date-filter input { min-height: 42px; flex: 1; font-size: 13px; }
  .table-scroll { overflow: visible; }
  .table-scroll table, .table-scroll tbody { display: block; width: 100%; }
  .table-scroll table { min-width: 0; }
  .table-scroll thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
  .table-scroll tbody { display: grid; gap: 9px; }
  .table-scroll tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 9px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
  .table-scroll td { min-width: 0; padding: 5px 0; border: 0; font-size: 12px; }
  .table-scroll td:first-child { grid-column: 1 / -1; padding-bottom: 8px; }
  .table-scroll td[data-label]::before { display: block; margin-bottom: 3px; color: var(--muted); content: attr(data-label); font-size: 10px; font-weight: 650; }
  .table-transaction-item .category-icon { flex-basis: 39px; width: 39px; height: 39px; }
  .table-transaction-item .transaction-name { font-size: 14px; }
  .table-transaction-item .transaction-sub { font-size: 12px; }
  .table-scroll .tx-amount { text-align: left; font-size: 14px; }
  .table-scroll .row-actions { justify-content: flex-end; }
  .table-scroll .row-actions button { min-height: 36px; padding: 0 10px; font-size: 12px; }
  .table-scroll .empty-state { grid-column: 1 / -1; }
  .debt-summary .summary-card { min-height: 106px; padding: 12px 9px; }
  .report-heading { align-items: flex-start; flex-direction: column; }
  .reminder-frequency { grid-template-columns: 1fr; gap: 5px; }
  .planning-form { grid-template-columns: 1fr; }
  .budget-category-options { grid-template-columns: 1fr; max-height: 220px; }
  .link-sheet-form { align-items: stretch; flex-direction: column; }
  .report-summary .summary-card { min-height: 112px; }
  .two-fields { grid-template-columns: 1fr; }
  .toast { right: 12px; bottom: calc(148px + env(safe-area-inset-bottom)); left: 12px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; } }
