:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface-1: #ffffff;
  --surface-2: #f1f2f5;
  --surface-3: #e8eaef;
  --border: #e3e5ea;
  --text-primary: #111318;
  --text-secondary: #4a4f5a;
  --text-muted: #737885;
  --accent: #2a78d6;
  --accent-soft: #e6f0fc;
  --on-accent: #ffffff;     /* текст на кнопці кольору accent */
  --series-1: #2a78d6;      /* виручка, нейтральні величини */
  --pos: #2a78d6;           /* прибуток: синій полюс */
  --neg: #e34948;           /* збиток: червоний полюс */
  --up: #12784a;  --up-bg: #e5f5ec;
  --warn: #9a5b00; --warn-bg: #fdf1dc;   /* «є ризики» */
  --down: #c2362f; --down-bg: #fdecea;
  --grid: #eceef2;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.05);
  --radius: 16px;
  --insight: #6a46d6; --insight-soft: #f0ebfd;        /* аналітика / галузеві огляди */
  --co-kind: #0b7a6b; --co-kind-soft: #e1f4f0;        /* огляди компаній */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1013; --surface-1: #17191d; --surface-2: #1f2227; --surface-3: #2a2e35; --border: #2b2f36;
    --text-primary: #f1f2f4; --text-secondary: #c2c6ce; --text-muted: #8d929c;
    --accent: #4b93ea; --accent-soft: #1b2a3d; --on-accent: #0b1525; --series-1: #3987e5; --pos: #3987e5; --neg: #e66767;
    --up: #4cc387; --up-bg: #15291f; --down: #ff8a80; --down-bg: #33191a; --warn: #f2b45b; --warn-bg: #33260f;
    --grid: #24272d; --shadow: none;
    --insight: #a990f7; --insight-soft: #251e3d; --co-kind: #4fd1bd; --co-kind-soft: #11302b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1013; --surface-1: #17191d; --surface-2: #1f2227; --surface-3: #2a2e35; --border: #2b2f36;
  --text-primary: #f1f2f4; --text-secondary: #c2c6ce; --text-muted: #8d929c;
  --accent: #4b93ea; --accent-soft: #1b2a3d; --on-accent: #0b1525; --series-1: #3987e5; --pos: #3987e5; --neg: #e66767;
  --up: #4cc387; --up-bg: #15291f; --down: #ff8a80; --down-bg: #33191a; --warn: #f2b45b; --warn-bg: #33260f;
  --grid: #24272d; --shadow: none;
  --insight: #a990f7; --insight-soft: #251e3d; --co-kind: #4fd1bd; --co-kind-soft: #11302b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text-primary);
  font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- шапка ---------- */
.top { background: color-mix(in srgb, var(--surface-1) 92%, transparent); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top-row { display: flex; align-items: center; gap: 18px; min-height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; color: var(--text-primary); letter-spacing: -.025em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo:hover .logo-mark { transform: translateY(-1px); }
.logo-mark { display: block; flex: none; width: 30px; height: 30px; color: var(--accent); transition: transform .15s; }
.logo-accent { color: var(--accent); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: var(--text-secondary); padding: 7px 12px; border-radius: 9px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.tabs a:hover { background: var(--surface-2); text-decoration: none; color: var(--text-primary); }
.tabs a.on { color: var(--accent); background: var(--accent-soft); }
.tabs a.tab-insight { color: var(--insight); background: var(--insight-soft); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-left: 4px; }
.tabs a.tab-insight:hover { background: color-mix(in srgb, var(--insight) 18%, var(--insight-soft)); color: var(--insight); }
.tabs a.tab-insight.on { background: var(--insight); color: var(--on-accent); }
.tab-ico { width: 15px; height: 15px; flex: none; }
.search { position: relative; margin-left: auto; flex: 0 1 280px; }
.search input {
  width: 100%; padding: 9px 12px 9px 36px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center;
  color: var(--text-primary); font: inherit; font-size: 14px;
}
.search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; background-color: var(--surface-1); }
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; z-index: 30;
  list-style: none; background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.14); max-height: 60vh; overflow: auto; min-width: 280px;
}
.suggest li a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text-primary); font-size: 14px; }
.suggest li a:hover, .suggest li a.hl { background: var(--surface-2); text-decoration: none; }
.suggest small { color: var(--text-muted); display: block; font-size: 12px; }
@media (max-width: 760px) {
  .top-row { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px 8px; min-height: 0; }
  .tabs { order: 3; width: calc(100% + 8px); margin: 0 -4px; justify-content: space-between; }
  .tabs a { padding: 7px 8px; font-size: 13.5px; }
  .search { order: 2; flex: 1 1 160px; }
}
@media (max-width: 440px) {
  .tabs a[href^="/pro-dani"] { display: none; }   /* є у футері: «Про дані й методологію» */
  .tabs a.tab-home { display: none; }              /* на головну веде логотип */
  .tab-ico { display: none; }
  .tabs a { padding: 7px 7px; }
}
.home .top .search { visibility: hidden; }   /* на головній — великий пошук у героїчному блоці */
@media (max-width: 760px) { .home .top .search { display: none; } }

/* ---------- макет ---------- */
main { padding-top: 24px; padding-bottom: 40px; min-height: 60vh; }
h1 { font-size: 30px; line-height: 1.15; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 19px; margin: 0; letter-spacing: -.01em; font-weight: 650; }
h3 { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin: 2px 0 8px; }
.sub { color: var(--text-secondary); margin: 0 0 18px; font-size: 15px; }
.lead { font-size: 18px; line-height: 1.5; color: var(--text-secondary); margin: 0 0 18px; max-width: 760px; }
.lead b { color: var(--text-primary); font-weight: 650; }
.crumbs { font-size: 13px; margin-bottom: 10px; color: var(--text-muted); }
.crumbs a { color: var(--text-secondary); }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid2 > * { min-width: 0; }  /* інакше елемент сітки розтягується під ширину графіка */
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } h1 { font-size: 25px; } .lead { font-size: 16px; } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { margin: 0; }

/* ---------- героїчний блок головної ---------- */
.hero { background: linear-gradient(135deg, var(--accent-soft), var(--surface-1) 70%); border: 1px solid var(--border);
  border-radius: 22px; padding: 32px; margin-bottom: 20px; }
.hero h1 { font-size: 34px; max-width: 760px; }
.hero .search { margin: 18px 0 10px; max-width: 560px; }
.hero .search input { padding: 14px 16px 14px 44px; font-size: 16px; border-radius: 14px; background-color: var(--surface-1); background-position: 16px center; box-shadow: var(--shadow); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--text-muted); }
.chip-link { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--surface-1); border: 1px solid var(--border); color: var(--text-secondary); font-size: 13px; }
.chip-link:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
@media (max-width: 600px) { .hero { padding: 22px 18px; border-radius: 18px; } .hero h1 { font-size: 26px; } }

/* ---------- показники ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.kpi .l { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 6px; line-height: 1.15; }
.kpi .d { font-size: 13px; color: var(--text-muted); }
/* мобільні значення — після базових правил, інакше базові їх перекривають */
@media (max-width: 520px) {
  .kpis { gap: 10px; }
  .kpi { padding: 12px 13px; border-radius: 14px; }
  .kpi .v { font-size: clamp(16px, 5vw, 20px); letter-spacing: -.025em; white-space: normal; }
  .kpi .d { font-size: 12px; }
  .card { padding: 16px; }
}
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chip.up { color: var(--up); background: var(--up-bg); }
.chip.down { color: var(--down); background: var(--down-bg); }
.chip.flat { color: var(--text-muted); background: var(--surface-2); }
.neg-text { color: var(--down); }

/* ---------- плитки галузей ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-1); color: var(--text-primary); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.tile .t { font-weight: 600; font-size: 14px; line-height: 1.3; min-height: 2.6em; }
.tile .code { color: var(--text-muted); font-weight: 500; font-size: 12px; }
.tile .v { font-size: 20px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.01em; }
.tile .bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 8px 0 6px; }
.tile .bar i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.tile .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-muted); align-items: center; }

/* ---------- таблиці ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
td.r, th.r { text-align: right; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
table.cmp td:first-child { white-space: nowrap; color: var(--text-secondary); }
table.cmp th.r, table.cmp td.r { min-width: 96px; }
table.cmp tr.key td { font-weight: 600; color: var(--text-primary); }
.rank { color: var(--text-muted); width: 36px; font-variant-numeric: tabular-nums; }
.co-name { font-weight: 600; color: var(--text-primary); }
.co-meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
/* огляди: під назвою юрособи — бренди, під якими вона працює */
.co-brands { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 5px; }
.co-brands .co-meta { margin-top: 0; }
.tag.brand { color: var(--text-primary); font-weight: 600; }
/* мережа з кількох юросіб: список розгортається без JS */
.co-ents { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.co-ents summary { cursor: pointer; width: fit-content; }
.co-ents summary:hover { color: var(--text-primary); }
.co-ents ul { margin: 6px 0 2px; padding-left: 16px; min-width: 240px; }
.co-ents li { margin: 2px 0; }
.co-ents li a { color: var(--text-secondary); }
.tag { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap; font-weight: 500; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- фільтри й перемикачі ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: inline-flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.filters select, .field select {
  font: inherit; font-size: 14px; padding: 8px 32px 8px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23888' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--text-primary); appearance: none; max-width: 100%; min-width: 0; text-overflow: ellipsis; cursor: pointer;
}
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); max-width: 100%; }
.seg button { font: inherit; font-size: 13.5px; padding: 6px 12px; border-radius: 8px; border: 0; cursor: pointer; background: transparent; color: var(--text-secondary); font-weight: 500; }
.seg button:hover { color: var(--text-primary); }
.seg button.on { background: var(--surface-1); color: var(--text-primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.filter-card { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 600px) { .field, .field select, .filters select { width: 100%; } }

/* ---------- графіки ---------- */
.chart-scroll { overflow-x: auto; }
.chart-scroll .chart { min-width: 340px; }
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--text-muted); font-size: 12px; font-family: inherit; }
.chart .axis { stroke: var(--border); }
.chart .grid { stroke: var(--grid); }
.chart .hit { fill: transparent; cursor: default; }
.chart .bar { transition: opacity .1s; }
.chart g.col:hover .bar { opacity: .8; }
.hbar { display: flex; flex-direction: column; gap: 2px; }
.hrow { display: grid; grid-template-columns: minmax(120px, 240px) 1fr auto; gap: 12px; align-items: center;
  padding: 5px 6px; border-radius: 8px; color: var(--text-secondary); font-size: 13.5px; }
a.hrow:hover { text-decoration: none; background: var(--surface-2); color: var(--text-primary); }
.hl { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht { position: relative; height: 18px; }
.hb { position: absolute; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.hb.neg { border-radius: 4px 0 0 4px; }
.hz { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--border); }
.hv { color: var(--text-primary); min-width: 96px; text-align: right; font-weight: 500; }
@media (max-width: 600px) {
  .hrow { grid-template-columns: 1fr auto; row-gap: 3px; }
  .hl { grid-column: 1 / -1; text-align: left; white-space: normal; }
  .ht { grid-column: 1; }
}
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- підказки й примітки ---------- */
.tip {
  position: fixed; z-index: 50; pointer-events: none; background: var(--text-primary); color: var(--surface-1);
  border-radius: 10px; padding: 8px 11px; font-size: 13px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 300px;
}
.tip b { display: block; font-weight: 600; margin-bottom: 2px; }
.term { border-bottom: 1px dotted color-mix(in srgb, currentColor 45%, transparent); cursor: help; }
.term:hover, .term:focus-visible { border-bottom-color: currentColor; }
.info { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-3); color: var(--text-secondary); font-size: 11px; font-weight: 700; cursor: help; vertical-align: 1px; margin-left: 4px; font-style: normal; }
details.how { margin-top: 14px; font-size: 13.5px; color: var(--text-secondary); }
details.how > summary { cursor: pointer; color: var(--text-muted); list-style: none; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
details.how > summary::-webkit-details-marker { display: none; }
details.how > summary::before { content: "i"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); font-size: 11px; font-weight: 700; font-style: italic; }
details.how[open] > summary { margin-bottom: 8px; }
details.how p { margin: 6px 0; }
details.more > summary { cursor: pointer; color: var(--accent); font-size: 14px; font-weight: 500; margin-top: 12px; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: " ↓"; }
details.more[open] > summary::after { content: " ↑"; }
.note { font-size: 13px; color: var(--text-muted); margin: 10px 0 0; }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text-secondary); font-size: 14px; margin-bottom: 18px; }
.foot { padding-bottom: 32px; font-size: 13px; border-top: 1px solid var(--border); padding-top: 18px; }

/* ---------- сторінка компанії ---------- */
.co-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badges .tag { white-space: normal; max-width: 100%; }
.verdict { font-size: 16px; color: var(--text-secondary); margin: 14px 0 0; max-width: 760px; }
.verdict b { color: var(--text-primary); }

/* ---------- про дані ---------- */
.prose { max-width: 780px; }
.prose h2 { margin: 26px 0 8px; }
.prose p, .prose li { color: var(--text-secondary); }
.prose dl { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 18px; }
.prose dt { font-weight: 600; }
.prose dd { margin: 0; color: var(--text-secondary); }
@media (max-width: 600px) { .prose dl { grid-template-columns: 1fr; } .prose dd { margin-bottom: 8px; } }

/* ---------- завантаження ---------- */
.skeleton { height: 220px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } html { scroll-behavior: auto; } }

/* ---------- підсумок кварталу / місце серед конкурентів ---------- */
.qsum { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 16px; }
.qsum > div { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); min-width: 0; }
.qsum > div > b { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.qsum > div > b .chip { font-size: 15px; padding: 2px 10px; }
.qsum .muted { font-size: 12.5px; }

/* ---------- таблиці компаній: сортування, «показати ще», CSV ---------- */
th button.sort { all: unset; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; white-space: nowrap; border-bottom: 1px dashed transparent; }
th button.sort:hover { color: var(--text-primary); border-bottom-color: currentColor; }
th button.sort.on { color: var(--accent); }
th button.sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.dt-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; font-size: 13px; }
.dt-foot .muted { margin-right: auto; }
.btn { font: inherit; font-size: 13.5px; font-weight: 600; padding: 7px 14px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--border); }
.btn.ghost:hover { border-color: var(--accent); }
tr.me td { background: var(--accent-soft); }

/* ---------- лідери кварталу ---------- */
.leaders { list-style: none; margin: 0; padding: 0; counter-reset: l; }
.leaders li { counter-increment: l; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.leaders li:last-child { border-bottom: 0; }
.leaders li > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.leaders li > span:first-child::before { content: counter(l) "."; color: var(--text-muted); font-size: 12px; }
.leaders .co-name { overflow: hidden; text-overflow: ellipsis; }

/* ---------- сторінка компанії: посилання ---------- */
.co-links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin-top: 14px; font-size: 13.5px; }
.co-links .ext { display: inline-flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.co-links .ext a { font-weight: 600; }
a.tag.link { color: var(--accent); }
a.tag.link:hover { text-decoration: none; background: var(--accent-soft); }
.card-head .field select { min-width: 220px; }
@media (max-width: 600px) { .card-head .field, .card-head .field select { width: 100%; min-width: 0; } }

/* ---------- футер і статичні сторінки (про проєкт, умови, політика) ---------- */
.foot { margin-top: 12px; }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 20px 32px; padding: 6px 0 18px; }
.foot .foot-brand p { margin: 10px 0 0; max-width: 340px; line-height: 1.5; }
.foot-col { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.foot-col b { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
.foot-col a { color: var(--text-secondary); }
.foot-col a:hover { color: var(--accent); }
@media (max-width: 700px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-brand { grid-column: 1 / -1; } }
.foot p { margin: 6px 0; }
.foot .owner { font-size: 12.5px; }
body.static main { padding-top: 22px; }
.legal { max-width: 860px; }
.legal h1 { margin-top: 4px; }
.legal h2 { font-size: 18px; }
.legal .small { font-size: 13px; }
.legal ul { padding-left: 20px; }
.legal li { margin: 6px 0; }
.legal code { font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* ---------- «Дивіться також» ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.see-also h2 { margin-bottom: 4px; }
.see-also h3 { margin: 14px 0 8px; }
.see-also .chip-link { padding: 5px 12px; }

/* ---------- широкі таблиці: перша колонка (назва рядка) закріплена під час горизонтальної прокрутки ---------- */
table.cmp td:first-child, table.cmp th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface-1);
  box-shadow: 1px 0 0 var(--border); }
table.cmp tbody tr:hover td:first-child { background: var(--surface-2); }
tr.me td:first-child { background: var(--accent-soft); }
@media (max-width: 760px) {
  table.cmp td:first-child, table.cmp th:first-child { max-width: 46vw; white-space: normal; }
  th, td { padding: 9px 7px; }
}

/* ---------- плашка «Побачили помилку?» ---------- */
.report { display: flex; align-items: flex-start; gap: 10px; margin-top: 6px; margin-bottom: 22px; padding: 12px 16px;
  border: 1px dashed var(--border); border-radius: 12px; background: var(--surface-1); color: var(--text-secondary); font-size: 14px; }
.report a { font-weight: 600; }
.report-ico { color: var(--accent); font-size: 16px; line-height: 1.3; }
@media (max-width: 600px) { .report { margin-left: 16px; margin-right: 16px; } }

/* ---------- «Про компанію»: опис і сайт ---------- */
.co-about { margin: 12px 0 4px; max-width: 820px; }
.co-about p { margin: 6px 0; color: var(--text-secondary); font-size: 15px; line-height: 1.55; }
.co-about .co-src { font-size: 12.5px; white-space: nowrap; }
.co-about .co-site { font-size: 14px; }
.co-about .co-site a { font-weight: 600; }

/* ---------- держзакупівлі ---------- */
.buyers { margin: 0; padding-left: 20px; }
.buyers li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.buyers li:last-child { border-bottom: 0; }
.buyers li > span:first-child { display: block; }
.buyers li .num { font-size: 13px; }

/* ---------- зручності: нещодавно переглянуті, копіювання ЄДРПОУ, підказка «/» ---------- */
.recent { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.chip-link.recent-co { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .sug-head { padding: 6px 10px 2px; font-size: 12px; color: var(--text-muted); font-weight: 600; }
button.tag.copy { font: inherit; font-size: 11.5px; font-weight: 500; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
button.tag.copy:hover { background: var(--surface-3); color: var(--text-primary); }
button.tag.copy svg { width: 12px; height: 12px; opacity: .7; }
button.tag.copy.done { background: var(--up-bg); color: var(--up); }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 11px/1 inherit; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 6px; background: var(--surface-1); pointer-events: none; }
.search input:focus ~ kbd, .search input:not(:placeholder-shown) ~ kbd { display: none; }
@media (hover: none), (max-width: 760px) { .search kbd { display: none; } }

/* ---------- огляди (tools/reviews.py) ---------- */
.rv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
a.rv-card { display: flex; flex-direction: column; gap: 8px; color: var(--text-primary); padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); transition: border-color .15s, transform .15s; margin: 0; }
a.rv-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
a.rv-card .tag { align-self: flex-start; }
a.rv-card h2, a.rv-card h3 { font-size: 18px; line-height: 1.3; margin: 2px 0 0; color: var(--text-primary); font-weight: 700; }
a.rv-card p { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.rv-card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; font-size: 13px; }
.rv-stat { color: var(--text-secondary); } .rv-stat b { color: var(--text-primary); font-size: 17px; margin-right: 3px; }
.review { max-width: 920px; }
.rv-head { margin: 6px 0 18px; }
.rv-head h1 { font-size: 34px; margin: 10px 0 8px; max-width: 820px; }
.rv-meta { color: var(--text-muted); font-size: 13.5px; margin: 0; }
.review .lead { font-size: 18px; max-width: 820px; }
.review .card p, .review .card li { color: var(--text-secondary); line-height: 1.65; max-width: 780px; }
.review .card p b, .review .card li b { color: var(--text-primary); }
.review .card h2 { margin-bottom: 10px; }
.review .card h3 { margin-top: 18px; }
.review .card ul { padding-left: 20px; margin: 8px 0 0; } .review .card li { margin: 6px 0; }
.takeaways { background: linear-gradient(135deg, var(--accent-soft), var(--surface-1) 75%); }
.sub-note { font-size: 13.5px; color: var(--text-muted) !important; margin: 0 0 8px; }
.review .hbar .hrow { grid-template-columns: minmax(110px, 200px) 1fr auto; }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
a.mini-card { display: block; padding: 12px 14px 10px; border: 1px solid var(--border); border-radius: 12px; color: var(--text-primary); background: var(--surface-1); }
a.mini-card:hover { text-decoration: none; border-color: var(--accent); }
.mini-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.chart.mini text { font-size: 11px; }
.mini-val { font-size: 15px; font-weight: 700; margin: 0 0 8px; } .mini-val .muted { font-size: 12px; font-weight: 400; }
.mini-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.method p { font-size: 14px; }
.rv-mention { margin-bottom: 18px; }
@media (max-width: 600px) { .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } a.mini-card { padding: 10px 10px 8px; } .mini-foot { font-size: 10.5px; } .mini-head { font-size: 13px; flex-wrap: wrap; gap: 4px; } .mini-val { font-size: 13.5px; } .mini-val .muted { display: block; font-size: 11.5px; } .rv-head h1 { font-size: 26px; } .review .lead { font-size: 16px; } .review .hbar .hrow { grid-template-columns: 1fr auto; } }

/* ---------- аналітика: кольори типів оглядів ---------- */
.rv-tags { display: inline-flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; }
.tag.kind-sector { background: var(--insight-soft); color: var(--insight); font-weight: 600; }
.tag.kind-company { background: var(--co-kind-soft); color: var(--co-kind); font-weight: 600; }
a.rv-card:hover { border-color: var(--insight); }
.insight-card { border-top: 3px solid var(--insight); }
.insight-link, .insight-card .card-head a { color: var(--insight); }
.insight-h1 { color: var(--insight); }
.rv-group + .rv-group { margin-top: 26px; }
.rv-group-h { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 0 0 12px; font-weight: 600; }
.rv-mention { background: var(--insight-soft); }
.rv-mention a { color: var(--insight); font-weight: 600; }
.reviews .rv-head h1 { color: var(--text-primary); }
.reviews .takeaways { background: linear-gradient(135deg, var(--insight-soft), var(--surface-1) 75%); }

/* ---------- карта регіонів ---------- */
.map-layout { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(220px, 1fr); gap: 20px; align-items: start; }
.ua-map { display: block; width: 100%; height: auto; }
.ua-map path, .ua-map circle { stroke: var(--surface-1); stroke-width: 1.3; vector-effect: non-scaling-stroke; transition: opacity .12s; cursor: pointer; }
.ua-map circle { stroke-width: 2; }
.ua-map a:hover path, .ua-map a:hover circle, .ua-map a:focus-visible path { opacity: .78; stroke: var(--text-primary); stroke-width: 1.6; }
.ua-map a:focus { outline: none; }
.map-side h3 { margin-top: 0; }
.map-top { list-style: none; margin: 0; padding: 0; counter-reset: m; font-size: 14px; }
.map-top li { counter-increment: m; display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.map-top li:last-child { border-bottom: 0; }
.map-top li a::before { content: counter(m) ". "; color: var(--text-muted); }
.map-top li a { color: var(--text-primary); }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--text-secondary); }
.map-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid var(--border); }
.locator { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: 20px; align-items: center; }
.locator .qsum { margin: 0; }
.ua-map.mini path, .ua-map.mini circle { stroke-width: 1; }
@media (max-width: 760px) {
  .map-layout, .locator { grid-template-columns: 1fr; }
  .card-head .seg { width: 100%; }
}

/* ---------- стан компанії, «коротко», порівняння з конкурентами, калькулятор ---------- */
.co-summary { font-size: 15px; color: var(--text-secondary); margin: 8px 0 0; max-width: 760px; }
.co-summary b { color: var(--text-primary); }
.health-body { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: start; }
.health-score { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 10px; border-radius: 14px; text-align: center; }
.health-score b { font-size: 38px; line-height: 1; font-weight: 750; letter-spacing: -.02em; }
.health-score span { font-size: 12px; opacity: .8; }
.health-score strong { font-size: 14px; margin-top: 6px; }
.health-score.good { background: var(--up-bg); color: var(--up); }
.health-score.warn { background: var(--warn-bg); color: var(--warn); }
.health-score.bad { background: var(--down-bg); color: var(--down); }
.flags { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.flag { display: flex; gap: 9px; align-items: flex-start; font-size: 14.5px; color: var(--text-secondary); }
.flag-ico { flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; margin-top: 1px; }
.flag-r .flag-ico { background: var(--down-bg); color: var(--down); }
.flag-y .flag-ico { background: var(--warn-bg); color: var(--warn); }
.flag-g .flag-ico { background: var(--up-bg); color: var(--up); }
.flag-r { color: var(--text-primary); }
@media (max-width: 600px) { .health-body { grid-template-columns: 1fr; } .health-score { flex-direction: row; justify-content: center; gap: 8px; } .health-score strong { margin: 0 0 0 6px; } }
.bench-h { margin: 22px 0 10px; }
.bench { display: grid; gap: 2px; }
.bench-row { display: grid; grid-template-columns: minmax(150px, 1.3fr) minmax(90px, .7fr) minmax(120px, 1.4fr) 128px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.bench-lbl { display: flex; flex-direction: column; gap: 1px; font-size: 14px; min-width: 0; }
.bench-lbl .muted { font-size: 12px; }
.bench-val { font-weight: 650; font-size: 15px; text-align: right; }
.bench-bar { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); }
.bench-band { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: var(--surface-3); }
.bench-med { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text-muted); border-radius: 1px; }
.bench-dot { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--series-1); border: 2px solid var(--surface-1); box-shadow: 0 0 0 1px var(--series-1); }
.bench-txt { font-size: 13px; color: var(--text-secondary); }
@media (max-width: 700px) {
  .bench-row { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .bench-bar { grid-column: 1 / -1; order: 3; }
  .bench-txt { grid-column: 1 / -1; order: 4; font-size: 12.5px; }
}
.calc-link { margin: 12px 0 0; font-size: 14px; }
.qsum > div:only-child { max-width: 280px; }
.calc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 22px 0 10px; }
.calc-head h2 { margin: 0; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.calc-grid .field { display: flex; }
.calc-grid .field i { font-style: normal; font-weight: 400; }
.calc input[type="text"] { font: inherit; font-size: 15px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-primary); width: 100%; font-variant-numeric: tabular-nums; }
.calc input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.calc select:disabled { opacity: .55; cursor: not-allowed; }
table.xfold tr.xmore { display: none; }
.xmore-btn { margin-top: 10px; }
