@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #242923;
  background: #edf5e9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --ink: #242923;
  --muted: #898e85;
  --blue: #254a78;
  --blue-dark: #1b385f;
  --blue-soft: #eaf0f7;
  --line: #eceee8;
  --surface: #fff;
  --red: #c56e5d;
  --shadow: 0 14px 40px rgba(39, 49, 39, 0.045);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.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; }

.security-lock { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(237,245,233,.96); backdrop-filter: blur(12px); }
.security-lock[hidden] { display: none; }
.security-lock-card { width: min(380px, 100%); padding: 34px 32px 28px; text-align: center; background: #fff; border: 1px solid #e9ebe5; border-radius: 16px; box-shadow: 0 20px 60px rgba(39,49,39,.12); }
.lock-icon { width: 46px; height: 46px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 13px; color: var(--blue); background: var(--blue-soft); }
.lock-icon svg { width: 25px; height: 25px; }
.security-lock-card .eyebrow { margin-bottom: 8px; }
.security-lock-card h2 { margin: 0 0 7px; font-size: 21px; }
.lock-subtitle { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.lock-pin { width: 148px; height: 48px; border: 1px solid #dde3d9; border-radius: 9px; text-align: center; font: 700 24px "Manrope", sans-serif; letter-spacing: 10px; padding-left: 10px; color: var(--ink); outline: none; }
.lock-pin:focus { border-color: #7898bc; box-shadow: 0 0 0 4px rgba(69,106,151,.12); }
.lock-error { min-height: 18px; margin: 8px 0 4px; color: #b25649; font-size: 11px; }
.unlock-button { width: 148px; height: 43px; }
.app-shell[hidden] { display: none; }

.app-shell { max-width: 1160px; padding: 0 36px; margin: 0 auto; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e8eae5; }
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; }
.brand-mark { width: 32px; height: 32px; color: var(--blue); display: inline-flex; }
.brand-mark svg { width: 100%; }
.brand-name { font: 800 20px/1 "Manrope", sans-serif; letter-spacing: -1px; }
.brand-period { color: #7898bc; }
.topbar-right { display: flex; align-items: center; gap: 22px; }
.currency-picker select { appearance: none; border: 0; background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%237c827a' stroke-width='1.3'/%3E%3C/svg%3E") no-repeat right center; color: #596057; font-size: 12px; font-weight: 600; padding: 8px 18px 8px 4px; cursor: pointer; }
.privacy-note { font-size: 11px; color: #81877e; display: inline-flex; gap: 7px; align-items: center; }
.privacy-dot { width: 6px; height: 6px; border-radius: 50%; background: #7898bc; }
.recurring-status { margin-top: 10px; padding: 10px 13px; border: 1px solid #dfe6ef; border-radius: 8px; background: #f2f6fa; color: var(--blue-dark); font-size: 11px; line-height: 1.5; }
.recurring-status[hidden] { display: none; }

main { padding-top: 40px; }
.welcome-row { display: flex; align-items: end; justify-content: space-between; margin-bottom: 27px; }
.eyebrow { font-size: 9px; font-weight: 700; letter-spacing: 1.65px; color: #90978d; margin: 0 0 10px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: "Manrope", "DM Sans", sans-serif; letter-spacing: -0.8px; }
h1 { margin-bottom: 6px; font-size: 27px; line-height: 1.2; font-weight: 700; }
.welcome-subtitle { margin: 0; color: #898e85; font-size: 12px; }
.month-control { display: flex; align-items: center; gap: 6px; padding: 4px 5px; background: #fff; border: 1px solid #e9ebe5; border-radius: 9px; box-shadow: 0 3px 9px rgba(30,40,30,.025); }
.month-arrow { width: 28px; height: 28px; padding: 6px; border: 0; background: transparent; color: #767d73; border-radius: 6px; }
.month-arrow:hover { background: #f2f4ef; }
.month-arrow svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#month-picker { width: 128px; border: 0; background: transparent; color: var(--ink); font-size: 12px; font-weight: 600; text-align: center; outline: 0; }

.summary-grid { display: grid; grid-template-columns: 1.45fr 1fr 1fr; gap: 14px; }
.balance-card { color: white; border-radius: 12px; padding: 20px 22px 16px; background: linear-gradient(126deg, #2b4d7a 0%, #1c3c68 100%); box-shadow: 0 8px 20px rgba(32, 63, 103, .16); min-height: 172px; }
.balance-topline, .balance-footer, .stat-heading { display: flex; align-items: center; justify-content: space-between; }
.balance-card .card-label { color: rgba(255,255,255,.7); }
.card-label { font-size: 9px; letter-spacing: 1.25px; font-weight: 700; }
.balance-icon { width: 28px; height: 28px; color: rgba(255,255,255,.78); display: inline-flex; }
.balance-icon svg { width: 100%; height: 100%; }
.balance-amount { margin: 11px 0 3px; font: 700 29px/1.1 "Manrope", sans-serif; letter-spacing: -.8px; }
.balance-caption { color: rgba(255,255,255,.68); font-size: 10px; margin: 0; }
.balance-rule { border-top: 1px solid rgba(255,255,255,.17); margin: 15px 0 11px; }
.balance-footer { color: rgba(255,255,255,.7); font-size: 9px; }
.balance-footer > span:first-child { display: flex; align-items: center; gap: 6px; }
.balance-dot { width: 6px; height: 6px; border: 1px solid rgba(255,255,255,.7); border-radius: 50%; }
#month-day-count { font-variant-numeric: tabular-nums; }
.stat-card { background: var(--surface); border: 1px solid #eff0ec; border-radius: 12px; padding: 18px 19px 15px; min-height: 172px; box-shadow: 0 5px 16px rgba(30,40,30,.025); }
.stat-heading { justify-content: flex-start; gap: 9px; }
.stat-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; }
.stat-icon svg { width: 15px; height: 15px; }
.income-icon { color: #426d9e; background: #eef3f8; }
.expense-icon { color: #c07967; background: #fbf0ed; }
.income-card .card-label { color: #81887e; }
.expense-card .card-label { color: #81887e; }
.stat-amount { font: 700 23px/1.1 "Manrope", sans-serif; letter-spacing: -.5px; margin: 16px 0 5px; font-variant-numeric: tabular-nums; }
.stat-caption { margin: 0; color: #92978e; font-size: 10px; }
.text-action { border: 0; background: none; padding: 0; font-size: 10px; font-weight: 600; margin-top: 15px; }
.text-action span { font-size: 13px; vertical-align: -1px; margin-right: 3px; }
.income-action { color: #426d9e; }
.expense-action { color: #bc705e; }
.text-action:hover { text-decoration: underline; }

.content-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 14px; margin-top: 17px; align-items: stretch; }
.side-panels { display: grid; gap: 14px; align-content: start; }
.panel { background: var(--surface); border: 1px solid #eff0ec; border-radius: 12px; box-shadow: 0 5px 16px rgba(30,40,30,.025); }
.transactions-panel { min-height: 315px; padding: 20px 21px 16px; }
.spending-panel { padding: 20px 20px 15px; min-height: 315px; display: flex; flex-direction: column; }
.panel-heading { display: flex; align-items: end; justify-content: space-between; }
.spending-panel .panel-heading { gap: 8px; }
.spending-panel .panel-heading > div { min-width: 0; }
.panel-heading .eyebrow { margin-bottom: 6px; }
.panel-heading h2 { font-size: 16px; line-height: 1.3; margin: 0; font-weight: 700; letter-spacing: -.4px; }
.budgets-button { flex: 0 0 auto; padding: 7px 9px; font-size: 9px; white-space: nowrap; }
.savings-panel { padding: 18px 20px 16px; color: #fff; border-color: transparent; background: linear-gradient(126deg, #2b4d7a 0%, #1c3c68 100%); box-shadow: 0 8px 20px rgba(32, 63, 103, .16); }
.savings-panel-heading { align-items: center; }
.savings-panel .panel-heading h2 { color: #fff; }
.savings-balance { margin: 13px 0 0; color: #fff; font: 700 24px/1.2 "Manrope", sans-serif; font-variant-numeric: tabular-nums; }
.savings-account-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.14); color: #fff; font-size: 17px; }
.savings-account-note { margin: 6px 0 12px; color: rgba(255,255,255,.72); font-size: 9px; line-height: 1.45; }
.savings-account-actions { display: flex; gap: 7px; }
.savings-account-actions .button { flex: 1; padding: 8px 7px; font-size: 9px; }
.savings-account-actions .button-primary { border-color: #fff; background: #fff; color: var(--blue); }
.savings-account-actions .button-primary:hover { background: #eef3f8; }
.savings-account-actions .button-secondary { border-color: rgba(255,255,255,.45); background: transparent; color: #fff; }
.savings-account-actions .button-secondary:hover { background: rgba(255,255,255,.12); }
.transaction-total { font-size: 10px; color: #999e96; padding-bottom: 2px; }
.transaction-panel-actions { display: flex; align-items: center; gap: 9px; }
.recurring-manage-button { padding: 6px 8px; font-size: 9px; white-space: nowrap; }
.transaction-list { margin-top: 15px; }
.transaction-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto 28px; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid #f0f1ee; }
.transaction-mark { width: 33px; height: 33px; display: grid; place-items: center; color: #697689; background: #f1f3f6; border-radius: 9px; font-size: 13px; font-weight: 600; }
.transaction-mark.income { color: #426d9e; background: #eef3f8; }
.transaction-mark.expense { color: #bc705e; background: #fbf0ed; }
.transaction-info { min-width: 0; }
.transaction-name { margin: 0 0 3px; font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-meta { margin: 0; font-size: 9px; color: #999e96; }
.transaction-amount { font-size: 11px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.transaction-amount.income { color: #426d9e; }
.transaction-amount.expense { color: #464a44; }
.delete-entry { width: 25px; height: 25px; border: 0; border-radius: 6px; color: #a4a8a0; background: transparent; font-size: 16px; line-height: 1; opacity: .65; }
.delete-entry:hover, .delete-entry:focus-visible { color: #bf6757; background: #fbf0ed; opacity: 1; }
.empty-state { text-align: center; padding: 30px 12px 16px; max-width: 340px; margin: 0 auto; }
.empty-icon { width: 43px; height: 43px; color: #547ca9; background: #eef3f8; display: inline-grid; place-items: center; border-radius: 13px; margin-bottom: 10px; }
.empty-icon svg { width: 28px; height: 28px; }
.empty-state h3 { font: 700 14px "Manrope", sans-serif; margin-bottom: 5px; }
.empty-state p { color: #91968e; font-size: 10px; line-height: 1.6; margin-bottom: 14px; }
.empty-actions { display: flex; justify-content: center; gap: 8px; }
.button { border-radius: 7px; padding: 9px 13px; font-weight: 600; font-size: 10px; transition: background .15s, transform .15s; }
.button:active { transform: translateY(1px); }
.button-primary { border: 1px solid var(--blue); background: var(--blue); color: #fff; }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary { border: 1px solid #e5e9e3; background: #fff; color: #596257; }
.button-secondary:hover { background: #f6f8f5; }
.category-breakdown { margin-top: 20px; }
.category-row { margin-bottom: 16px; }
.category-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.category-name { font-size: 10px; color: #646a61; }
.category-value { font-size: 10px; color: #41463f; font-weight: 600; font-variant-numeric: tabular-nums; }
.category-track { height: 5px; background: #f1f3ef; border-radius: 8px; overflow: hidden; }
.category-fill { height: 100%; min-width: 3px; border-radius: inherit; background: #6488b1; }
.category-row:nth-child(3n + 2) .category-fill { background: #c8a47a; }
.category-row:nth-child(3n) .category-fill { background: #94a5b6; }
.category-row .category-fill.warning { background: #d39a43; }
.category-row .category-fill.over-budget { background: #c56e5d; }
.category-budget-status { margin: 5px 0 0; color: #898e85; font-size: 9px; }
.category-budget-status.warning { color: #95681c; }
.category-budget-status.over-budget { color: #b25649; }
.category-budget-increase { margin-left: 5px; padding: 0; border: 0; background: transparent; color: var(--blue); font-size: 9px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.category-budget-increase:hover { color: var(--blue-dark); }
.category-empty { display: grid; place-content: center; flex: 1; text-align: center; min-height: 155px; color: #9da198; }
.category-empty-mark { color: #8da7c3; font-size: 22px; }
.category-empty p { max-width: 180px; font-size: 10px; line-height: 1.6; margin: 7px auto 0; }
.category-footnote { display: flex; align-items: center; gap: 7px; margin-top: auto; padding-top: 13px; border-top: 1px solid #f0f1ee; color: #a0a49d; font-size: 9px; }
.category-footnote-dot { width: 6px; height: 6px; border-radius: 50%; background: #7898bc; }

.app-footer { display: flex; justify-content: space-between; padding: 23px 2px 28px; color: #a1a59e; font-size: 9px; }
.footer-heart { color: #bf8879; font-size: 12px; vertical-align: -1px; }
.entry-dialog { border: 0; border-radius: 15px; box-shadow: 0 22px 80px rgba(24,36,25,.22); width: min(440px, calc(100% - 28px)); padding: 25px 27px 20px; color: var(--ink); }
.entry-dialog::backdrop { background: rgba(25,35,27,.38); backdrop-filter: blur(2px); }
.budget-dialog { max-height: min(80vh, 680px); overflow-y: auto; }
.budget-dialog-description { margin: -5px 0 16px; color: #898e85; font-size: 11px; line-height: 1.5; }
.budget-fields { display: grid; gap: 10px; }
.budget-field { display: grid; grid-template-columns: minmax(0, 1fr) 150px; align-items: center; gap: 12px; }
.budget-field label { color: #555b53; font-size: 11px; font-weight: 600; }
.budget-field input { width: 100%; height: 38px; border: 1px solid #e6e9e3; border-radius: 7px; padding: 0 10px; color: #454a43; font-size: 11px; }
.budget-increase-dialog #budget-increase-amount { width: 100%; height: 40px; margin-bottom: 10px; border: 1px solid #e6e9e3; border-radius: 7px; padding: 0 10px; color: #454a43; font-size: 12px; }
.budget-field input:focus { border-color: #7898bc; box-shadow: 0 0 0 3px rgba(69,106,151,.12); outline: none; }
.recurring-dialog { width: min(500px, calc(100% - 28px)); max-height: min(86vh, 760px); overflow-y: auto; }
.recurring-dialog-description { margin: -5px 0 16px; color: #898e85; font-size: 11px; line-height: 1.5; }
.recurring-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.recurring-dialog #recurring-amount { width: 100%; height: 40px; border: 1px solid #e6e9e3; border-radius: 7px; padding: 0 10px; color: #454a43; font-size: 12px; }
.recurring-saved-items { margin-top: 19px; padding-top: 16px; border-top: 1px solid #eceee8; }
.recurring-saved-items h3 { margin: 0 0 10px; font: 700 13px "Manrope", sans-serif; }
.recurring-empty { margin: 0; color: #92978e; font-size: 10px; }
.recurring-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.recurring-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid #eceee8; border-radius: 8px; }
.recurring-item-info { min-width: 0; }
.recurring-item-title { margin: 0 0 3px; color: #41463f; font-size: 10px; font-weight: 600; overflow-wrap: anywhere; }
.recurring-item-meta { margin: 0; color: #92978e; font-size: 9px; }
.recurring-remove { flex: 0 0 auto; padding: 6px 8px; border: 1px solid #eceee8; border-radius: 6px; background: #fff; color: #a45b50; font-size: 9px; }
.recurring-remove:hover { background: #fbf0ed; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; }
.dialog-heading .eyebrow { margin-bottom: 6px; }
.dialog-heading h2 { font-size: 20px; margin: 0 0 19px; }
.dialog-close { width: 28px; height: 28px; border: 0; border-radius: 7px; background: #f4f5f2; color: #71766e; font-size: 21px; line-height: 1; }
.type-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #f2f4f0; border-radius: 8px; padding: 4px; margin-bottom: 19px; }
.type-toggle[hidden] { display: none; }
.type-option { padding: 8px; border: 0; background: transparent; color: #777e74; border-radius: 6px; font-size: 11px; font-weight: 600; }
.type-option.active[data-type="expense"] { color: #a85e50; background: white; box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.type-option.active[data-type="income"] { color: #355f8e; background: white; box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.field-label { display: block; font-size: 10px; font-weight: 600; color: #555b53; margin-bottom: 7px; }
.optional-label { color: #a1a59e; font-weight: 400; }
.amount-input-wrap { display: flex; align-items: center; gap: 8px; border: 1px solid #e6e9e3; border-radius: 8px; padding: 0 12px; height: 43px; margin-bottom: 14px; color: #80877d; }
.amount-input-wrap input { width: 100%; border: 0; outline: none; font-size: 17px; font-weight: 600; color: var(--ink); }
.entry-dialog input:not([type="hidden"]):not([type="number"]), .entry-dialog select { height: 40px; width: 100%; border: 1px solid #e6e9e3; border-radius: 7px; padding: 0 10px; color: #454a43; background-color: white; font-size: 11px; outline: none; }
.entry-dialog input:focus, .entry-dialog select:focus, .amount-input-wrap:focus-within { border-color: #7898bc; box-shadow: 0 0 0 3px rgba(69,106,151,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 0 0 14px; }
.form-field { min-width: 0; }
#entry-note { margin-bottom: 13px; }
.form-error { min-height: 0; color: #b25649; font-size: 10px; margin: 0; }
.form-error:not(:empty) { min-height: 18px; }
.submit-button { width: 100%; padding: 11px; margin-top: 6px; font-size: 11px; }
.local-save-note { margin: 11px 0 0; text-align: center; color: #a0a59d; font-size: 9px; }

@media (min-width: 1200px) {
  .app-shell { padding-left: 46px; padding-right: 46px; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 22px; }
  .topbar { height: 70px; }
  main { padding-top: 31px; }
  .summary-grid { grid-template-columns: 1.2fr 1fr; }
  .balance-card { grid-row: span 2; min-height: 100%; }
  .stat-card { min-height: 156px; padding: 16px; }
  .content-grid { grid-template-columns: 1.2fr 1fr; }
}
@media (max-width: 560px) {
  .app-shell { padding: 0 17px; }
  .topbar { height: 64px; }
  .topbar-right { gap: 8px; }
  .privacy-note { font-size: 0; gap: 0; }
  .privacy-dot { width: 7px; height: 7px; }
  .currency-picker select { font-size: 10px; padding-right: 16px; }
  main { padding-top: 26px; }
  .welcome-row { align-items: flex-start; flex-direction: column; gap: 16px; margin-bottom: 18px; }
  h1 { font-size: 24px; }
  .welcome-subtitle { font-size: 11px; }
  .month-control { align-self: stretch; justify-content: space-between; }
  #month-picker { flex: 1; }
  .summary-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .balance-card { grid-column: 1 / -1; grid-row: auto; min-height: 155px; padding: 18px 19px 14px; }
  .balance-amount { font-size: 27px; }
  .stat-card { min-height: 150px; padding: 14px 13px 12px; }
  .stat-amount { font-size: clamp(17px, 5vw, 22px); margin-top: 15px; }
  .stat-caption { font-size: 9px; }
  .text-action { margin-top: 13px; }
  .content-grid { grid-template-columns: 1fr; gap: 11px; margin-top: 11px; }
  .side-panels { gap: 11px; }
  .transactions-panel { min-height: 290px; padding: 18px 15px 14px; }
  .spending-panel { min-height: 245px; padding: 18px 16px 14px; }
  .savings-panel { padding: 18px 16px 14px; }
  .recurring-fields { grid-template-columns: 1fr; gap: 0; }
  .panel-heading h2 { font-size: 15px; }
  .category-empty { min-height: 115px; }
  .app-footer { padding: 19px 1px 23px; font-size: 8px; }
  .entry-dialog { padding: 22px 20px 17px; }
  .budget-field { grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
