:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-subtle: #f8fafb;
  --text: #17202a;
  --muted: #66727e;
  --border: #dce2e7;
  --primary: #174f45;
  --primary-hover: #103d35;
  --positive: #176b4d;
  --negative: #a13d3d;
  --warning: #8a5a0a;
  --danger: #a12e2e;
  --focus: #397dff;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(23 32 42 / 6%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  background: var(--surface);
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  color: #eaf2ef;
  background: #132d29;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 24px;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: .01em;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  color: #132d29;
  background: #cce8df;
}

.main-nav { display: grid; gap: 4px; }

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 8px;
  color: #d9e5e1;
  text-decoration: none;
}

a.nav-link:hover { background: rgb(255 255 255 / 8%); }
.nav-link.is-active { color: #fff; background: rgb(204 232 223 / 16%); }
.nav-link.is-disabled { color: #849b95; cursor: default; }
.nav-link small { font-size: .65rem; }

.nav-section-label {
  margin: 24px 11px 4px;
  color: #87a39c;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.logout-link { margin-top: auto; border-top: 1px solid rgb(255 255 255 / 10%); border-radius: 0; }
.logout-form { margin-top: auto; }
.logout-form .logout-link { width: 100%; border-right: 0; border-bottom: 0; border-left: 0; font: inherit; text-align: left; cursor: pointer; }

.app-main { min-height: 100vh; margin-left: 248px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 12px clamp(20px, 4vw, 48px);
  border-bottom: 1px solid var(--border);
  background: rgb(244 246 248 / 94%);
  backdrop-filter: blur(8px);
}

.global-search { display: flex; width: min(620px, 100%); gap: 8px; }
.global-search input,
.form-control {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #c9d1d8;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface);
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  margin-right: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.content { width: min(1180px, 100%); margin: 0 auto; padding: 36px clamp(20px, 4vw, 48px) 64px; }

.page-header,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.page-header { margin-bottom: 28px; }
.page-header h1, .section-heading h2 { margin: 0; line-height: 1.2; }
.page-header h1 { font-size: clamp(1.75rem, 4vw, 2.35rem); }
.section-heading h2 { font-size: 1.2rem; }
.eyebrow { margin: 0 0 5px; color: var(--primary); font-size: .75rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.page-description, .summary-meta { margin: 7px 0 0; color: var(--muted); }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.summary-card, .panel, .week-card, .result-section, .empty-state {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.table-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.summary-card { min-height: 165px; padding: 20px; }
.summary-label { margin: 0; color: var(--muted); font-size: .85rem; font-weight: 650; }
.financial-amount {
  margin: 10px 0;
  font-size: 1.25rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.summary-card .financial-amount { font-size: clamp(1.55rem, 3vw, 2rem); }
.amount-positive { color: var(--positive); }
.amount-negative { color: var(--negative); }
.text-link { color: var(--primary); font-size: .84rem; font-weight: 650; }
.empty-inline { color: var(--muted); font-size: .92rem; }

.panel { padding: 22px; }
.panel + .panel, .message + .panel, .message + .content-grid { margin-top: 18px; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.card-heading h2 { margin: 0; font-size: 1.2rem; }
.card-heading .financial-amount { margin: 0; }
.content-grid { display: grid; grid-template-columns: minmax(280px, .75fr) minmax(420px, 1.25fr); align-items: start; gap: 20px; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 680;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { color: #fff; background: var(--primary); }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { border-color: #b9c4ca; color: var(--text); background: var(--surface); }
.button-neutral { border-color: #c7d0d6; color: #33404a; background: #eef2f4; }
.button-warning { border-color: #dfc38c; color: var(--warning); background: #fff9ed; }
.button-danger { color: #fff; background: var(--danger); }
.button:disabled { cursor: not-allowed; opacity: .52; }
.button-block { width: 100%; }
.button-small { min-height: 34px; padding: 6px 10px; font-size: .78rem; }

.form-panel { max-width: 820px; }
.form-stack { display: grid; gap: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; align-content: start; gap: 6px; }
.field label { font-size: .82rem; font-weight: 700; }
.field-wide { grid-column: 1 / -1; }
.field-help, .optional-label { color: var(--muted); font-size: .76rem; font-weight: 500; }
.field-help { margin: 0 0 14px; }
.money-input { font-variant-numeric: tabular-nums; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.form-section { margin: 0; padding: 18px; border: 1px solid var(--border); border-radius: 10px; }
.form-section legend { padding: 0 7px; font-weight: 750; }
.extra-list { display: grid; gap: 13px; }
.extra-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; }
.inline-form, .filter-form { display: flex; align-items: end; gap: 12px; }
.grow { flex: 1; }
.amount-field { flex: 0 1 190px; }
.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.toolbar-total { display: flex; align-items: baseline; gap: 12px; color: var(--muted); }
.toolbar-total .financial-amount { margin: 0; color: var(--text); }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th, .data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.data-table th { color: #52606a; background: var(--surface-subtle); font-size: .72rem; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.data-table tbody tr:hover { background: #fafcfb; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tfoot th { border-top: 1px solid var(--border); border-bottom: 0; color: var(--text); background: var(--surface); }
.data-table .align-right, .financial-cell { text-align: right; }
.financial-cell { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted-cell { color: var(--muted); }
.nowrap { white-space: nowrap; }

.note-composer { margin-bottom: 18px; }
.note-list { display: grid; }
.note-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 15px 0; }
.note-item + .note-item { border-top: 1px solid var(--border); }
.note-status { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #b9c8c4; border-radius: 50%; color: var(--primary); font-weight: 800; }
.note-copy p { margin: 0; }
.note-copy small { display: block; margin-top: 3px; color: var(--muted); }
.note-item.is-complete .note-copy p { color: var(--muted); text-decoration: line-through; }
.note-item.is-complete .note-status { color: #fff; background: var(--positive); border-color: var(--positive); }

.auth-page { min-height: 100vh; background: #132d29; }
.auth-shell { min-height: 100vh; display: grid; align-content: center; justify-items: center; gap: 22px; padding: 28px 18px; }
.auth-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 1.1rem; font-weight: 750; }
.auth-card { width: min(430px, 100%); padding: 30px; border: 1px solid rgb(255 255 255 / 12%); border-radius: 16px; background: var(--surface); box-shadow: 0 18px 45px rgb(4 16 13 / 25%); }
.auth-heading { margin-bottom: 22px; }
.auth-heading h1 { margin: 0; font-size: 1.85rem; }
.auth-heading p:last-child { margin: 7px 0 0; color: var(--muted); }
.auth-card .message { margin-bottom: 18px; }

.section-block { margin-top: 28px; }
.section-block > .section-heading { align-items: center; margin-bottom: 14px; }
.legacy-section { padding-top: 26px; border-top: 1px solid var(--border); }
.creation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.creation-card { padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-subtle); }
.creation-card h3 { margin: 0; font-size: 1rem; }
.creation-card p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; }
.weekly-creation-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inheritance-notice { display: grid; gap: 3px; padding: 14px 16px; border: 1px solid #b9d4cc; border-radius: 10px; background: #f3faf7; }
.inheritance-notice span { color: var(--muted); font-size: .84rem; }
.budget-family-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.budget-family-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.budget-family-card small { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; }
.period-budget-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 15px; color: var(--primary); font-size: .8rem; }
.period-budget-label span { color: var(--muted); }
.classification-panel { display: grid; gap: 18px; margin-bottom: 18px; border-color: #dfc38c; background: #fffaf0; }
.classification-panel h2 { margin: 0; font-size: 1.2rem; }
.auto-fund-balance { min-width: 210px; padding: 15px 18px; border: 1px solid #b9d4cc; border-radius: var(--radius); background: #f3faf7; text-align: right; }
.auto-fund-balance span { display: block; color: var(--muted); font-size: .78rem; font-weight: 650; }
.auto-fund-balance .financial-amount { display: block; margin: 3px 0 0; font-size: 1.65rem; }
.initial-capital-panel { display: grid; gap: 18px; margin-bottom: 18px; border-color: #b9d4cc; background: #f7fbf9; }
.initial-capital-panel h2 { margin: 0; font-size: 1.2rem; }
.auto-fund-composer { margin-bottom: 20px; }
.auto-fund-form-grid { grid-template-columns: 180px 180px 180px minmax(240px, 1fr); }
.auto-fund-form-grid .field-wide { grid-column: auto; }
.auto-fund-ledger .movement-kind-label { display: block; margin-top: 3px; color: var(--muted); font-size: .72rem; }
.vehicle-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.vehicle-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-decoration: none; }
.vehicle-card:hover { border-color: #a8bab5; }
.vehicle-card-photo { display: grid; height: 190px; place-items: center; overflow: hidden; color: #76928a; background: #e4efeb; font-size: 1.2rem; font-weight: 800; letter-spacing: .12em; }
.vehicle-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-card-body { padding: 18px; }
.vehicle-card-body h2 { margin: 14px 0 4px; font-size: 1.12rem; }
.vehicle-card-body p { margin: 0; color: var(--muted); font-size: .82rem; }
.vehicle-card-body .financial-amount { display: block; margin-bottom: 0; }
.vehicle-status-purchased { color: #245b72; border-color: #b8d3df; background: #eff7fa; }
.vehicle-status-preparation { color: var(--warning); border-color: #dfc38c; background: #fff9ed; }
.vehicle-status-listed { color: #5b478c; border-color: #cfc2e8; background: #f7f3fc; }
.vehicle-status-sold { color: var(--positive); border-color: #b7d8ca; background: #eff8f4; }
.vehicle-form { max-width: 1040px; }
.vehicle-required-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.vehicle-optional-panel { padding: 0; overflow: hidden; }
.vehicle-optional-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; cursor: pointer; list-style: none; }
.vehicle-optional-panel > summary::-webkit-details-marker { display: none; }
.vehicle-optional-panel > summary > span:first-child { display: grid; gap: 3px; }
.vehicle-optional-panel > summary small { color: var(--muted); }
.vehicle-optional-panel[open] > summary { border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.vehicle-optional-content { padding: 22px; }
.vehicle-textarea { min-height: 110px; resize: vertical; }
.vehicle-state-text { font-size: 1.2rem !important; white-space: normal; }
.vehicle-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.detail-list div { padding: 12px 0; border-bottom: 1px solid var(--border); }
.detail-list div:nth-child(odd) { padding-right: 16px; }
.detail-list dt { color: var(--muted); font-size: .76rem; font-weight: 650; }
.detail-list dd { margin: 3px 0 0; font-weight: 680; }
.vehicle-copy-block h3 { margin: 0 0 4px; font-size: .86rem; }
.vehicle-copy-block h3:not(:first-child) { margin-top: 20px; }
.vehicle-copy-block p { margin: 0; color: var(--muted); white-space: pre-wrap; }
.vehicle-gallery-section { margin-top: 20px; }
.vehicle-photo-form { padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.file-control { padding-block: 7px; }
.vehicle-gallery { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.vehicle-photo { min-width: 0; margin: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-subtle); }
.vehicle-photo > a { display: block; height: 175px; background: #e4ebe8; }
.vehicle-photo img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-photo figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; }
.vehicle-photo figcaption > span { overflow: hidden; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.vehicle-photo form { margin: 0; }
.future-module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 20px; }
.future-module-grid h2 { margin: 0; font-size: 1rem; }
.vehicle-financial-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vehicle-finance-grid { grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); margin-bottom: 20px; }
.vehicle-operation-form { align-items: end; margin-bottom: 18px; }
.vehicle-operation-form .money-input { width: 130px; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.table-actions form { margin: 0; }
.amount-positive { color: var(--positive); }
.amount-negative { color: var(--danger); }
.reports-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.report-net-card { border-color: #b9d4cc; background: #f3faf7; }
.reports-section { margin-bottom: 20px; }
.report-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--border); }
.report-metric { display: grid; align-content: start; gap: 5px; min-height: 112px; padding: 16px; background: var(--surface-subtle); }
.report-metric span { color: var(--muted); font-size: .76rem; }
.report-metric a { overflow: hidden; color: var(--text); font-size: .82rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.report-metric strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.reports-chart-grid, .reports-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; }
.report-chart-card { min-width: 0; }
.line-chart { display: block; width: 100%; height: 210px; overflow: visible; border-radius: 8px; background: linear-gradient(to bottom, #f8fbfa, #fff); }
.chart-axis { stroke: #dce4e1; stroke-width: .5; vector-effect: non-scaling-stroke; }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.profit-chart .chart-line { stroke: var(--positive); }
.chart-caption { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--muted); font-size: .72rem; }
.chart-caption strong { color: var(--text); font-size: .9rem; }
.status-chart { display: grid; gap: 16px; }
.status-chart-row > div:first-child { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: .8rem; }
.status-chart-track { height: 12px; overflow: hidden; border-radius: 999px; background: #edf1ef; }
.status-chart-bar { display: block; min-width: 0; height: 100%; border: 0; border-radius: inherit; }
.report-footnote { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
.report-detail-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.period-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.period-card { display: block; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-decoration: none; }
.period-card:hover { border-color: #a8bab5; }
.period-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.period-card h3 { margin: 16px 0 4px; font-size: 1rem; }
.period-card p { margin: 0; color: var(--muted); font-size: .8rem; }
.period-card .financial-amount { margin-bottom: 0; }
.status-success { color: var(--positive); border-color: #b7d8ca; background: #eff8f4; }
.status-open { color: #245b72; border-color: #b8d3df; background: #eff7fa; }
.table-card-heading { margin: 0; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.weekly-document-intro { margin-bottom: 18px; border-color: #b9d4cc; background: #f7fbf9; }
.weekly-document-intro h2 { margin: 0; font-size: 1.2rem; }
.period-item-composer { margin-bottom: 18px; }
.table-editor-input { min-width: 190px; }
.table-editor-amount { width: 130px; margin-left: auto; text-align: right; }
.editable-period-row td { background: #fcfefd; }
.editable-period-row:focus-within td { background: #f4faf7; }
.button-icon { width: 34px; padding-inline: 0; }
.weekly-close-stage { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--border); }
.close-panel { max-width: none; padding: 0; overflow: hidden; }
.close-panel-trigger { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; cursor: pointer; list-style: none; }
.close-panel-trigger::-webkit-details-marker { display: none; }
.close-panel-trigger > span:first-child { display: grid; gap: 3px; }
.close-panel-trigger strong { font-size: 1.1rem; }
.close-panel-trigger small { color: var(--muted); font-weight: 500; }
.close-panel[open] .close-panel-trigger { border-bottom: 1px solid var(--border); background: var(--surface-subtle); }
.close-panel-content { padding: 22px; }
.summary-strip, .close-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-subtle); }
.summary-strip { margin-bottom: 22px; }
.close-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.summary-strip div, .close-summary div { display: grid; gap: 3px; }
.summary-strip span, .close-summary span { color: var(--muted); font-size: .75rem; }
.summary-strip strong, .close-summary strong { font-variant-numeric: tabular-nums; }
.closed-summary-grid { margin-top: 20px; }

.week-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.week-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 15px;
  padding: 20px;
  text-decoration: none;
}
.week-card:hover { border-color: #a8bab5; }
.week-card small { display: block; margin-top: 2px; color: var(--muted); }
.week-number { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: var(--primary); background: #e2f0eb; font-weight: 800; }

.result-section { margin-bottom: 18px; overflow: hidden; }
.result-section .section-heading { align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.result-list { display: grid; }
.result-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; text-decoration: none; }
.result-item + .result-item { border-top: 1px solid var(--border); }
.result-item:hover { background: var(--surface-subtle); }
.result-item small { display: block; margin-top: 3px; color: var(--muted); }
.status-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; color: #4c5963; background: var(--surface-subtle); font-size: .72rem; font-weight: 700; }
.empty-state { padding: 34px; text-align: center; }
.empty-state.compact { border: 0; border-radius: 0; box-shadow: none; }
.empty-state h2 { margin-top: 0; }
.empty-state p { margin-bottom: 0; color: var(--muted); }
.empty-state .button { margin-top: 18px; }

.message { padding: 12px 14px; border: 1px solid; border-radius: 8px; }
.message-success { border-color: #acd6c3; color: #155f45; background: #effaf5; }
.message-error { border-color: #e1b1b1; color: #8b2e2e; background: #fff4f4; }

.sidebar-backdrop { position: fixed; inset: 0; z-index: 25; background: rgb(8 20 18 / 45%); }

@media (max-width: 980px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .form-panel { max-width: none; }
  .period-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .close-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .weekly-creation-fields { grid-template-columns: 1fr 1fr; }
  .budget-family-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .auto-fund-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auto-fund-form-grid .field-wide { grid-column: 1 / -1; }
  .vehicle-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vehicle-required-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .vehicle-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reports-summary-grid, .report-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body.sidebar-open { overflow: hidden; }
  .sidebar { transform: translateX(-105%); transition: transform 160ms ease-out; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .menu-button { display: inline-grid; place-items: center; flex: 0 0 auto; }
  .topbar { min-height: 64px; padding: 10px 16px; }
  .global-search .button { padding-inline: 11px; }
  .content { padding: 26px 16px 48px; }
  .page-header { align-items: stretch; flex-direction: column; }
  .summary-grid, .week-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: auto; }
  .result-item { align-items: flex-start; }
  .toolbar, .inline-form { align-items: stretch; flex-direction: column; }
  .toolbar-total { justify-content: space-between; padding-top: 14px; border-top: 1px solid var(--border); }
  .form-grid, .extra-row { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .note-item { grid-template-columns: auto minmax(0, 1fr); }
  .note-item .button, .note-item > .status-badge { grid-column: 2; justify-self: start; }
  .data-table th, .data-table td { padding: 12px; }
  .creation-grid, .period-grid, .summary-strip, .close-summary { grid-template-columns: 1fr; }
  .weekly-creation-fields, .budget-family-grid { grid-template-columns: 1fr; }
  .row-actions { min-width: 220px; }
  .close-panel-trigger { align-items: stretch; flex-direction: column; }
  .close-panel-trigger .button { width: 100%; }
  .auto-fund-balance { width: 100%; text-align: left; }
  .auto-fund-form-grid { grid-template-columns: 1fr; }
  .auto-fund-form-grid .field-wide { grid-column: auto; }
  .vehicle-grid, .vehicle-required-grid, .vehicle-detail-grid, .future-module-grid, .vehicle-finance-grid { grid-template-columns: 1fr; }
  .vehicle-optional-panel > summary { align-items: stretch; flex-direction: column; }
  .vehicle-optional-panel > summary .button { width: 100%; }
  .vehicle-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reports-summary-grid, .report-metric-grid, .reports-chart-grid, .reports-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .vehicle-gallery { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
