/*
 * ПРОЯВ·ЛАБ — стилі сайту.
 * Концепція: робочий стіл друкаря. Біле «паперове» поле, графітовий текст, глибокий процесний блакитний
 * як акцент; кольори CMY лише в смузі-марці. Наскрізний мотив — шкала бажаності Харрінгтона
 * (0 · 0,20 · 0,37 · 0,63 · 0,80 · 1), якою показано кожен висновок.
 */
:root {
  --bg: #F3F5F5;
  --surface: #FFFFFF;
  --surface-2: #EBEEEF;
  --ink: #14181B;
  --ink-2: #48525A;
  --ink-3: #75808A;
  --line: #D9DFE2;
  --line-2: #C3CBD0;
  --accent: #006B80;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCEEF1;
  --photo-bg: #DADFE1;
  --shade: rgba(14, 20, 24, 0.52);

  --ok: #1D7A4B;      --ok-bg: #E2F2E8;
  --fix: #5A44BE;     --fix-bg: #ECE8FA;
  --check: #9C5A00;   --check-bg: #F8ECD8;
  --no: #B5372A;      --no-bg: #F8E4E1;

  --z1: #C2412F; --z2: #DB8A2E; --z3: #C9AE2C; --z4: #6FAA4B; --z5: #1D7A4B;

  --cmy-c: #00A3BF; --cmy-m: #D2187A; --cmy-y: #F2C400; --cmy-k: #14181B;

  --f-display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --f-text: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --r: 10px;
  --r-s: 6px;
  --shadow: 0 1px 2px rgba(20, 24, 27, 0.06), 0 8px 24px rgba(20, 24, 27, 0.08);
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --top-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1113; --surface: #161A1D; --surface-2: #1E2327; --ink: #E8ECEC; --ink-2: #A9B3B8; --ink-3: #7E898F;
    --line: #283035; --line-2: #374047; --accent: #39B8CE; --accent-ink: #061417; --accent-soft: #10343B;
    --photo-bg: #0A0C0D; --shade: rgba(0, 0, 0, 0.6);
    --ok: #4CC38A; --ok-bg: #12301F; --fix: #A596FF; --fix-bg: #231E45; --check: #E6A443; --check-bg: #36260C; --no: #F2705F; --no-bg: #3A1915;
    --z1: #E2553F; --z2: #E89A3C; --z3: #D9BE3A; --z4: #7CC05A; --z5: #3FB27A;
    --cmy-k: #E8ECEC;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1113; --surface: #161A1D; --surface-2: #1E2327; --ink: #E8ECEC; --ink-2: #A9B3B8; --ink-3: #7E898F;
  --line: #283035; --line-2: #374047; --accent: #39B8CE; --accent-ink: #061417; --accent-soft: #10343B;
  --photo-bg: #0A0C0D; --shade: rgba(0, 0, 0, 0.6);
  --ok: #4CC38A; --ok-bg: #12301F; --fix: #A596FF; --fix-bg: #231E45; --check: #E6A443; --check-bg: #36260C; --no: #F2705F; --no-bg: #3A1915;
  --z1: #E2553F; --z2: #E89A3C; --z3: #D9BE3A; --z4: #7CC05A; --z5: #3FB27A;
  --cmy-k: #E8ECEC;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ── база ── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top-h) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.55 var(--f-text);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); }
h1, h2, h3 { margin: 0; text-wrap: balance; color: var(--ink); }
h1 { font: 600 clamp(28px, 4.2vw, 46px)/1.12 var(--f-display); letter-spacing: -0.01em; }
h2 { font: 600 clamp(21px, 2.4vw, 27px)/1.2 var(--f-display); letter-spacing: -0.005em; }
h3 { font: 600 17px/1.3 var(--f-text); }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
sub { font-size: 0.72em; }
.wrap { width: 100%; max-width: 1360px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.eyebrow { font: 500 12px/1.4 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.lead { font-size: clamp(17px, 1.6vw, 19px); line-height: 1.55; color: var(--ink-2); max-width: 62ch; }
.hint { font-size: 13px; line-height: 1.45; color: var(--ink-3); }

/* ── кнопки ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none;
  cursor: pointer; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-small { min-height: 34px; padding: 0 14px; font-size: 14px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  cursor: pointer; font-size: 17px; line-height: 1; display: inline-grid; place-items: center;
}
.icon-btn:disabled { opacity: .35; cursor: default; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ── висновки (пігулки) ── */
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 9px; border-radius: 999px;
  font: 600 13px/1.25 var(--f-text); white-space: nowrap; border: 1px solid transparent;
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.pill[data-tone="ok"] { color: var(--ok); background: var(--ok-bg); }
.pill[data-tone="fix"] { color: var(--fix); background: var(--fix-bg); }
.pill[data-tone="check"] { color: var(--check); background: var(--check-bg); }
.pill[data-tone="no"] { color: var(--no); background: var(--no-bg); }
.pill[data-tone="wait"] { color: var(--ink-3); background: var(--surface-2); }
.pill[data-tone="wait"]::before { animation: pulse 1.1s ease-in-out infinite; }
.pill[data-tone="err"] { color: var(--no); background: transparent; border-color: var(--no); }
@keyframes pulse { 50% { opacity: .25; } }

/* ── шкала Харрінгтона ── */
.scale { position: relative; height: 10px; border-radius: 999px; overflow: visible; display: grid;
  grid-template-columns: 20fr 17fr 26fr 17fr 20fr; gap: 2px; }
.scale > i { display: block; height: 100%; }
.scale > i:nth-child(1) { background: var(--z1); border-radius: 999px 0 0 999px; }
.scale > i:nth-child(2) { background: var(--z2); }
.scale > i:nth-child(3) { background: var(--z3); }
.scale > i:nth-child(4) { background: var(--z4); }
.scale > i:nth-child(5) { background: var(--z5); border-radius: 0 999px 999px 0; }
.scale .mark {
  position: absolute; top: 50%; width: 4px; height: 20px; margin-left: -2px; transform: translateY(-50%);
  background: var(--ink); border-radius: 2px; box-shadow: 0 0 0 2px var(--surface); transition: left .35s ease;
}
.scale.slim { height: 6px; }
.scale.slim .mark { height: 14px; width: 3px; margin-left: -1.5px; }
.scale-ticks { display: flex; justify-content: space-between; margin-top: 6px; font: 400 11px/1 var(--f-mono); color: var(--ink-3); position: relative; height: 12px; }
.scale-ticks span { position: absolute; transform: translateX(-50%); }
.scale-ticks span:first-child { transform: none; }
.scale-ticks span:last-child { transform: translateX(-100%); }
.dbar { height: 6px; border-radius: 999px; background: var(--surface-2); position: relative; overflow: hidden; }
.dbar > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; transition: width .35s ease; }

/* ── шапка ── */
.site-top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { height: var(--top-h); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); flex: none; }
.brand-name { font: 600 16px/1 var(--f-display); letter-spacing: 0.06em; }
.strip { display: inline-grid; grid-template-columns: repeat(4, 7px); height: 20px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-2); }
.strip i:nth-child(1) { background: var(--cmy-c); }
.strip i:nth-child(2) { background: var(--cmy-m); }
.strip i:nth-child(3) { background: var(--cmy-y); }
.strip i:nth-child(4) { background: var(--cmy-k); }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 15px; white-space: nowrap;
}
  .nav .s { display: none; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }

/* ── огляд ── */
.view { padding-block: 0 72px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 56px; align-items: center; padding-block: 56px 48px; }
.hero-text { display: grid; gap: 22px; min-width: 0; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 10px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.hero-facts div { display: grid; gap: 4px; }
.hero-facts dt { font: 600 30px/1 var(--f-display); color: var(--accent); }
.hero-facts dd { margin: 0; font-size: 14px; line-height: 1.4; color: var(--ink-2); }

.specimen { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 14px; min-width: 0; }
.specimen-frame { position: relative; border-radius: 10px; overflow: hidden; background: var(--photo-bg); aspect-ratio: 3 / 2; max-width: 100%; }
.specimen-frame img { width: 100%; height: 100%; object-fit: cover; }
.specimen-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 14px; }
.specimen-cap { display: grid; gap: 12px; padding: 4px 6px 6px; }
.specimen-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.specimen-title { font-weight: 600; }
.specimen-meta { font: 400 13px/1.4 var(--f-mono); color: var(--ink-3); }
.specimen-why { font-size: 14px; color: var(--ink-2); }
.legend-card { display: grid; gap: 16px; padding: 10px 10px 12px; }
.legend-lead { color: var(--ink-2); font-size: 15px; }
.zones { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.zones li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14px; color: var(--ink-2); }
.zones i { width: 14px; height: 8px; border-radius: 999px; }
.zones .mono { font-size: 12.5px; color: var(--ink-3); }
.legend-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.legend-card .btn { justify-self: start; }
.specimen-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.specimen-tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.specimen-tabs button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.cropbox { position: absolute; border: 2px solid rgba(255, 255, 255, 0.95); box-shadow: 0 0 0 9999px var(--shade); pointer-events: none; transition: all .35s ease; }
.cropbox[data-fit="fit"] { box-shadow: none; border-style: dashed; }
.cropbox-label { position: absolute; left: 8px; top: 8px; font: 500 11px/1 var(--f-mono); color: #fff; background: rgba(0, 0, 0, .55); padding: 4px 6px; border-radius: 4px; letter-spacing: .04em; }

.band { padding-block: 44px; border-top: 1px solid var(--line); display: grid; gap: 28px; }
.band-head { display: grid; gap: 10px; max-width: 70ch; }
.band-head p { color: var(--ink-2); }
.band-link { font-weight: 600; }
.verdicts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.verdict { display: grid; gap: 12px; align-content: start; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.verdict p { font-size: 14.5px; color: var(--ink-2); }
.verdict .pill { justify-self: start; }
.flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; counter-reset: step; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.flow li { counter-increment: step; padding: 18px; display: grid; gap: 8px; align-content: start; border-left: 1px solid var(--line); position: relative; }
.flow li:first-child { border-left: 0; }
.flow li::before { content: counter(step); font: 600 13px/1 var(--f-mono); color: var(--accent); }
.flow b { font-weight: 600; }
.flow span { font-size: 14px; color: var(--ink-2); }
.ov-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat { padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 6px; }
.stat b { font: 600 32px/1 var(--f-display); color: var(--ink); }
.stat span { font-size: 14px; color: var(--ink-2); }

/* ── лабораторія ── */
.lab { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: start; padding-block: 28px 0; }
.params { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px) + 16px); max-height: calc(100vh - var(--top-h) - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; scrollbar-width: thin; }
.params-summary { display: none; }
.params-body { padding: 16px; display: grid; gap: 16px; }
.params-title { font: 600 16px/1.2 var(--f-text); }
.field { border: 0; margin: 0; padding: 0; display: grid; gap: 9px; min-width: 0; }
.field legend { padding: 0; margin-bottom: 9px; font: 500 11.5px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.formats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fmt {
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 6px 7px; cursor: pointer;
  display: grid; gap: 2px; justify-items: center; text-align: center; color: var(--ink);
}
.fmt b { font: 600 15px/1.1 var(--f-text); }
.fmt small { font: 400 10.5px/1.2 var(--f-mono); color: var(--ink-3); }
.fmt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opts { display: grid; gap: 6px; }
.opt { text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 11px; cursor: pointer; display: grid; gap: 2px; }
.opt b { font-weight: 600; font-size: 15px; }
.opt small { font-size: 12.5px; line-height: 1.35; color: var(--ink-3); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; background: var(--surface-2); border-radius: 9px; gap: 3px; }
.seg button { border: 0; background: transparent; border-radius: 7px; padding: 7px 8px; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.profile-box { padding: 12px; border-radius: 8px; background: var(--surface-2); gap: 8px; }
.profile-box .pb-state { display: flex; gap: 8px; align-items: baseline; font-size: 14px; font-weight: 600; }
.profile-box .pb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; transform: translateY(-1px); }
.profile-box .pb-dot.on { background: var(--ok); }

.sheet { display: grid; gap: 18px; min-width: 0; }
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sheet-titles { display: grid; gap: 8px; min-width: 0; max-width: 70ch; }
.sheet-titles h1 { font-size: clamp(26px, 3vw, 34px); }
.sheet-titles p { color: var(--ink-2); }
.drop {
  border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 16px 18px; display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: baseline;
  color: var(--ink-2); background: var(--surface); transition: border-color .15s, background .15s;
}
.drop b { color: var(--ink); }
.drop span { font-size: 14px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button {
  display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; cursor: pointer; color: var(--ink-2);
}
.filters button .num { color: var(--ink-3); font-size: 12.5px; }
.filters button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.filters button[data-tone]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.filters button[data-tone="ok"]::before { background: var(--ok); }
.filters button[data-tone="fix"]::before { background: var(--fix); }
.filters button[data-tone="check"]::before { background: var(--check); }
.filters button[data-tone="no"]::before { background: var(--no); }
.filters button:disabled { opacity: .45; cursor: default; }
.sheet-tools { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: grid;
  grid-template-rows: auto 1fr; cursor: pointer; text-align: left; padding: 0; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.card:active { transform: translateY(1px); }
.card-img { position: relative; aspect-ratio: 4 / 3; background: var(--photo-bg); overflow: hidden; max-width: 100%; }
.card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.card-img .imgbox { position: absolute; overflow: hidden; }
.card-img .imgbox img { position: static; width: 100%; height: 100%; object-fit: fill; }
.card-tag { position: absolute; z-index: 2; right: 8px; top: 8px; font: 500 10.5px/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: #fff; background: rgba(0, 0, 0, .55); padding: 4px 6px; border-radius: 4px; }
.card-body { padding: 13px 14px 14px; display: grid; gap: 10px; align-content: start; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.card-pqi { font: 500 13px/1 var(--f-mono); color: var(--ink-2); white-space: nowrap; }
.card-pqi b { color: var(--ink); font-weight: 600; font-size: 15px; }
.card-title { font-weight: 600; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.card-meta { font: 400 12px/1.4 var(--f-mono); color: var(--ink-3); }
.card-why { font-size: 13.5px; line-height: 1.45; color: var(--ink-2); }
.card.busy .card-body > *:not(.card-top) { opacity: .55; }
.card .pill { font-size: 12.5px; }
.empty { border: 1px dashed var(--line-2); border-radius: 12px; padding: 32px; display: grid; gap: 14px; justify-items: start; color: var(--ink-2); background: var(--surface); }

/* ── документальні сторінки ── */
.doc { display: grid; gap: 40px; padding-block: 44px 0; max-width: 1100px; }
.doc-head { display: grid; gap: 14px; }
.doc-sec { display: grid; gap: 16px; padding-top: 32px; border-top: 1px solid var(--line); }
.doc-sec > p, .doc-sec .two p { max-width: 72ch; color: var(--ink-2); }
.doc-sec h2 { margin-bottom: 4px; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; }
.toc a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: 14px; background: var(--surface); }
.toc a:hover { color: var(--ink); border-color: var(--line-2); }
.formula { font: 500 clamp(17px, 2vw, 21px)/1.4 var(--f-mono); padding: 16px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); max-width: 100%; overflow-x: auto; }
.where { font-size: 14.5px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.two > div { display: grid; gap: 8px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); align-content: start; }
.tech { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.tech li { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); font-size: 14.5px; color: var(--ink-2); }
.tech b { color: var(--ink); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); max-width: 100%; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font: 500 11.5px/1.3 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); background: var(--surface-2); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; white-space: nowrap; }
table.data .pill { font-size: 12px; }
.harr { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: center; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.harr svg { width: 100%; height: auto; display: block; }
.harr-ctl { display: grid; gap: 12px; }
.harr-ctl label { font-size: 13px; color: var(--ink-3); }
.harr-ctl select, .harr-ctl input[type="range"] { width: 100%; }
.harr-ctl select { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); }
.harr-out { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.harr-out dt { color: var(--ink-3); }
.harr-out dd { margin: 0; font-family: var(--f-mono); }
.scale-demo { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.sd-item { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 8px; }
.sd-item b { font: 600 22px/1 var(--f-display); }
.sd-item span { font-size: 13.5px; color: var(--ink-2); }

/* ── результати ── */
.res-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 4px 0 16px; min-width: 0; }
.res-tools .filters { min-width: 0; }
.seg-small { flex: none; }
.seg-small button { padding: 6px 12px; font-size: 13.5px; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.res-item { margin: 0; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.res-item .ri-title { font-weight: 600; font-size: 13px; line-height: 1.3; }
.res-item .ri-pqi { font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); }
.res-more { display: flex; justify-content: center; margin-top: 16px; }
.res-item .ri-img { aspect-ratio: 3 / 2; background: var(--photo-bg); max-width: 100%; }
.res-item .ri-img img { width: 100%; height: 100%; object-fit: cover; }
.res-item .ri-body { padding: 10px 11px 11px; display: grid; gap: 6px; font-size: 13px; }
.res-item .ri-cat { color: var(--ink-3); font-size: 12px; line-height: 1.35; }
.res-item .pill { font-size: 11.5px; justify-self: start; }
.confusion td.num { font-size: 15px; }
.confusion td.hit { background: var(--accent-soft); font-weight: 600; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) 64px; gap: 12px; align-items: center; font-size: 14px; }
.bar-row .bar { height: 12px; background: var(--surface-2); border-radius: 999px; position: relative; overflow: hidden; }
.bar-row .bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; }
.bar-row .bar i.base { background: var(--ink-3); opacity: .55; }
.bar-row .v { font-family: var(--f-mono); text-align: right; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 8px; border-radius: 999px; background: var(--accent); }
.legend i.base { background: var(--ink-3); opacity: .55; }
.note { font-size: 14px; color: var(--ink-2); padding: 14px 16px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--r-s) var(--r-s) 0; max-width: 80ch; }

/* ── підвал ── */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-in { padding-block: 32px max(32px, env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px 40px; }
.foot-label { font: 500 11.5px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.foot-topic { font-size: 15px; color: var(--ink); max-width: 60ch; }
.foot-meta { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.foot-meta div { display: contents; }
.foot-meta dt { color: var(--ink-3); }
.foot-meta dd { margin: 0; color: var(--ink-2); }
.foot-credits { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.foot-credits:empty { display: none; }

/* ── розбір кадру ── */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(8, 12, 14, .62); }
.detail {
  border: 0; padding: 0; background: var(--surface); width: min(1320px, calc(100vw - 32px)); max-width: none;
  height: min(900px, calc(100vh - 32px)); max-height: none; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
}
.d-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.d-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.d-titles { display: grid; gap: 4px; min-width: 0; }
.d-titles h2 { font: 600 20px/1.25 var(--f-text); overflow-wrap: anywhere; }
.d-eyebrow { font: 500 11.5px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.d-meta { font: 400 13px/1.4 var(--f-mono); color: var(--ink-3); }
.d-nav { display: flex; gap: 8px; align-items: center; flex: none; }
.d-body { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, 1fr); min-height: 0; }
.d-stage { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; padding: 16px 20px; min-height: 0; background: var(--bg); }
.tabs { display: flex; gap: 4px; padding: 3px; background: var(--surface-2); border-radius: 10px; justify-self: start; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: transparent; border-radius: 8px; padding: 7px 13px; font-size: 14px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.stage { position: relative; min-height: 0; border-radius: 10px; background: var(--photo-bg); overflow: hidden; display: grid; place-items: center; }
.stage-inner { position: relative; max-width: 100%; max-height: 100%; overflow: hidden; }
.stage-inner > img { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
.stage-msg { padding: 24px; text-align: center; color: var(--ink-2); display: grid; gap: 12px; justify-items: center; max-width: 46ch; }
.stage-note { font-size: 13px; color: var(--ink-3); min-height: 1.4em; }
.d-side { overflow-y: auto; padding: 18px 20px 28px; display: grid; gap: 22px; align-content: start; border-left: 1px solid var(--line); min-height: 0; }
.blk { display: grid; gap: 12px; }
.blk-title { font: 500 11.5px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.verdict-big { display: grid; gap: 10px; }
.verdict-big .pill { font-size: 14.5px; padding: 6px 13px 6px 11px; justify-self: start; }
.pqi-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pqi-line b { font: 600 34px/1 var(--f-display); }
.pqi-line span { font-size: 14px; color: var(--ink-2); }
.reasons { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.reasons li { font-size: 14.5px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); display: grid; gap: 4px; }
.reasons li small { font-size: 12.5px; color: var(--ink-3); }
.reasons li[data-sev="critical"] { box-shadow: inset 3px 0 0 var(--no); }
.reasons li[data-sev="warn"] { box-shadow: inset 3px 0 0 var(--check); }
.reasons li[data-sev="info"] { box-shadow: inset 3px 0 0 var(--ink-3); }
.metrics { display: grid; gap: 2px; }
.metric { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.metric:last-child { border-bottom: 0; }
.metric .m-name { font-size: 14px; font-weight: 500; }
.metric .m-val { font: 400 13px/1.3 var(--f-mono); color: var(--ink-2); text-align: right; white-space: nowrap; }
.metric .dbar { grid-column: 1 / -1; }
.metric .m-d { grid-column: 1 / -1; display: flex; justify-content: space-between; font: 400 11.5px/1 var(--f-mono); color: var(--ink-3); }
.fmx { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.fmx button {
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px; text-align: left; cursor: pointer;
  display: grid; gap: 4px; color: var(--ink); font-size: 13px;
}
.fmx button b { font-size: 15px; }
.fmx button .tone { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.fmx button .tone::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.fmx button[data-tone="ok"] .tone::before { background: var(--ok); }
.fmx button[data-tone="fix"] .tone::before { background: var(--fix); }
.fmx button[data-tone="check"] .tone::before { background: var(--check); }
.fmx button[data-tone="no"] .tone::before { background: var(--no); }
.fmx button[aria-current="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fmx .num { font-size: 12px; color: var(--ink-3); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; font-size: 14px; color: var(--ink-2); }
.steps li::before { content: counter(s); font: 500 12px/22px var(--f-mono); text-align: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); height: 22px; }
.steps li.done::before { background: var(--ok-bg); color: var(--ok); content: "✓"; }
.steps li.now::before { background: var(--accent-soft); color: var(--accent); }
.steps li b { color: var(--ink); font-weight: 600; }
.out-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 14px; margin: 0; }
.out-facts dt { color: var(--ink-3); }
.out-facts dd { margin: 0; font-family: var(--f-mono); font-size: 13px; overflow-wrap: anywhere; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.compare { position: relative; max-width: 100%; max-height: 100%; touch-action: none; user-select: none; cursor: ew-resize; }
.compare img { display: block; max-width: 100%; max-height: 100%; }
.compare .after { position: absolute; inset: 0; overflow: hidden; }
.compare .after img { width: 100%; height: 100%; max-width: none; max-height: none; }
.compare .handle { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.compare .handle::after { content: "↔"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-size: 15px; box-shadow: 0 1px 6px rgba(0,0,0,.35); }
.compare .lbl { position: absolute; top: 8px; font: 500 11px/1 var(--f-mono); color: #fff; background: rgba(0,0,0,.6); padding: 4px 6px; border-radius: 4px; letter-spacing: .04em; }
.loupe { position: absolute; inset: 0; overflow: hidden; cursor: grab; touch-action: none; }
.loupe.drag { cursor: grabbing; }
.loupe canvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; }
.loupe-mini { position: absolute; right: 10px; bottom: 10px; width: 150px; border: 1px solid rgba(255,255,255,.8); box-shadow: 0 2px 10px rgba(0,0,0,.4); background: #000; }
.loupe-mini img { width: 100%; display: block; opacity: .9; }
.loupe-mini i { position: absolute; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.loupe-switch { position: absolute; left: 10px; top: 10px; display: flex; gap: 4px; padding: 3px; background: rgba(0,0,0,.6); border-radius: 8px; }
.loupe-switch button { border: 0; background: transparent; color: #fff; font-size: 12.5px; padding: 5px 9px; border-radius: 6px; cursor: pointer; }
.loupe-switch button[aria-pressed="true"] { background: #fff; color: #111; font-weight: 600; }

.modal { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--surface); box-shadow: var(--shadow); }
.modal-in { padding: 22px; display: grid; gap: 14px; }
.modal-in p { font-size: 14.5px; color: var(--ink-2); }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.prof-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.prof-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.prof-list li small { display: block; color: var(--ink-3); font-size: 12px; }
.prof-list li.empty-li { color: var(--ink-3); border-style: dashed; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-size: 14.5px; max-width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow);
}
.toast.error { background: var(--no); color: #fff; }

/* ── адаптивність ── */
@media (max-width: 1180px) {
  .verdicts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow { grid-template-columns: 1fr; }
  .flow li { border-left: 0; border-top: 1px solid var(--line); grid-template-columns: 28px minmax(0, 1fr); }
  .flow li:first-child { border-top: 0; }
  .flow li::before { grid-row: span 2; padding-top: 3px; }
}
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-block: 36px 32px; }
  .lab { grid-template-columns: 1fr; gap: 16px; padding-block: 16px 0; }
  .params { position: static; max-height: none; }
  .params-summary {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%;
    padding: 13px 16px; border: 0; background: transparent; cursor: pointer; text-align: left;
  }
  .ps-label { font: 500 11.5px/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
  .ps-value { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ps-chev { width: 10px; height: 10px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); transition: transform .2s; margin-top: -4px; }
  .params[data-open="true"] .ps-chev { transform: rotate(-135deg); margin-top: 4px; }
  .params-body { display: none; padding-top: 4px; border-top: 1px solid var(--line); }
  .params[data-open="true"] .params-body { display: grid; }
  .params-title { display: none; }
  .formats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .detail { width: 100vw; height: 100%; max-height: 100vh; border-radius: 0; margin: 0; }
  .d-body { grid-template-columns: 1fr; overflow-y: auto; }
  .d-stage { min-height: 56vh; grid-template-rows: auto minmax(42vh, 1fr) auto; }
  .d-side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .d-head { padding: 12px max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); padding-top: max(12px, env(safe-area-inset-top, 0px)); }
  .foot-in { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .harr { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --top-h: 104px; }
  .top-in { flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; height: auto; min-height: var(--top-h); padding-block: 10px 8px; }
  .nav { margin-inline: -4px; }
  .nav a { padding: 7px 10px; font-size: 14px; }
  .nav .l { display: none; }
  .nav .s { display: inline; }
  .sheet-bar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
  .filters button { flex: none; }
  .hero-facts { grid-template-columns: 1fr; gap: 12px; }
  .hero-facts div { grid-template-columns: 48px minmax(0, 1fr); align-items: baseline; }
  .verdicts { grid-template-columns: 1fr; }
  .formats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid { grid-template-columns: 1fr; }
  .fmx { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .res-tools { display: grid; grid-template-columns: minmax(0, 1fr); }
  .res-tools .seg-small { justify-self: start; }
  .res-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .res-item .ri-body { padding: 8px 9px 9px; gap: 5px; }
  .d-head { flex-wrap: wrap; }
  .d-nav { width: 100%; justify-content: flex-end; }
  .bar-row { grid-template-columns: minmax(0, 1fr) 56px; }
  .bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
  .doc { gap: 28px; padding-block: 28px 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ── перевірка: мініатюри в таблиці ── */
.row-thumb { display: inline-block; width: 54px; height: 36px; border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 10px; background: var(--photo-bg); }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
table.data td .pill { white-space: nowrap; }
.metric.excluded .dbar { opacity: .4; }
.metric.excluded .m-name::after { content: " · інформація"; font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
