/* ==========================================================================
   Автоматическая проверка Республиканских Работ — интерфейс (тёмная и светлая темы)
   ========================================================================== */
:root {
  --bg: #0a0f17; --bg-veil: rgba(10, 15, 23, 0.74);
  --surface: #111824; --surface-2: #162030; --surface-3: #1c2839;
  --border: #233147; --border-strong: #2f4260;
  --text: #e7edf5; --text-muted: #93a1b5; --text-faint: #66758a;
  --accent: #5aaefc; --accent-strong: #2f8ef0; --accent-soft: rgba(90, 174, 252, 0.12); --on-accent: #fff;
  --crit: #ff6b6b; --crit-soft: rgba(255, 107, 107, 0.12);
  --warn: #f2b544; --warn-soft: rgba(242, 181, 68, 0.13);
  --ok: #3dd68c;   --ok-soft: rgba(61, 214, 140, 0.12);
  --info: #7cb9ff; --info-soft: rgba(124, 185, 255, 0.10);
  --ai: #a78bfa;   --ai-soft: rgba(167, 139, 250, 0.13);
  --font-body: 'Golos Text', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-base: 1rem; --text-lg: 1.125rem;
  --text-xl: clamp(1.35rem, 1.1rem + 0.9vw, 1.7rem); --text-2xl: clamp(2rem, 1.2rem + 2.8vw, 3.2rem);
  --radius: 14px; --radius-sm: 9px; --radius-lg: 20px;
  --shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 12px 40px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 24px 80px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --content: 1240px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f3f6fa; --bg-veil: rgba(243, 246, 250, 0.8);
  --surface: #ffffff; --surface-2: #f5f8fc; --surface-3: #eaf0f7;
  --border: #dbe3ee; --border-strong: #c5d1e0;
  --text: #0f1b2b; --text-muted: #4d5d72; --text-faint: #7d8b9e;
  --accent: #1f6fd1; --accent-strong: #185bb0; --accent-soft: rgba(31, 111, 209, 0.09);
  --crit: #d63838; --crit-soft: rgba(214, 56, 56, 0.08);
  --warn: #b7791f; --warn-soft: rgba(214, 150, 30, 0.12);
  --ok: #148a55;   --ok-soft: rgba(20, 138, 85, 0.09);
  --info: #2b6cb0; --info-soft: rgba(43, 108, 176, 0.08);
  --ai: #6d4fd8;   --ai-soft: rgba(109, 79, 216, 0.09);
  --shadow: 0 1px 2px rgba(16, 32, 60, 0.05), 0 8px 28px rgba(16, 32, 60, 0.07);
  --shadow-pop: 0 24px 70px rgba(16, 32, 60, 0.22);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 var(--text-base)/1.6 var(--font-body); -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(90, 174, 252, 0.3); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.nowrap { white-space: nowrap; }

/* ---------- Фон ---------- */
#neuron-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#neuron-bg::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, transparent 0%, var(--bg) 85%); }
#neuron-bg canvas { width: 100%; height: 100%; }
.page { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; }
main { flex: 1; }
main:focus, main:focus-visible { outline: none; }
.wrap { max-width: var(--content); margin: 0 auto; padding: 0 24px; }

/* ---------- Шапка ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--bg-veil);
  backdrop-filter: blur(14px) saturate(140%); border-bottom: 1px solid var(--border); }
.topbar__inner { max-width: var(--content); margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand__mark { height: 34px; padding: 0 9px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(140deg, #5aaefc, #1d5fb8); color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.brand__name { display: block; font-weight: 600; line-height: 1.15; }
.brand__sub { display: block; font-size: var(--text-xs); color: var(--text-muted); line-height: 1.2; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { color: var(--text-muted); padding: 7px 12px; border-radius: 9px; font-size: var(--text-sm); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--text); background: var(--accent-soft); }
.nav a .count { font-size: 11px; background: var(--surface-3); border-radius: 99px; padding: 0 6px; color: var(--text-muted); }
.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; color: var(--text-muted); transition: .15s; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.ai-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }
.ai-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.ai-chip.on { border-color: color-mix(in srgb, var(--ai) 45%, transparent); color: var(--text); background: var(--ai-soft); }
.ai-chip.on .dot { background: var(--ai); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ai) 25%, transparent); }
.menu-btn { display: none; }

/* ---------- Кнопки и поля ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 11px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 500; font-size: var(--text-sm); cursor: pointer; transition: transform .12s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: linear-gradient(140deg, var(--accent), var(--accent-strong)); border-color: transparent; color: var(--on-accent); }
.btn--primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn--ai { background: linear-gradient(140deg, #8b6cf6, #6a4be0); border-color: transparent; color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.btn--danger:hover { border-color: var(--crit); color: var(--crit); }
.btn--sm { min-height: 32px; padding: 0 11px; font-size: var(--text-xs); border-radius: 9px; }
.btn--lg { min-height: 50px; padding: 0 24px; font-size: var(--text-base); border-radius: 13px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > label { font-size: var(--text-sm); color: var(--text-muted); font-weight: 500; }
.field small { color: var(--text-faint); font-size: var(--text-xs); }
.input, .select, .textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; color: var(--text); transition: border-color .15s, box-shadow .15s; min-height: 40px; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.req::after { content: " *"; color: var(--crit); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: var(--text-sm); }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }
.check b { display: block; font-weight: 500; color: var(--text); }
.check small { color: var(--text-muted); font-size: var(--text-xs); line-height: 1.45; display: block; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: var(--text-muted); border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--ai); border-color: var(--ai); }
.switch input:checked + span::before { transform: translateX(18px); background: #fff; }

/* ---------- Карточки, бейджи ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card--pad { padding: 22px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: var(--text-xs);
  font-weight: 600; background: var(--surface-3); color: var(--text-muted); white-space: nowrap; line-height: 1.6; }
.badge--crit { background: var(--crit-soft); color: var(--crit); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--ai { background: var(--ai-soft); color: var(--ai); }
.badge--fixed { background: var(--ok-soft); color: var(--ok); }
.kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--text-muted); }

.section { padding: 56px 0; }
.section__head { margin-bottom: 26px; }
.section__head h2 { font-size: var(--text-xl); margin: 0 0 6px; letter-spacing: -.01em; }
.section__head p { margin: 0; color: var(--text-muted); max-width: 70ch; }
.eyebrow { font-family: var(--font-mono); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin-bottom: 10px; display: block; }
.grid { display: grid; gap: 16px; }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1080px) { .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid--4 { grid-template-columns: 1fr; } }

/* ---------- Главная ---------- */
.hero { padding: 64px 0 28px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 48px; align-items: center; }
.hero h1 { font-size: var(--text-2xl); line-height: 1.08; margin: 0 0 18px; letter-spacing: -.02em; font-weight: 700; }
.hero h1 em { font-style: normal; background: linear-gradient(120deg, var(--accent), var(--ai)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: var(--text-lg); color: var(--text-muted); margin: 0 0 22px; max-width: 54ch; }
.hero__points { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--text-muted); font-size: var(--text-sm); }
.hero__points span { display: inline-flex; gap: 8px; align-items: center; }
.hero__points i { color: var(--ok); }
.drop { min-height: 230px; display: flex; flex-direction: column; justify-content: center; position: relative; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 34px 26px; text-align: center;
  background: var(--surface); transition: border-color .2s, background .2s, transform .2s; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.drop.over { transform: scale(1.01); }
.drop__icon { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; font-size: 26px;
  background: var(--accent-soft); color: var(--accent); }
.drop h3 { margin: 0 0 6px; font-size: var(--text-lg); }
.drop p { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.opts { margin-top: 14px; }
.opts summary { cursor: pointer; color: var(--text-muted); font-size: var(--text-sm); list-style: none; display: inline-flex; gap: 8px; align-items: center; }
.opts summary::-webkit-details-marker { display: none; }
.opts[open] summary i { transform: rotate(90deg); }
.opts summary i { transition: .2s; font-size: 11px; }
.opts__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.queue { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.qitem { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 11px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.qitem__icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.qitem__name { font-size: var(--text-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qitem__sub { font-size: var(--text-xs); color: var(--text-muted); }
.bar { height: 4px; border-radius: 9px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--ai)); transition: width .25s; }
.bar.indet > i { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.feature { padding: 20px; }
.feature__icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px; background: var(--accent-soft); color: var(--accent); }
.feature__icon.ai { background: var(--ai-soft); color: var(--ai); }
.feature__icon.ok { background: var(--ok-soft); color: var(--ok); }
.feature__icon.warn { background: var(--warn-soft); color: var(--warn); }
.feature h3 { margin: 0 0 6px; font-size: var(--text-base); }
.feature p { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: s; }
.step { padding: 20px; position: relative; }
.step::before { counter-increment: s; content: "0" counter(s); font-family: var(--font-mono); color: var(--accent); font-size: var(--text-sm); display: block; margin-bottom: 8px; }
.step h3 { margin: 0 0 6px; font-size: var(--text-base); }
.step p { margin: 0; color: var(--text-muted); font-size: var(--text-sm); }
.recent { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Заголовок страницы ---------- */
.phead { padding: 34px 0 18px; display: flex; gap: 20px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.phead h1 { margin: 0; font-size: var(--text-xl); letter-spacing: -.01em; }
.phead p { margin: 4px 0 0; color: var(--text-muted); }
.crumbs { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }

/* ---------- Отчёт ---------- */
.summary { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; padding: 24px 26px; }
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { transform: rotate(-90deg); }
.ring__val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring__val b { font-size: 34px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.ring__val small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.verdict { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .02em; font-size: var(--text-sm); padding: 5px 12px; border-radius: 9px; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.verdict.crit { background: var(--crit-soft); color: var(--crit); }
.verdict.fail { background: var(--surface-3); color: var(--text-muted); }
.summary h1 { font-size: var(--text-xl); margin: 10px 0 4px; word-break: break-word; line-height: 1.25; }
.summary .meta { color: var(--text-muted); font-size: var(--text-sm); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.counters { display: grid; grid-template-columns: repeat(3, minmax(88px, 1fr)); gap: 10px; }
.counter { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); text-align: left; cursor: pointer; transition: .15s; }
.counter:hover { border-color: var(--border-strong); }
.counter b { display: block; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter span { font-size: var(--text-xs); color: var(--text-muted); }
.counter.crit b { color: var(--crit); } .counter.warn b { color: var(--warn); } .counter.ok b { color: var(--ok); }
.delta { font-size: var(--text-xs); font-weight: 600; }
.delta.up { color: var(--ok); } .delta.down { color: var(--crit); }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stat { font-size: var(--text-xs); padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); }
.stat b { color: var(--text); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; align-items: center; }
.actions .spacer { flex: 1; }
.banner { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: var(--radius); border: 1px solid; margin: 14px 0; flex-wrap: wrap; }
.banner--ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.banner--crit { background: var(--crit-soft); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.banner--ai { background: var(--ai-soft); border-color: color-mix(in srgb, var(--ai) 35%, transparent); }
.banner--info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.banner__icon { font-size: 20px; }
.banner--ok .banner__icon { color: var(--ok); } .banner--crit .banner__icon { color: var(--crit); } .banner--ai .banner__icon { color: var(--ai); } .banner--info .banner__icon { color: var(--info); }
.banner__body { flex: 1; min-width: 220px; font-size: var(--text-sm); }
.banner__body b { display: block; font-size: var(--text-base); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 11px 14px; color: var(--text-muted); cursor: pointer; font-weight: 500; font-size: var(--text-sm);
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { font-size: 11px; background: var(--surface-3); border-radius: 99px; padding: 0 7px; color: var(--text-muted); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { min-height: 36px; width: auto; }
.toolbar .select { max-width: 240px; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search .input { width: 100%; padding-left: 34px; }
.toolbar .search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 13px; }
.chipset { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); border-radius: 99px; padding: 5px 12px; font-size: var(--text-xs); cursor: pointer; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.fchip:hover { border-color: var(--border-strong); color: var(--text); }
.fchip.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--text); }
.fchip .d { width: 7px; height: 7px; border-radius: 50%; }
.progress-line { display: flex; gap: 12px; align-items: center; font-size: var(--text-sm); color: var(--text-muted); margin-bottom: 12px; }
.progress-line .bar { flex: 1; margin: 0; height: 6px; }
.progress-line .bar > i { background: var(--ok); }

.group { margin-bottom: 18px; }
.group__title { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); font-family: var(--font-mono); margin: 0 0 8px 2px; display: flex; gap: 8px; }
.issue { display: grid; grid-template-columns: 4px 1fr; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); overflow: hidden; margin-bottom: 8px; transition: border-color .15s, opacity .2s; }
.issue:hover { border-color: var(--border-strong); }
.issue__rail { background: var(--text-faint); }
.issue.critical .issue__rail { background: var(--crit); } .issue.warning .issue__rail { background: var(--warn); }
.issue.ok .issue__rail { background: var(--ok); } .issue.info .issue__rail { background: var(--info); }
.issue__body { padding: 13px 16px; min-width: 0; }
.issue__head { display: flex; gap: 10px; align-items: flex-start; }
.issue__title { font-weight: 600; font-size: var(--text-sm); flex: 1; min-width: 0; }
.issue__msg { font-size: var(--text-sm); color: var(--text); margin-top: 3px; overflow-wrap: anywhere; }
.issue__loc { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); margin-top: 6px; overflow-wrap: anywhere; max-height: 4.6em; overflow: hidden; }
.issue__loc.open { max-height: none; }
.issue__rule { font-size: var(--text-xs); color: var(--text-faint); margin-top: 4px; }
.issue__acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.issue.done { opacity: .55; }
.issue.done .issue__title { text-decoration: line-through; }
.issue.ignored { opacity: .5; border-style: dashed; }
.issue .help { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: var(--text-sm); }
.issue .help h4 { margin: 0 0 4px; font-size: var(--text-sm); }
.issue .help p { margin: 4px 0; }
.ai-note { margin-top: 8px; font-size: var(--text-xs); padding: 7px 10px; border-radius: 8px; background: var(--ai-soft); color: var(--text); }
.ai-note b { color: var(--ai); }
.pre { font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; background: var(--surface-3); border-radius: 8px; padding: 10px 12px; margin: 6px 0; overflow-wrap: anywhere; line-height: 1.55; }
.tick { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; cursor: pointer; background: transparent; flex-shrink: 0; color: transparent; font-size: 11px; padding: 0; }
.tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }

/* Документ */
.docview { display: grid; grid-template-columns: 220px 1fr; gap: 18px; }
.outline { position: sticky; top: 78px; align-self: start; max-height: calc(100vh - 100px); overflow: auto; font-size: var(--text-sm); }
.outline a { display: block; padding: 5px 10px; border-radius: 8px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.outline .sub { padding-left: 22px; font-size: var(--text-xs); }
.paper { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px clamp(16px, 4vw, 48px); font-family: 'Times New Roman', Georgia, serif; font-size: 15.5px; line-height: 1.65; }
[data-theme="light"] .paper { background: #fff; }
.region-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 22px 0 8px; padding-top: 14px; border-top: 1px dashed var(--border); }
.region-label:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.para { position: relative; padding: 3px 8px 3px 44px; border-radius: 6px; margin: 1px 0; text-indent: 0; overflow-wrap: anywhere; }
.para__n { position: absolute; left: 4px; top: 5px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); width: 34px; text-align: right; }
.para.t { font-size: 13.5px; color: var(--text-muted); }
.para.crit { background: var(--crit-soft); box-shadow: inset 3px 0 0 var(--crit); cursor: pointer; }
.para.warn { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); cursor: pointer; }
.para.flash { animation: flash 1.6s var(--ease); }
@keyframes flash { 0%, 30% { background: color-mix(in srgb, var(--accent) 35%, transparent); } }
.pop { position: fixed; z-index: 60; max-width: 380px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: var(--text-sm); }
.pop li { margin: 4px 0; }
.pop ul { margin: 6px 0 0; padding-left: 18px; }

/* ИИ */
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.advice { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; }
.advice h4 { margin: 0 0 4px; font-size: var(--text-sm); display: flex; gap: 8px; align-items: center; }
.advice p { margin: 0; font-size: var(--text-sm); color: var(--text-muted); }
.bibfix { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 8px; font-size: var(--text-sm); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty i.big { font-size: 34px; color: var(--text-faint); margin-bottom: 12px; display: block; }
.empty h3 { color: var(--text); margin: 0 0 6px; }
.empty p { margin: 0 auto 16px; max-width: 52ch; }

/* ---------- Чат ---------- */
.chat { display: flex; flex-direction: column; height: min(70vh, 680px); min-height: 420px; }
.chat__log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 86%; font-size: var(--text-sm); }
.msg.me { align-self: flex-end; background: linear-gradient(140deg, var(--accent), var(--accent-strong)); color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; }
.msg.bot { align-self: flex-start; }
.msg.bot .bubble { background: var(--surface-2); border: 1px solid var(--border); padding: 12px 15px; border-radius: 14px 14px 14px 4px; }
.msg.bot .bubble > * + * { margin-top: 8px; }
.msg.bot p { margin: 0; }
.msg .src { font-size: 11px; color: var(--text-faint); margin-top: 5px; display: flex; gap: 6px; align-items: center; }
.msg .kbcard { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; }
.msg .kbcard h4 { margin: 0 0 4px; font-size: var(--text-sm); }
.msg .kbcard .ref { font-size: 11px; color: var(--text-faint); }
.msg .mini-issue { display: flex; gap: 8px; align-items: baseline; padding: 6px 9px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); margin-top: 5px; cursor: pointer; }
.msg .mini-issue:hover { border-color: var(--border-strong); }
.msg .ai-answer { border-left: 3px solid var(--ai); padding-left: 12px; white-space: pre-wrap; }
.typing { display: inline-flex; gap: 4px; padding: 12px 15px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: bob 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-4px); opacity: 1; } }
.chat__sugg { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 18px 10px; }
.chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat__form .textarea { min-height: 42px; max-height: 140px; resize: none; }
.chat__opts { display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--border); font-size: var(--text-xs); color: var(--text-muted); flex-wrap: wrap; }

/* ---------- Мои работы ---------- */
.project { padding: 20px 22px; margin-bottom: 14px; }
.project__head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.project__name { font-weight: 600; font-size: var(--text-lg); flex: 1; min-width: 200px; overflow-wrap: anywhere; }
.project__name input { font-weight: 600; font-size: var(--text-lg); }
.score-pill { font-variant-numeric: tabular-nums; font-weight: 700; border-radius: 9px; padding: 3px 10px; font-size: var(--text-sm); }
.spark { width: 140px; height: 38px; }
.timeline { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.ver { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 12px; align-items: center; padding: 8px 10px; border-radius: 10px; font-size: var(--text-sm); }
.ver:hover { background: var(--surface-2); }
.ver__dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); margin: 0 auto; background: var(--surface); }
.ver.fixed .ver__dot { border-color: var(--ok); background: var(--ok); }
.ver a { color: var(--text); font-weight: 500; }
.ver__meta { color: var(--text-muted); font-size: var(--text-xs); }
.ver input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

.cmp { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cmp__col h3 { font-size: var(--text-base); display: flex; gap: 8px; align-items: center; margin: 0 0 12px; }
.cmp__item { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 6px; font-size: var(--text-sm); }
.cmp__item b { display: block; font-size: var(--text-xs); color: var(--text-muted); font-weight: 500; }
.cmp__head { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 20px 22px; margin-bottom: 18px; }
.cmp__score { text-align: center; }
.cmp__score b { font-size: 34px; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.cmp__arrow { font-size: 22px; color: var(--text-faint); }

/* ---------- Справочник ---------- */
.kb { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.kb__side { position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow: auto; padding: 14px; }
.kb__topic { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); font-family: var(--font-mono); margin: 14px 8px 6px; }
.kb__topic:first-child { margin-top: 4px; }
.kb__link { display: block; padding: 7px 10px; border-radius: 8px; color: var(--text-muted); font-size: var(--text-sm); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.kb__link:hover { background: var(--surface-2); color: var(--text); }
.kb__link.active { background: var(--accent-soft); color: var(--text); }
.article { padding: 28px clamp(18px, 3vw, 36px); }
.article h2 { margin: 0 0 6px; font-size: var(--text-xl); }
.article .ref { color: var(--text-faint); font-size: var(--text-sm); margin-bottom: 18px; }
.article h3 { font-size: var(--text-base); margin: 22px 0 8px; display: flex; gap: 8px; align-items: center; }
.article p { margin: 0 0 10px; }
.article ol, .article ul { padding-left: 20px; margin: 0; }
.article li { margin: 4px 0; }

/* ---------- Библиография ---------- */
.bib { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 18px; }
.kind { padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; font-size: var(--text-sm); display: flex; gap: 9px; align-items: center; color: var(--text-muted); line-height: 1.3; }
.kind:hover { border-color: var(--border-strong); color: var(--text); }
.kind.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.kind i { color: var(--accent); width: 16px; text-align: center; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.preview { position: sticky; top: 78px; }
.preview__entry { font-family: 'Times New Roman', Georgia, serif; font-size: 16px; line-height: 1.6; padding: 18px 20px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-height: 90px; overflow-wrap: anywhere; }
[data-theme="light"] .preview__entry { background: #fff; }
.mylist { margin-top: 16px; }
.mylist ol { padding-left: 22px; margin: 8px 0; font-family: 'Times New Roman', Georgia, serif; font-size: 15px; }
.mylist li { margin: 6px 0; overflow-wrap: anywhere; }
.mylist li button { margin-left: 6px; vertical-align: middle; }
.diff del { background: var(--crit-soft); color: var(--crit); text-decoration: line-through; }
.diff ins { background: var(--ok-soft); color: var(--ok); text-decoration: none; }

/* ---------- Модальные окна ---------- */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(3, 7, 14, 0.62); backdrop-filter: blur(4px); animation: fade .18s; }
.modal__box { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); animation: rise .22s var(--ease); }
.modal__box.wide { width: min(820px, 100%); }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal__head h2 { margin: 0; font-size: var(--text-lg); flex: 1; }
.modal__body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal__foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--border); flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); }
.note { font-size: var(--text-xs); color: var(--text-muted); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); line-height: 1.5; }
.note b { color: var(--text); }
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.radio-card { border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; cursor: pointer; font-size: var(--text-xs); color: var(--text-muted); display: block; }
.radio-card input { display: none; }
.radio-card b { display: block; color: var(--text); font-size: var(--text-sm); font-weight: 500; margin-bottom: 2px; }
.radio-card:has(input:checked) { border-color: var(--ai); background: var(--ai-soft); }
.fixopts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.fix-result { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; text-align: center; padding: 18px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.fix-result b { font-size: 40px; line-height: 1; display: block; font-variant-numeric: tabular-nums; }
.fix-groups details { border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; margin-bottom: 6px; font-size: var(--text-sm); }
.fix-groups summary { cursor: pointer; display: flex; gap: 8px; align-items: center; }
.fix-groups ul { margin: 8px 0 2px; padding-left: 18px; color: var(--text-muted); font-size: var(--text-xs); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ---------- Тосты ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: var(--text-sm); display: flex; gap: 10px; align-items: flex-start; animation: rise .2s var(--ease); }
.toast.err i { color: var(--crit); } .toast.ok i { color: var(--ok); } .toast.info i { color: var(--accent); }

/* ---------- Подвал ---------- */
.footer { border-top: 1px solid var(--border); margin-top: 60px; background: var(--bg-veil); }
.footer__inner { max-width: var(--content); margin: 0 auto; padding: 22px 24px; display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; color: var(--text-muted); font-size: var(--text-sm); }
.footer__links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer__links a { color: var(--text-muted); display: inline-flex; gap: 7px; align-items: center; }
.footer__links a:hover { color: var(--text); }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: 10px; }
@keyframes sk { to { background-position: -200% 0; } }
.fade-in { animation: fade .3s; }

/* ---------- Адаптив ---------- */
@media (max-width: 1080px) {
  .nav a span.lbl { display: none; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 40px; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .summary { grid-template-columns: auto 1fr; }
  .summary .counters { grid-column: 1 / -1; }
  .kb { grid-template-columns: 1fr; }
  .kb__side { position: static; max-height: 300px; }
  .bib { grid-template-columns: 1fr; }
  .preview { position: static; }
  .cmp { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .topbar__inner { padding: 8px 16px; gap: 10px; }
  .brand__sub { display: none; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; justify-content: space-around; background: var(--bg-veil); backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 40; }
  .nav a { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 8px; }
  .nav a span.lbl { display: block; }
  .nav a .count { display: none; }
  body { padding-bottom: 64px; }
  .ai-chip .lbl { display: none; }
  .summary { grid-template-columns: 1fr; text-align: center; padding: 20px; gap: 16px; }
  .ring { margin: 0 auto; }
  .summary .meta { justify-content: center; }
  .stats { justify-content: center; }
  .counters { grid-template-columns: repeat(3, 1fr); }
  .docview { grid-template-columns: 1fr; }
  .outline { display: none; }
  .ai-grid, .opts__grid, .fixopts, .form-grid, .radio-cards { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .msg { max-width: 94%; }
  .ver { grid-template-columns: 18px 1fr auto; }
  .ver .ver__acts { grid-column: 2 / -1; }
  .spark { display: none; }
  .phead { padding-top: 22px; }
  .toasts { bottom: 76px; }
  .fix-result b { font-size: 32px; }
  .modal { padding: 0; align-items: end; }
  .modal__box { max-height: 92vh; border-radius: 20px 20px 0 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.cmp__score:hover { text-decoration: none; }
.summary > * { min-width: 0; }
@media (max-width: 760px) {
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .counters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .counter { padding: 10px; }
  .counter b { font-size: 22px; }
  .counter span { font-size: 11px; }
  .summary h1 { font-size: 1.25rem; }
  .actions .btn { flex: 1 1 auto; }
  .actions .spacer { display: none; }
  .toolbar .select { max-width: none; flex: 1; }
}
