:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #15231d;
  --muted: #64746d;
  --line: #dce6df;
  --paper: #ffffff;
  --canvas: #aeb4b1;
  --green: #176b4d;
  --green-soft: #e0f2e8;
  --red: #b44949;
  --red-soft: #fae7e5;
  --sand: #f3eee1;
  --shadow: 0 18px 45px rgba(31, 62, 50, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 16px clamp(20px, 4vw, 64px); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.88); }
.brand, .header-actions, .section-actions { display: flex; align-items: center; gap: 10px; }
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.brand-mark { display: grid !important; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: white !important; background: var(--green); font-weight: 800; }
.status-pill, .category-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 700; }
.status-pill.received { color: var(--green); background: var(--green-soft); }
.status-pill.pending, .status-pill.company { color: #7a5a18; background: var(--sand); }
.status-pill.personal, .status-pill.review { color: var(--red); background: var(--red-soft); }
.shell { width: min(1440px, 100%); margin: auto; padding: 40px clamp(18px, 4vw, 64px) 64px; }
.auth-panel { max-width: 620px; margin: 7vh auto 0; padding: clamp(24px, 5vw, 46px); }
.auth-panel h1 { font-size: clamp(34px, 5vw, 50px); }
.auth-form { display: flex; align-items: end; gap: 10px; margin-top: 24px; }
.auth-form label { flex: 1; }
.hero { margin-bottom: 22px; }
h1 { max-width: 820px; margin: 5px 0 10px; font-family: Georgia, serif; font-size: clamp(34px, 5vw, 58px); line-height: 1.03; }
h2 { margin: 3px 0 0; font-size: 20px; }
h3 { margin: 0 0 5px; }
.hero-copy { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.6; }
.eyebrow { margin: 0; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.panel { border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 6px; width: fit-content; margin-bottom: 28px; padding: 6px; }
.tab-button { border: 0; border-radius: 12px; padding: 10px 16px; color: var(--muted); background: transparent; font-weight: 750; }
.tab-button.active { color: white; background: var(--green); }
.section-heading, .panel-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-heading { padding: 18px 18px 12px; margin: 0; }
.statement-summary { margin-top: 18px; }
.statement-copy { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 0 18px 18px; color: var(--muted); font-size: 13px; }
.statement-copy strong { color: var(--ink); }
.toolbar { display: flex; align-items: end; gap: 12px; padding: 14px; margin-bottom: 18px; }
.toolbar-note { color: var(--muted); font-size: 13px; line-height: 1.45; }
label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink); background: white; }
.search-field { flex: 1; }
.primary-button, .secondary-button, .icon-button, .text-button { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 750; }
.primary-button { color: white; background: var(--green); }
.secondary-button { color: var(--green); background: var(--green-soft); }
.icon-button { color: var(--muted); background: transparent; font-size: 18px; }
.text-button { padding: 5px 7px; color: var(--green); background: transparent; font-size: 12px; }
.text-button.danger { color: var(--red); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-metrics { grid-template-columns: repeat(4, 1fr); }
.card-metrics { grid-template-columns: repeat(4, 1fr); }
.metric-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.metric-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; margin-top: 9px; font-size: 23px; }
.income strong { color: var(--green); }
.expense strong { color: var(--red); }
.balance { background: var(--sand); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
.breakdown { padding: 4px 18px 18px; }
.breakdown-row { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.breakdown-row strong { color: var(--ink); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px 18px; border-top: 1px solid var(--line); text-align: left; font-size: 13px; }
th { color: var(--muted); background: #fbfcfb; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.align-right, .row-actions { text-align: right; }
.amount { font-weight: 800; }
.amount.expense { color: var(--red); }
.amount.income { color: var(--green); }
.empty-state { padding: 42px 20px; color: var(--muted); text-align: center; }
.form-message { min-height: 20px; margin: 14px 0 0; color: var(--green); font-size: 13px; font-weight: 700; }
dialog { width: min(620px, calc(100% - 28px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 24px 70px rgba(21, 35, 29, 0.22); }
.wide-dialog { width: min(1180px, calc(100% - 28px)); max-height: calc(100vh - 28px); }
dialog::backdrop { background: rgba(21, 35, 29, 0.42); }
.dialog-heading { display: flex; justify-content: space-between; padding: 22px 22px 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 10px 22px 18px; }
.full-width { grid-column: 1 / -1; }
.dialog-actions { display: flex; justify-content: end; gap: 10px; padding: 16px 22px 22px; border-top: 1px solid var(--line); }
.calculation-box { padding: 13px; border-radius: 12px; color: var(--green); background: var(--green-soft); font-size: 14px; font-weight: 800; }
.statement-preview-wrap { max-height: 52vh; border-top: 1px solid var(--line); }
.import-table input, .import-table select { min-width: 118px; padding: 7px 8px; font-size: 12px; }
.import-table input[data-field="description"] { min-width: 260px; }
.import-table .needs-review { background: var(--red-soft); }
.review-tag { display: inline-flex; border-radius: 999px; padding: 4px 8px; color: var(--red); background: var(--red-soft); font-size: 11px; font-weight: 800; }
.match-tag { display: inline-flex; border-radius: 999px; padding: 4px 8px; color: var(--green); background: var(--green-soft); font-size: 11px; font-weight: 800; }
@media (max-width: 900px) { .content-grid { grid-template-columns: 1fr; } .summary-metrics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) {
  .topbar { padding: 12px 16px; }
  .status-pill { display: none; }
  .shell { padding: 28px 14px 42px; }
  .section-heading { display: block; }
  .section-actions { flex-wrap: wrap; margin-top: 14px; }
  .section-heading > .primary-button { width: 100%; margin-top: 14px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar label { width: 100%; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 14px; }
  .metric-card strong { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: auto; }
  .auth-form { display: block; }
  .auth-form .primary-button { width: 100%; margin-top: 10px; }
}
