:root {
  color-scheme: light;
  --ink: #182127;
  --muted: #647079;
  --line: #dce2e5;
  --surface: #ffffff;
  --canvas: #f4f6f6;
  --sidebar: #20292d;
  --teal: #087f78;
  --teal-soft: #e4f3f1;
  --green: #39734f;
  --amber: #b76b12;
  --amber-soft: #fff3df;
  --red: #b43d3d;
  --red-soft: #fdeaea;
  --blue: #326b94;
  --shadow: 0 12px 32px rgba(31, 43, 48, .09);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--canvas); color: var(--ink); }
body.drawer-open { overflow: hidden; }
button, input, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: default; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); color: #fff; z-index: 20; }
.brand { height: 70px; display: flex; align-items: center; gap: 11px; padding: 0 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-symbol { display: grid; place-items: center; width: 34px; height: 34px; border: 2px solid #59b9b0; color: #76d2ca; font-weight: 800; font-size: 18px; }
.brand div { display: grid; gap: 2px; }
.sidebar-close { display: none; margin-left: auto; border-color: rgba(255,255,255,.18); color: #dce3e5; background: transparent; }
.sidebar-scrim { display: none; }
.brand strong { font-size: 14px; }
.brand span:last-child { color: #aebac0; font-size: 11px; }
.nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.nav-section { display: block; padding: 18px 10px 7px; color: #829097; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.nav-item { width: 100%; height: 40px; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: #c9d0d3; text-align: left; text-decoration: none; font-size: 13px; }
.nav-item:hover:not(:disabled), .nav-item.is-active { background: rgba(255,255,255,.09); color: #fff; }
.nav-item.is-active { box-shadow: inset 3px 0 #59b9b0; }
.nav-item:disabled { opacity: .56; }
.nav-item small { color: #7f8b91; font-size: 10px; }
.sidebar-foot { min-height: 68px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-foot div { min-width: 0; display: grid; gap: 3px; }
.sidebar-foot strong, .sidebar-foot span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot strong { font-size: 11px; }
.sidebar-foot span { color: #9ba7ad; font-size: 10px; }
.source-dot { width: 8px; height: 8px; border-radius: 50%; background: #78858b; flex: 0 0 auto; }
.source-dot.is-live { background: #54b97b; box-shadow: 0 0 0 4px rgba(84,185,123,.14); }

.workspace { min-width: 0; }
.topbar { height: 58px; position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.breadcrumb svg { width: 14px; }
.breadcrumb strong { color: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.freshness { height: 32px; display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 11px; background: #fff; }
.freshness.is-stale { color: var(--amber); border-color: #e7c58e; background: var(--amber-soft); }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 auto; padding: 0; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--surface); }
.icon-button:hover:not(:disabled) { color: var(--ink); border-color: #aeb8bd; background: #f7f8f8; }
.sidebar-toggle { display: none; }

.main { width: min(1680px, 100%); margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.page-head h1 { margin: 0; font-size: 25px; line-height: 1.2; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.quick-ranges { display: flex; gap: 2px; padding: 3px; background: #e7ebec; border-radius: 5px; }
.quick-ranges button { height: 30px; min-width: 58px; padding: 0 10px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; }
.quick-ranges button.is-active { color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.filter-bar { display: grid; grid-template-columns: 130px 130px 145px minmax(160px,1.3fr) 110px minmax(160px,1.2fr) 120px auto; gap: 8px; align-items: end; padding: 12px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.filter-bar label { min-width: 0; display: grid; gap: 5px; }
.filter-bar label > span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.filter-bar input, .filter-bar select { width: 100%; height: 36px; min-width: 0; padding: 0 9px; border: 1px solid #ccd4d7; border-radius: 3px; background: #fff; color: var(--ink); font-size: 12px; }
.filter-bar input:focus, .filter-bar select:focus { outline: 2px solid rgba(8,127,120,.2); border-color: var(--teal); }
.filter-actions { display: flex; gap: 6px; }
.primary-button { height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border: 1px solid var(--teal); border-radius: 4px; background: var(--teal); color: #fff; font-weight: 700; font-size: 12px; }
.primary-button:hover { background: #066e68; }

.notice { min-height: 46px; margin: 14px 0; padding: 12px 14px; border-left: 3px solid var(--amber); background: var(--amber-soft); color: #684719; font-size: 13px; }
.notice.is-error { border-color: var(--red); background: var(--red-soft); color: #762c2c; }
.notice.is-empty { border-color: var(--blue); background: #eaf2f7; color: #295775; }

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { min-height: 112px; padding: 14px; border: 1px solid var(--line); border-top: 3px solid #9aa7ad; border-radius: 5px; background: var(--surface); }
.kpi-action { width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.kpi-action:hover { border-right-color: #aab9bf; border-bottom-color: #aab9bf; border-left-color: #aab9bf; box-shadow: 0 3px 10px rgba(24,33,39,.08); }
.kpi-action:focus-visible { outline: 3px solid rgba(10,125,117,.28); outline-offset: 2px; }
.kpi-action:active { transform: translateY(1px); }
.kpi[data-tone="teal"] { border-top-color: var(--teal); }
.kpi[data-tone="green"] { border-top-color: var(--green); }
.kpi[data-tone="amber"] { border-top-color: var(--amber); }
.kpi[data-tone="red"] { border-top-color: var(--red); }
.kpi[data-tone="blue"] { border-top-color: var(--blue); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); }
.kpi-head span { font-size: 10px; font-weight: 700; text-transform: uppercase; }
.kpi-head svg { width: 16px; height: 16px; }
.kpi strong { display: block; margin-top: 13px; overflow: hidden; font-size: clamp(20px, 1.65vw, 29px); line-height: 1.15; white-space: nowrap; text-overflow: ellipsis; }
.kpi small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.kpi.is-loading { border-top-color: #d9dfe1; }
.skeleton { display: block; border-radius: 3px; background: #edf0f1; animation: pulse 1.2s ease-in-out infinite; }
.skeleton.line { width: 58%; height: 10px; }
.skeleton.value { width: 76%; height: 27px; margin-top: 20px; }
@keyframes pulse { 50% { opacity: .48; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .8s linear infinite; }

.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(360px, 1fr); gap: 12px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.panel > header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #e7ebec; }
.panel h2 { margin: 3px 0 0; font-size: 15px; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.panel-meta { color: var(--muted); font-size: 10px; }
.chart-filter-clear.is-active { color: var(--teal); border-color: #83bdb7; background: var(--teal-soft); }
.trend-panel { grid-column: 1; }
.compact-panel { min-height: 330px; }
.chart { width: 100%; }
.chart-large { height: 310px; }
.chart-medium { height: 258px; }

.late-filter-bar { grid-template-columns: 112px 112px 104px minmax(132px, 1fr) minmax(124px, .9fr) minmax(150px, 1.15fr) 108px minmax(160px, 1.05fr) auto; }
.is-on-time-expenses .late-filter-bar { grid-template-columns: 126px 126px 118px minmax(165px, 1.15fr) minmax(145px, 1fr) minmax(185px, 1.3fr) auto; }
.provision-filter-bar { grid-template-columns: 112px 112px 128px minmax(165px, 1fr) minmax(190px, 1.25fr) minmax(170px, 1fr) auto; }
.definition-strip { min-height: 42px; display: flex; align-items: center; gap: 9px; padding: 9px 12px; margin-bottom: 12px; border: 1px solid #cbdde7; border-left: 3px solid var(--blue); background: #eef5f8; color: #315b71; font-size: 11px; }
.definition-strip svg { width: 16px; flex: 0 0 auto; }
.definition-strip span { color: var(--muted); }
.late-analysis-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.late-trend-panel { grid-column: 1 / -1; }
.late-record-panel { margin-top: 12px; }
.late-record-table { min-width: 1540px; }
.late-record-table th:nth-child(1) { width: 165px; }
.late-record-table th:nth-child(2) { width: 205px; }
.late-record-table th:nth-child(3) { width: 260px; }
.late-record-table th:nth-child(4), .late-record-table th:nth-child(5), .late-record-table th:nth-child(6) { width: 112px; }
.late-record-table th:nth-child(7) { width: 180px; }
.late-record-table th:nth-child(8) { width: 205px; }
.late-record-table th:nth-child(9) { width: 130px; }
.late-record-table th:nth-child(10) { width: 155px; }
.late-record-table th:nth-child(11) { width: 108px; }
.sort-button { width: 100%; min-height: 34px; display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; text-align: left; text-transform: uppercase; cursor: pointer; }
.sort-button.is-number { justify-content: flex-end; }
.sort-button svg { width: 12px; height: 12px; opacity: .48; }
th[aria-sort="ascending"] .sort-button, th[aria-sort="descending"] .sort-button { color: var(--teal); }
th[aria-sort="ascending"] .sort-button svg, th[aria-sort="descending"] .sort-button svg { opacity: 1; }
.lag-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 7px; border-radius: 3px; color: #8b4a09; background: #fde8c7; font-size: 9px; font-weight: 800; white-space: nowrap; }
.lag-badge.is-high { color: #a13d24; background: #fbe2d8; }
.lag-badge.is-critical { color: #8f2020; background: #fbdede; }
.lag-badge.is-on-time { color: #245d3a; background: #dff1e5; }
.date-basis-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 7px; border-radius: 3px; color: #315b71; background: #e4eef4; font-size: 9px; font-weight: 800; line-height: 1.25; }
.date-basis-badge.is-backdated { color: #8b4a09; background: #fde8c7; }
.date-basis-badge.is-both { color: #8f2020; background: #fbdede; }
.date-basis-badge.is-posting { color: #a13d24; background: #fbe2d8; }
.date-basis-badge.is-on_time { color: #245d3a; background: #dff1e5; }
.provision-status { display: inline-flex; min-height: 24px; align-items: center; padding: 0 7px; border-radius: 3px; font-size: 9px; font-weight: 800; line-height: 1.25; white-space: nowrap; }
.provision-status.is-no_evidence { color: #8f2020; background: #fbdede; }
.provision-status.is-partially_covered { color: #8b4a09; background: #fde8c7; }
.provision-status.is-provisioned { color: #245d80; background: #e1eef6; }
.provision-status.is-received_before_close { color: #245d3a; background: #dff1e5; }
.provision-status.is-credited { color: #4d5960; background: #e7ebec; }
.history-status { display: inline-flex; min-height: 24px; align-items: center; padding: 0 7px; border-radius: 3px; font-size: 9px; font-weight: 800; line-height: 1.25; white-space: nowrap; }
.history-status.is-provisioned_reversed_exact, .history-status.is-reversal { color: #8f2020; background: #fbdede; }
.history-status.is-provisioned_reversed { color: #8b4a09; background: #fde8c7; }
.history-status.is-provisioned_active, .history-status.is-provision { color: #245d3a; background: #dff1e5; }
.history-status.is-historical_evidence { color: #245d80; background: #e1eef6; }
.history-status.is-no_history, .history-status.is-neutral { color: #4d5960; background: #e7ebec; }
.gap-value { color: var(--red); }
.provision-record-table { min-width: 1840px; }
.provision-record-table th:nth-child(1) { width: 145px; }
.provision-record-table th:nth-child(2) { width: 220px; }
.provision-record-table th:nth-child(3) { width: 270px; }
.provision-record-table th:nth-child(4), .provision-record-table th:nth-child(5) { width: 105px; }
.provision-record-table th:nth-child(6) { width: 230px; }
.provision-record-table th:nth-child(7) { width: 190px; }
.provision-record-table th:nth-child(8), .provision-record-table th:nth-child(9), .provision-record-table th:nth-child(10) { width: 145px; }
.provision-record-table th:nth-child(11) { width: 104px; }
.table-link-button { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 9px; border: 1px solid #b9c5ca; border-radius: 4px; color: #315b71; background: #fff; font-size: 10px; font-weight: 750; text-decoration: none; white-space: nowrap; }
.table-link-button:hover { color: var(--ink); border-color: #82969e; background: #f4f8f9; }
.table-link-button svg { width: 14px; height: 14px; }

.exception-panel { margin-top: 12px; }
.table-actions { display: flex; align-items: center; gap: 10px; }
.table-summary { display: flex; align-items: baseline; gap: 5px; color: var(--muted); font-size: 11px; }
.table-summary strong { color: var(--ink); font-size: 18px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { height: 38px; padding: 0 12px; color: var(--muted); background: #f7f8f8; border-bottom: 1px solid var(--line); font-size: 9px; text-align: left; text-transform: uppercase; }
td { height: 54px; padding: 8px 12px; border-bottom: 1px solid #edf0f1; font-size: 11px; vertical-align: middle; }
tbody tr:hover { background: #f8faf9; }
th:nth-child(1) { width: 94px; } th:nth-child(2) { width: 150px; } th:nth-child(3) { width: 190px; } th:nth-child(5) { width: 100px; } th:nth-child(6) { width: 120px; } th:nth-child(7) { width: 52px; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.cell-sub { display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.severity { display: inline-flex; align-items: center; min-height: 23px; padding: 0 7px; border-radius: 3px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.severity.critical { color: #8f2020; background: #fbdede; }
.severity.high { color: #8b4a09; background: #fde8c7; }
.severity.medium { color: #245d80; background: #e1eef6; }
.severity.low { color: #3a6548; background: #e3f0e7; }
.pagination { min-height: 52px; display: flex; align-items: center; justify-content: space-between; padding: 8px 13px; color: var(--muted); font-size: 10px; }
.pagination div { display: flex; gap: 5px; }
.empty-row td { height: 110px; color: var(--muted); text-align: center; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 49; background: rgba(16,24,27,.36); }
.drawer { position: fixed; top: 0; right: 0; z-index: 50; width: min(760px, 94vw); height: 100vh; display: grid; grid-template-rows: auto minmax(0,1fr); background: #fff; box-shadow: -16px 0 42px rgba(16,24,27,.18); transform: translateX(102%); transition: transform .18s ease; }
.drawer.is-open { transform: translateX(0); }
.drawer > header { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.drawer h2 { margin: 3px 0 0; font-size: 18px; }
.drawer-body { overflow-y: auto; padding: 18px; }
.provision-case-drawer { width: min(1180px, 96vw); }
.case-drawer-actions { display: flex; align-items: center; gap: 6px; }
.case-drawer-actions > span { min-width: 58px; color: var(--muted); font-size: 10px; text-align: center; }
.case-verdict { min-height: 112px; display: grid; grid-template-columns: minmax(0,1fr) 240px; align-items: center; gap: 22px; padding: 18px; margin-bottom: 14px; border-left: 4px solid var(--blue); background: #eef5f8; }
.case-verdict.is-provisioned_reversed_exact, .case-verdict.is-provisioned_reversed { border-color: var(--amber); background: var(--amber-soft); }
.case-verdict.is-no_evidence { border-color: var(--red); background: var(--red-soft); }
.case-verdict h3 { margin: 4px 0 6px; font-size: 19px; }
.case-verdict p { max-width: 760px; margin: 0; color: #445159; font-size: 12px; line-height: 1.55; }
.case-verdict-amount { padding-left: 20px; border-left: 1px solid rgba(49,91,113,.22); text-align: right; }
.case-verdict-amount span, .case-verdict-amount small { display: block; color: var(--muted); font-size: 10px; }
.case-verdict-amount strong { display: block; margin: 5px 0; font-size: 24px; font-variant-numeric: tabular-nums; }
.case-summary-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.accounting-readout { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); margin-top: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.accounting-readout > div { min-height: 118px; display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 10px; align-content: start; padding: 16px; }
.accounting-readout > div + div { border-left: 1px solid var(--line); }
.accounting-readout svg { width: 18px; color: var(--teal); }
.accounting-readout span { color: #4f5c63; font-size: 11px; line-height: 1.55; }
.accounting-readout strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 11px; }
.case-timeline { padding: 4px 0 2px; }
.timeline-entry { min-height: 72px; display: grid; grid-template-columns: 112px 18px minmax(0,1fr); gap: 9px; position: relative; }
.timeline-entry time { padding-top: 3px; color: var(--muted); font-size: 10px; text-align: right; }
.timeline-entry::after { content: ''; position: absolute; top: 17px; bottom: -5px; left: 129px; width: 1px; background: var(--line); }
.timeline-entry:last-child::after { display: none; }
.timeline-marker { position: relative; z-index: 1; width: 11px; height: 11px; margin: 3px auto 0; border: 2px solid var(--blue); border-radius: 50%; background: #fff; }
.timeline-entry.is-provision .timeline-marker { border-color: var(--green); }
.timeline-entry.is-reversal .timeline-marker { border-color: var(--red); }
.timeline-entry.is-invoice .timeline-marker { border-color: var(--amber); }
.timeline-entry strong { font-size: 11px; }
.timeline-entry p { margin: 4px 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.timeline-amount { color: var(--ink); font-size: 10px; font-weight: 750; }
.case-detail-table { min-width: 900px; }
.case-evidence-table { min-width: 1120px; }
.case-method-note { margin: 18px 0 0; padding: 10px 12px; border-left: 3px solid #b6c5cb; background: #f5f7f7; color: var(--muted); font-size: 10px; line-height: 1.5; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.detail-grid div { min-height: 64px; padding: 10px; background: #fff; }
.detail-grid span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; }
.detail-grid strong { display: block; margin-top: 5px; overflow-wrap: anywhere; font-size: 12px; }
.detail-section { margin-top: 20px; }
.detail-section h3 { margin: 0 0 9px; font-size: 13px; }
.detail-section table { table-layout: auto; }
.detail-section th { white-space: nowrap; }
.detail-section td { height: 42px; }
.detail-issue { padding: 10px 12px; border-left: 3px solid var(--amber); background: var(--amber-soft); font-size: 11px; }
.detail-issue + .detail-issue { margin-top: 7px; }

.active-filter-dock { position: fixed; right: 24px; bottom: 20px; z-index: 30; width: min(620px, calc(100vw - 48px)); min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 11px 10px 14px; border: 1px solid #b8c7cc; border-left: 4px solid var(--teal); border-radius: 6px; background: rgba(255,255,255,.98); box-shadow: 0 12px 30px rgba(24,33,39,.17); }
.active-filter-summary { min-width: 0; display: flex; align-items: center; gap: 10px; }
.active-filter-summary > svg { width: 18px; height: 18px; flex: 0 0 auto; color: var(--teal); }
.active-filter-summary > div { min-width: 0; display: grid; gap: 3px; }
.active-filter-summary strong { font-size: 11px; }
.active-filter-summary span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.filter-reset-button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: 0 0 auto; padding: 0 12px; border: 1px solid #9aacb3; border-radius: 4px; color: #30434b; background: #fff; font-size: 11px; font-weight: 750; }
.filter-reset-button:hover { color: #fff; border-color: var(--teal); background: var(--teal); }
.filter-reset-button svg { width: 16px; height: 16px; }
body.has-filter-dock .main { padding-bottom: 96px; }

@media (max-width: 1520px) {
  .late-filter-bar { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
  .is-on-time-expenses .late-filter-bar { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
  .late-filter-bar .filter-actions { justify-content: flex-end; }
  .provision-filter-bar { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
  .provision-filter-bar .filter-actions { justify-content: flex-end; }
}

@media (max-width: 1280px) {
  .filter-bar { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .late-filter-bar { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .is-on-time-expenses .late-filter-bar { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
  .provision-filter-bar { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .filter-actions { justify-content: flex-end; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 940px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar.is-open + .sidebar-scrim { position: fixed; inset: 0; z-index: 19; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(24,33,39,.34); }
  .sidebar-close { display: inline-grid; }
  .sidebar-toggle { display: inline-grid; }
  .breadcrumb span, .breadcrumb svg { display: none; }
  .topbar { padding: 0 14px; }
  .main { padding: 16px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .late-analysis-grid { grid-template-columns: 1fr; }
  .late-trend-panel { grid-column: auto; }
  .trend-panel { grid-column: auto; }
}

@media (max-width: 680px) {
  .page-head { align-items: stretch; flex-direction: column; }
  .quick-ranges { width: 100%; }
  .quick-ranges button { flex: 1; min-width: 0; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .late-filter-bar { grid-template-columns: 1fr 1fr; }
  .is-on-time-expenses .late-filter-bar { grid-template-columns: 1fr 1fr; }
  .provision-filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-event { grid-column: 1 / -1; }
  .filter-basis { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .primary-button { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi { min-height: 102px; }
  .kpi strong { font-size: 21px; }
  .freshness { max-width: 170px; }
  .freshness span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chart-large { height: 280px; }
  .definition-strip { align-items: flex-start; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .provision-case-drawer { width: 100vw; }
  .provision-case-drawer > header { height: auto; min-height: 68px; align-items: flex-start; }
  .case-drawer-actions > span { display: none; }
  .case-verdict { grid-template-columns: 1fr; }
  .case-verdict-amount { padding: 12px 0 0; border-top: 1px solid rgba(49,91,113,.22); border-left: 0; text-align: left; }
  .case-summary-grid { grid-template-columns: 1fr 1fr; }
  .case-summary-grid > div:last-child { grid-column: 1 / -1; }
  .accounting-readout { grid-template-columns: 1fr; }
  .accounting-readout > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .timeline-entry { grid-template-columns: 88px 18px minmax(0,1fr); }
  .timeline-entry::after { left: 105px; }
  .active-filter-dock { right: 10px; bottom: 10px; width: calc(100vw - 20px); gap: 10px; }
  .active-filter-summary span { max-width: 46vw; }
  .filter-reset-button { padding: 0 10px; }
  body.has-filter-dock .main { padding-bottom: 104px; }
}

@media print {
  .sidebar, .topbar, .filter-bar, .quick-ranges, .pagination, .icon-button, .active-filter-dock { display: none !important; }
  .app-shell { display: block; }
  .main { width: 100%; padding: 0; }
  .panel, .kpi { break-inside: avoid; box-shadow: none; }
}
