/* Генезис.юа — Liquid Glass у кольорах Державного Прапора України */
:root {
  --blue: #0057B7; --blue-600: #004A9E; --blue-700: #003C82; --blue-900: #0B1F44;
  --gold: #FFD700; --gold-600: #E6BF00; --gold-700: #B89600; --gold-900: #5C4B00;
  --bg: #EAF2FF; --bg-2: #FFF6CC;
  --ink: #0B1F44; --ink-2: #33445F; --muted: #5A6A85;
  --glass: rgba(255, 255, 255, .62); --glass-strong: rgba(255, 255, 255, .78);
  --glass-tint: rgba(0, 87, 183, .06);
  --hairline: rgba(255, 255, 255, .85); --hairline-out: rgba(11, 31, 68, .10);
  --shadow: 0 1px 2px rgba(11,31,68,.06), 0 10px 30px -10px rgba(0,87,183,.25), 0 30px 60px -30px rgba(11,31,68,.25);
  --shadow-hover: 0 2px 4px rgba(11,31,68,.06), 0 18px 40px -12px rgba(0,87,183,.35), 0 40px 80px -30px rgba(11,31,68,.3);
  --focus: 0 0 0 3px rgba(255, 215, 0, .9), 0 0 0 6px rgba(0, 87, 183, .35);
  --r-xl: 32px; --r-lg: 24px; --r-md: 16px; --r-sm: 12px; --r-pill: 999px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --font: "Manrope", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ok: #1DB954; --ok-bg: rgba(29,185,84,.14); --ok-ink: #0E6B33;
  --warn: #FF8A00; --warn-bg: rgba(255,138,0,.16); --warn-ink: #8A4B00;
  --bad: #E5484D; --bad-bg: rgba(229,72,77,.14); --bad-ink: #9B1C20;
  --neutral: #9AA6BC; --neutral-bg: rgba(154,166,188,.18); --neutral-ink: #4B5A75;
  --info: #3D8BFF; --info-bg: rgba(61,139,255,.14); --info-ink: #1B4F9E;
  --sidebar-w: 264px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071633; --bg-2: #2A2400;
    --ink: #F2F6FF; --ink-2: #C9D5EC; --muted: #93A3C2;
    --glass: rgba(16, 34, 70, .55); --glass-strong: rgba(16, 34, 70, .72);
    --glass-tint: rgba(255, 215, 0, .04);
    --hairline: rgba(255, 255, 255, .22); --hairline-out: rgba(255, 255, 255, .08);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -10px rgba(0,0,0,.5), 0 30px 60px -30px rgba(0,87,183,.5);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.3), 0 18px 40px -12px rgba(0,0,0,.6), 0 40px 80px -30px rgba(0,87,183,.6);
    --gold-700: #FFE04D; --blue-600: #6FA8FF; --blue-700: #8CBBFF;
    --ok-ink: #7BE2A3; --warn-ink: #FFC46B; --bad-ink: #FF9A9E; --neutral-ink: #C0CBE0; --info-ink: #9CC4FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #071633; --bg-2: #2A2400;
    --ink: #F2F6FF; --ink-2: #C9D5EC; --muted: #93A3C2;
    --glass: rgba(16, 34, 70, .55); --glass-strong: rgba(16, 34, 70, .72);
    --glass-tint: rgba(255, 215, 0, .04);
    --hairline: rgba(255, 255, 255, .22); --hairline-out: rgba(255, 255, 255, .08);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -10px rgba(0,0,0,.5), 0 30px 60px -30px rgba(0,87,183,.5);
    --shadow-hover: 0 2px 4px rgba(0,0,0,.3), 0 18px 40px -12px rgba(0,0,0,.6), 0 40px 80px -30px rgba(0,87,183,.6);
    --gold-700: #FFE04D; --blue-600: #6FA8FF; --blue-700: #8CBBFF;
    --ok-ink: #7BE2A3; --warn-ink: #FFC46B; --bad-ink: #FF9A9E; --neutral-ink: #C0CBE0; --info-ink: #9CC4FF;
    color-scheme: dark;
  }


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  color: var(--ink); background: var(--bg); overflow-x: hidden;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font); margin: 0; line-height: 1.15; letter-spacing: -.01em; font-weight: 800; }
p { margin: 0; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--r-sm); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.dot { color: var(--gold-600); }
.skip { position: absolute; left: -999px; top: var(--s-3); z-index: 100; padding: var(--s-2) var(--s-4); background: var(--gold); color: var(--blue-900); border-radius: var(--r-pill); font-weight: 600; }
.skip:focus { left: var(--s-3); }

/* ---------- Фон: прапор (синє небо → золоте поле) з живими блобами */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 60%, var(--blue) 12%) 45%, var(--bg-2) 100%); }
.blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; will-change: transform;
  animation: drift 26s var(--ease) infinite alternate; }
.blob-1 { width: 55vmax; height: 55vmax; left: -12vmax; top: -18vmax; background: radial-gradient(circle, var(--blue) 0%, transparent 65%); }
.blob-2 { width: 45vmax; height: 45vmax; right: -10vmax; top: 6vmax; background: radial-gradient(circle, #3D8BFF 0%, transparent 65%); animation-duration: 32s; animation-delay: -8s; }
.blob-3 { width: 60vmax; height: 60vmax; left: 10vmax; bottom: -30vmax; background: radial-gradient(circle, var(--gold) 0%, transparent 65%); animation-duration: 30s; animation-delay: -14s; }
.blob-4 { width: 40vmax; height: 40vmax; right: -8vmax; bottom: -12vmax; background: radial-gradient(circle, #FFB300 0%, transparent 65%); animation-duration: 36s; animation-delay: -20s; }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); } }
.watermark { position: absolute; right: -6vmin; bottom: -4vmin; width: 62vmin; height: 80vmin; fill: var(--ink); opacity: .035; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .watermark { fill: var(--gold); opacity: .05; } :root:not([data-theme="light"]) .blob { opacity: .4; } }
:root[data-theme="dark"] .watermark { fill: var(--gold); opacity: .05; } :root[data-theme="dark"] .blob { opacity: .4; }


/* ---------- Liquid Glass */
.glass {
  position: relative; isolation: isolate;
  background: linear-gradient(180deg, var(--glass-strong), var(--glass)), var(--glass-tint);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hairline-out); box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow);
  border-radius: var(--r-lg);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .35s var(--ease);
}
.glass::before { /* specular верхнє ребро */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(255,255,255,.65), rgba(255,255,255,0) 32%);
  mix-blend-mode: soft-light;
}
.glass::after { /* shimmer / рефракція — короткий м'який відблиск при наведенні, лише на дрібних елементах */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 1; opacity: 0;
  background: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.16) 49%, rgba(255,215,0,.08) 53%, transparent 60%);
  background-size: 300% 100%; background-position: 130% 0;
}
.glass:hover::after { animation: glass-shimmer .9s var(--ease) 1 both; }
@keyframes glass-shimmer { 0% { opacity: 0; background-position: 130% 0; } 25% { opacity: 1; } 100% { opacity: 0; background-position: -60% 0; } }
/* великі поверхні: без відблиску (заважає читати текст) */
:is(.panel, .table-wrap, .hit, .msg .bubble, .kpi, .assist-bar, .composer, .drawer, .modal, .sidebar, .topbar, .act-head, .tab-panel, .stage, .job-panel, .profile-card, .state, .skeleton, .ctx-p, .answer, .filters, .job-mini, .searchbar)::after { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .glass::after { background-image: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.09) 49%, rgba(255,215,0,.06) 53%, transparent 60%); } }
:root[data-theme="dark"] .glass::after { background-image: linear-gradient(115deg, transparent 42%, rgba(255,255,255,.09) 49%, rgba(255,215,0,.06) 53%, transparent 60%); }
.glass > * { position: relative; z-index: 2; }

/* ---------- Пошук */
.searchbar { width: 100%; max-width: 820px; margin-top: var(--s-4); display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); border-radius: var(--r-pill); }
.searchbar:focus-within { box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-hover), 0 0 0 3px rgba(255,215,0,.55); transform: translateY(-1px); }
.searchbar .icon { width: 22px; height: 22px; color: var(--blue-600); flex: none; }
.searchbar input { flex: 1; min-width: 0; border: 0; background: none; padding: var(--s-3) 0; font-size: 1.05rem; color: var(--ink); }
.searchbar input::placeholder { color: var(--muted); }
.searchbar input::-webkit-search-cancel-button, .searchbar input::-webkit-search-decoration { -webkit-appearance: none; }
.hint { font-family: var(--font); font-size: .75rem; font-weight: 700; color: var(--muted); padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--hairline-out); background: rgba(255,255,255,.35); }
.k-select select { appearance: none; -webkit-appearance: none; padding: var(--s-2) 28px var(--s-2) var(--s-3); border-radius: var(--r-pill);
  border: 1px solid var(--hairline-out); background: rgba(255,255,255,.4) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%235A6A85' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center / 16px;
  font-weight: 600; font-size: .9rem; color: var(--ink); }
.btn-primary { padding: var(--s-3) var(--s-5); border-radius: var(--r-pill); font-family: var(--font); font-weight: 700; color: #fff; letter-spacing: .01em;
  background: linear-gradient(180deg, #2F7DE1, var(--blue) 55%, var(--blue-600)); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 6px 16px -4px rgba(0,87,183,.6);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .25s; }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 10px 22px -6px rgba(0,87,183,.7); }
.btn-primary:active { transform: translateY(0) scale(.98); }
.btn-ghost { padding: var(--s-2) var(--s-3); border-radius: var(--r-pill); font-weight: 600; font-size: .88rem; color: var(--blue-600);
  border: 1px solid transparent; transition: background .25s, border-color .25s; }
.btn-ghost:hover { background: rgba(0,87,183,.1); border-color: var(--hairline-out); }

.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s-3); margin-top: var(--s-2); }
.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: var(--r-pill); gap: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { position: relative; z-index: 3; padding: var(--s-2) var(--s-4); border-radius: var(--r-pill); font-weight: 600; font-size: .9rem;
  color: var(--ink-2); cursor: pointer; text-align: center; white-space: nowrap; transition: color .3s; user-select: none; }
.segmented input:checked + label { color: var(--blue-900); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented input:checked + label { color: var(--blue-900); } }
:root[data-theme="dark"] .segmented input:checked + label { color: var(--blue-900); }

.segmented input:focus-visible + label { box-shadow: var(--focus); }
.segmented .thumb { position: absolute; z-index: 2; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: var(--r-pill);
  background: linear-gradient(180deg, #FFE455, var(--gold) 60%, var(--gold-600)); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 3px 10px -2px rgba(184,150,0,.6);
  transition: transform .35s var(--ease); }
.segmented input:nth-of-type(2):checked ~ .thumb { transform: translateX(100%); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; }
.chip { padding: 6px var(--s-4); border-radius: var(--r-pill); font-size: .88rem; font-weight: 600; color: var(--ink-2); }
.chip:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-hover); color: var(--blue-600); }

/* ---------- Результати */
.results { display: flex; flex-direction: column; gap: var(--s-4); }
.results-head { display: flex; align-items: baseline; gap: var(--s-3); padding: 0 var(--s-2); }
.results-head h2 { font-size: 1.25rem; }
.hit { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); animation: rise .5s var(--ease) both; }
.hit:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-hover); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.hit-head { display: flex; gap: var(--s-4); align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.hit-title { min-width: 0; flex: 1 1 60%; }
.hit .act { font-size: 1.08rem; font-weight: 700; color: var(--ink); }
.hit .where { margin-top: var(--s-1); display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: baseline; color: var(--ink-2); font-weight: 500; }
.hit .art { font-family: var(--font); font-weight: 800; color: var(--blue-600); }
.hit .heading { font-style: italic; }
.hit-meta { display: flex; gap: var(--s-2); align-items: center; flex: none; }
.chip-sm { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-size: .78rem; font-weight: 700;
  color: var(--gold-900); background: linear-gradient(180deg, rgba(255,229,102,.95), rgba(255,215,0,.85)); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 1px 3px rgba(184,150,0,.35); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip-sm { color: #3E3200; } }
:root[data-theme="dark"] .chip-sm { color: #3E3200; }

.score { font-family: var(--font); font-variant-numeric: tabular-nums; font-size: .8rem; font-weight: 700; color: var(--blue-600);
  padding: 4px 10px; border-radius: var(--r-pill); background: rgba(0,87,183,.1); border: 1px solid rgba(0,87,183,.15); }
.excerpt { color: var(--ink-2); line-height: 1.6; }
.excerpt mark, .full mark { background: linear-gradient(180deg, transparent 55%, rgba(255,215,0,.75) 55%); color: inherit; padding: 0 1px; border-radius: 2px; }
.full { white-space: pre-wrap; color: var(--ink); line-height: 1.65; padding: var(--s-4); border-radius: var(--r-md);
  background: rgba(255,255,255,.35); border: 1px solid var(--hairline-out); max-height: 60vh; overflow: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .full { background: rgba(0,0,0,.2); } }
:root[data-theme="dark"] .full { background: rgba(0,0,0,.2); }

.hit-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; font-size: .82rem; }
.path { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.state { padding: var(--s-6); text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.state .emblem { width: 44px; height: 57px; fill: var(--blue-600); opacity: .7; }
.state h3 { font-size: 1.15rem; }
.state.error .emblem { fill: #E5484D; }
.state p { color: var(--muted); max-width: 52ch; }

/* skeleton shimmer у склі */
.skeleton { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.sk { height: 14px; border-radius: 8px; position: relative; overflow: hidden;
  background: linear-gradient(90deg, rgba(0,87,183,.08), rgba(0,87,183,.16), rgba(0,87,183,.08)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.sk.t { height: 20px; width: 60%; } .sk.s { width: 35%; } .sk.l { width: 92%; } .sk.m { width: 80%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Панелі */
.panels { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--s-4); }
.panel { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); min-height: 180px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.panel-head h2 { font-size: 1.1rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.tile { padding: var(--s-4); border-radius: var(--r-md); background: rgba(255,255,255,.4); border: 1px solid var(--hairline-out);
  box-shadow: inset 0 1px 0 var(--hairline); display: flex; flex-direction: column; gap: 2px; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.tile:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 var(--hairline), 0 8px 20px -8px rgba(0,87,183,.4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile { background: rgba(255,255,255,.05); } }
:root[data-theme="dark"] .tile { background: rgba(255,255,255,.05); }

.tile .num { font-family: var(--font); font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--blue-600); }
.tile:nth-child(3n) .num { color: var(--gold-700); }
.tile .lbl { font-size: .78rem; color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.quota { display: flex; flex-direction: column; gap: var(--s-3); }
.bar { height: 10px; border-radius: 6px; background: rgba(0,87,183,.12); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.bar > i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, var(--blue), #2F7DE1 60%, var(--gold)); transition: width 1.2s var(--ease); }
.bar.warn > i { background: linear-gradient(90deg, var(--gold-600), #FF8A00); }
.quota .row, .live .row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); font-size: .9rem; }
.quota .row strong { font-family: var(--font); font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px var(--s-4); font-size: .88rem; }
.kv dt { color: var(--muted); font-weight: 600; } .kv dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- Футер */
.footer { position: relative; max-width: 1120px; margin: 0 auto; padding: var(--s-6) var(--s-4) var(--s-7); text-align: center; display: flex; flex-direction: column; gap: var(--s-2); }
.footer .flag-line { top: 0; bottom: auto; }
.glory { font-family: var(--font); font-weight: 800; font-size: 1.05rem; letter-spacing: .04em; text-transform: uppercase;
  background: linear-gradient(90deg, var(--blue-600), var(--gold-700)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.footer .muted { font-size: .85rem; }

/* ---------- Доступність: менше руху */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .blob { opacity: .35; }
  html { scroll-behavior: auto; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

/* =====================================================================
   Кабінет: оболонка (сайдбар + топбар), маршрути, компоненти
   ===================================================================== */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; gap: var(--s-4); padding: var(--s-3); }
.content { min-width: 0; display: flex; flex-direction: column; gap: var(--s-4); }
main { flex: 1; display: flex; flex-direction: column; gap: var(--s-5); padding: var(--s-2) 0 var(--s-5); max-width: 1240px; width: 100%; }
main:focus { outline: none; }

/* ---------- Сайдбар */
.sidebar { position: sticky; top: var(--s-3); height: calc(100dvh - var(--s-3) * 2); display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-4) var(--s-3) var(--s-4); border-radius: var(--r-xl); z-index: 60; }
.brand { display: flex; align-items: center; gap: var(--s-3); color: var(--ink); text-decoration: none !important; padding: 0 var(--s-2); }
.roundel { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 35% 30%, #2F7DE1, var(--blue) 60%, var(--blue-700));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 4px 12px -2px rgba(0,87,183,.5); }
.tryzub { width: 24px; height: 31px; fill: var(--gold); filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font); font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: .72rem; font-weight: 500; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.side-group { font-family: var(--font); font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: var(--s-4) var(--s-3) var(--s-1); }
.side-nav a { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-3); border-radius: var(--r-md); color: var(--ink-2); font-weight: 600; font-size: .95rem;
  border: 1px solid transparent; transition: background .25s, color .25s, border-color .25s; }
.side-nav a:hover { background: rgba(0,87,183,.08); color: var(--blue-600); text-decoration: none; }
.side-nav a[aria-current="page"] { background: linear-gradient(180deg, rgba(255,229,102,.95), rgba(255,215,0,.85)); color: var(--blue-900); border-color: rgba(184,150,0,.35);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 3px 10px -2px rgba(184,150,0,.5); }
.ico { width: 20px; height: 20px; flex: none; }
.side-foot { position: relative; padding: var(--s-3) var(--s-2) var(--s-2); }
.job-mini { display: flex; align-items: center; gap: var(--s-2); font-size: .8rem; font-weight: 600; color: var(--ink-2); padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  background: var(--info-bg); border: 1px solid var(--hairline-out); }
.job-mini .pulse { background: var(--info); animation: pulse 2s infinite; }
.job-mini-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(11,31,68,.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }

/* ---------- Топбар */
.topbar { position: sticky; top: var(--s-3); z-index: 50; display: flex; align-items: center; gap: var(--s-4); padding: var(--s-2) var(--s-4) calc(var(--s-2) + 3px); border-radius: var(--r-xl); }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--blue-600); border: 1px solid transparent; transition: background .25s, border-color .25s; }
.icon-btn:hover { background: rgba(0,87,183,.1); border-color: var(--hairline-out); }
.menu-btn { display: none; }
.topsearch { max-width: 560px; margin: 0; padding: 2px var(--s-3) 2px var(--s-4); box-shadow: inset 0 0 0 1px var(--hairline); }
.topsearch input { padding: var(--s-2) 0; font-size: .98rem; }
.health-chips { display: flex; gap: var(--s-2); margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.hchip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: var(--r-pill); font-size: .78rem; font-weight: 700; color: var(--muted);
  background: var(--neutral-bg); border: 1px solid var(--hairline-out); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--neutral); flex: none; }
.hchip.ok { color: var(--ok-ink); background: var(--ok-bg); } .hchip.ok .pulse { background: var(--ok); animation: pulse 2s infinite; }
.hchip.bad { color: var(--bad-ink); background: var(--bad-bg); } .hchip.bad .pulse { background: var(--bad); }
.hchip.off { color: var(--neutral-ink); } .hchip.off .pulse { background: var(--neutral); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(29,185,84,.5);} 70% { box-shadow: 0 0 0 8px rgba(29,185,84,0);} 100% { box-shadow: 0 0 0 0 rgba(29,185,84,0);} }
.flag-line { position: absolute; left: var(--s-5); right: var(--s-5); bottom: 0; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--blue) 0 50%, var(--gold) 50% 100%); opacity: .9; z-index: 2; }

/* ---------- Заголовки сторінок */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; padding: 0 var(--s-2); }
.page-head h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.02em;
  background: linear-gradient(90deg, var(--blue-600) 0%, var(--blue) 55%, var(--gold-700) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.page-head p { color: var(--ink-2); max-width: 70ch; }
.page-head .actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s-4); padding-top: var(--s-5); }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 800; letter-spacing: -.03em;
  background: linear-gradient(90deg, var(--blue-600) 0%, var(--blue) 55%, var(--gold-700) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero h1 .dot { color: transparent; }
.tagline { font-size: clamp(1.05rem, 2.2vw, 1.3rem); color: var(--ink-2); max-width: 44ch; font-weight: 500; text-wrap: balance; }
.hit-actions { display: flex; gap: var(--s-2); align-items: center; }
.hit .act a { color: inherit; } .hit .act a:hover { color: var(--blue-600); }

/* ---------- Кнопки / форми */
.btn-secondary { padding: var(--s-2) var(--s-4); border-radius: var(--r-pill); font-family: var(--font); font-weight: 700; font-size: .9rem; color: var(--blue-900);
  background: linear-gradient(180deg, #FFE455, var(--gold) 60%, var(--gold-600)); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 3px 10px -2px rgba(184,150,0,.6);
  transition: transform .25s var(--ease), filter .25s; }
.btn-secondary:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn-danger { padding: var(--s-2) var(--s-4); border-radius: var(--r-pill); font-family: var(--font); font-weight: 700; font-size: .9rem; color: #fff;
  background: linear-gradient(180deg, #FF6B70, var(--bad) 60%, #B8262B); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 6px 16px -4px rgba(229,72,77,.6); }
.btn-primary.sm, .btn-secondary.sm, .btn-danger.sm { padding: 7px var(--s-4); font-size: .85rem; }
button:disabled, .btn-primary:disabled, .btn-secondary:disabled { opacity: .55; cursor: not-allowed; transform: none !important; filter: none !important; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; color: var(--ink-2); font-weight: 600; min-width: 0; }
.field input[type="text"], .field input[type="number"], .field input[type="search"], .field select, .field textarea, .input {
  padding: 9px var(--s-3); border-radius: var(--r-sm); border: 1px solid var(--hairline-out); background: rgba(255,255,255,.45); color: var(--ink); font-weight: 500; font-size: .92rem; min-width: 0; width: 100%; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.field input, .field select, .field textarea, .input) { background: rgba(0,0,0,.22); } }
:root[data-theme="dark"] :is(.field input, .field select, .field textarea, .input) { background: rgba(0,0,0,.22); }
.field select { appearance: none; -webkit-appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%235A6A85' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; }
.field textarea { min-height: 72px; resize: vertical; font-family: var(--font-body); }
.check { display: flex; align-items: center; gap: var(--s-2); font-size: .88rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s-3); align-items: end; }
.form-row { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: end; padding: var(--s-4); }
.filters .field { flex: 1 1 160px; } .filters .field.grow { flex: 2 1 260px; }
.filters .check { padding-bottom: 9px; }

/* ---------- Пілюлі статусів (семантичні, не акцент) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); font-size: .74rem; font-weight: 700; white-space: nowrap;
  color: var(--neutral-ink); background: var(--neutral-bg); border: 1px solid rgba(0,0,0,.05); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok { color: var(--ok-ink); background: var(--ok-bg); }
.pill.warn { color: var(--warn-ink); background: var(--warn-bg); }
.pill.bad { color: var(--bad-ink); background: var(--bad-bg); }
.pill.info { color: var(--info-ink); background: var(--info-bg); }
.pill.gold { color: var(--gold-900); background: linear-gradient(180deg, rgba(255,229,102,.95), rgba(255,215,0,.85)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.gold { color: #3E3200; } }
:root[data-theme="dark"] .pill.gold { color: #3E3200; }
.tag { display: inline-block; padding: 2px 9px; border-radius: var(--r-pill); font-size: .74rem; font-weight: 600; color: var(--ink-2); background: rgba(0,87,183,.08); border: 1px solid rgba(0,87,183,.12); }

/* ---------- Таблиця реєстру */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-family: var(--font); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--hairline-out); white-space: nowrap; }
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--hairline-out); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .2s; } .table tbody tr:hover { background: rgba(0,87,183,.05); }
.table .title a { color: var(--ink); font-weight: 600; } .table .title a:hover { color: var(--blue-600); }
.table .nreg { font-family: var(--font); font-weight: 700; color: var(--blue-600); white-space: nowrap; }
.table .num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.table .dim { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); flex-wrap: wrap; font-size: .88rem; color: var(--ink-2); }
.pager .pages { display: flex; gap: 4px; }
.pager button { min-width: 36px; height: 36px; border-radius: var(--r-pill); font-weight: 700; color: var(--blue-600); border: 1px solid transparent; }
.pager button:hover:not(:disabled) { background: rgba(0,87,183,.1); border-color: var(--hairline-out); }
.pager button[aria-current="page"] { background: var(--blue); color: #fff; }

/* ---------- Картка акта */
.act-head { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.act-head h1 { font-size: clamp(1.3rem, 2.6vw, 1.9rem); letter-spacing: -.02em; color: var(--ink); text-wrap: balance; }
.act-meta { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.act-meta .nreg { font-family: var(--font); font-weight: 800; color: var(--blue-600); font-size: 1rem; }
.act-dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-2) var(--s-4); }
.act-dates .d { display: flex; flex-direction: column; font-size: .84rem; }
.act-dates .d span { color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; }
.act-dates .d strong { font-family: var(--font); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); width: max-content; max-width: 100%; overflow-x: auto; }
.tabs button { padding: var(--s-2) var(--s-4); border-radius: var(--r-pill); font-weight: 700; font-size: .9rem; color: var(--ink-2); white-space: nowrap; transition: background .3s, color .3s; }
.tabs button[aria-selected="true"] { background: linear-gradient(180deg, #FFE455, var(--gold) 60%, var(--gold-600)); color: var(--blue-900); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 3px 10px -2px rgba(184,150,0,.6); }
.tabs button .cnt { font-size: .74rem; opacity: .75; margin-left: 6px; font-variant-numeric: tabular-nums; }
.tab-panel { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.tab-toolbar { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; justify-content: space-between; }

/* дерево структури */
.tree { display: flex; flex-direction: column; gap: 6px; }
.tree details { border-radius: var(--r-md); border: 1px solid var(--hairline-out); background: rgba(255,255,255,.3); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tree details { background: rgba(255,255,255,.04); } }
:root[data-theme="dark"] .tree details { background: rgba(255,255,255,.04); }
.tree summary { cursor: pointer; list-style: none; padding: var(--s-3) var(--s-4); font-family: var(--font); font-weight: 700; display: flex; align-items: center; gap: var(--s-2); color: var(--ink); }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--blue-600); border-bottom: 2px solid var(--blue-600); transform: rotate(-45deg); transition: transform .25s var(--ease); flex: none; }
.tree details[open] > summary::before { transform: rotate(45deg); }
.tree summary .cnt { margin-left: auto; font-size: .74rem; color: var(--muted); font-weight: 600; }
.tree .sec-body { padding: 0 var(--s-3) var(--s-3); display: flex; flex-direction: column; gap: 6px; }
.prov { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: 1px solid transparent; scroll-margin-top: 90px; transition: background .3s, border-color .3s; }
.prov:target, .prov.flash { background: rgba(255,215,0,.18); border-color: rgba(184,150,0,.4); }
.prov-head { display: flex; gap: var(--s-2); align-items: baseline; flex-wrap: wrap; }
.prov-head .art { font-family: var(--font); font-weight: 800; color: var(--blue-600); }
.prov-head .art a { color: inherit; }
.prov-head .lvl { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.prov-head .heading { font-weight: 600; color: var(--ink); }
.prov-head .badges { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.prov-text { white-space: pre-wrap; color: var(--ink); line-height: 1.6; margin-top: 6px; font-size: .94rem; }
.prov-text.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.prov .more { margin-top: 4px; padding: 2px var(--s-2); font-size: .8rem; }
.note { margin-top: var(--s-2); padding: var(--s-2) var(--s-3); border-left: 3px solid var(--neutral); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--neutral-bg); color: var(--muted); font-size: .8rem; font-style: italic; line-height: 1.5; }
.note b { font-style: normal; font-weight: 700; color: var(--neutral-ink); text-transform: uppercase; font-size: .66rem; letter-spacing: .08em; margin-right: 6px; }
.notes-list { display: flex; flex-direction: column; gap: 6px; }

/* таймлайн (редакції / події) */
.timeline { display: flex; flex-direction: column; position: relative; padding-left: var(--s-5); }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(180deg, var(--blue), var(--gold)); opacity: .5; border-radius: 2px; }
.tl-item { position: relative; padding: var(--s-2) 0 var(--s-3) var(--s-3); display: flex; flex-direction: column; gap: 4px; }
.tl-item::before { content: ""; position: absolute; left: calc(-1 * var(--s-5) + 2px); top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--glass-strong); border: 2px solid var(--blue); }
.tl-item.active::before { background: var(--gold); border-color: var(--gold-700); box-shadow: 0 0 0 4px rgba(255,215,0,.3); }
.tl-item .when { font-family: var(--font); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.tl-item .what { color: var(--ink-2); font-size: .9rem; }
.tl-item .basis { display: flex; gap: 4px; flex-wrap: wrap; }
.tl-item button.pick { padding: 3px var(--s-3); font-size: .78rem; }

/* посилання */
.cite-list { display: flex; flex-direction: column; gap: 6px; }
.cite { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s-3); align-items: center; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); border: 1px solid var(--hairline-out); background: rgba(255,255,255,.3); font-size: .9rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cite { background: rgba(255,255,255,.04); } }
:root[data-theme="dark"] .cite { background: rgba(255,255,255,.04); }
.cite .nreg { font-family: var(--font); font-weight: 700; color: var(--blue-600); white-space: nowrap; }
.cite .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite .t a { color: var(--ink); } .cite .t a:hover { color: var(--blue-600); }
.cite .rel { font-size: .76rem; color: var(--muted); }

/* ---------- Конвеєр даних */
.stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s-4); }
.stage { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.stage-head { display: flex; align-items: flex-start; gap: var(--s-3); }
.stage-no { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-family: var(--font); font-weight: 800; color: #fff;
  background: linear-gradient(180deg, #2F7DE1, var(--blue) 55%, var(--blue-600)); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 4px 10px -3px rgba(0,87,183,.6); }
.stage h3 { font-size: 1.05rem; } .stage .cmd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; color: var(--muted); }
.stage p { color: var(--ink-2); font-size: .9rem; }
.stage-form { display: flex; flex-direction: column; gap: var(--s-3); }
.stage-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-top: auto; }
.stage-status { font-size: .82rem; color: var(--muted); display: flex; gap: var(--s-2); align-items: center; }
.quota-inline { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: var(--muted); }
.quota-inline .bar { height: 7px; }
.pipeline-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
.job-panel { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.job-head { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.job-head h2 { font-size: 1.1rem; }
.log { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 46vh; overflow: auto; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); color: var(--ink); background: rgba(11,31,68,.06); border: 1px solid var(--hairline-out); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .log { background: rgba(0,0,0,.3); } }
:root[data-theme="dark"] .log { background: rgba(0,0,0,.3); }
.log .err { color: var(--bad-ink); } .log .warn { color: var(--warn-ink); } .log .ok { color: var(--ok-ink); }
.jobs-list { display: flex; flex-direction: column; gap: 6px; }
.job-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--s-3); align-items: center; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); border: 1px solid var(--hairline-out); font-size: .86rem; cursor: pointer; transition: background .2s; }
.job-row:hover { background: rgba(0,87,183,.06); }
.job-row[aria-current="true"] { border-color: rgba(0,87,183,.4); background: rgba(0,87,183,.06); }
.job-row .kind { font-family: var(--font); font-weight: 800; color: var(--blue-600); }
.job-row .params { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-row .when { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.result-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: var(--s-2); }
.result-tiles .tile { padding: var(--s-3); } .result-tiles .tile .num { font-size: 1.2rem; }

/* ---------- Індекс: токени */
.tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.tokens .tok { padding: 4px 10px; border-radius: var(--r-pill); font-family: var(--font); font-weight: 700; font-size: .84rem; color: var(--blue-900);
  background: linear-gradient(180deg, rgba(255,229,102,.95), rgba(255,215,0,.85)); box-shadow: inset 0 1px 0 rgba(255,255,255,.7); animation: rise .4s var(--ease) both; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--s-4); align-items: start; }
.three-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-4); align-items: start; }
.kv-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--s-2); }
.kv-tiles .tile .num { font-size: .92rem; font-weight: 700; overflow-wrap: anywhere; color: var(--ink); }
.kv-tiles .tile:nth-child(3n) .num { color: var(--ink); }

/* ---------- Знімок БД */
.snap-meta { display: flex; gap: var(--s-4); flex-wrap: wrap; align-items: center; font-size: .9rem; color: var(--ink-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }

/* ---------- Drawer / Modal / Toasts */
.drawer-root, .modal-root { position: fixed; inset: 0; z-index: 90; display: flex; }
.drawer-root .backdrop, .modal-root .backdrop { position: absolute; inset: 0; background: rgba(11,31,68,.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.drawer { position: relative; margin-left: auto; width: min(480px, 100%); height: 100%; border-radius: var(--r-xl) 0 0 var(--r-xl); padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); overflow: auto;
  animation: slide-in .4s var(--ease) both; }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head, .modal-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.drawer-head h2, .modal-head h2 { font-size: 1.15rem; }
.modal-root { align-items: center; justify-content: center; padding: var(--s-4); }
.modal { position: relative; width: min(520px, 100%); padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); animation: rise .4s var(--ease) both; }
.modal p { color: var(--ink-2); }
.modal-actions { display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; }
.toasts { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 100; display: flex; flex-direction: column; gap: var(--s-2); max-width: min(380px, calc(100% - var(--s-6))); }
.toast { padding: var(--s-3) var(--s-4); display: flex; gap: var(--s-3); align-items: center; font-size: .9rem; font-weight: 600; animation: rise .4s var(--ease) both; border-left: 4px solid var(--info); }
.toast.ok { border-left-color: var(--ok); } .toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; }

/* ---------- Адаптивність */
@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: var(--s-3); top: var(--s-3); width: var(--sidebar-w); transform: translateX(calc(-100% - var(--s-4))); transition: transform .35s var(--ease); }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; }
  .health-chips .hchip { font-size: 0; gap: 0; padding: 6px; } .health-chips .hchip .pulse { margin: 0; }
  .topsearch { flex: 1; }
  .panels { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .shell { padding: var(--s-2); gap: var(--s-3); }
  .topbar { gap: var(--s-2); padding: var(--s-2) var(--s-3) calc(var(--s-2) + 3px); }
  .topsearch .hint { display: none; }
  .hit { padding: var(--s-4); }
  .searchbar { flex-wrap: wrap; padding: var(--s-3); border-radius: var(--r-lg); }
  .searchbar.topsearch { flex-wrap: nowrap; padding: 2px var(--s-3); border-radius: var(--r-pill); }
  .searchbar:not(.topsearch) input { flex-basis: 100%; order: -1; padding: var(--s-2) var(--s-1); }
  .searchbar:not(.topsearch) .icon, .searchbar:not(.topsearch) .hint { display: none; }
  .k-select { margin-left: auto; }
  .tab-panel, .stage, .act-head, .job-panel { padding: var(--s-4); }
  .cite { grid-template-columns: 1fr; gap: 4px; }
  .job-row { grid-template-columns: 1fr auto; } .job-row .params { display: none; }
}


/* ---------- Запитати (RAG + локальна LLM) */
.ask-hero .searchbar { max-width: 880px; }
.ask-hero .controls { align-items: center; }
.model-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--r-pill); font-family: var(--font); font-weight: 700; font-size: .85rem; color: var(--neutral-ink); }
.model-badge .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral); }
.model-badge.ok { color: var(--ok-ink); } .model-badge.ok .pulse { background: var(--ok); animation: pulse 2s infinite; }
.model-badge.off { color: var(--warn-ink); } .model-badge.off .pulse { background: var(--warn); }
.ask-opt { padding: 6px 12px; border-radius: var(--r-pill); }
.ask-opt select { border: 0; background: transparent; font-weight: 700; color: var(--blue-600); }
.ask-out { display: flex; flex-direction: column; gap: var(--s-4); margin-top: var(--s-5); }
.answer { padding: var(--s-5) var(--s-6); animation: rise .5s var(--ease) both; }
.answer-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.answer-head h2 { font-size: 1.15rem; }
.answer-body { font-size: 1.02rem; line-height: 1.7; color: var(--ink); }
.answer-body p { margin: 0 0 var(--s-3); } .answer-body p:last-child { margin-bottom: 0; }
.answer-body .cite-n { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; margin: 0 2px; padding: 0 6px; border-radius: var(--r-pill);
  font-family: var(--font); font-size: .74rem; font-weight: 800; color: var(--blue-900); background: linear-gradient(180deg, var(--gold), var(--gold-600)); text-decoration: none; vertical-align: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 2px 6px -2px rgba(184,150,0,.6); transition: transform .2s var(--ease); }
.answer-body .cite-n:hover { transform: translateY(-1px) scale(1.06); text-decoration: none; }
.passage .pn { font-family: var(--font); font-weight: 800; color: var(--gold-700); margin-right: 2px; }
.passage .prov-text { white-space: pre-wrap; font-size: .95rem; color: var(--ink-2); }
.passage .prov-text.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.passage.flash { animation: flash-glow 2.2s var(--ease); }
@keyframes flash-glow { 0% { box-shadow: 0 0 0 3px rgba(255,215,0,.95), var(--shadow-hover); } 100% { box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow); } }

/* ---------- Індекс: конвеєр, датчики, прогрес */
.pipeline { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-4); counter-reset: p; }
.pnode { position: relative; padding: var(--s-4); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 6px; animation: rise .5s var(--ease) both; }
.pnode .ico { width: 22px; height: 22px; color: var(--blue-600); }
.pnode strong { font-family: var(--font); font-size: .95rem; }
.pnode small { color: var(--muted); font-size: .76rem; line-height: 1.35; }
.pnode .pno { position: absolute; top: 8px; right: 10px; font-family: var(--font); font-weight: 800; font-size: .72rem; color: var(--gold-700); }
.pnode:not(:last-child)::after { content: ""; position: absolute; right: -14px; top: 50%; width: 14px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--blue), var(--gold)); opacity: .9; z-index: 3; }
@media (max-width: 720px) { .pnode:not(:last-child)::after { display: none; } }
.idx-grid { align-items: stretch; }
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s-3); }
.gauge { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; position: relative; }
.gauge svg { width: 96px; height: 96px; transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: rgba(0,87,183,.16); stroke-width: 9; }
.gauge .fill { fill: none; stroke: var(--gold); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); }
.gauge-num { position: absolute; top: 34px; font-family: var(--font); font-weight: 800; font-size: 1.15rem; color: var(--blue-600); font-variant-numeric: tabular-nums; }
.gauge-lbl { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.gauge-lbl small { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 70px; gap: var(--s-3); align-items: center; font-size: .85rem; }
.hbar .hb-lbl { color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .hb-track { height: 12px; border-radius: 4px; background: rgba(0,87,183,.12); overflow: hidden; }
.hbar .hb-track i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--blue-600), var(--blue)); transition: width 1s var(--ease); }
.hbar:hover .hb-track i { filter: brightness(1.12); }
.hbar .hb-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .hbar { grid-template-columns: 90px 1fr 60px; } }
.panel.live { border-color: rgba(255,215,0,.55); }
.pulse-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); margin-right: 8px; animation: pulse 2s infinite; vertical-align: 2px; }
.live-bar i { background: linear-gradient(90deg, var(--blue), var(--gold)); }
.live-meta { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: .84rem; color: var(--ink-2); margin-top: var(--s-2); }

/* ---------- Асистент (#/): чат + контекстна панель */
.modes { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); width: max-content; max-width: 100%; overflow-x: auto; }
.modes button { padding: var(--s-2) var(--s-4); border-radius: var(--r-pill); font-family: var(--font); font-weight: 700; font-size: .88rem; color: var(--ink-2); white-space: nowrap; transition: background .3s, color .3s; }
.modes button[aria-selected="true"] { background: linear-gradient(180deg, #FFE455, var(--gold) 60%, var(--gold-600)); color: var(--blue-900); box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 3px 10px -2px rgba(184,150,0,.6); }
.assist-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-6) var(--s-4); max-width: 720px; }
.assist-empty .emblem { width: 44px; height: 57px; fill: var(--blue-600); opacity: .7; }
.assist-empty h2 { font-size: 1.4rem; }
.assist-empty p { max-width: 60ch; }
.msg { display: flex; animation: rise .4s var(--ease) both; }
.msg.user { justify-content: flex-end; }
.msg .bubble { max-width: min(100%, 860px); padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.msg.user .bubble { background: linear-gradient(180deg, rgba(0,87,183,.16), rgba(0,87,183,.10)), var(--glass); border-bottom-right-radius: var(--r-sm); font-weight: 500; white-space: pre-wrap; }
.msg.assistant .bubble { width: 100%; border-bottom-left-radius: var(--r-sm); }
.msg-head { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.msg-foot { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.msg-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.timings { display: inline-flex; gap: var(--s-2); flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.timings span { padding: 2px 8px; border-radius: var(--r-pill); background: var(--neutral-bg); }
.timings b { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ctx-md { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; line-height: 1.5; max-height: 40vh; overflow: auto; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: rgba(11,31,68,.06); border: 1px solid var(--hairline-out); color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ctx-md { background: rgba(0,0,0,.3); } }
:root[data-theme="dark"] .ctx-md { background: rgba(0,0,0,.3); }
.composer-form { display: flex; gap: var(--s-2); align-items: flex-end; }
.composer-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 320px; padding: 10px var(--s-4); border-radius: var(--r-lg); border: 1px solid var(--hairline-out); background: rgba(255,255,255,.55); color: var(--ink); font-size: 1rem; line-height: 1.5; font-family: var(--font-body); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .composer-form textarea { background: rgba(0,0,0,.25); } }
:root[data-theme="dark"] .composer-form textarea { background: rgba(0,0,0,.25); }
.composer-form .send { width: 46px; height: 46px; padding: 0; border-radius: 50%; display: grid; place-items: center; flex: none; }
.composer-form .send .ico { width: 20px; height: 20px; }
.tiny { font-size: .76rem; }
.budget { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--ink-2); }
.budget .bar { height: 7px; }
.ctx-p { padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-2); border-radius: var(--r-md); }
.ctx-p header { display: flex; gap: var(--s-2); align-items: baseline; flex-wrap: wrap; font-weight: 700; }
.ctx-p header .pn { font-family: var(--font); font-weight: 800; color: var(--gold-700); }
.ctx-p header .act-link { color: var(--ink); }
.ctx-p header .art { font-family: var(--font); font-weight: 800; color: var(--blue-600); }
.ctx-p .heading { font-size: .84rem; font-style: italic; }
.ctx-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ctx-p .prov-text { font-size: .88rem; color: var(--ink-2); margin: 0; }
.ctx-p .prov-text.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.ctx-p .more { align-self: flex-start; padding: 2px var(--s-2); font-size: .78rem; }
.ctx-p footer { font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-p.flash { animation: flash-glow 2s var(--ease); }
.ctx-list { display: flex; flex-direction: column; }
.conv-list { display: flex; flex-direction: column; gap: 6px; }
.conv-row { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s-2); align-items: center; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); border: 1px solid var(--hairline-out); cursor: pointer; }
.conv-row .t { grid-column: 1; grid-row: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-row .m { grid-column: 1; grid-row: 2; font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-row .del { grid-column: 2; grid-row: 1 / span 2; width: 32px; height: 32px; }
.conv-row.active { border-color: rgba(0,87,183,.4); background: rgba(0,87,183,.06); }
.conv-row:hover { background: rgba(0,87,183,.06); }
.check-list { display: flex; flex-direction: column; gap: var(--s-3); }
.check-item { padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border-left: 4px solid var(--neutral); background: rgba(255,255,255,.35); display: flex; flex-direction: column; gap: 6px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .check-item { background: rgba(255,255,255,.05); } }
:root[data-theme="dark"] .check-item { background: rgba(255,255,255,.05); }
.check-item.conflict { border-left-color: var(--bad); } .check-item.ok { border-left-color: var(--ok); } .check-item.unknown { border-left-color: var(--warn); }
.check-head { display: flex; gap: var(--s-2); align-items: center; }
.check-q { margin: 0; padding: 6px var(--s-3); border-left: 2px solid var(--hairline-out); color: var(--ink-2); font-size: .88rem; font-style: italic; }

/* ---------- Контекст (#/context) */
.cx-form .field.range { flex: 1 1 180px; }
.cx-form .field.range input[type="range"] { accent-color: var(--blue); width: 100%; }
.cx-form textarea { min-height: 56px; }
.trace-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-4); margin: var(--s-4) 0; }
.trace-col { min-height: 0; }
.trace-list { margin: 0; padding: 0 0 0 var(--s-2); list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: .84rem; }
.trace-list li { display: grid; grid-template-columns: 26px 1fr auto; gap: 6px; align-items: baseline; padding: 4px 6px; border-radius: var(--r-sm); }
.trace-list li:hover { background: rgba(0,87,183,.06); }
.trace-list .rk { font-family: var(--font); font-weight: 800; color: var(--gold-700); font-variant-numeric: tabular-nums; }
.trace-list a { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-list .art { color: var(--blue-600); font-weight: 700; margin-left: 4px; }
.trace-list .sc { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .76rem; }
.table tr.sel td { background: rgba(255,215,0,.14); }
#cx-out { display: flex; flex-direction: column; gap: var(--s-4); margin-top: var(--s-4); }
#cx-out details summary { cursor: pointer; font-weight: 700; color: var(--blue-600); }

/* ---------- Профілі (#/profiles) */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--s-4); margin-top: var(--s-4); }
.profile-card { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.profile-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); flex-wrap: wrap; }
.profile-card h2 { font-size: 1.2rem; }
.pf-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.cov { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; }
.cov-row { display: flex; justify-content: space-between; color: var(--ink-2); }
.cov .bar { height: 8px; }
.pf-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: auto; }
.cov-list { display: flex; flex-direction: column; gap: 6px; }
.cov-item { padding: var(--s-2) var(--s-3); border-radius: var(--r-md); border-left: 3px solid var(--neutral); background: rgba(255,255,255,.3); font-size: .86rem; }
.cov-item.ok { border-left-color: var(--ok); } .cov-item.warn { border-left-color: var(--warn); } .cov-item.bad { border-left-color: var(--bad); }
.ci-head { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ci-title { color: var(--ink-2); }
.pf-form { display: flex; flex-direction: column; gap: var(--s-3); max-height: 78vh; overflow: auto; padding-right: 4px; }
.modal:has(.pf-form) { width: min(760px, 100%); }
.picker { position: relative; }
.pk-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.pk-hit { text-align: left; padding: 6px var(--s-3); border-radius: var(--r-sm); border: 1px solid var(--hairline-out); font-size: .86rem; }
.pk-hit:hover { background: rgba(0,87,183,.08); }
.pk-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow: auto; }
.pk-row { display: grid; grid-template-columns: 110px 70px 1fr 32px; gap: 6px; align-items: center; font-size: .86rem; }
.pk-row .nreg { font-family: var(--font); font-weight: 700; }
.pk-row input { padding: 4px 8px; border-radius: var(--r-sm); border: 1px solid var(--hairline-out); background: rgba(255,255,255,.45); color: var(--ink); min-width: 0; }
.pk-row .icon-btn { width: 30px; height: 30px; }

/* ---------- Підключення (#/connect) */
.snippet { min-height: 0; }
.code { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); color: var(--ink); background: rgba(11,31,68,.07); border: 1px solid var(--hairline-out); overflow-x: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .code { background: rgba(0,0,0,.3); } }
:root[data-theme="dark"] .code { background: rgba(0,0,0,.3); }
.page-head code, .panel p code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; padding: 1px 6px; border-radius: 6px; background: rgba(0,87,183,.08); }

@media (max-width: 640px) {
  .pk-row { grid-template-columns: 90px 60px 1fr 30px; }
}

/* --- пояснення «Що це і як користуватись» (Конвеєр) */
.howto { margin-bottom: var(--s-5); min-height: 0; }
.howto summary .muted { font-weight: 500; }
.howto summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--s-3); }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::before { content: "▸"; color: var(--gold-700); transition: transform .2s var(--ease); }
.howto[open] summary::before { transform: rotate(90deg); }
.howto summary h2 { margin: 0; font-size: 1.05rem; }
.howto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-5); margin-top: var(--s-4); }
.howto-grid h3 { margin: 0 0 var(--s-2); font-size: .95rem; }
.howto-grid p { margin: 0; font-size: .9rem; line-height: 1.55; }
.howto-steps { margin: 0; padding-left: 1.2em; font-size: .9rem; line-height: 1.55; color: var(--ink-2); }
.howto-steps li + li { margin-top: var(--s-1); }
.howto code { font-size: .85em; background: var(--glass-tint); padding: 1px 5px; border-radius: 6px; }

/* --- Готовність системи (Конвеєр) */
.readiness { margin-bottom: var(--s-5); border-left: 4px solid var(--muted); }
.readiness.ok { border-left-color: var(--ok, #2E9E5B); } .readiness.warn { border-left-color: var(--gold-600); } .readiness.bad { border-left-color: var(--bad, #C93B3B); }
.readiness-head { display: flex; justify-content: space-between; gap: var(--s-5); align-items: flex-start; flex-wrap: wrap; }
.readiness-head p { margin: var(--s-2) 0 0; font-size: .9rem; }
.pill.big { font-size: 1rem; padding: 6px 14px; }
.next-step { display: grid; gap: 2px; min-width: 260px; max-width: 420px; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); text-decoration: none; color: var(--ink);
  background: linear-gradient(135deg, rgba(255,215,0,.22), rgba(0,87,183,.10)); border: 1px solid rgba(255,215,0,.6); box-shadow: 0 0 0 4px rgba(255,215,0,.15), var(--shadow); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.next-step:hover { transform: translateY(-2px); box-shadow: 0 0 0 6px rgba(255,215,0,.22), var(--shadow-hover); }
.next-step small { text-transform: uppercase; letter-spacing: .06em; font-size: .7rem; color: var(--gold-700); font-weight: 700; }
.next-step b { font-size: 1.05rem; } .next-step span { font-size: .85rem; color: var(--ink-2); }
.next-step.done { background: var(--glass-tint); border-color: var(--hairline-out); box-shadow: none; }
.readiness-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--s-5); margin-top: var(--s-4); }
@media (max-width: 800px) { .readiness-grid { grid-template-columns: 1fr; } }
.readiness-grid h3 { margin: 0 0 var(--s-2); font-size: .95rem; }
.caps, .stage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.caps li { display: grid; grid-template-columns: 22px 1fr; gap: 0 8px; align-items: baseline; font-size: .92rem; }
.caps li small { grid-column: 2; color: var(--muted); font-size: .8rem; }
.caps .mark { font-weight: 800; } .caps li.ok .mark { color: var(--ok, #2E9E5B); } .caps li.bad .mark { color: var(--bad, #C93B3B); }
.caps li.bad > span:nth-child(2) { color: var(--ink-2); }
.stage-list a { display: flex; gap: 8px; align-items: center; text-decoration: none; color: var(--ink); font-size: .9rem; }
.stage-list a:hover { text-decoration: underline; }
.chip-sm.ok { background: rgba(46,158,91,.15); color: var(--ok, #2E9E5B); } .chip-sm.bad { background: rgba(201,59,59,.12); color: var(--bad, #C93B3B); }
/* стан на картці етапу */
.stage { border-left: 4px solid transparent; transition: box-shadow .3s var(--ease); }
.stage.st-ok { border-left-color: var(--ok, #2E9E5B); } .stage.st-partial, .stage.st-stale { border-left-color: var(--gold-600); }
.stage.st-missing { border-left-color: var(--bad, #C93B3B); } .stage.st-running { border-left-color: var(--blue); }
.stage.st-next { box-shadow: 0 0 0 3px rgba(255,215,0,.55), var(--shadow-hover); }
.stage.st-next .stage-no { background: var(--gold); color: var(--blue-900); }
.stage-state { margin: var(--s-2) 0 var(--s-3); display: grid; gap: 6px; }
.stage-state p { margin: 0; font-size: .9rem; color: var(--ink-2); }
.stage-state .metrics { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.stage-state .metrics span { display: grid; font-size: .75rem; color: var(--muted); padding: 4px 10px; border-radius: var(--r-sm); background: var(--glass-tint); }
.stage-state .metrics b { font-size: .95rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.stage-state .todo { padding: 6px 10px; border-radius: var(--r-sm); background: rgba(255,215,0,.14); color: var(--ink); font-size: .88rem; }
.stage.flash { animation: flash-glow 1.6s var(--ease); }

/* ---------- Документи (#/documents) */
.doc-grid { margin-top: var(--s-4); margin-bottom: var(--s-4); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: var(--s-6) var(--s-4); border-radius: var(--r-lg); border: 2px dashed rgba(0,87,183,.35); background: rgba(0,87,183,.04); text-align: center; cursor: pointer; transition: background .25s, border-color .25s, transform .25s var(--ease); }
.dropzone .ico { width: 30px; height: 30px; color: var(--blue-600); }
.dropzone:hover, .dropzone.over { background: rgba(255,215,0,.14); border-color: var(--gold-600); transform: translateY(-1px); }
.dropzone:focus-visible { box-shadow: var(--focus); }
.doc-file { font-size: .86rem; }
.tag.local { color: var(--gold-900); background: linear-gradient(180deg, rgba(255,229,102,.95), rgba(255,215,0,.85)); border-color: rgba(184,150,0,.4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tag.local { color: #3E3200; } }
:root[data-theme="dark"] .tag.local { color: #3E3200; }
.note.bad { border-left-color: var(--bad); color: var(--bad-ink); }

/* ---------- Асистент (#/): чат на всю висоту, решта — модалки/шухляда */
body.route-assistant .footer { display: none; }
body.route-assistant main { padding-bottom: 0; max-width: none; }
.assist { display: flex; flex-direction: column; gap: var(--s-3); height: calc(100dvh - 112px); min-height: 460px; width: 100%; max-width: 1040px; margin: 0 auto; }
.assist-bar { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); border-radius: var(--r-pill); flex-wrap: wrap; }
.profile-pick { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: var(--r-pill); color: var(--blue-600); font-weight: 700; font-size: .9rem; background: rgba(0,87,183,.08); max-width: 320px; }
.profile-pick .ico { width: 16px; height: 16px; flex: none; }
.profile-pick select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--blue-600); font-weight: 700; font-size: .9rem; padding: 4px 22px 4px 0; min-width: 0; text-overflow: ellipsis; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%230057B7' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 2px center; background-size: 16px; }
.assist-bar .modes { padding: 3px; }
.assist-bar .modes button { padding: 6px var(--s-3); font-size: .84rem; }
.assist-bar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.assist-bar-right .btn-ghost { display: inline-flex; align-items: center; gap: 6px; }
.assist-bar-right .ico { width: 16px; height: 16px; }
.assist-bar-right .icon-btn { width: 36px; height: 36px; }
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s-3); overflow: auto; padding: var(--s-2) var(--s-2) var(--s-3); scroll-behavior: smooth; overscroll-behavior: contain; }
.msg .bubble { max-width: min(100%, 900px); }
.msg-foot .btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 4px var(--s-3); font-size: .82rem; }
.msg-foot .btn-ghost .ico { width: 15px; height: 15px; }
.msg-foot .push, .check-head .push { margin-left: auto; }
.working { display: inline-flex; align-items: center; gap: 6px; }
.working .pulse { background: var(--info); animation: pulse 1.6s infinite; }
.composer { padding: var(--s-3) var(--s-4) var(--s-2); display: flex; flex-direction: column; gap: 6px; flex: none; }
.composer-foot { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; min-height: 28px; }
.composer-foot .hint-text { margin-left: auto; }
.opt-summary { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: var(--r-pill); font-size: .8rem; font-weight: 600; color: var(--ink-2); background: rgba(0,87,183,.07); border: 1px solid transparent; transition: background .25s, border-color .25s, color .25s; max-width: 100%; }
.opt-summary:hover { background: rgba(0,87,183,.13); border-color: var(--hairline-out); color: var(--blue-600); }
.opt-summary .ico { width: 15px; height: 15px; color: var(--blue-600); flex: none; }
.opt-summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer .model-badge { padding: 3px 10px; font-size: .78rem; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s-3); }
.opt-grid .field small { font-weight: 500; font-size: .76rem; line-height: 1.4; }
.opt-list { display: flex; flex-direction: column; gap: var(--s-2); }
.opt-row { align-items: flex-start; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); border: 1px solid var(--hairline-out); }
.opt-row:hover { background: rgba(0,87,183,.05); }
.opt-row input { margin-top: 3px; flex: none; }
.opt-row span { display: flex; flex-direction: column; gap: 2px; font-weight: 500; }
.opt-row small { font-size: .78rem; line-height: 1.4; }
.opt-row:has(input:disabled) { opacity: .6; }
.drawer.wide { width: min(600px, 100%); }
.src-tabs { width: 100%; }
.src-tabs button { flex: 1; text-align: center; }
.src-pane { display: flex; flex-direction: column; gap: var(--s-2); }
.details-kv { grid-template-columns: max-content 1fr; }
.src-h { font-size: .9rem; margin-top: var(--s-2); }
.ctx-md.tall { max-height: none; }
.ctx-p header .act-link:hover { color: var(--blue-600); }
@media (max-width: 760px) {
  .assist { height: calc(100dvh - 100px); }
  .assist-bar { border-radius: var(--r-lg); gap: var(--s-2); }
  .assist-bar .modes { order: 3; width: 100%; } .assist-bar .modes button { flex: 1; text-align: center; }
  .assist-bar-right .lbl { display: none; } .assist-bar-right .btn-ghost { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: 50%; }
  .profile-pick { flex: 1; min-width: 0; }
  .composer-foot .hint-text { display: none; }
  .msg .bubble { padding: var(--s-3) var(--s-4); }
}

/* ---------- OCR: скріншот у композері / документах */
.composer.over { outline: 2px dashed var(--gold-600); outline-offset: -4px; background: rgba(255,215,0,.10); }
.composer-form .attach-btn { width: 40px; height: 40px; flex: none; align-self: flex-end; margin-bottom: 3px; }
.composer-form .attach-btn .ico { width: 18px; height: 18px; }
.attach-card { display: flex; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-lg); margin-bottom: var(--s-2); align-items: flex-start; animation: rise .35s var(--ease) both; }
.attach-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--hairline-out); background: rgba(255,255,255,.4); flex: none; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.attach-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.attach-head { display: flex; align-items: center; gap: var(--s-2); }
.attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.attach-close { width: 30px; height: 30px; margin-left: auto; flex: none; }
.attach-close .ico { width: 15px; height: 15px; }
.attach-status { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--muted); }
.attach-status.bad { color: var(--bad-ink); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(0,87,183,.2); border-top-color: var(--blue-600); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.attach-res { display: flex; flex-direction: column; gap: 6px; }
.attach-meta { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.attach-hint { margin: 0; }
.tiny-btn { padding: 3px 9px; font-size: .78rem; }
.ocr-lines { margin: 0; padding: 0 0 0 4px; list-style: none; max-height: 180px; overflow: auto; font-size: .8rem; line-height: 1.45; border-radius: var(--r-sm); background: rgba(0,0,0,.04); }
.ocr-lines li { display: flex; gap: 8px; padding: 2px 8px; border-left: 3px solid var(--ok); }
.ocr-lines li.gold { border-left-color: var(--gold-600); background: rgba(255,215,0,.12); }
.ocr-lines li.bad { border-left-color: var(--bad); background: var(--bad-bg); color: var(--bad-ink); }
.ocr-lines .lc { font-family: var(--mono, ui-monospace, monospace); font-size: .72rem; color: var(--muted); width: 26px; flex: none; text-align: right; }
.attach-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ocr-lines { background: rgba(255,255,255,.05); } }
:root[data-theme="dark"] .ocr-lines { background: rgba(255,255,255,.05); }
@media (max-width: 640px) { .attach-thumb { width: 64px; height: 48px; } .ocr-hint { display: none; } }
