:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d7dee8;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --accent: #087f73;
  --accent-dark: #05645b;
  --accent-soft: #e8f6f3;
  --positive: #147d53;
  --negative: #c23b3b;
  --warning: #9a6700;
  --sidebar: 270px;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--soft); }
body { margin: 0; min-width: 320px; }
button, select { font: inherit; }
button { letter-spacing: 0; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 16px 24px; background: #fff; border-right: 1px solid var(--line); z-index: 5; }
.brand-block { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.brand-title { font-size: 20px; font-weight: 800; }
.brand-subtitle { margin-top: 2px; color: var(--muted); font-size: 13px; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; margin-top: 14px; border: 1px solid #b8c4d4; }
.mode-button { min-height: 36px; border: 0; border-right: 1px solid #b8c4d4; background: white; color: var(--ink); font-weight: 700; cursor: pointer; }
.mode-button:last-child { border-right: 0; }
.mode-button.is-active { background: var(--accent); color: white; }

.filter-stack { display: grid; gap: 13px; padding-top: 16px; }
.filter-stack label { display: grid; gap: 5px; }
.filter-stack label[hidden] { display: none; }
.filter-stack span { font-size: 13px; font-weight: 750; }
.filter-stack select { width: 100%; min-height: 48px; padding: 5px 6px; border: 1px solid #b8c4d4; border-radius: 0; background: white; color: var(--ink); outline: none; }
.filter-stack select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(8, 127, 115, .15); }
.filter-stack option { padding: 2px 3px; }
.reset-button { width: 100%; min-height: 38px; margin-top: 16px; border: 1px solid #9ca9ba; background: white; color: var(--ink); font-weight: 700; cursor: pointer; }
.reset-button:hover { background: var(--soft); }

.main { min-width: 0; padding: 18px; }
.topbar { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.title-block { min-width: 260px; }
h1 { margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: 0; }
.title-block p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.tabs { display: flex; flex-wrap: wrap; justify-content: flex-end; border: 1px solid var(--line); background: white; }
.tab { min-height: 39px; padding: 0 18px; border: 0; border-right: 1px solid var(--line); background: white; color: var(--ink); font-weight: 750; cursor: pointer; }
.tab:last-child { border-right: 0; }
.tab.is-active { background: var(--ink); color: white; }
.sidebar-toggle { display: none; min-height: 36px; padding: 0 12px; border: 1px solid #9ca9ba; background: white; font-weight: 700; }

.kpi-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi-strip > div { min-width: 0; padding: 13px 15px; border: 1px solid var(--line); background: white; }
.kpi-strip span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi-strip strong { display: block; margin-top: 4px; font-size: 22px; line-height: 1.15; overflow-wrap: anywhere; }
.kpi-strip strong.positive { color: var(--positive); }
.kpi-strip strong.negative { color: var(--negative); }

.view { display: none; }
.view.is-active { display: block; }
.grid { display: grid; gap: 14px; }
.panel { min-width: 0; border: 1px solid var(--line); background: white; }
.panel-head { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.panel-head h2 { margin: 0; font-size: 15px; line-height: 1.2; letter-spacing: 0; }
.hint, .table-pager { color: var(--muted); font-size: 12px; white-space: nowrap; }
.table-pager button { width: 30px; height: 28px; margin-left: 5px; border: 1px solid #aeb9c8; background: white; cursor: pointer; }
.table-pager button:disabled { opacity: .35; cursor: default; }
.table-wrap { max-width: 100%; overflow: auto; max-height: 460px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
th, td { min-width: 96px; padding: 7px 9px; border-right: 1px solid #e1e6ee; border-bottom: 1px solid #e1e6ee; text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 3; background: #344054; color: white; font-weight: 750; }
th:first-child, td:first-child { text-align: left; }
tbody tr:nth-child(even) td { background: #f8fafc; }
tbody tr:hover td { background: var(--accent-soft); }
tfoot td { position: sticky; bottom: 0; z-index: 2; background: #eef2f6; font-weight: 800; }
.sticky-1 { position: sticky; left: 0; z-index: 2; min-width: 150px; max-width: 220px; text-align: left; }
.sticky-2 { position: sticky; left: 150px; z-index: 2; min-width: 210px; max-width: 280px; text-align: left; }
th.sticky-1, th.sticky-2 { z-index: 5; background: #344054; }
td.sticky-1, td.sticky-2 { background: white; }
tbody tr:nth-child(even) td.sticky-1, tbody tr:nth-child(even) td.sticky-2 { background: #f8fafc; }
tbody tr:hover td.sticky-1, tbody tr:hover td.sticky-2 { background: var(--accent-soft); }
.delta-positive { color: var(--positive); font-weight: 750; }
.delta-negative { color: var(--negative); font-weight: 750; }
.delta-flat { color: var(--muted); }
.group-start { border-left: 2px solid #98a2b3; }
.empty { padding: 28px 12px; color: var(--muted); text-align: center; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: min(88vw, 310px); box-shadow: 12px 0 30px rgba(23, 32, 51, .18); transition: transform .2s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-toggle { display: inline-flex; align-items: center; }
  .main { padding: 12px; }
  .topbar { align-items: center; flex-wrap: wrap; }
  .title-block { flex: 1; min-width: 210px; }
  .tabs { width: 100%; justify-content: stretch; }
  .tab { flex: 1; padding: 0 8px; }
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  h1 { font-size: 20px; }
  .kpi-strip { grid-template-columns: 1fr; }
  .kpi-strip strong { font-size: 20px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .table-wrap { max-height: 520px; }
}
