/* Shared by every page: base reset, colour tokens for both themes, the site bar and the home page.
   Each analysis page loads its own /p/<page>.css after this one; both use the same token names, so
   the light/dark switch (data-theme on <html>) recolours the whole page. */

/* Self-hosted web fonts (SIL Open Font License 1.1): Golos Text (Paratype) and IBM Plex Mono (IBM).
   Cyrillic and Latin subsets from Google Fonts; the CSP allows only same-origin fonts. */
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/assets/fonts/golos-text-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Golos Text'; font-style: normal; font-weight: 400 700; font-display: swap; src: url('/assets/fonts/golos-text-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-400-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-400-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-500-cyrillic.woff2') format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-500-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f6f7f9; --surface: #ffffff; --fg: #1b2230; --muted: #5d6779; --line: #dde1e8;
  --accent: #1f4fa3; --accent-soft: #e6edf9;
  --font-body: "Golos Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11151c; --surface: #181e27; --fg: #e5e9f0; --muted: #98a2b3; --line: #2a3240;
  --accent: #8fb3ff; --accent-soft: #1d2a44; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #11151c; --surface: #181e27; --fg: #e5e9f0; --muted: #98a2b3; --line: #2a3240;
  --accent: #8fb3ff; --accent-soft: #1d2a44; color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }

/* Layout: a sidebar with the sections on the left, the page on the right. On a phone the sidebar
   becomes a sticky top bar whose "Розділи" button opens the section list. The page stylesheets give
   body its own padding; it is cancelled here and the gutter lives on .page instead. */
body.pg-index, body[class^="pg-"] { padding: 0 !important; }
.page { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 28px 48px; }
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; }
.sidenav { position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; background: var(--surface);
  border-right: 1px solid var(--line); padding: 18px 12px 24px max(12px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
.sn-head { display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.sn-brand { flex: 1; font-weight: 700; font-size: 16px; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.sn-menu { display: none; }
.sn-theme, .sn-menu { flex: none; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); cursor: pointer; }
.sn-theme { width: 34px; display: grid; place-items: center; }
.sn-theme:hover, .sn-menu:hover { background: var(--bg); }
.sn-theme svg, .sn-menu svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sn-theme .ic-sun { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sn-theme .ic-sun { display: block; }
  :root:not([data-theme="light"]) .sn-theme .ic-moon { display: none; } }
:root[data-theme="dark"] .sn-theme .ic-sun { display: block; }
:root[data-theme="dark"] .sn-theme .ic-moon { display: none; }
.sn-nav { display: grid; gap: 4px; }
.sn-group { margin: 12px 0 4px; padding: 0 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.sn-list, .sn-subs { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.sn-link { display: block; padding: 7px 10px; border-radius: 7px; color: var(--fg); text-decoration: none; font-size: 14px; line-height: 1.3; }
.sn-link:hover { background: var(--bg); }
.sn-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sn-subs { margin: 2px 0 6px 14px; padding-left: 8px; border-left: 2px solid var(--line); }
.sn-sub { display: block; padding: 4px 8px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.35; }
.sn-sub:hover { color: var(--fg); background: var(--bg); }
.sn-sub.is-active { color: var(--accent); font-weight: 600; }
[id] { scroll-margin-top: 16px; }

@media (max-width: 899px) {
  .shell { display: block; }
  .sidenav { z-index: 20; height: auto; max-height: 100vh; overflow: visible; padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
    border-right: 0; border-bottom: 1px solid var(--line); gap: 0; }
  .sn-head { min-height: 52px; padding: 0; }
  .sn-menu { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; font: 500 13.5px/1 var(--font-body); }
  .sn-menu[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
  .sn-nav { display: none; max-height: calc(100vh - 64px); overflow-y: auto; padding: 4px 0 14px; }
  .sidenav.is-open .sn-nav { display: grid; }
  [id] { scroll-margin-top: 68px; }
}
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Home page. */
.home { max-width: 1240px; margin: 0 auto; display: grid; gap: 36px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 36px 56px; }
.home h1, .home h2 { margin: 0; text-wrap: balance; }
.home-hero { display: grid; gap: 14px; }
.home .eyebrow { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.home h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); line-height: 1.12; letter-spacing: -0.02em; max-width: 22ch; }
.home .lead { margin: 0; font-size: 16px; line-height: 1.55; color: var(--muted); max-width: 68ch; }
.home-facts { margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.home-facts > div { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.home-facts dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.home-facts dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.35rem; }
.home-group { display: grid; gap: 14px; }
.home h2 { font-size: 1.1rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { display: grid; gap: 6px; align-content: start; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; text-decoration: none; color: var(--fg); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-title { font-weight: 600; font-size: 15.5px; }
.card-text { color: var(--muted); font-size: 14px; line-height: 1.45; }
.home-foot { color: var(--muted); font-size: 13px; display: grid; gap: 4px; max-width: 90ch; }
.home-foot p { margin: 0; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

/* "i" detail: a small circled i next to a heading, figure or label; clicking it opens a panel
   with the detail (method, sources, legal references). Plain <details>, so it needs no script;
   site/assets/site.js only closes other open panels and keeps the panel inside the viewport.
   Markup:
   <details class="info"><summary aria-label="Детальніше"></summary><div class="info-body">...</div></details> */
.info { display: inline-block; position: relative; vertical-align: middle; margin-left: 4px; line-height: 1; }
.info > summary { list-style: none; cursor: pointer; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--muted);
  color: var(--muted); display: inline-grid; place-items: center; font: 600 11px/1 var(--font-body); font-style: italic; user-select: none; }
.info > summary::-webkit-details-marker { display: none; }
.info > summary::after { content: "i"; }
.info > summary:hover, .info[open] > summary { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.info > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.info-body { position: absolute; z-index: 30; top: calc(100% + 8px); left: -8px; width: max-content; max-width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .14); font: 400 13.5px/1.5 var(--font-body); letter-spacing: normal; text-transform: none;
  text-align: left; white-space: normal; display: grid; gap: 6px; }
.info-body p, .info-body ul { margin: 0; }
.info-body ul { padding-left: 18px; }
.info-body .ref { color: var(--muted); font-size: 12.5px; }
.info-body a { color: var(--accent); }

/* Register pages (Сектор Б/О ... Кредитування): KPI tiles, then one toolbar card: filters on the left,
   search and expand on the right, the Δ colour legend under a divider. Page stylesheets set --chip-bg-l. */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
/* each tile spans three subgrid rows (label, value, note) so values line up even when a label wraps */
.fact { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 4px; align-content: start; min-width: 0; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.fact > span { align-self: end; font-size: 12px; font-weight: 600; line-height: 1.35; color: var(--muted); }
.fact > b { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 500; white-space: nowrap; }
.fact > small { font-size: 12.5px; color: var(--muted); }
.fact > small .chip { min-width: 0; margin-right: 2px; font-family: var(--font-mono); }
.toolbar { display: grid; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.tb-row { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; justify-content: space-between; }
.tb-filters, .tb-find { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.tb-find { gap: 12px 8px; }
.fld { display: grid; gap: 6px; }
.ctl-label { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg button, .btn { font: inherit; font-size: 13px; padding: 7px 12px; border: 0; background: transparent; color: var(--fg); cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--surface); font-weight: 600; }
.seg button:hover, .btn:hover { background: var(--accent-soft); }
.seg button[aria-pressed="true"]:hover { background: var(--accent); }
.acts { display: inline-flex; gap: 6px; }
.btn { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); }
.btn:hover { color: var(--fg); }
.q-wrap { position: relative; }
.q { font: inherit; font-size: 13px; width: 260px; max-width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); }
.q::placeholder { color: var(--muted); }
.q:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.q-n { position: absolute; right: 30px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--muted); pointer-events: none; }
.q-n:empty { display: none; }
.q-wrap:has(.q-n:not(:empty)) .q { padding-right: 104px; }
/* name cell: the name, then its "i" and tags right beside it, even when the name wraps or is clamped */
td.name > .nm { display: flex; align-items: baseline; }
td.name > .nm > :first-child { min-width: 0; }
td.name > .nm > .info, td.name > .nm > .tag { flex: none; }
#tbl mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.lg-label { font-weight: 600; }
.scale { display: grid; gap: 2px; width: min(100%, 300px); }
.scale .bar { height: 8px; border-radius: 4px; background: linear-gradient(90deg, hsl(0 72% var(--chip-bg-l)) 0%, hsl(25 72% var(--chip-bg-l)) 40%, hsl(52 72% var(--chip-bg-l)) 57.2%, hsl(140 72% var(--chip-bg-l)) 100%); }
.scale .ticks { position: relative; height: 14px; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.scale .ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.scale .ticks span:first-child { transform: none; }
.scale .ticks span:last-child { transform: translateX(-100%); }
@media (max-width: 599px) {
  .tb-row, .tb-filters, .tb-find { display: grid; justify-content: stretch; align-items: stretch; }
  .seg { display: flex; } .seg button { flex: 1; padding-inline: 8px; }
  .q { width: 100%; } .acts > .btn { flex: 1; }
  .fact { padding: 10px 12px; } .fact > b { font-size: 1.15rem; }
}
