/* © Егор — демо портфолио. */
/* Кейс 15 — статическое демо файлового аудита конфиденциальных текстов.
   Палитра, типографика и метрики сняты с оригинального интерфейса;
   контурные обводки блоков убраны (airy borderless), радиусы/тени сохранены. */

:root {
  --bg: #0b1020;
  --bg-2: #121a31;
  --ink: #ebf0ff;
  --muted: #aeb8d8;
  --accent: #76a9ff;
  --accent-2: #9bb9ff;
  --danger: #ff7b7b;
  --warning: #f5a623;
  --ok: #4caf50;
  --card: rgba(18, 26, 49, 0.74);
  --stroke: rgba(122, 169, 255, 0.26);
  --shadow: 0 24px 64px rgba(7, 10, 20, 0.45);
  --radius: 18px;
}

body[data-theme="light"] {
  --bg: #f0f4fa;
  --bg-2: #ffffff;
  --ink: #1a2744;
  --muted: #5a6d8a;
  --accent: #2f6fff;
  --accent-2: #4d85ff;
  --danger: #d63939;
  --card: rgba(255, 255, 255, 0.92);
  --stroke: rgba(47, 111, 255, 0.18);
  --shadow: 0 8px 32px rgba(32, 57, 105, 0.10);
}

body[data-theme="ocean"] {
  --bg: #071a1f;
  --bg-2: #0d2830;
  --ink: #d8f3f0;
  --muted: #8abdb5;
  --accent: #4dd9c0;
  --accent-2: #6eecd6;
  --danger: #ff8a7a;
  --card: rgba(13, 40, 48, 0.78);
  --stroke: rgba(77, 217, 192, 0.22);
  --shadow: 0 24px 64px rgba(5, 18, 22, 0.50);
}

body[data-theme="forest"] {
  --bg: #0e1a0e;
  --bg-2: #162416;
  --ink: #ddeedd;
  --muted: #8db88d;
  --accent: #5cc96b;
  --accent-2: #7ddf8a;
  --danger: #e06050;
  --card: rgba(22, 36, 22, 0.78);
  --stroke: rgba(92, 201, 107, 0.22);
  --shadow: 0 24px 64px rgba(8, 14, 8, 0.50);
}

body[data-theme="sunset"] {
  --bg: #1a100a;
  --bg-2: #2a1810;
  --ink: #fae8dc;
  --muted: #c09a80;
  --accent: #f0864a;
  --accent-2: #ffa76e;
  --danger: #e04848;
  --card: rgba(42, 24, 16, 0.78);
  --stroke: rgba(240, 134, 74, 0.22);
  --shadow: 0 24px 64px rgba(14, 8, 4, 0.50);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 18%, #162447 0%, var(--bg) 38%),
    radial-gradient(circle at 86% 0%, #1b2e5c 0%, transparent 38%),
    linear-gradient(135deg, #090e1b 0%, #0b1020 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

body[data-theme="light"] {
  background:
    radial-gradient(circle at 18% 18%, #ffffff 0%, var(--bg) 45%),
    radial-gradient(circle at 86% 0%, #dce8ff 0%, transparent 42%),
    linear-gradient(135deg, #f4f8ff 0%, #e9f1ff 100%);
}
body[data-theme="ocean"] { background: radial-gradient(circle at 18% 18%, #0a2e35 0%, var(--bg) 38%), radial-gradient(circle at 86% 0%, #12353f 0%, transparent 38%), linear-gradient(135deg, #061518 0%, #071a1f 100%); }
body[data-theme="forest"] { background: radial-gradient(circle at 18% 18%, #1a3018 0%, var(--bg) 38%), radial-gradient(circle at 86% 0%, #1e3a1c 0%, transparent 38%), linear-gradient(135deg, #0a120a 0%, #0e1a0e 100%); }
body[data-theme="sunset"] { background: radial-gradient(circle at 18% 18%, #2e1a0e 0%, var(--bg) 38%), radial-gradient(circle at 86% 0%, #3a2012 0%, transparent 38%), linear-gradient(135deg, #120a06 0%, #1a100a 100%); }

/* ── Шапка ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 3vw;
  backdrop-filter: blur(16px);
  background: rgba(18, 26, 49, 0.82);
  border-bottom: 1px solid var(--stroke);
  min-height: 48px;
}
body[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.86); }
body[data-theme="ocean"] .topbar { background: rgba(13, 40, 48, 0.85); }
body[data-theme="forest"] .topbar { background: rgba(22, 36, 22, 0.85); }
body[data-theme="sunset"] .topbar { background: rgba(42, 24, 16, 0.85); }

.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__title { display: flex; flex-direction: column; }
.topbar__title-row { display: flex; align-items: center; gap: 8px; }
.topbar__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(118, 169, 255, 0.1);
  overflow: hidden;
  flex-shrink: 0;
}
.topbar__logo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.topbar__nav {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(16, 27, 52, 0.78);
  backdrop-filter: blur(8px);
}
body[data-theme="light"] .topbar__nav { background: rgba(255, 255, 255, 0.92); }
body[data-theme="ocean"] .topbar__nav { background: rgba(10, 30, 38, 0.8); }
body[data-theme="forest"] .topbar__nav { background: rgba(16, 28, 16, 0.8); }
body[data-theme="sunset"] .topbar__nav { background: rgba(30, 18, 10, 0.8); }

.topbar__link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  border-radius: 999px;
  padding: 8px 14px;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}
.topbar__link:hover { color: var(--ink); background: rgba(118, 169, 255, 0.18); }
.topbar__link.is-active { color: var(--ink); background: rgba(118, 169, 255, 0.24); }

.topbar__actions { display: flex; gap: 10px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: rgba(18, 26, 49, 0.9);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
.icon-btn:hover {
  background: rgba(118, 169, 255, 0.18);
  box-shadow: 0 2px 10px rgba(118, 169, 255, 0.15);
  transform: translateY(-1px);
}
body[data-theme="light"] .icon-btn { background: #ffffff; }

/* ── Панель подсказок ── */
.help-panel {
  position: fixed;
  right: 6vw;
  top: 90px;
  width: min(420px, 90vw);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 16px;
  z-index: 6;
  animation: modalSlide 0.22s ease;
}
.help-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--stroke);
}
.help-panel__body { display: flex; flex-direction: column; gap: 4px; }
.help-panel details { border-radius: 12px; padding: 0; overflow: hidden; background: rgba(118, 169, 255, 0.04); }
.help-panel summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  background: rgba(118, 169, 255, 0.04);
  transition: background 0.15s;
  list-style: none;
}
.help-panel summary::-webkit-details-marker { display: none; }
.help-panel summary::before { content: "▸ "; color: var(--muted); display: inline-block; }
.help-panel details[open] summary::before { content: "▾ "; }
.help-panel summary:hover { background: rgba(118, 169, 255, 0.08); }
.help-panel details > :not(summary) { padding: 0 14px; }
.help-panel details p { margin: 6px 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.help-panel details ul { margin: 4px 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.help-panel details li { margin-bottom: 3px; }
.help-panel details code {
  background: rgba(118, 169, 255, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  color: var(--accent);
}

/* ── Фон: орбита, сетка, звёзды ── */
.bg-orbit {
  position: fixed;
  top: -170px;
  right: -170px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 141, 255, 0.35), transparent 70%);
  filter: blur(56px);
  opacity: 0.35;
  animation: driftBlob 14s ease-in-out infinite;
  z-index: 0;
  pointer-events: none;
}
.bg-orbit::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(118, 169, 255, 0.26), transparent 72%);
  left: -470px;
  top: 250px;
}
body[data-theme="light"] .bg-orbit { background: radial-gradient(circle, rgba(47, 111, 255, 0.18), transparent 70%); opacity: 0.5; }
body[data-theme="light"] .bg-orbit::after { background: radial-gradient(circle, rgba(79, 141, 255, 0.14), transparent 72%); }
body[data-theme="ocean"] .bg-orbit { background: radial-gradient(circle, rgba(77, 217, 192, 0.28), transparent 70%); }
body[data-theme="ocean"] .bg-orbit::after { background: radial-gradient(circle, rgba(77, 217, 192, 0.18), transparent 72%); }
body[data-theme="forest"] .bg-orbit { background: radial-gradient(circle, rgba(92, 201, 107, 0.28), transparent 70%); }
body[data-theme="forest"] .bg-orbit::after { background: radial-gradient(circle, rgba(92, 201, 107, 0.18), transparent 72%); }
body[data-theme="sunset"] .bg-orbit { background: radial-gradient(circle, rgba(240, 134, 74, 0.28), transparent 70%); }
body[data-theme="sunset"] .bg-orbit::after { background: radial-gradient(circle, rgba(240, 134, 74, 0.18), transparent 72%); }

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(118, 169, 255, 0.13), transparent 28%),
    radial-gradient(circle at 90% 62%, rgba(155, 185, 255, 0.12), transparent 30%);
  pointer-events: none;
  z-index: 0;
}
body[data-theme="light"] .bg-grid {
  background-image:
    radial-gradient(circle at 12% 18%, rgba(47, 111, 255, 0.08), transparent 28%),
    radial-gradient(circle at 90% 62%, rgba(100, 155, 255, 0.08), transparent 30%);
}
body[data-theme="ocean"] .bg-grid { background-image: radial-gradient(circle at 12% 18%, rgba(77, 217, 192, 0.10), transparent 28%), radial-gradient(circle at 90% 62%, rgba(110, 236, 214, 0.08), transparent 30%); }
body[data-theme="forest"] .bg-grid { background-image: radial-gradient(circle at 12% 18%, rgba(92, 201, 107, 0.10), transparent 28%), radial-gradient(circle at 90% 62%, rgba(125, 223, 138, 0.08), transparent 30%); }
body[data-theme="sunset"] .bg-grid { background-image: radial-gradient(circle at 12% 18%, rgba(240, 134, 74, 0.10), transparent 28%), radial-gradient(circle at 90% 62%, rgba(255, 167, 110, 0.08), transparent 30%); }

.stars { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.star {
  --size: 6px;
  --dur: 9s;
  --delay: 0s;
  position: absolute;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 14px rgba(155, 185, 255, 0.8), 0 0 26px rgba(118, 169, 255, 0.55);
  mix-blend-mode: screen;
  animation: starFloat var(--dur) ease-in-out infinite var(--delay), starBlink calc(var(--dur) / 4) ease-in-out infinite var(--delay);
  will-change: transform, opacity;
}
body[data-theme="light"] .star { background: rgba(160, 190, 230, 0.4); box-shadow: 0 0 6px rgba(140, 175, 220, 0.3), 0 0 14px rgba(140, 175, 220, 0.15); mix-blend-mode: normal; }
body[data-theme="ocean"] .star { background: rgba(110, 236, 214, 0.9); box-shadow: 0 0 14px rgba(77, 217, 192, 0.7), 0 0 26px rgba(77, 217, 192, 0.4); }
body[data-theme="forest"] .star { background: rgba(125, 223, 138, 0.9); box-shadow: 0 0 14px rgba(92, 201, 107, 0.7), 0 0 26px rgba(92, 201, 107, 0.4); }
body[data-theme="sunset"] .star { background: rgba(255, 167, 110, 0.9); box-shadow: 0 0 14px rgba(240, 134, 74, 0.7), 0 0 26px rgba(240, 134, 74, 0.4); }

body.no-animations .stars,
body.no-animations .bg-orbit { display: none !important; }

.star:nth-child(1) { top: 8%; left: 2.5%; --size: 3px; --dur: 8s; --delay: -0.3s; }
.star:nth-child(2) { top: 18%; left: 5%; --size: 7px; --dur: 11s; --delay: -1.1s; }
.star:nth-child(3) { top: 30%; left: 3%; --size: 5px; --dur: 9s; --delay: -2.2s; }
.star:nth-child(4) { top: 42%; left: 6%; --size: 9px; --dur: 13s; --delay: -0.8s; }
.star:nth-child(5) { top: 54%; left: 2.5%; --size: 4px; --dur: 10s; --delay: -2.9s; }
.star:nth-child(6) { top: 66%; left: 4%; --size: 6px; --dur: 12s; --delay: -1.7s; }
.star:nth-child(7) { top: 78%; left: 6.5%; --size: 8px; --dur: 10.5s; --delay: -3.4s; }
.star:nth-child(8) { top: 90%; left: 3%; --size: 5px; --dur: 9.5s; --delay: -1.3s; }
.star:nth-child(9) { top: 8%; left: 97.5%; --size: 4px; --dur: 8.5s; --delay: -0.4s; }
.star:nth-child(10) { top: 18%; left: 95%; --size: 8px; --dur: 12s; --delay: -2.5s; }
.star:nth-child(11) { top: 30%; left: 97%; --size: 5px; --dur: 9s; --delay: -1s; }
.star:nth-child(12) { top: 42%; left: 94.5%; --size: 10px; --dur: 14s; --delay: -3.1s; }
.star:nth-child(13) { top: 54%; left: 98%; --size: 4px; --dur: 10s; --delay: -2s; }
.star:nth-child(14) { top: 66%; left: 93.5%; --size: 7px; --dur: 11.5s; --delay: -0.6s; }
.star:nth-child(15) { top: 78%; left: 96.5%; --size: 5px; --dur: 9.2s; --delay: -2.7s; }
.star:nth-child(16) { top: 90%; left: 94.5%; --size: 9px; --dur: 12.8s; --delay: -1.5s; }

/* типы анимации фона */
body[data-anim="snow"] .star { animation: snowFall var(--dur) linear infinite var(--delay); border-radius: 50%; }
body[data-anim="fireflies"] .star { animation: fireflyGlow calc(var(--dur) / 2) ease-in-out infinite var(--delay), starFloat var(--dur) ease-in-out infinite var(--delay); }
body[data-anim="particles"] .star { animation: particleDrift var(--dur) ease-in-out infinite var(--delay); }
body[data-anim="matrix"] .star { border-radius: 1px; height: calc(var(--size) * 2.2); animation: matrixFall calc(var(--dur) / 2) linear infinite var(--delay); }

/* ── Hero ── */
.hero { position: relative; z-index: 1; padding: 48px 8vw 32px; }
.hero__top { display: flex; align-items: center; gap: 24px; margin-bottom: 20px; }
.hero__side-emblem {
  flex-shrink: 0;
  width: clamp(80px, 12vw, 160px);
  opacity: 0.42;
  filter: drop-shadow(0 16px 38px rgba(0, 0, 0, 0.35));
  transition: opacity 0.25s ease, transform 0.25s ease, filter 0.25s ease;
}
.hero__side-emblem img { width: 100%; height: auto; display: block; }
.hero__side-emblem:hover {
  opacity: 0.52;
  transform: translateY(-3px) scale(1.02);
  filter: drop-shadow(0 22px 50px rgba(118, 169, 255, 0.32));
}
h1 { font-size: clamp(32px, 5vw, 56px); margin: 4px 0 8px; }
.hero p { max-width: 640px; color: var(--muted); line-height: 1.6; }

.hero__row { display: flex; align-items: center; gap: 20px; }
.hero__meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; flex: 1; min-width: 0; }
.hero__meta div {
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
body[data-theme="light"] .hero__meta div { background: rgba(255, 255, 255, 0.95); box-shadow: 0 4px 16px rgba(32, 57, 105, 0.06); }

.label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ── Раскладка и панели (без контурных обводок) ── */
.layout { position: relative; z-index: 1; display: grid; gap: 28px; padding: 18px 8vw 64px; }
.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  animation: fadeUp 0.55s ease forwards;
  opacity: 0;
  min-width: 0;
}
body[data-theme="light"] .panel { background: rgba(255, 255, 255, 0.92); box-shadow: 0 4px 20px rgba(32, 57, 105, 0.06); }
.panel__header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel__header-row h2 { margin: 0; }
.panel:nth-of-type(1) { animation-delay: 0.05s; }
.panel:nth-of-type(2) { animation-delay: 0.15s; }
.panel:nth-of-type(3) { animation-delay: 0.25s; }
.panel:nth-of-type(4) { animation-delay: 0.35s; }
.panel:nth-of-type(5) { animation-delay: 0.45s; }
.panel:nth-of-type(6) { animation-delay: 0.55s; }

.clear-section-btn {
  background: transparent;
  border: 1px dashed var(--stroke);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.clear-section-btn:hover { color: var(--accent); border-color: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-top: 16px; }
.stat-grid article {
  padding: 16px;
  border-radius: 14px;
  background: rgba(18, 26, 49, 0.72);
}
body[data-theme="light"] .stat-grid article { background: rgba(244, 248, 255, 0.88); }
body[data-theme="ocean"] .stat-grid article { background: rgba(13, 40, 48, 0.72); }
body[data-theme="forest"] .stat-grid article { background: rgba(22, 36, 22, 0.72); }
body[data-theme="sunset"] .stat-grid article { background: rgba(42, 24, 16, 0.72); }
.stat-grid strong { display: block; font-size: 26px; margin-top: 8px; word-break: break-all; overflow-wrap: break-word; }
.stat-grid p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }

/* ── Поля ввода (обводки сохранены) ── */
.scan__grid input[type="text"],
.scan__grid select,
.modal__row input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(10, 16, 32, 0.9);
  color: var(--ink);
  margin-top: 8px;
  font: inherit;
}
body[data-theme="light"] .scan__grid input[type="text"],
body[data-theme="light"] .scan__grid select { background: #ffffff; }

.scan__grid input[type="text"]:focus,
.scan__grid select:focus {
  outline: none;
  border-color: rgba(118, 169, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(118, 169, 255, 0.18);
}
.scan__grid select option,
.modal__row select option { background: var(--card); color: var(--ink); }

input, select, textarea { color: var(--ink); border-color: var(--stroke); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

button { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; font: inherit; }

/* ── Кнопки сканирования ── */
.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.button-row--scan { justify-content: space-between; }
.button-row__left, .button-row__right { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

#scanStart, #exportReportBtn, .btn--primary-soft {
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(118, 169, 255, 0.15);
  color: var(--accent);
  border: 1px solid rgba(118, 169, 255, 0.35);
}
#scanStart:hover, #exportReportBtn:hover, .btn--primary-soft:hover {
  transform: translateY(-1px);
  background: rgba(118, 169, 255, 0.25);
  box-shadow: 0 6px 18px rgba(118, 169, 255, 0.18);
}
body[data-theme="light"] #scanStart, body[data-theme="light"] #exportReportBtn {
  background: rgba(47, 111, 255, 0.08);
  color: #3a6abf;
  border: 1px solid rgba(47, 111, 255, 0.25);
}
#scanStart:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

#scanStop, #scanFinishCurrent, #scanRefresh, .btn--danger-soft {
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255, 123, 123, 0.45);
}
#scanStop:hover, #scanFinishCurrent:hover, #scanRefresh:hover, .btn--danger-soft:hover {
  background: rgba(255, 123, 123, 0.1);
  border-color: rgba(255, 123, 123, 0.7);
  box-shadow: 0 6px 16px rgba(255, 123, 123, 0.14);
  transform: translateY(-1px);
}
#scanStop:disabled, #scanFinishCurrent:disabled, #scanRefresh:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

#scanPause {
  background: transparent;
  color: var(--warning);
  border: 1px solid rgba(245, 166, 35, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}
#scanPause:hover { background: rgba(245, 166, 35, 0.12); border-color: rgba(245, 166, 35, 0.7); transform: translateY(-1px); }
#scanPause:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

#scanResume, .btn--success {
  background: rgba(76, 175, 80, 0.1);
  color: #4caf50;
  border: 1px solid rgba(76, 175, 80, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}
#scanResume:hover, .btn--success:hover { background: rgba(76, 175, 80, 0.2); border-color: rgba(76, 175, 80, 0.7); transform: translateY(-1px); }

/* ── Сетка настроек скана ── */
.scan__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.scan__grid > label { display: flex; flex-direction: column; font-size: 0.86rem; color: var(--muted); font-weight: 500; min-width: 0; }
.scan__cell--wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .scan__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .scan__grid { grid-template-columns: 1fr; } }

.scan-paths-collapsible, .scan-filters-collapsible {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 0;
  margin-top: 4px;
}
.scan-paths-collapsible[open], .scan-filters-collapsible[open] { background: rgba(255, 255, 255, 0.05); }
.scan-paths-collapsible > summary, .scan-filters-collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  user-select: none;
  border-radius: 10px;
}
.scan-paths-collapsible > summary::-webkit-details-marker,
.scan-filters-collapsible > summary::-webkit-details-marker { display: none; }
.scan-paths-collapsible > summary:hover, .scan-filters-collapsible > summary:hover { background: rgba(255, 255, 255, 0.04); }
.scan-paths-collapsible__label, .scan-filters-collapsible__label { flex: 1; }
.scan-paths-collapsible__count {
  background: var(--accent);
  color: #fff;
  font-size: 0.78em;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
}
.scan-paths-collapsible__chevron, .scan-filters-collapsible__chevron { font-size: 1em; opacity: 0.7; transition: transform 0.2s ease; }
.scan-paths-collapsible[open] .scan-paths-collapsible__chevron,
.scan-filters-collapsible[open] .scan-filters-collapsible__chevron { transform: rotate(180deg); }
.scan-paths-collapsible .scan-paths { padding: 4px 14px 14px 14px; }
.scan-filters-collapsible .db-filters__row { padding: 4px 14px 14px 14px; }
.scan-filters-collapsible .filter-count {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 0.78em;
  font-weight: 600;
}

.scan-paths__list { display: flex; flex-direction: column; gap: 8px; }
.scan-paths__item { display: flex; gap: 8px; align-items: center; }
.scan-paths__item input { flex: 1; margin-top: 0; }
.scan-paths__remove {
  background: transparent;
  border: 1px solid rgba(255, 123, 123, 0.35);
  color: var(--danger);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.scan-paths__remove:hover { background: rgba(255, 123, 123, 0.12); }
.scan-paths__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.scan-paths__add {
  background: transparent;
  border: 1px dashed var(--stroke);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.scan-paths__add:hover { border-color: var(--accent); color: var(--accent); }
.scan-paths__add--danger { color: var(--danger); border-color: rgba(255, 123, 123, 0.35); }
.scan-paths__add--danger:hover { border-color: var(--danger); color: var(--danger); background: rgba(255, 123, 123, 0.08); }
.scan-paths--dragover { outline: 2px dashed var(--accent); outline-offset: 4px; background: rgba(99, 179, 237, 0.06); border-radius: 12px; }

/* ── Зона загрузки (пунктир — функциональная обводка инпута) ── */
.drop-zone {
  border: 2px dashed var(--stroke);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.2s ease, background 0.2s ease;
  cursor: pointer;
  margin: 14px 0 12px;
}
.drop-zone.is-over { border-color: var(--accent); background: rgba(118, 169, 255, 0.08); }
body[data-theme="light"] .drop-zone.is-over { background: rgba(47, 111, 255, 0.06); }
.drop-zone p { margin: 0; font-size: 14px; }
.drop-zone strong { color: var(--ink); }
.drop-zone .drop-zone__hint { font-size: 12px; margin-top: 6px; opacity: 0.8; }

.samples-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.samples-row .label { display: inline; margin-right: 4px; }
.sample-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.sample-chip:hover { background: color-mix(in srgb, var(--accent) 22%, transparent); transform: translateY(-1px); }
.sample-chip small { color: var(--muted); font-weight: 500; margin-left: 4px; }

/* ── Виджет состояния сервиса ── */
.health-widget {
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  font-size: 0.85em;
}
.health-widget[data-status="ok"] { box-shadow: 0 0 0 1px rgba(46, 160, 67, 0.18) inset; }
.health-widget[data-status="loading"] { opacity: 0.7; }
.health-widget__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.health-widget__dot { width: 9px; height: 9px; border-radius: 50%; background: #888; flex: 0 0 auto; }
.health-widget[data-status="ok"] .health-widget__dot { background: #2ea043; box-shadow: 0 0 8px rgba(46, 160, 67, 0.6); }
.health-widget__label { color: var(--muted); }
.health-widget__value { font-weight: 600; }
.health-widget__refresh {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: inherit;
  border-radius: 8px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.health-widget__refresh:hover { background: rgba(255, 255, 255, 0.06); }
.health-widget__checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 0.85em; color: var(--muted); }
.health-widget__check { display: inline-flex; align-items: center; gap: 5px; }
.health-widget__check::before { content: "•"; font-size: 14px; color: #888; }
.health-widget__check[data-ok="true"]::before { color: #2ea043; }
.health-widget__check[data-ok="false"]::before { color: #dc3545; }
.health-widget__metrics { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 0.78em; color: var(--muted); }
.health-widget__metric strong { color: var(--ink); margin-left: 4px; font-weight: 600; }

/* ── Прогресс-бар с гусём ── */
.progress-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 16px;
  padding: 18px 16px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  min-height: 118px;
}
.progress-bar.is-idle { opacity: 0.72; }
.progress-bar__track { width: 100%; height: 10px; border-radius: 8px; background: rgba(118, 169, 255, 0.12); overflow: visible; position: relative; }
.progress-bar__fill { height: 100%; width: 0%; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.3s ease; }
body[data-theme="ocean"] .progress-bar__fill,
body[data-theme="forest"] .progress-bar__fill,
body[data-theme="sunset"] .progress-bar__fill { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.progress-bar__goose {
  position: absolute;
  top: -18px;
  left: 0%;
  width: 26px;
  height: 26px;
  line-height: 1;
  transition: left 0.4s ease;
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
  animation: goose-waddle 0.4s ease-in-out infinite;
  z-index: 2;
  transform: scaleX(-1);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cellipse cx='38' cy='44' rx='18' ry='14' fill='%23f5f5f0'/%3E%3Cellipse cx='38' cy='44' rx='18' ry='14' fill='none' stroke='%23ccc' stroke-width='1'/%3E%3Cpath d='M22 42 Q14 38 12 30 Q10 22 16 18 Q20 15 22 18 Q20 22 22 26 Q24 30 24 36 Z' fill='%23f5f5f0' stroke='%23ccc' stroke-width='1'/%3E%3Ccircle cx='16' cy='20' r='6' fill='%23f5f5f0' stroke='%23ccc' stroke-width='1'/%3E%3Ccircle cx='14.5' cy='19' r='1.5' fill='%23222'/%3E%3Cpath d='M10 21 L7 22 L10 23.5' fill='%23e8913a' stroke='%23d07820' stroke-width='0.8' stroke-linejoin='round'/%3E%3Cpath d='M34 56 L32 62 L36 62 Z' fill='%23e8913a'/%3E%3Cpath d='M44 56 L42 62 L46 62 Z' fill='%23e8913a'/%3E%3C/svg%3E") no-repeat center / contain;
}
.progress-bar__goose.is-celebrate { animation: goose-celebrate 0.9s ease; }
.progress-bar.is-idle .progress-bar__goose { animation-play-state: paused; }

.progress-bar__text { font-size: 13px; font-weight: 600; color: var(--accent); min-width: 40px; text-align: right; }
.progress-bar__info { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.progress-bar__count { font-weight: 600; font-size: 0.95em; font-variant-numeric: tabular-nums; }
.progress-bar__eta { color: var(--accent); font-size: 0.88em; font-weight: 500; opacity: 0.85; font-variant-numeric: tabular-nums; }
.progress-bar__hint { font-size: 0.8em; color: var(--muted); margin-left: 8px; }
.progress-bar__file { min-height: 1.35em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85em; color: var(--muted); margin-top: 4px; word-break: break-all; }
.progress-bar__folder { font-size: 0.78em; color: var(--muted); margin-top: 2px; }

/* ── Очередь сканирования ── */
.scan-queue, .cluster-list { margin-top: 16px; display: grid; gap: 12px; }
.scan-card, .cluster-card {
  padding: 14px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-2) 85%, black);
  display: grid;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.2s;
}
.cluster-card:hover { background: color-mix(in srgb, var(--bg-2) 70%, black); }
body[data-theme="light"] .scan-card, body[data-theme="light"] .cluster-card { background: color-mix(in srgb, var(--bg-2) 92%, var(--accent)); }
body[data-theme="light"] .cluster-card:hover { background: color-mix(in srgb, var(--bg-2) 84%, var(--accent)); }

.scan-card--active { box-shadow: 0 0 12px rgba(118, 169, 255, 0.25), inset 0 0 0 1px rgba(118, 169, 255, 0.55); }
.scan-card--error { box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.55); background: rgba(248, 113, 113, 0.06); }
.scan-card__num { display: inline-block; min-width: 1.5em; color: var(--accent); opacity: 0.7; font-size: 0.82em; }
.scan-card__row { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.scan-card__status { display: inline-flex; align-items: center; gap: 6px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.status-dot--queued { background: var(--muted); opacity: 0.6; }
.status-dot--running { background: var(--accent); box-shadow: 0 0 8px rgba(118, 169, 255, 0.7); animation: pulseDot 1s ease-in-out infinite; }
.status-dot--done { background: #5cd97f; }
.status-dot--error { background: var(--danger); }
.status-dot--paused { background: var(--warning); }

.cluster-card--mini { padding: 8px 12px; border-radius: 10px; gap: 4px; }
.cluster-card--mini .cluster-card__header strong { font-size: 13px; }
.cluster-card--mini .cluster-card__meta { font-size: 12px; }
.detail-file--active { box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-2)) !important; }
.cluster-card__header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.cluster-card__header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cluster-card__meta { color: var(--muted); font-size: 13px; }

/* ── Поиск и фильтры результатов ── */
.dsp-search-bar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.dsp-search-input {
  flex: 1;
  min-width: 180px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  outline: none;
}
.dsp-search-input:focus { border-color: var(--accent); }
.dsp-search-select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.db-filters__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.db-filter-group { display: flex; flex-direction: column; gap: 4px; }
.db-filter-label { font-size: 0.72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.db-filter-select, .db-filter-input {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--ink);
  font-size: 0.8rem;
  outline: none;
  transition: border-color 0.2s;
}
.db-filter-select:focus, .db-filter-input:focus { border-color: var(--accent); }
.db-filter-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: rgba(118, 169, 255, 0.08);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.db-filter-btn:hover { background: rgba(118, 169, 255, 0.18); }
.db-filter-btn--secondary { background: transparent; color: var(--muted); }
.db-filter-btn--secondary:hover { color: var(--ink); border-color: var(--accent); }

/* ── Таблица находок ── */
.db-table {
  margin-top: 16px;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 70vh;
  border-radius: 14px;
  background: rgba(10, 16, 32, 0.88);
}
.db-table::-webkit-scrollbar { width: 10px; height: 10px; }
.db-table::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.15); border-radius: 5px; }
.db-table::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 5px; min-height: 30px; }
.db-table::-webkit-scrollbar-thumb:hover { background: var(--accent-2); }
body[data-theme="light"] .db-table { background: #f7fbff; }
.db-table table { width: max-content; min-width: 100%; border-collapse: collapse; font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.db-table th, .db-table td { padding: 10px 12px; border-bottom: 1px solid var(--stroke); text-align: left; color: var(--muted); white-space: nowrap; }
.db-table th { color: var(--ink); background: #1a2444; position: sticky; top: 0; z-index: 2; }
body[data-theme="light"] .db-table th { background: #e3ecff; }
.db-table tr:hover td { background: rgba(118, 169, 255, 0.05); transition: background 0.15s ease; }
.db-table tr { cursor: pointer; }
.db-table .cell-fragment { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.db-table .cell-path { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

/* категории и severity */
.cat-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.cat-pill--dsp { color: var(--accent-2); background: rgba(118, 169, 255, 0.14); border-color: rgba(118, 169, 255, 0.35); }
.cat-pill--secret { color: #ffb3b3; background: rgba(255, 123, 123, 0.14); border-color: rgba(255, 123, 123, 0.4); }
.cat-pill--pdn { color: #7fe3d2; background: rgba(77, 217, 192, 0.12); border-color: rgba(77, 217, 192, 0.35); }
.cat-pill--kt { color: #cdb8f0; background: rgba(179, 157, 219, 0.14); border-color: rgba(179, 157, 219, 0.38); }
.cat-pill--archive { color: var(--muted); background: rgba(174, 184, 216, 0.1); border-color: rgba(174, 184, 216, 0.3); }
body[data-theme="light"] .cat-pill--dsp { color: #2f6fff; }
body[data-theme="light"] .cat-pill--secret { color: #c62f2f; }
body[data-theme="light"] .cat-pill--pdn { color: #0e8f7a; }
body[data-theme="light"] .cat-pill--kt { color: #6a4fa3; }

.sev { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.sev--critical { color: var(--danger); }
.sev--high { color: var(--warning); }
.sev--medium { color: #ffd54f; }
.sev--low { color: var(--muted); }
body[data-theme="light"] .sev--medium { color: #b8860b; }

.stamp-flag { color: #7fe3d2; font-weight: 700; }
body[data-theme="light"] .stamp-flag { color: #0e8f7a; }

mark.hl { background: rgba(255, 213, 79, 0.35); color: inherit; border-radius: 2px; padding: 0 2px; }
body[data-theme="light"] mark.hl { background: rgba(255, 193, 7, 0.3); }
body[data-theme="ocean"] mark.hl { background: rgba(77, 217, 192, 0.25); }
body[data-theme="forest"] mark.hl { background: rgba(92, 201, 107, 0.25); }
body[data-theme="sunset"] mark.hl { background: rgba(240, 134, 74, 0.3); }

/* ── Риск-сводка ── */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.risk-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.risk-badge--critical { color: #ffb3b3; background: rgba(255, 123, 123, 0.14); }
.risk-badge--high { color: #ffc978; background: rgba(245, 166, 35, 0.14); }
.risk-badge--medium { color: #ffe08a; background: rgba(255, 213, 79, 0.12); }
.risk-badge--low { color: #9fe3b0; background: rgba(76, 175, 80, 0.14); }
body[data-theme="light"] .risk-badge--critical { color: #c62f2f; }
body[data-theme="light"] .risk-badge--high { color: #b26a00; }
body[data-theme="light"] .risk-badge--medium { color: #8a6d00; }
body[data-theme="light"] .risk-badge--low { color: #2e7d32; }

.report-recs { padding-left: 20px; color: var(--muted); font-size: 0.88rem; line-height: 1.8; margin: 10px 0 0; }
.report-recs b { color: var(--ink); }
.results-summary { margin-top: 16px; }

/* ── Карточка файла ── */
.detail { display: grid; gap: 18px; }
.detail__header { display: flex; justify-content: space-between; align-items: center; }
.detail__header h2 { margin: 0; }
.detail__close {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}
.detail__close:hover { color: var(--ink); border-color: rgba(118, 169, 255, 0.55); }
.detail__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-top: 12px; }
.detail__section { margin-top: 16px; }
.detail__chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.detail__chip, .tag-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  font-size: 12px;
}
.detail__chip--danger { color: #ffb3b3; border-color: rgba(255, 123, 123, 0.4); background: rgba(255, 123, 123, 0.12); }
.detail__chip--ok { color: #9fe3b0; border-color: rgba(76, 175, 80, 0.4); background: rgba(76, 175, 80, 0.12); }
body[data-theme="light"] .detail__chip, body[data-theme="light"] .tag-pill { background: rgba(47, 111, 255, 0.1); border-color: rgba(47, 111, 255, 0.25); color: var(--accent); }
body[data-theme="light"] .detail__chip--danger { color: #c62f2f; }
body[data-theme="light"] .detail__chip--ok { color: #2e7d32; }

.detail__snippets { display: grid; gap: 12px; margin-top: 8px; }
.detail__snippet {
  padding: 12px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.detail__snippet .snippet-meta { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 6px; }

.detail__meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 10px; }
.meta-item { padding: 10px 14px; border-radius: 12px; background: var(--bg); }
body[data-theme="light"] .meta-item { background: var(--bg-2); }
.meta-item .label { font-size: 11px; margin-bottom: 2px; }
.meta-item strong { display: block; font-size: 13px; word-break: break-all; }

.tag-list { margin-top: 20px; display: grid; gap: 10px; }
.tag-list__items { display: flex; flex-wrap: wrap; gap: 10px; }
.db-overview__hint { font-size: 0.82em; margin: 2px 0 10px 0; opacity: 0.75; }

/* ── История ── */
.history-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.history-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.history-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.25); }
.history-btn:active { transform: translateY(1px); }
.history-btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.history-btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.history-btn--danger { background: transparent; border-color: rgba(255, 123, 123, 0.4); color: var(--danger); }
.history-btn--danger:hover { background: rgba(255, 123, 123, 0.1); border-color: var(--danger); }

.scan-history__list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding-top: 8px; }
.history-card { padding: 10px 14px; border-radius: 10px; background: var(--bg-2); transition: box-shadow 0.2s; }
.history-card:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.history-card__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.history-card__top strong { font-size: 0.88rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.history-card__count { font-size: 0.78rem; color: var(--accent); white-space: nowrap; font-weight: 600; }
.history-card__bottom { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; }
.history-repeat-btn {
  margin-left: auto;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.history-repeat-btn:hover { background: rgba(118, 169, 255, 0.12); }

/* ── Подвал ── */
.footer { display: flex; justify-content: space-between; padding: 18px 8vw 32px; font-size: 12px; color: var(--muted); position: relative; z-index: 1; flex-wrap: wrap; gap: 8px; }
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ── Модальные окна ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}
.modal-overlay.is-hidden { display: none; }
.modal {
  background: var(--bg-2);
  border-radius: var(--radius);
  width: 480px;
  max-width: 94vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
  animation: modalSlide 0.22s ease;
}
.modal__header { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px 14px; border-bottom: 1px solid var(--stroke); }
.modal__header h2 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.modal__header .icon-btn { font-size: 1.3rem; width: 36px; height: 36px; }
.modal__body { padding: 20px 28px 28px; }
.modal__section { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid color-mix(in srgb, var(--stroke) 55%, transparent); }
.modal__section:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.modal__section h3 { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 14px; font-weight: 600; }
.modal__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.modal__row:last-child { margin-bottom: 0; }
.modal__row > span { min-width: 160px; font-size: 0.88rem; color: var(--ink); }
.modal__row select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--ink);
  font-size: 0.88rem;
  min-width: 140px;
}
.modal__row input[type="text"] { padding: 8px 12px; border-radius: 10px; margin-top: 0; min-width: 140px; flex: 1; }
.modal__btn {
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  border: 1px solid var(--stroke);
  background: rgba(118, 169, 255, 0.08);
  color: var(--accent);
  transition: all 0.18s;
  letter-spacing: 0.01em;
}
.modal__btn:hover { background: rgba(118, 169, 255, 0.18); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(118, 169, 255, 0.15); }
.modal__btn--danger { background: rgba(255, 123, 123, 0.06); color: var(--danger); border-color: rgba(255, 123, 123, 0.2); }
.modal__btn--danger:hover { background: rgba(255, 123, 123, 0.15); box-shadow: 0 4px 12px rgba(255, 123, 123, 0.12); }
.modal__btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.modal__btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.report-opt { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.92em; }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.88rem; }
.toggle input { width: 16px; height: 16px; }

/* ── Тосты ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column-reverse; gap: 10px; z-index: 100; pointer-events: none; }
.toast {
  pointer-events: auto;
  min-width: 260px;
  max-width: 380px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--card);
  backdrop-filter: blur(12px);
  color: var(--ink);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastIn 0.35s ease forwards;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.is-out { animation: toastOut 0.3s ease forwards; }
.toast--success { border-left: 4px solid #5cd97f; }
.toast--error { border-left: 4px solid var(--danger); }
.toast--info { border-left: 4px solid var(--accent); }
.toast--warning { border-left: 4px solid #f0ad4e; }
.toast__icon { font-size: 18px; flex-shrink: 0; }
.toast__msg { flex: 1; }

/* ── Лог-панель ── */
.log-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}
.log-fab:hover { transform: translateY(-2px); }
.log-fab--open { transform: rotate(180deg); }
.log-panel {
  position: fixed;
  right: 24px;
  bottom: 76px;
  width: min(560px, 92vw);
  max-height: 320px;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  z-index: 60;
  animation: modalSlide 0.22s ease;
}
.log-panel__header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--stroke); }
.log-panel__header strong { font-size: 0.85rem; }
.log-panel__body {
  overflow-y: auto;
  padding: 10px 14px;
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}
.log-line--info { color: var(--muted); }
.log-line--warn { color: var(--warning); }
.log-line--ok { color: #5cd97f; }
.log-line--err { color: var(--danger); }
.log-line time { color: var(--accent); opacity: 0.8; margin-right: 6px; }

/* ── Демо-лента ── */
.demo-ribbon {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 40;
  pointer-events: none;
  font-family: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--card);
  backdrop-filter: blur(8px);
  padding: 5px 10px;
  border-radius: 6px;
}

/* ── Служебное ── */
.is-hidden { display: none !important; }
.muted { color: var(--muted); }
.empty-note { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

/* ── Анимации ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlide { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(20px) scale(0.95); } }
@keyframes starBlink { 0%, 100% { opacity: 0.2; transform: scale(0.9); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes starFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
@keyframes driftBlob { 0%, 100% { transform: translateY(0) translateX(0) scale(1); } 50% { transform: translateY(-20px) translateX(12px) scale(1.04); } }
@keyframes snowFall { 0% { transform: translateY(-10vh) translateX(0); opacity: 0; } 10% { opacity: 0.9; } 100% { transform: translateY(110vh) translateX(24px); opacity: 0.1; } }
@keyframes fireflyGlow { 0%, 100% { opacity: 0.15; box-shadow: 0 0 4px rgba(255, 224, 130, 0.3); } 50% { opacity: 1; box-shadow: 0 0 18px rgba(255, 224, 130, 0.9); } }
@keyframes particleDrift { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(14px, -20px); } 50% { transform: translate(-10px, -34px); } 75% { transform: translate(-18px, -12px); } }
@keyframes matrixFall { 0% { transform: translateY(-12vh); opacity: 0; } 12% { opacity: 0.85; } 100% { transform: translateY(112vh); opacity: 0; } }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes goose-waddle {
  0%, 100% { transform: scaleX(-1) translateY(0) rotate(0deg); }
  25% { transform: scaleX(-1) translateY(-3px) rotate(-5deg); }
  75% { transform: scaleX(-1) translateY(-1px) rotate(4deg); }
}
@keyframes goose-celebrate {
  0% { transform: scaleX(-1) translateY(0) scale(1); }
  30% { transform: scaleX(-1) translateY(-12px) scale(1.3); }
  50% { transform: scaleX(-1) translateY(-6px) scale(1.2) rotate(10deg); }
  70% { transform: scaleX(-1) translateY(-8px) scale(1.3) rotate(-8deg); }
  100% { transform: scaleX(-1) translateY(0) scale(1); }
}

/* ── Адаптив ── */
@media (max-width: 760px) {
  .hero { padding: 32px 6vw 24px; }
  .hero__meta { grid-template-columns: 1fr; }
  .footer { flex-direction: column; gap: 8px; padding: 18px 6vw 32px; }
  .layout { padding: 14px 6vw 56px; gap: 20px; }
  .topbar { padding: 10px 3vw; gap: 8px; flex-wrap: wrap; }
  .topbar__nav { order: 3; width: 100%; overflow-x: auto; gap: 4px; padding: 4px; scrollbar-width: none; }
  .topbar__nav::-webkit-scrollbar { display: none; }
  .topbar__link { padding: 6px 10px; font-size: 0.78rem; }
  .topbar__brand { gap: 8px; }
  .hero__side-emblem { display: none; }
  .help-panel { right: 4vw; top: 110px; }
  .panel { padding: 18px; }
  .toast-container { right: 12px; bottom: 52px; left: 12px; }
  .toast { min-width: 0; max-width: none; }
  .log-fab { right: 12px; bottom: 52px; }
  .log-panel { right: 12px; bottom: 104px; }
  .demo-ribbon { left: 12px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .star, .bg-orbit, .progress-bar__goose { animation: none !important; }
  .panel { animation-duration: 0.01s; }
}
