:root {
  --ink: #19261f;
  --muted: #6a766f;
  --forest: #214c3b;
  --forest-2: #36705a;
  --pea: #a6c96b;
  --pea-soft: #e9f1d9;
  --cream: #f4f1e8;
  --paper: #fffdf8;
  --line: #dddcd2;
  --plum: #6b4968;
  --plum-soft: #eee3ed;
  --amber: #c98c3b;
  --blue: #557b8c;
  --danger: #a5483f;
  --shadow: 0 16px 50px rgba(31, 55, 43, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--cream); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.5; }
a { color: var(--forest-2); text-decoration: none; }
a:hover { color: var(--forest); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px 18px; color: #eef4ed; background: var(--forest); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; color: white; }
.brand:hover { color: white; }
.brand-mark { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50% 44% 50% 45%; color: var(--forest); background: var(--pea); font-family: Georgia, serif; font-size: 21px; font-weight: 700; box-shadow: inset -6px -4px 0 rgba(33, 76, 59, .1); transform: rotate(-4deg); }
.brand-mark.large { width: 50px; height: 50px; font-size: 27px; }
.brand strong { display: block; font-family: Georgia, "Times New Roman", serif; font-size: 22px; line-height: 1.1; }
.brand small { color: #b9c9bf; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 9px 12px; color: #cbd8d0; border-radius: 10px; font-weight: 620; }
.nav a span { width: 18px; color: #9fbaa9; font-size: 17px; text-align: center; }
.nav a:hover, .nav a.active { color: white; background: rgba(255,255,255,.1); }
.nav a.active span { color: var(--pea); }
.nav-label { margin: 22px 12px 7px; color: #8ba294; font-size: 10px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.sidebar-scrim { display: none; }
.read-only { display: flex; align-items: center; gap: 8px; color: #afc0b5; font-size: 12px; }
.read-only span { width: 7px; height: 7px; border-radius: 50%; background: var(--pea); box-shadow: 0 0 0 4px rgba(166,201,107,.12); }
.main-column { min-width: 0; }
.content { width: min(1480px, 100%); margin: 0 auto; padding: 34px 42px 24px; }
.mobile-header { display: none; }
.page-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 28px; }
.page-header h1 { margin: 2px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px, 3vw, 43px); font-weight: 500; letter-spacing: -.035em; line-height: 1.1; }
.eyebrow { margin: 0; color: var(--forest-2); font-size: 11px; font-weight: 780; letter-spacing: .14em; text-transform: uppercase; }
.page-subtitle { margin: 8px 0 0; color: var(--muted); }
.page-actions { flex: 0 0 auto; }
.legal-note { margin-top: 26px; padding: 18px 0 0; color: #879189; border-top: 1px solid var(--line); font-size: 11px; }

.button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; padding: 8px 15px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 680; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--forest); }
.button.primary:hover { color: white; background: #17392c; }
.button.secondary { color: var(--forest); background: var(--paper); border-color: var(--line); }
.button.ghost { color: inherit; background: transparent; border-color: var(--line); }
.sidebar .button.ghost { color: #d9e4dd; border-color: rgba(255,255,255,.18); }
.full { width: 100%; }

label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 680; }
input, select { width: 100%; min-height: 40px; padding: 8px 10px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 9px; outline: none; }
input:focus, select:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(54,112,90,.12); }
.period-form { display: flex; align-items: end; gap: 8px; }
.period-form input { width: 142px; }

.panel { padding: 23px; margin-bottom: 22px; background: var(--paper); border: 1px solid rgba(208,208,196,.85); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 23px; font-weight: 500; }
.panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.panel-heading > a { font-weight: 680; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi { min-height: 150px; padding: 19px; background: var(--paper); border: 1px solid rgba(208,208,196,.85); border-radius: 16px; box-shadow: var(--shadow); }
.kpi.household { background: linear-gradient(145deg, #fbfdf7, #edf4df); }
.kpi.business { background: linear-gradient(145deg, #fffdfb, #f2eaf1); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi > span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi > strong { display: block; margin: 22px 0 3px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(27px, 2.6vw, 37px); font-weight: 500; letter-spacing: -.03em; }
.kpi > small { display: block; color: var(--muted); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; }
.status-dot.amber { background: var(--amber); box-shadow: 0 0 0 5px #f4e8d5; }
.status-dot.blue { background: var(--blue); box-shadow: 0 0 0 5px #e1ebed; }
.pill { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 10px; font-weight: 760; letter-spacing: .02em; white-space: nowrap; }
.pill.green { color: #355e35; background: var(--pea-soft); }
.pill.plum { color: var(--plum); background: var(--plum-soft); }
.pill.neutral { color: #5f6a64; background: #eceee9; }

.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.chart-panel { overflow: hidden; }
.split-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.mini-chart h3 { margin: 0 0 13px; font-size: 13px; }
.chart-row { display: grid; grid-template-columns: 70px minmax(70px, 1fr) 80px; gap: 11px; align-items: center; min-height: 39px; border-top: 1px solid #edede6; }
.chart-row > span, .chart-row > small { color: var(--muted); font-size: 11px; }
.chart-row > small { text-align: right; font-variant-numeric: tabular-nums; }
.double-meter { display: grid; gap: 3px; }
meter { width: 100%; height: 8px; border: 0; background: #ecede8; border-radius: 999px; }
meter::-webkit-meter-bar { background: #ecede8; border: 0; border-radius: 999px; }
meter::-webkit-meter-optimum-value { background: var(--forest-2); border-radius: 999px; }
meter::-moz-meter-bar { background: var(--forest-2); border-radius: 999px; }
meter.spending::-webkit-meter-optimum-value { background: #c48765; }
meter.spending::-moz-meter-bar { background: #c48765; }
.legend { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 11px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--forest-2); }
.legend i.spending { margin-left: 7px; background: #c48765; }
.rank-list { display: grid; gap: 2px; }
.rank-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 16px; padding: 11px 2px; color: var(--ink); border-top: 1px solid #edede6; }
.rank-row:hover { color: var(--forest); }
.rank-row span:first-child { min-width: 0; }
.rank-row strong, .rank-row small { display: block; }
.rank-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.rank-row small { color: var(--muted); font-size: 11px; }
.rank-row meter { grid-column: 1 / -1; height: 5px; }
.rank-value { font-variant-numeric: tabular-nums; font-weight: 720; }

.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 9px 11px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .09em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 13px 11px; border-bottom: 1px solid #edede6; vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #faf9f3; }
.numeric { text-align: right !important; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.transaction-link { color: var(--ink); font-weight: 660; }
.transaction-link:hover { color: var(--forest-2); }
.category-label { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.amount { white-space: nowrap; font-weight: 710; }
.amount.positive { color: var(--forest-2); }
.amount.negative { color: #6c5145; }
.tag-line { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { display: inline-block; padding: 2px 7px; color: #536a3d; background: var(--pea-soft); border-radius: 999px; font-size: 10px; font-weight: 670; }
.tag.large { padding: 5px 10px; font-size: 12px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-panel { padding: 16px; }
.filter-form { display: grid; gap: 12px; }
.filter-top { display: grid; grid-template-columns: minmax(240px, 1fr) auto; gap: 11px; align-items: end; }
.filter-details summary { display: none; }
.filter-options { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); gap: 11px; align-items: end; }
.filter-actions { display: flex; gap: 7px; }
.active-filter-dot { padding: 2px 7px; color: #536a3d; background: var(--pea-soft); border-radius: 999px; font-size: 10px; letter-spacing: .03em; text-transform: uppercase; }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--muted); }
.pagination > div { display: flex; gap: 8px; }
.detail-list { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px 18px; margin: 18px 0 0; }
.detail-list dt { color: var(--muted); font-size: 12px; }
.detail-list dd { margin: 0; font-weight: 620; }
.detail-list.inline { grid-template-columns: 130px minmax(0, 1fr); }
.break-all { overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }

.travel-summary { position: relative; display: flex; justify-content: space-between; align-items: center; min-height: 190px; margin-bottom: 22px; padding: 30px 34px; color: white; background: linear-gradient(120deg, var(--forest), #396a55); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); }
.travel-summary > div:first-child { position: relative; z-index: 2; }
.travel-summary span, .travel-summary small, .travel-summary strong { display: block; }
.travel-summary > div:first-child > span { color: #c7d8cc; font-size: 12px; font-weight: 700; }
.travel-summary strong { margin: 10px 0 2px; font-family: Georgia, serif; font-size: 42px; font-weight: 500; }
.travel-summary small { color: #b8cbc0; }
.travel-art { position: absolute; right: 5%; display: flex; gap: 12px; align-items: center; color: var(--pea); opacity: .45; transform: rotate(-9deg); }
.travel-art span:nth-child(1) { font-size: 78px; }
.travel-art span:nth-child(2) { font-size: 120px; }
.travel-art span:nth-child(3) { font-size: 36px; }
.trip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.trip-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 22px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.trip-card:hover { color: var(--ink); border-color: #bfcbb7; transform: translateY(-1px); }
.trip-icon { display: grid; place-items: center; width: 44px; height: 44px; color: var(--forest); background: var(--pea-soft); border-radius: 50%; font-size: 20px; }
.trip-card h2 { margin: 2px 0; font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.trip-card p { margin: 0; color: var(--muted); font-size: 11px; }
.trip-card > strong { font-size: 17px; }

.account-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.account-card { padding: 21px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.account-head { display: flex; gap: 11px; align-items: center; }
.account-head strong, .account-head small { display: block; }
.account-head small { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.account-icon { display: grid; place-items: center; width: 38px; height: 38px; color: var(--forest); background: var(--pea-soft); border-radius: 11px; font-family: Georgia, serif; font-size: 19px; }
.account-balance { margin: 24px 0 18px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.account-balance span, .account-balance small, .account-balance strong { display: block; }
.account-balance span, .account-balance small { color: var(--muted); font-size: 11px; }
.account-balance strong { margin: 4px 0 1px; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.account-card dl { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 0 0 17px; font-size: 12px; }
.account-card dt { color: var(--muted); }
.account-card dd { margin: 0; text-align: right; }
.account-card > a { font-size: 12px; font-weight: 700; }

.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.report-card { display: block; padding: 22px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.report-card:hover { color: var(--ink); border-color: #bfcbb7; transform: translateY(-1px); }
.report-card h2 { margin: 20px 0 3px; font-family: Georgia, serif; font-size: 28px; font-weight: 500; }
.report-card p { margin: 0 0 20px; color: var(--muted); font-size: 12px; }
.report-card > span:last-child { color: var(--forest-2); font-size: 12px; font-weight: 700; }
.report-type { padding: 4px 8px; color: var(--plum); background: var(--plum-soft); border-radius: 999px; font-size: 10px; font-weight: 750; text-transform: capitalize; }
.report-content { max-height: 75vh; margin: 0; padding: 8px; overflow: auto; color: #26342d; background: transparent; font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.raw-text { color: #4c5851; }
.rendered-report { max-width: 920px; font: 15px/1.7 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; white-space: normal; }
.rendered-report h1, .rendered-report h2, .rendered-report h3 { font-family: Georgia, serif; font-weight: 500; line-height: 1.2; }
.rendered-report h1 { margin-top: 0; font-size: 32px; }
.rendered-report h2 { margin: 30px 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 23px; }
.rendered-report h3 { margin-top: 24px; font-size: 18px; }
.rendered-report code { padding: 2px 5px; background: #eef0ea; border-radius: 5px; }
.rendered-report pre { padding: 14px; overflow: auto; background: #f2f2ec; border-radius: 10px; }
.rendered-report table { width: 100%; border-collapse: collapse; }
.rendered-report th, .rendered-report td { padding: 9px; border-bottom: 1px solid var(--line); text-align: left; }
.rendered-report blockquote { margin-left: 0; padding-left: 16px; color: var(--muted); border-left: 3px solid var(--pea); }
.review-list { display: grid; }
.review-list > a { display: flex; justify-content: space-between; gap: 16px; padding: 12px 2px; color: var(--ink); border-top: 1px solid #edede6; }
.review-list strong, .review-list small { display: block; }
.review-list strong { font-size: 13px; }
.review-list small { color: var(--muted); font-size: 11px; }
.review-list > a > span:last-child { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.compact-kpis .kpi { min-height: 125px; }
.compact-kpis .kpi > strong { margin-top: 15px; }

.empty-state { padding: 48px 20px; color: var(--muted); text-align: center; }
.empty-state.compact { padding: 24px 10px; }
.muted { color: var(--muted); }
.alert { margin: 18px 0; padding: 11px 13px; border-radius: 10px; }
.alert.error { color: #79372f; background: #fae6e2; border: 1px solid #ebc2bc; }

.cash-flow-controls-panel { padding: 18px 20px; }
.cash-flow-controls { display: grid; grid-template-columns: minmax(190px, 1.35fr) minmax(150px, 1fr) minmax(150px, 1fr) auto; gap: 12px; align-items: end; }
.cash-flow-controls > [data-period-field][hidden] { display: none; }
.cash-flow-controls .button { min-height: 40px; }
.cash-flow-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.cash-flow-kpi { min-height: 124px; }
.cash-flow-kpi > strong { margin-top: 14px; }
.cash-flow-panel { overflow: hidden; }
.cash-flow-heading { align-items: center; }
.cash-flow-period { margin: 5px 0 0; font-size: 12px; }
.cash-flow-chart { width: 100%; min-height: 520px; transition: height .2s ease; }
.cash-flow-loading, .cash-flow-empty { display: grid; place-items: center; min-height: 420px; padding: 30px; color: var(--muted); text-align: center; }
.cash-flow-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.coverage-list { margin-top: 15px; }
.coverage-list > p { margin: 9px 0 0; }
.coverage-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid #edede6; }
.coverage-row span { min-width: 0; overflow-wrap: anywhere; }
.coverage-row strong { flex: 0 0 auto; color: var(--muted); font-size: 12px; font-weight: 650; text-align: right; }
.cash-flow-warning { padding-left: 13px; border-left: 3px solid var(--amber); }

.login-page { display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 20% 10%, #edf2df 0, transparent 35%), var(--cream); }
.login-shell { display: grid; grid-template-columns: 1.15fr .85fr; width: min(960px, 100%); min-height: 570px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 30px 90px rgba(35,63,49,.15); }
.login-intro { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 58px; color: white; background: linear-gradient(145deg, #193d2f, #35664f); overflow: hidden; }
.login-intro::after { content: ""; position: absolute; right: -80px; bottom: -90px; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 55px rgba(255,255,255,.035), 0 0 0 110px rgba(255,255,255,.02); }
.login-brand { position: absolute; top: 40px; display: flex; align-items: center; gap: 12px; font-family: Georgia, serif; font-size: 25px; }
.login-intro h1 { position: relative; z-index: 1; max-width: 500px; margin: 45px 0 15px; font-family: Georgia, serif; font-size: clamp(35px, 4vw, 53px); font-weight: 500; letter-spacing: -.035em; line-height: 1.05; }
.login-intro p { position: relative; z-index: 1; max-width: 470px; color: #c5d5cb; font-size: 16px; }
.privacy-note { position: absolute; bottom: 40px; display: flex; gap: 8px; color: #aebfb5; font-size: 11px; text-transform: uppercase; letter-spacing: .09em; }
.privacy-note span { color: var(--pea); }
.login-card { align-self: center; padding: 50px; }
.login-card h2 { margin: 2px 0 0; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.login-card > p.muted { margin-top: 6px; }
.stack-form { display: grid; gap: 15px; margin-top: 30px; }
.stack-form input { min-height: 46px; }
.stack-form button { margin-top: 4px; min-height: 46px; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-grid, .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-options { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .cash-flow-controls { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
  .cash-flow-controls .button { grid-column: auto; }
}

@media (max-width: 850px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: 258px; transition: transform .2s ease; box-shadow: 24px 0 60px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-scrim { position: fixed; inset: 0; z-index: 19; display: block; padding: 0; background: rgba(16, 29, 23, .48); border: 0; }
  body.menu-open { overflow: hidden; }
  .mobile-header { position: sticky; top: 0; z-index: 15; display: flex; justify-content: space-between; align-items: center; height: 58px; padding: 0 20px; background: rgba(244,241,232,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
  .menu-button { min-width: 44px; min-height: 44px; padding: 6px 10px; color: var(--forest); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
  .mobile-brand { color: var(--forest); font-family: Georgia, serif; font-size: 20px; font-weight: 700; }
  .content { padding: 26px 20px 20px; }
  .page-header { display: block; }
  .page-actions { margin-top: 18px; }
  .two-column, .split-charts, .trip-grid { grid-template-columns: 1fr; }
  .cash-flow-details { grid-template-columns: 1fr; }
  .filter-options { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
  .login-shell { grid-template-columns: 1fr; }
  .login-intro { min-height: 300px; padding: 42px; }
  .login-intro h1 { margin-top: 65px; font-size: 38px; }
  .privacy-note { display: none; }
}

@media (max-width: 580px) {
  .content { padding: 22px 13px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .account-grid, .report-grid { grid-template-columns: 1fr; }
  .kpi { min-height: 135px; padding: 14px; }
  .kpi > strong { margin-top: 16px; font-size: clamp(19px, 5.6vw, 26px); white-space: nowrap; }
  .panel { padding: 17px; border-radius: 14px; }
  .period-form { display: grid; grid-template-columns: 1fr 1fr; }
  .period-form input { width: 100%; }
  .period-form button { grid-column: 1 / -1; }
  .cash-flow-controls-panel { padding: 14px; }
  .cash-flow-controls { grid-template-columns: 1fr; }
  .cash-flow-controls .button { grid-column: auto; min-height: 44px; }
  .cash-flow-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cash-flow-kpis .kpi:last-child { grid-column: 1 / -1; }
  .cash-flow-heading { display: grid; align-items: stretch; }
  .cash-flow-heading .button { min-height: 44px; }
  .cash-flow-chart { margin: 0 -8px; width: calc(100% + 16px); min-height: 620px; }
  .coverage-row { display: grid; gap: 2px; }
  .coverage-row strong { text-align: left; }
  .filter-top { grid-template-columns: 1fr; }
  .filter-actions { grid-column: auto; }
  .filter-actions .button { flex: 1; min-height: 44px; }
  .filter-details { padding-top: 10px; border-top: 1px solid var(--line); }
  .filter-details summary { display: flex; justify-content: space-between; align-items: center; min-height: 44px; color: var(--forest); cursor: pointer; font-weight: 700; list-style: none; }
  .filter-details summary::-webkit-details-marker { display: none; }
  .filter-details summary::after { content: "+"; margin-left: auto; padding-left: 10px; font-size: 21px; font-weight: 400; }
  .filter-details[open] summary::after { content: "−"; }
  .filter-details summary .active-filter-dot { margin-left: 8px; }
  .filter-options { grid-template-columns: 1fr; padding-top: 10px; }
  .chart-row { grid-template-columns: 62px minmax(60px, 1fr) 69px; }
  .table-panel { padding: 12px; }
  .mobile-cards { overflow: visible; }
  .mobile-cards .data-table { display: block; min-width: 0; }
  .mobile-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .mobile-cards tbody { display: grid; gap: 10px; }
  .mobile-cards tr { display: block; padding: 11px 13px; background: #fffdf8; border: 1px solid var(--line); border-radius: 12px; }
  .mobile-cards td { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; padding: 6px 0; border: 0; text-align: left !important; overflow-wrap: anywhere; }
  .mobile-cards td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
  .mobile-cards tbody tr:hover { background: #fffdf8; }
  .pagination { align-items: stretch; flex-direction: column; }
  .pagination > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-list, .detail-list.inline { grid-template-columns: 1fr; gap: 2px; }
  .detail-list dd { margin-bottom: 10px; }
  .trip-card { grid-template-columns: auto minmax(0, 1fr); }
  .trip-card > strong { grid-column: 2; }
  .travel-summary { padding: 24px; }
  .travel-summary strong { font-size: 34px; }
  .login-page { padding: 12px; }
  .login-shell { min-height: calc(100vh - 24px); border-radius: 18px; }
  .login-intro { min-height: 260px; padding: 28px; }
  .login-brand { top: 26px; }
  .login-intro h1 { margin-top: 65px; font-size: 32px; }
  .login-intro p { font-size: 14px; }
  .login-card { padding: 32px 26px; }
}

@media (max-width: 350px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .cash-flow-kpis { grid-template-columns: 1fr; }
  .cash-flow-kpis .kpi:last-child { grid-column: auto; }
}

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