:root {
  font-family: "Segoe UI", Arial, sans-serif;
  color: #172235;
  background: #f5f7fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #172235;
  --muted: #77849a;
  --line: #e7ebf0;
  --blue: #3159c8;
  --pale-blue: #eef3ff;
  --green: #20865c;
  --red: #c24848;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 340px; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.sidebar { width: 264px; position: fixed; inset: 0 auto 0 0; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 10; transition: transform .2s ease; }
.brand { display: flex; align-items: center; gap: 11px; padding: 25px 23px 22px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; background: #151f31; border-radius: 12px; color: #fff; font: 800 21px Manrope, sans-serif; }
.brand strong { display: block; font: 800 17px "Segoe UI", sans-serif; letter-spacing: -.4px; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
#navigation { flex: 1; overflow-y: auto; padding: 2px 13px 20px; }
.nav-link { color: #536077; text-decoration: none; display: flex; align-items: center; gap: 12px; min-height: 41px; padding: 0 12px; margin: 2px 0; border-radius: 9px; font-size: 13px; transition: .15s; }
.nav-link:hover, .nav-link.active { color: #1d3154; background: #f1f4fa; }
.nav-link.active { font-weight: 700; box-shadow: inset 3px 0 #3159c8; }
.nav-icon { width: 18px; text-align: center; color: #5d6c81; font-size: 16px; }
.nav-group { margin-top: 13px; }
.nav-group-title { text-transform: uppercase; letter-spacing: .08em; color: #a0a9b7; font-size: 10px; font-weight: 700; padding: 8px 12px 3px; }
.sidebar-foot { padding: 15px 18px 19px; color: #718096; font-size: 11px; border-top: 1px solid var(--line); }
.online-dot { background: #31a36f; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.main { margin-left: 264px; min-height: 100vh; }
.topbar { height: 69px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; display: flex; align-items: center; padding: 0 28px; gap: 20px; }
.icon-button { border: 1px solid var(--line); background: #fff; border-radius: 9px; color: #526075; width: 38px; height: 38px; font-size: 17px; }
.global-search { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 9px; height: 39px; width: min(430px, 60%); padding: 0 12px; color: #9aa5b5; margin: auto; }
.global-search input { width: 100%; outline: none; border: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-result-details { max-width: 560px; overflow-wrap: anywhere; white-space: normal; }
.search-result-count { margin: 0; padding: 13px 18px; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.save-status { color: var(--muted); font-size: 11px; white-space: nowrap; }
.avatar { border-radius: 50%; background: #131b29; color: #fff; width: 34px; height: 34px; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.page { max-width: 1440px; padding: 31px 32px 55px; margin: 0 auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.title-wrap { display: flex; align-items: center; gap: 14px; }
.title-icon { width: 45px; height: 45px; display: grid; place-items: center; color: #31415b; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 2px 7px #1b2b4310; font-size: 20px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font: 800 25px "Segoe UI", sans-serif; letter-spacing: -.8px; margin: 0 0 4px; }
.subtitle { color: var(--muted); font-size: 13px; margin: 0; }
.heading-actions { display: flex; align-items: center; gap: 9px; }
.button { min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; font-weight: 700; text-decoration: none; transition: .15s; white-space: nowrap; }
.button.primary { background: var(--blue); color: #fff; box-shadow: 0 2px 4px #3159c826; }
.button.primary:hover { background: #244bb6; }
.button.secondary { background: #fff; color: #37445a; border-color: var(--line); }
.button.secondary:hover { background: #f7f8fb; }
.button.danger { color: var(--red); background: #fff3f3; border-color: #f3dede; }
.button.small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.search-row { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.search-box { border: 1px solid #d9e0e9; border-radius: 9px; min-height: 41px; display: flex; align-items: center; gap: 9px; padding: 0 12px; color: #99a4b4; background: #fff; flex: 1; max-width: 580px; }
.search-box input { outline: none; border: 0; width: 100%; background: transparent; font-size: 12px; color: var(--ink); }
.card { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 2px 5px #1b2b4305; }
.table-card { overflow: hidden; }
.card-heading { padding: 19px 21px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.card-heading h2 { font: 700 17px "Segoe UI", sans-serif; margin: 0 0 3px; letter-spacing: -.3px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; }
th { color: #6e7b90; text-transform: uppercase; letter-spacing: .045em; font-size: 10px; font-weight: 700; background: #fafbfc; padding: 13px 18px; }
td { padding: 14px 18px; border-top: 1px solid #eff1f4; color: #344054; font-size: 12px; }
tbody tr:hover { background: #fbfcfe; }
.cell-strong { color: #202b3b; font-weight: 700; }
.muted { color: var(--muted); }
.empty-state { text-align: center; color: var(--muted); padding: 48px 16px; font-size: 13px; }
.empty-state strong { color: #344054; display: block; font: 700 14px Manrope, sans-serif; margin-bottom: 6px; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 99px; background: #edf7f1; color: #247647; font-size: 10px; font-weight: 700; text-transform: capitalize; }
.badge.unpaid, .badge.due { background: #fff5e7; color: #a36410; }
.badge.overdue, .badge.low { background: #fff0f0; color: #b74444; }
.action-cell { display: flex; gap: 7px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 19px; }
.stat-card { padding: 18px 18px 16px; }
.stat-label { color: var(--muted); font-size: 11px; margin-bottom: 13px; display: flex; align-items: center; justify-content: space-between; }
.stat-symbol { width: 29px; height: 29px; border-radius: 9px; display: grid; place-items: center; background: #eef3ff; color: #365bc1; font-size: 13px; }
.stat-value { font: 800 23px "Segoe UI", sans-serif; letter-spacing: -.7px; }
.stat-note { color: #8994a5; font-size: 10px; margin-top: 5px; }
.dashboard-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 17px; margin-top: 17px; }
.dashboard-sections-wrap { margin-top: 24px; }
.dashboard-records-heading { margin-bottom: 13px; }
.dashboard-records-heading h2 { margin: 0 0 4px; font-size: 17px; }
.dashboard-records-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.dashboard-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.dashboard-section { min-width: 0; padding: 14px 16px; }
.dashboard-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.dashboard-section-heading h2 { margin: 0 0 3px; font-size: 14px; }
.dashboard-section-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.dashboard-record-list { display: grid; gap: 9px; padding: 11px 0 0; margin: 0; list-style: none; }
.dashboard-record { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dashboard-record-title { overflow-wrap: anywhere; color: #344054; font-size: 12px; font-weight: 650; }
.dashboard-record-meta { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.dashboard-section-empty { margin: 12px 0 2px; color: var(--muted); font-size: 11px; }
.simple-chart { padding: 20px; min-height: 210px; }
.chart-bars { display: flex; gap: 12px; align-items: end; height: 117px; border-bottom: 1px solid var(--line); margin-top: 25px; }
.chart-column { flex: 1; display: flex; align-items: center; justify-content: end; flex-direction: column; height: 100%; gap: 7px; color: #98a2b1; font-size: 9px; }
.chart-bar { width: min(30px, 65%); min-height: 4px; background: #7792e4; border-radius: 5px 5px 1px 1px; }
.chart-bar.expense { background: #c6d0e5; }
.insight-list { display: grid; gap: 14px; padding: 18px 20px; }
.insight-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #59667a; font-size: 12px; }
.insight-row strong { color: var(--ink); font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; }
.settings-card { padding: 20px; }
.settings-card h2 { font: 700 16px "Segoe UI", sans-serif; margin-bottom: 7px; }
.settings-card p { font-size: 12px; line-height: 1.6; color: var(--muted); }
.settings-card .button { margin-right: 7px; margin-top: 5px; }
.backup-history { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; margin: 10px 0 14px; }
.backup-history-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); font-size: 11px; }
.backup-history-row .button { flex: 0 0 auto; margin: 0; }
.account-security-card { grid-column: 1 / -1; }
.account-security-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.account-security-heading p { overflow-wrap: anywhere; }
.account-security-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 13px; }
.account-security-form .field input { width: 100%; }
.account-security-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 13px; }
.account-security-buttons { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.account-security-buttons .button, .account-security-heading > .button { margin: 0; }
.account-security-actions .auth-note, .account-security-actions .auth-error, .account-security-actions .auth-success { flex: 1 1 220px; }
.path-text { background: #f6f7f9; border-radius: 7px; padding: 10px; color: #46556b; overflow-wrap: anywhere; font: 11px Consolas, monospace; margin: 12px 0; }
.form-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; padding: 19px 22px; max-height: 65vh; overflow-y: auto; }
.field { display: grid; gap: 6px; font-size: 11px; font-weight: 700; color: #58667a; }
.field.full { grid-column: 1/-1; }
.field input, .field select, .field textarea { border: 1px solid #dfe4eb; border-radius: 8px; min-height: 38px; padding: 8px 10px; font-size: 12px; outline: none; color: var(--ink); background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #829ce9; box-shadow: 0 0 0 3px #3159c81a; }
.field textarea { min-height: 75px; resize: vertical; }
.record-dialog { width: min(560px, calc(100vw - 28px)); max-width: none; border: 1px solid var(--line); border-radius: 14px; padding: 0; box-shadow: 0 18px 70px #1722352b; }
.record-dialog::backdrop { background: #14203675; backdrop-filter: blur(2px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.dialog-heading h2 { font: 800 19px "Segoe UI", sans-serif; margin: 4px 0 0; }
.eyebrow { color: #7887a2; font-size: 9px; letter-spacing: .11em; font-weight: 700; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; border-top: 1px solid var(--line); padding: 14px 22px 18px; }
.toast { position: fixed; bottom: 21px; right: 22px; padding: 12px 16px; color: white; background: #263751; border-radius: 9px; box-shadow: 0 5px 22px #17223536; font-size: 12px; z-index: 30; }
.toast.error { background: #a43d3d; }
.report-summary { display: flex; gap: 10px; flex-wrap: wrap; padding: 17px; border-bottom: 1px solid var(--line); }
.report-chip { background: #f6f8fb; border: 1px solid var(--line); border-radius: 8px; padding: 11px 14px; font-size: 11px; color: var(--muted); }
.report-chip strong { color: var(--ink); display: block; font: 700 16px "Segoe UI", sans-serif; margin-top: 5px; }
.report-shortcuts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.report-shortcut { display: flex; align-items: center; gap: 14px; padding: 16px; color: var(--ink); text-decoration: none; transition: .15s; }
.report-shortcut:hover { border-color: #b9c8f3; box-shadow: 0 4px 14px #1b2b4310; transform: translateY(-1px); }
.report-shortcut .title-icon { flex: 0 0 auto; }
.report-shortcut strong, .report-shortcut small { display: block; }
.report-shortcut strong { font-size: 13px; }
.report-shortcut small { color: var(--muted); font-size: 11px; margin-top: 5px; }
.report-arrow { margin-left: auto; color: var(--blue); font-size: 18px; }
.balance-sheet-columns { display: grid; gap: 12px; padding: 12px; }
.financial-table { table-layout: fixed; white-space: normal; }
.financial-table th, .financial-table td { padding: 11px 12px; overflow-wrap: anywhere; vertical-align: top; }
.financial-table th:last-child, .financial-table td:last-child { width: 38%; text-align: right; white-space: nowrap; overflow-wrap: normal; }
.financial-table tbody tr:last-child { font-weight: 700; }
.balance-check { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 15px 18px; border-top: 1px solid var(--line); font-size: 12px; }
.menu-button { display: none; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #f5f7fa; }
.auth-card { width: min(100%, 480px); padding: 26px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 8px 30px #1b2b4310; }
.auth-brand { padding: 0 0 23px; }
.auth-card h1 { font-size: 22px; margin: 0 0 8px; }
.auth-description, .auth-note { color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-form { display: grid; gap: 13px; }
.auth-form .field input { min-height: 42px; }
.auth-error { padding: 11px 13px; border: 1px solid #f3dede; border-radius: 8px; background: #fff3f3; color: #a43d3d; font-size: 12px; line-height: 1.45; }
.auth-success { padding: 11px 13px; border: 1px solid #dceee3; border-radius: 8px; background: #edf7f1; color: #247647; font-size: 12px; line-height: 1.45; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 16px; }
.auth-link { border: 0; padding: 0; background: transparent; color: var(--blue); font-size: 12px; font-weight: 700; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }
.auth-form .button { min-height: 42px; }
.team-panel { margin-top: 17px; padding: 20px; }
.team-panel h2 { font: 700 16px "Segoe UI", sans-serif; margin-bottom: 7px; }
.team-panel p { font-size: 12px; line-height: 1.6; color: var(--muted); }
.team-list { display: grid; gap: 9px; margin-top: 15px; }
.team-member { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 11px; overflow-wrap: anywhere; }
.invite-result { margin-top: 12px; }
.invite-code { padding: 10px; border-radius: 7px; background: #f6f7f9; font: 12px Consolas, monospace; overflow-wrap: anywhere; }

@media (max-width: 1050px) {
  .sidebar { width: 230px; }
  .main { margin-left: 230px; }
  .page { padding-left: 23px; padding-right: 23px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); box-shadow: 8px 0 25px #18263b1c; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-button { display: block; flex: 0 0 auto; }
  .topbar { height: 60px; padding: 0 12px; gap: 9px; }
  .top-actions { gap: 7px; }
  .global-search { width: auto; flex: 1; margin: 0; }
  .save-status { display: none; }
  .page { padding: 23px 14px 40px; }
  .page-heading { align-items: flex-start; }
  .title-wrap { align-items: flex-start; gap: 10px; }
  .title-icon { width: 38px; height: 38px; }
  h1 { font-size: 20px; }
  .subtitle { font-size: 11px; }
  .heading-actions .button { padding: 0 10px; }
  .stat-grid { gap: 9px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 18px; }
  .dashboard-grid, .dashboard-sections, .settings-grid, .report-shortcuts { grid-template-columns: 1fr; }
  .account-security-card { grid-column: auto; }
  .account-security-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 450px) {
  .page-heading { flex-direction: column; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .form-fields { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .account-security-heading { flex-direction: column; }
  .account-security-form { grid-template-columns: 1fr; }
  .account-security-actions { align-items: stretch; flex-direction: column; }
  .account-security-buttons { align-items: stretch; flex-direction: column; }
}
