:root {
  font-family: "DM Sans", sans-serif;
  color: #20251f;
  background: #f5f6f2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #20251f;
  --muted: #858a82;
  --line: #e9ebe5;
  --green: #285d48;
  --green-dark: #204c3a;
  --mint: #dcefe2;
}

* { box-sizing: border-box; }
body { min-width: 360px; margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.app-shell { min-height: 100vh; }
.sidebar { width: 242px; position: fixed; inset: 0 auto 0 0; padding: 31px 19px 20px; display: flex; flex-direction: column; background: #fff; border-right: 1px solid var(--line); z-index: 2; }
.brand, .mobile-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand { padding: 0 10px; margin-bottom: 66px; }
.brand-mark { width: 36px; height: 36px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--green); font: 800 24px Manrope, sans-serif; letter-spacing: -3px; padding: 0 4px 4px 0; }
.brand-mark span, .brand-dot { color: #b9e18b; }
.brand-name { font: 800 21px Manrope, sans-serif; letter-spacing: -1px; }
.nav-label, .eyebrow { font-size: 10px; letter-spacing: 1.5px; font-weight: 700; color: #8c9288; }
.nav-label { margin: 0 10px 13px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-link { min-height: 43px; border: 0; border-radius: 9px; display: flex; gap: 12px; align-items: center; padding: 0 12px; color: #71776e; background: transparent; text-decoration: none; font-weight: 500; text-align: left; font-size: 13px; }
.nav-link.active { color: var(--green); background: #edf5ef; font-weight: 700; }
.nav-icon { width: 17px; text-align: center; font-size: 18px; }
.sidebar-bottom { margin-top: auto; }
.privacy-note { display: flex; gap: 10px; align-items: center; padding: 12px 10px 16px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.privacy-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: var(--green); background: #edf5ef; }
.privacy-note strong, .privacy-note small { display: block; }
.privacy-note strong { font-size: 12px; }
.privacy-note small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.logout-button { width: 100%; }
.main-area { margin-left: 242px; }
.topbar { height: 67px; display: flex; justify-content: flex-end; align-items: center; padding: 0 48px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.68); }
.topbar-right { display: flex; gap: 9px; align-items: center; font-size: 12px; font-weight: 600; }
.user-avatar { width: 30px; height: 30px; display: grid; place-items: center; color: var(--green); border-radius: 50%; background: #dcefe2; font-weight: 700; }
.user-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.security-button { min-height: 30px; font-size: 10px; }
.mobile-brand { display: none; }
.content { width: min(1100px, 100%); margin: 0 auto; padding: 43px 48px 20px; }
.welcome-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 27px; }
.eyebrow { margin: 0 0 10px; }
h1, h2, h3, p { margin-top: 0; }
.welcome-row h1, .login-card h1 { margin: 0 0 8px; font: 700 30px/1.2 Manrope, sans-serif; letter-spacing: -1.3px; }
.welcome-row .muted { margin: 0; font-size: 13px; }
.wave { font-size: 21px; color: #7da66d; }
.month-picker input { padding: 10px 12px; border: 1px solid #e2e5dd; border-radius: 8px; color: var(--ink); background: white; font-size: 12px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin-bottom: 19px; }
.summary-card { min-height: 139px; padding: 17px 17px 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.card-heading { display: flex; justify-content: space-between; align-items: center; color: #6f766e; font-size: 11px; font-weight: 600; }
.metric-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; font-size: 16px; }
.income-icon, .saved-icon { color: #367552; background: #e6f3e9; }
.expense-icon { color: #b9785a; background: #fbede5; }
.balance-icon { color: #7772a1; background: #f0eef9; }
.metric-value { display: block; margin: 14px 0 4px; font: 700 22px Manrope, sans-serif; letter-spacing: -.7px; }
.metric-value.negative { color: #bd634d; }
.metric-caption { color: #999d96; font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; margin-bottom: 18px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: white; }
.budget-panel, .spending-panel { min-height: 320px; padding: 20px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading .eyebrow { margin-bottom: 6px; }
.panel h2, .modal-heading h2 { margin: 0; font: 700 17px Manrope, sans-serif; letter-spacing: -.4px; }
.icon-button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; color: #747a71; background: #f5f6f2; font-weight: 700; }
.panel-intro { margin: 9px 0 19px; color: #92978f; font-size: 11px; }
.budget-list { display: grid; gap: 17px; }
.budget-item { display: grid; gap: 7px; }
.budget-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.budget-name { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.dot, .category-dot { width: 8px; height: 8px; border-radius: 50%; }
.mint { background: #72ad83; }
.peach { background: #e6a17f; }
.lavender { background: #9c91c6; }
.yellow { background: #dfbd63; }
.blue { background: #80a9bf; }
.budget-percent { color: #9a9e97; font-size: 10px; font-weight: 400; }
.budget-value { font-weight: 600; }
.budget-value small { color: #a2a69f; font-size: 10px; font-weight: 400; }
.progress-track { height: 6px; overflow: hidden; border-radius: 8px; background: #f0f1ed; }
.progress-fill { height: 100%; display: block; min-width: 0; border-radius: inherit; transition: width .25s ease; }
.progress-fill.mint { background: #78b889; }
.progress-fill.peach { background: #dfa17e; }
.progress-fill.lavender { background: #a097c9; }
.budget-caption { color: #999e96; font-size: 9px; }
.rule-hint { display: flex; gap: 9px; align-items: flex-start; margin-top: 20px; padding: 10px; border-radius: 8px; color: #5c7863; background: #f0f6ef; }
.rule-hint span { color: #6b9a70; }
.rule-hint p { margin: 0; font-size: 10px; line-height: 1.5; }
.budget-edit { display: grid; gap: 9px; margin-top: 16px; }
.budget-edit label { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.budget-edit label span { display: flex; align-items: center; gap: 5px; }
.budget-edit input { width: 58px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; text-align: right; }
.budget-edit .muted { margin: 0; }
.button-row { display: flex; gap: 8px; justify-content: flex-end; }
.category-list { display: grid; gap: 16px; margin-top: 24px; }
.category-item { display: grid; grid-template-columns: 10px minmax(0,1fr) 30px auto; align-items: center; gap: 9px; font-size: 11px; }
.category-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.category-percent { color: #a0a49e; font-size: 10px; }
.category-item strong { font-size: 11px; font-weight: 600; }
.empty-categories { font-size: 11px; line-height: 1.6; }
.activity-panel, .plans-panel { margin-bottom: 17px; padding: 20px; }
.activity-panel .panel-heading, .plans-panel .panel-heading { margin-bottom: 18px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 13px; border: 0; border-radius: 8px; font-size: 11px; font-weight: 600; transition: background .15s, transform .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: #40684d; background: #edf5ef; }
.button-quiet { min-height: 31px; color: #526155; background: #f3f5f0; }
.plus { font-size: 15px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 0 9px 10px; border-bottom: 1px solid #f0f1ed; color: #9b9f98; font-size: 9px; font-weight: 600; }
td { padding: 11px 9px; border-bottom: 1px solid #f3f4f1; font-size: 11px; }
tr:last-child td { border-bottom: 0; }
td:first-child, th:first-child { padding-left: 0; }
.transaction-title { font-weight: 600; }
td small { display: block; margin-top: 3px; color: #a1a59e; font-size: 9px; }
.type-badge { display: inline-flex; padding: 4px 7px; border-radius: 20px; font-size: 9px; }
.badge-income { color: #467953; background: #ecf5ed; }
.badge-expense { color: #9a765b; background: #f8f0e9; }
.date-cell { color: #858a82; white-space: nowrap; }
.align-right { text-align: right; }
.amount-cell { white-space: nowrap; font-weight: 600; }
.amount-cell.positive { color: #43815b; }
.action-cell { width: 30px; text-align: right; }
.delete-button { width: 26px; height: 26px; border: 0; border-radius: 7px; color: #a3a79f; background: transparent; font-size: 18px; }
.delete-button:hover { color: #b75743; background: #fff0ec; }
.empty-state { padding: 23px 8px; margin: 0; color: #92978f; text-align: center; font-size: 11px; }
.plans-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.plan-card { padding: 15px; border: 1px solid #edf0e9; border-radius: 10px; background: #fdfefc; }
.plan-card-top { display: flex; align-items: center; justify-content: space-between; }
.plan-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; font-size: 15px; }
.plan-savings { color: #4c825b; background: #e8f3e9; }
.plan-investment { color: #776da6; background: #f0eef8; }
.plan-type { color: #989d95; font-size: 8px; letter-spacing: 1px; font-weight: 700; }
.plan-card h3 { overflow: hidden; margin: 14px 0 3px; font: 700 13px Manrope, sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.plan-destination { overflow: hidden; margin-bottom: 13px; color: #969b93; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.plan-balance { display: block; font: 700 20px Manrope, sans-serif; letter-spacing: -.5px; }
.plan-caption { color: #9da199; font-size: 9px; }
.plan-progress { margin-top: 11px; }
.plan-progress small { display: block; margin-top: 5px; color: #999e96; font-size: 9px; }
.plan-action { width: 100%; margin-top: 14px; }
.footer { padding: 6px 0 12px; color: #a1a59e; text-align: center; font-size: 10px; }
.footer span { color: #7da66d; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at top right,#e4f0e3 0,transparent 45%),#f5f6f2; }
.login-card { width: min(390px,100%); padding: 37px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 12px 44px rgba(36,54,39,.06); }
.login-card .brand-mark { margin-bottom: 30px; }
.login-card .eyebrow { margin-bottom: 12px; }
.login-card h1 { font-size: 35px; }
.login-card > .muted { margin: 12px 0 25px; font-size: 13px; }
.login-card label, .field-label { display: grid; gap: 7px; margin-bottom: 15px; color: #555d53; font-size: 11px; font-weight: 600; }
.login-card input, .field-label input, .field-label select { width: 100%; min-height: 40px; padding: 0 11px; border: 1px solid #e4e7df; border-radius: 7px; outline: none; color: var(--ink); background: #fff; font-size: 12px; }
.login-card input:focus, .field-label input:focus, .field-label select:focus { border-color: #80a98a; box-shadow: 0 0 0 3px #e8f2e9; }
.password-hint { display: block; margin: -9px 0 14px; color: #93988f; font-size: 10px; }
.auth-toggle { width: 100%; padding: 9px 0 0; border: 0; color: var(--green); background: transparent; font-size: 11px; font-weight: 600; }
.auth-toggle:hover { text-decoration: underline; }
.full-width { width: 100%; min-height: 42px; margin-top: 6px; justify-content: space-between; padding: 0 14px; }
.form-error { min-height: 14px; margin: 9px 0 0; color: #b34e3d; font-size: 11px; line-height: 1.4; }
.modal { width: min(480px, calc(100% - 28px)); max-width: 480px; max-height: min(90vh, 760px); padding: 0; border: 0; border-radius: 14px; background: transparent; overflow: auto; }
.modal::backdrop { background: rgba(31,38,31,.43); backdrop-filter: blur(3px); }
.modal-card { padding: 25px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.modal-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-heading .eyebrow { margin-bottom: 6px; }
.modal-heading h2 { font-size: 19px; }
.close-modal { font-size: 21px; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 4px; margin-bottom: 17px; border-radius: 9px; background: #f3f5f0; }
.type-switch label { margin: 0; }
.type-switch input { position: absolute; opacity: 0; }
.type-switch span { min-height: 34px; display: grid; place-items: center; border-radius: 7px; color: #7e857b; font-size: 11px; cursor: pointer; }
.type-switch input:checked + span { color: var(--green); background: white; box-shadow: 0 1px 4px rgba(20,40,20,.1); font-weight: 700; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.optional { color: #a0a49d; font-weight: 400; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.modal-actions .button { min-height: 38px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 5; max-width: min(380px,calc(100% - 32px)); padding: 12px 16px; border-radius: 9px; color: white; background: #253f31; box-shadow: 0 6px 22px #18281b2a; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1080px) {
  .content { padding-right: 30px; padding-left: 30px; }
  .topbar { padding-right: 30px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .summary-card { min-height: 125px; }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .main-area { margin-left: 0; }
  .topbar { height: 58px; justify-content: space-between; padding: 0 17px; }
  .mobile-brand { display: inline-flex; gap: 7px; }
  .mobile-brand .brand-mark { width: 29px; height: 29px; border-radius: 10px; font-size: 20px; }
  .mobile-brand .brand-name { font-size: 17px; }
  .topbar-right { gap: 6px; }
  .user-name { max-width: 92px; font-size: 10px; }
  .security-button { min-height: 29px; padding: 0 7px; font-size: 9px; }
  .content { padding: 29px 17px 15px; }
  .welcome-row { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .welcome-row h1 { font-size: 25px; }
  .month-picker input { width: 100%; }
  .month-picker { width: 100%; }
  .summary-grid { gap: 9px; }
  .summary-card { min-height: 120px; padding: 13px; }
  .metric-value { font-size: 19px; }
  .dashboard-grid { grid-template-columns: 1fr; gap: 11px; }
  .budget-panel, .spending-panel { min-height: 0; padding: 17px; }
  .activity-panel, .plans-panel { padding: 16px; }
  .activity-panel .panel-heading, .plans-panel .panel-heading { align-items: flex-start; }
  .activity-panel .panel-heading .button, .plans-panel .panel-heading .button { min-height: 32px; padding: 0 9px; font-size: 10px; }
  table { min-width: 520px; }
  .plans-grid { grid-template-columns: 1fr; }
  .plan-card { padding: 14px; }
  .toast { right: 16px; bottom: 16px; }
}
@media (max-width: 410px) {
  .summary-card { padding: 11px; }
  .card-heading { font-size: 10px; }
  .metric-value { font-size: 17px; }
  .metric-caption { font-size: 9px; }
  .panel h2 { font-size: 15px; }
}
