:root {
  --ink: #1b3328;
  --muted: #5e7065;
  --line: #e5e2d6;
  --paper: #fffefa;
  --canvas: #f6f4ec;
  --green: #236148;
  --green-dark: #174735;
  --mint: #e8f0e6;
  --gold: #ecc76e;
  --gold-dark: #a76e20;
  --forest: #132f25;
  --side-width: 230px;
  --editorial: 'Instrument Serif', Georgia, serif;
}

body { color: var(--ink); background: var(--canvas); }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:where(button, a, input, select, textarea, summary):focus-visible { outline: 2px solid #95701e; outline-offset: 3px; }

.sidebar { position: fixed; inset: 0 auto 0 0; display: flex; width: var(--side-width); height: auto; overflow-y: auto; padding: 29px 15px 17px; background: #142e25; border: 0; border-right: 1px solid #1e3b30; }
.main-content { margin-left: var(--side-width); width: calc(100% - var(--side-width)); min-width: 0; padding-bottom: 0; }
.brand { gap: 11px; color: #f9f6eb; font-size: 22px; padding: 0 10px; }
.brand-ai { color: #f0cd7a; }
.brand-mark { width: 35px; height: 35px; padding: 0; border-radius: 50%; flex: none; color: #253728; background: linear-gradient(145deg, #fae297, #d5a951); font: 800 22px/1 var(--display); letter-spacing: 0; box-shadow: inset 0 0 0 1px #ffffff67, 0 3px 9px #051a1455; }
.workspace-label { margin: 42px 11px 14px; color: #b5c5b9; }
.main-nav { height: auto; grid-template-columns: 1fr; gap: 5px; }
.nav-link, .nav-link:not(.active), .nav-link.active { min-height: 43px; height: auto; flex-direction: row; justify-content: flex-start; padding: 8px 11px; gap: 10px; color: #dfebe1; font-size: 13px; border: 1px solid transparent; border-radius: 10px; }
.nav-link .nav-icon { flex: none; font-size: 17px; color: #bacdc0; }
.nav-link:hover { color: #fffdf5; background: #29483b; }
.nav-link.active { color: #f8e0a6; border-color: #5f6240; background: #3a4937; }
.nav-link.active::before { display: none; }
.nav-link.active .nav-icon { color: var(--gold); }
.sidebar :focus-visible { outline-color: #f4ce79; }
.profile { cursor: default; border-color: #365247; padding: 15px 6px 0; margin-top: 24px; }
.avatar { color: #f5db9f; background: #3b5545; }
.profile-copy strong { color: #edf3eb; font-size: 12px; }
.profile-copy small { color: #adbdaf; font-size: 10px; }

.topbar { height: 58px; background: var(--paper); border-color: var(--line); }
.breadcrumbs { color: #596d61; font-size: 12px; }
.breadcrumbs strong { color: var(--ink); }
.crumb-sep { color: #69786b; }
.page { padding-top: 36px; }
.welcome-row { gap: 16px; margin-bottom: 26px; }
.welcome-row h1 { color: var(--ink); }
.eyebrow { color: #506258; font-size: 10px; letter-spacing: .11em; }
.subtitle { color: var(--muted); }

.primary-button, .outline-button, .cancel-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 700 13px/1.2 var(--font);
  text-decoration: none;
}
.primary-button { gap: 9px; height: auto; padding: 10px 15px; color: #242b20; border-color: #d0a850; background: linear-gradient(155deg, #f7d987, #e8bc60); box-shadow: 0 2px 0 #a97d2b, 0 5px 11px #7153231d; }
.primary-button:hover { color: #242b20; background: #f9df9c; transform: translateY(-1px); }
.primary-button:active { transform: translateY(1px); box-shadow: 0 1px 0 #a97d2b; }
.primary-button:disabled { color: #5d604f; border-color: #ddd5bf; background: #eee9dc; box-shadow: none; transform: none; cursor: default; }
.outline-button, .cancel-button { color: var(--green-dark); background: var(--paper); border-color: #cbd5c7; padding: 8px 12px; }
.outline-button:hover:not(:disabled), .cancel-button:hover { background: var(--mint); border-color: #8ba597; }
.money-button { gap: 10px; }
.money-button span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #75552487; border-radius: 50%; background: #fae5a2; color: #423518; font: 800 10px/1 var(--display); }
.text-link { color: var(--green-dark); font-size: 12px; font-weight: 700; }
.text-link:hover { text-decoration: underline; }
.add-row { width: auto; display: inline-flex; align-items: center; gap: 6px; margin-top: 13px; padding: 7px 10px; color: var(--green-dark); border: 1px solid #d8dfd2; border-radius: 8px; background: #f3f5ed; font: 700 12px/1.2 var(--font); }
.add-row:hover { background: var(--mint); }
.add-row span { margin: 0; color: inherit; }

.dashboard-heading h1 { font: 400 clamp(46px, 5.25vw, 76px)/.99 var(--editorial); letter-spacing: -.028em; }
.dashboard-heading h1 em { color: var(--green); font-weight: 400; }
.dashboard-heading .eyebrow { margin-bottom: 12px; }
.summary-grid { grid-template-columns: minmax(0, 1.65fr) minmax(205px, 1fr); gap: 16px; }
.summary-card { border-color: var(--line); background: var(--paper); box-shadow: 0 4px 14px #4339150b; }
.balance-card { min-height: 236px; height: auto; display: flex; align-items: center; isolation: isolate; overflow: hidden; padding: 27px clamp(20px, 3vw, 36px); border: 1px solid #234d3b; border-radius: 20px; color: #fff9e8; background: radial-gradient(ellipse at 95% 55%, #3c684b, transparent 64%), linear-gradient(130deg, #142f25, #215640); box-shadow: 0 9px 22px #1e392526; }
.balance-content { width: 100%; position: relative; z-index: 1; }
.balance-card .card-heading { color: #e2eadd; font-size: 13px; font-weight: 700; }
.big-number { max-width: 78%; margin: 9px 0 19px; font: 800 clamp(26px, 3.5vw, 54px)/1.15 var(--display); letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.balance-link { display: inline-flex; align-items: center; gap: 9px; padding: 7px 10px; border: 1px solid #eaca784d; border-radius: 8px; color: #ffdf92; background: #162c2259; font-size: 12px; font-weight: 700; text-decoration: none; }
.balance-link:hover { background: #172c22; text-decoration: underline; }
.balance-link:focus-visible { outline-color: #f1cc75; }
.balance-art { position: absolute; right: -1%; bottom: -21px; width: 42%; height: 115%; pointer-events: none; }
.balance-ring { position: absolute; right: -10%; top: -3%; width: 112%; aspect-ratio: 1; border: 1px solid #e5d6a245; border-radius: 50%; }
.balance-ring:nth-child(2) { right: -3%; top: 5%; width: 96%; }
.balance-ring:nth-child(3) { right: 4%; top: 13%; width: 80%; }
.coin { position: absolute; display: grid; place-items: center; right: 17%; width: min(55%, 132px); aspect-ratio: 1; bottom: 24%; border: 2px solid #f6d988; border-radius: 50%; transform: rotate(-19deg) scaleY(.86); background: linear-gradient(145deg, #f6dfa0, #d5a44a 63%, #ebb969); box-shadow: inset 0 0 0 4px #a9702e91, 4px 6px 0 #96692c; }
.coin::before { content: ''; position: absolute; inset: 10%; border: 1px dashed #825624b0; border-radius: 50%; }
.coin-back { right: 9%; bottom: 25%; filter: brightness(.72); }
.coin-shadow { right: 24%; bottom: 18%; filter: brightness(.62); }
.coin-front span { font: 400 clamp(22px, 4vw, 52px)/1 var(--editorial); color: #63450e; text-shadow: 0 1px 0 #f6e9b2; }
.coin-glint { position: absolute; top: 18%; right: 19%; color: #f8da8f; font-size: clamp(16px, 2.3vw, 28px); }
.dashboard-metrics { display: grid; gap: 13px; }
.month-metric { min-height: 0; height: auto; padding: 13px 18px; display: flex; flex-direction: column; justify-content: center; border-radius: 16px; }
.month-metric .card-heading { justify-content: flex-start; gap: 8px; color: #4d6356; font-size: 13px; font-weight: 700; }
.month-metric .metric-icon { width: 29px; height: 29px; border-radius: 9px; font-size: 18px; font-weight: 800; }
.income-icon { color: #226044; background: #e5f0e4; }
.expense-icon { color: #924d35; background: #f8e9de; }
.month-metric .metric-number { margin: 7px 0 0; font: 800 clamp(20px, 2.1vw, 32px)/1.16 var(--display); letter-spacing: -.035em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.content-grid { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; margin-top: 18px; }
.panel, .full-card { background: var(--paper); border-color: var(--line); box-shadow: 0 4px 14px #4339150b; }
.panel-header { gap: 10px; }
.panel-header h2, .planning-card h2, .report-panel h2, .invoice-heading h2, .result-panel h2 { color: var(--ink); font: 800 17px/1.25 var(--display); letter-spacing: -.02em; }
.panel-header p, .planning-card p, .report-muted, .report-empty { color: var(--muted); }
.transaction-row, .account-row, .goal-item, .budget-row { border-color: #edeae0; }
.transaction-copy strong, .account-copy strong, .card-info strong, .transaction-amount, .account-balance { color: #273c31; font-size: 13px; }
.transaction-copy small, .account-copy small, .card-info small { color: #596a60; }
.transaction-amount, .account-balance, .invoice-totals dd, .report-totals dd { font-variant-numeric: tabular-nums; }
.transaction-amount:not(.expense) { color: #1c6849; }
.transaction-status { border-radius: 999px; }
.empty-state { color: var(--muted); }
.result-panel { background: linear-gradient(145deg, #f4edda, #fdf9ee); border-color: #e9dec0; }
.result-panel h2 { margin: 0; }
.result-panel > strong { display: block; margin: 9px 0 5px; color: #245740; font: 800 clamp(23px, 2.6vw, 34px)/1.1 var(--display); letter-spacing: -.04em; overflow-wrap: anywhere; }
.result-panel > strong.negative-result { color: #943e2d; }
.result-panel p { margin: 0 0 12px; color: #665c48; font-size: 12px; }
.result-panel .text-link { display: inline-flex; align-items: center; gap: 5px; }

.filter-select, .report-filters input, .report-filters select, .form-field input, .form-field select, .form-field textarea, .invoice-batch-row input, .invoice-batch-row select {
  color: var(--ink);
  background: #fffefa;
  border-color: #cfd7ca;
  border-radius: 8px;
  font-size: 12px;
}
.form-field label { color: #4d6054; font-size: 11px; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #6b9078; box-shadow: 0 0 0 3px #e4eee3; }
.modal { color: var(--ink); background: var(--paper); border: 1px solid #e4deca; border-radius: 17px; max-height: calc(100dvh - 40px); overflow-y: auto; }
.modal h2 { color: var(--ink); font-size: 23px; }
.modal-subtitle { color: var(--muted); }
.modal-eyebrow { color: #526b5a; }
.invoice-totals > div, .report-totals div { background: #edf2e9; }
.report-advice { background: #edf3e7; }
.invoice-months [aria-current], .invoice-sections [aria-pressed="true"] { color: #254733; background: #e8f0e4; border-color: #7d9883; }
.invoice-settings, .report-category, .invoice-breakdown { border-color: var(--line); }
.csv-file-picker { background-color: #f5f7ef; }

@media (max-width: 1050px) {
  :root { --side-width: 194px; }
  .dashboard-heading h1 { font-size: clamp(41px, 5.7vw, 64px); }
}

@media (max-width: 820px) {
  :root { --side-width: 65px; }
  .sidebar { padding: 19px 8px; }
  .brand { display: flex; padding: 0; justify-content: center; }
  .brand > span:last-child, .workspace-label, .profile-copy { display: none; }
  .main-nav { margin-top: 30px; }
  .nav-link, .nav-link:not(.active), .nav-link.active { justify-content: center; font-size: 0; padding: 8px; gap: 0; }
  .nav-link .nav-icon { font-size: 18px; }
  .profile { justify-content: center; }
  .content-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 630px) {
  .app-shell { display: block; }
  .sidebar { position: static; display: block; width: 100%; padding: 13px 13px 10px; overflow: visible; border: 0; box-shadow: none; }
  .brand { justify-content: flex-start; padding: 0 2px; font-size: 20px; }
  .brand > span:last-child { display: inline; font-size: inherit; }
  .brand-mark { width: 29px; height: 29px; font-size: 18px; }
  .sidebar-bottom { display: none; }
  .main-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 9px; }
  .nav-link, .nav-link:not(.active), .nav-link.active { min-height: 37px; flex-direction: column; padding: 4px 2px; gap: 3px; font-size: clamp(9px, 2.25vw, 11px); border-radius: 7px; white-space: normal; text-align: center; }
  .nav-link .nav-icon { width: auto; font-size: 12px; }
  .main-content { width: 100%; margin-left: 0; }
  .topbar { display: none; }
  .page { padding: 23px 14px 42px; }
  .welcome-row { align-items: flex-start; margin-bottom: 19px; }
  .dashboard-heading h1 { font-size: clamp(39px, 9vw, 52px); }
  .summary-grid { grid-template-columns: 1fr; gap: 11px; }
  .balance-card { min-height: 172px; grid-column: auto; padding: 20px; }
  .balance-art { width: 43%; }
  .big-number { font-size: clamp(27px, 8vw, 43px); }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .month-metric { padding: 10px; }
  .month-metric .card-heading { font-size: 11px; }
  .month-metric .metric-icon { width: 22px; height: 22px; flex: none; font-size: 15px; }
  .month-metric .metric-number { font-size: clamp(17px, 5.5vw, 24px); }
  .content-grid { grid-template-columns: 1fr; gap: 11px; margin-top: 12px; }
  .panel:not(.batch-panel) { padding: 16px; }
}
