/* ==========================================================================
   Админка app.limian.ru — тема.

   Визуальный язык взят с основного сайта limian.ru (репозиторий `limianru`,
   css/chrome.css): шрифт Onest, оранжевый акцент с градиентными кнопками,
   тонкие «волосяные» границы, скруглённые поверхности.

   В отличие от сайта админка светлая по умолчанию и на чисто белом фоне —
   никаких заливок и подложек под контентом. Тёмная тема остаётся как опция:
   её включает атрибут data-theme="dark" на <html>, который выставляет
   инлайновый скрипт в <head> до первой отрисовки.

   Файл самодостаточный: внешний сброс стилей не подключается.
   ========================================================================== */

:root {
  color-scheme: light;

  --bg: #ffffff;
  --bg-deep: #ffffff;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --surface-3: #f4f4f2;
  --surface-faint: rgba(23, 19, 15, 0.03);
  --surface-hover: rgba(23, 19, 15, 0.05);

  --line-10: rgba(23, 19, 15, 0.1);
  --line-14: rgba(23, 19, 15, 0.15);
  --line-20: rgba(23, 19, 15, 0.22);

  /* Приглушённые ступени намеренно плотные: подписи и шапки таблиц набраны
     11-12px, и на 0.5 альфы они давали около 3.4:1 при норме 4.5:1. */
  --text: #17130f;
  --text-70: rgba(23, 19, 15, 0.8);
  --text-55: rgba(23, 19, 15, 0.7);
  --text-40: rgba(23, 19, 15, 0.6);

  /* Оранжевый как текст на белом не проходит по контрасту, поэтому здесь он
     темнее; заливки кнопок остаются фирменными через --grad-btn. */
  --accent: #cf5200;
  --accent-hi: #a63f00;
  --accent-deep: #7a2f00;
  --accent-ink: #ffffff;
  --accent-soft: rgba(255, 106, 0, 0.1);
  --accent-line: rgba(207, 82, 0, 0.34);
  --grad-btn: linear-gradient(135deg, #ff9a3d, #ff6a00 70%);
  --grad-mark: linear-gradient(150deg, rgba(255, 154, 61, 0.22), rgba(255, 106, 0, 0.08));

  /* Статусы держим отдельными токенами, чтобы тёмная тема меняла оттенки
     без правки самих правил. */
  --ok: #16794f;
  --ok-soft: rgba(22, 121, 79, 0.12);
  --warn: #8a5a00;
  --warn-soft: rgba(138, 90, 0, 0.12);
  --err: #b3261e;
  --err-soft: rgba(179, 38, 30, 0.1);
  --info: #1c5fb8;
  --info-soft: rgba(28, 95, 184, 0.1);

  --shadow-card: 0 1px 2px rgba(23, 19, 15, 0.04);
  --shadow-pop: 0 24px 50px -28px rgba(23, 19, 15, 0.4);
  --glow: 0 4px 12px rgba(255, 106, 0, 0.25);

  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 252px;
  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0f0f0e;
  --bg-deep: #0a0a0a;
  --surface: #161513;
  --surface-2: #1c1b19;
  --surface-3: #232120;
  --surface-faint: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.06);

  --line-10: rgba(255, 255, 255, 0.1);
  --line-14: rgba(255, 255, 255, 0.14);
  --line-20: rgba(255, 255, 255, 0.2);

  --text: #f5f1ec;
  --text-70: rgba(245, 241, 236, 0.74);
  --text-55: rgba(245, 241, 236, 0.6);
  --text-40: rgba(245, 241, 236, 0.52);

  --accent: #ff6a00;
  --accent-hi: #ff9a3d;
  --accent-deep: #d94e00;
  --accent-ink: #1c1006;
  --accent-soft: rgba(255, 106, 0, 0.14);
  --accent-line: rgba(255, 106, 0, 0.42);

  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.14);
  --warn: #f5b544;
  --warn-soft: rgba(245, 181, 68, 0.14);
  --err: #ff6b6b;
  --err-soft: rgba(255, 107, 107, 0.14);
  --info: #6aa8ff;
  --info-soft: rgba(106, 168, 255, 0.14);

  --shadow-card: 0 20px 44px -30px rgba(0, 0, 0, 0.9);
  --shadow-pop: 0 24px 60px -28px rgba(0, 0, 0, 0.95);
  --glow: 0 6px 16px rgba(255, 106, 0, 0.35);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; font-weight: 700; line-height: 1.2; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  border: 1px solid var(--line-10);
}

::selection { background: var(--accent-soft); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ==========================================================================
   Каркас страницы
   ========================================================================== */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Боковое меню ---------- */

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 14px 16px;
  background: var(--bg);
  border-right: 1px solid var(--line-10);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 18px;
  color: var(--text);
  font-weight: 700;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 11px;
  background: var(--grad-mark);
  border: 1px solid var(--accent-line);
}
.brand-mark img { width: 17px; height: 17px; display: block; }
.brand-name { font-size: 16px; letter-spacing: -0.02em; line-height: 1.15; }
.brand-sub {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-40);
  letter-spacing: 0.02em;
}

.nav-title {
  padding: 12px 12px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-40);
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-70);
  font-weight: 500;
  transition: background-color 0.16s ease, color 0.16s ease;
}
.nav-link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav-link svg { width: 17px; height: 17px; flex: none; opacity: 0.8; }
.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-link.is-active svg { opacity: 1; }
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line-10);
  display: grid;
  gap: 8px;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
  min-width: 0;
}
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.sidebar-user-meta { min-width: 0; }
.sidebar-user-meta strong { display: block; font-size: 12.5px; font-weight: 600; }
.sidebar-user-meta span {
  display: block;
  font-size: 11px;
  color: var(--text-40);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Верхняя панель ---------- */

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-10);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-40);
  min-width: 0;
}
.crumbs a { color: var(--text-55); }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { opacity: 0.5; }
.crumbs .current {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line-14);
  background: var(--surface);
  color: var(--text-70);
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}
.icon-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }

/* Иконка предлагает противоположную тему: на светлой — луну, на тёмной — солнце. */
.icon-sun { display: none; }
.icon-moon { display: block; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

.nav-toggle { display: none; }

/* Кнопка-затемнение под выдвижным меню. На широком экране её не должно быть
   даже в потоке: как третий элемент грида .layout она сдвигала контент
   на вторую строку. */
.scrim { display: none; }

/* ---------- Контент ---------- */

.content {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  padding: 28px 32px 72px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 { font-size: 26px; }
.page-head .lead { margin: 6px 0 0; color: var(--text-55); max-width: 68ch; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px 0 14px;
}
.section-head h2 { font-size: 17px; }
.section-head .count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-40);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line-10);
}
.section-head .spacer { margin-left: auto; }

/* ==========================================================================
   Карточки
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line-10);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line-10);
  background: var(--surface-2);
}
.card-head h2, .card-head h3 { font-size: 15px; }
.card-head .sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-40); font-weight: 400; }
.card-head .spacer { margin-left: auto; }

/* Карточка-гармошка: <details class="card"> со сводкой вместо шапки.
   Используется для форм, которые нужны не при каждом заходе на страницу. */
details.card > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  background: var(--surface-2);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-right: 1.9px solid var(--text-40);
  border-bottom: 1.9px solid var(--text-40);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
}
details.card[open] > summary::before { transform: rotate(45deg); }
details.card > summary:hover { color: var(--accent); }
details.card[open] > summary { border-bottom: 1px solid var(--line-10); }

.card-body { padding: 20px; }
.card-body > .table-wrap:only-child { margin: -20px; width: auto; }

.card-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line-10);
  background: var(--surface-2);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }

/* ==========================================================================
   Плитки показателей
   ========================================================================== */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

.stat {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-10);
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-40);
}
.stat-value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: 13px; font-weight: 600; color: var(--text-40); }
.stat-note { margin-top: 2px; font-size: 12px; color: var(--text-40); }

.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta-up { color: var(--ok); }
.delta-down { color: var(--err); }
.delta-flat { color: var(--text-40); }

/* ==========================================================================
   Формы
   ========================================================================== */

.form-grid { display: grid; gap: 16px; }
/* Две колонки на широком экране и одна на узком. Порог намеренно большой:
   при 240px поля рассыпались на четыре узкие колонки и форма читалась хуже. */
.form-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-70);
}
.field .hint { font-size: 12px; color: var(--text-40); }
.field .hint code { font-size: 11.5px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-14);
  background: var(--surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-40); }

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
select:hover,
textarea:hover { border-color: var(--line-20); }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select option { background: var(--surface); color: var(--text); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.check:hover { background: var(--surface-faint); border-color: var(--line-10); }
.check input[type="checkbox"] {
  margin: 3px 0 0;
  width: 15px;
  height: 15px;
  flex: none;
  accent-color: #ff6a00;
  cursor: pointer;
}
.check-text { font-size: 13.5px; color: var(--text-70); }

/* ==========================================================================
   Кнопки
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  background-image: var(--grad-btn);
  color: #ffffff;
  box-shadow: var(--glow);
  transition: box-shadow 0.22s ease, transform 0.14s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn:hover { box-shadow: 0 8px 20px rgba(255, 106, 0, 0.4); color: #ffffff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex: none; }
:root[data-theme="dark"] .btn,
:root[data-theme="dark"] .btn:hover { color: var(--accent-ink); }

.btn-ghost {
  background-image: none;
  background-color: transparent;
  border: 1px solid var(--line-20);
  color: var(--text-70);
  box-shadow: none;
}
.btn-ghost:hover {
  background-color: var(--surface-hover);
  border-color: var(--accent-line);
  color: var(--accent);
  box-shadow: none;
}

.btn-subtle {
  background-image: none;
  background-color: var(--surface-3);
  border: 1px solid var(--line-10);
  color: var(--text-70);
  box-shadow: none;
}
.btn-subtle:hover { background-color: var(--surface-hover); color: var(--text); box-shadow: none; }

.btn-danger {
  background-image: none;
  background-color: transparent;
  border: 1px solid var(--line-14);
  color: var(--text-55);
  box-shadow: none;
}
.btn-danger:hover {
  background-color: var(--err-soft);
  border-color: var(--err);
  color: var(--err);
  box-shadow: none;
}

.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-block { width: 100%; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline-flex; }

/* ==========================================================================
   Таблицы
   ========================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-40);
  padding: 11px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-14);
  white-space: nowrap;
}
table.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-10);
  vertical-align: top;
}
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr { transition: background-color 0.14s ease; }
table.table tbody tr:hover td { background: var(--surface-faint); }
table.table td.num, table.table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.table td.id { color: var(--text-40); font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
table.table .strong { font-weight: 600; color: var(--text); }
table.table .nowrap { white-space: nowrap; }
table.table .dim { color: var(--text-40); }

/* Компактная вложенная таблица (детали мини-проверки лида). */
table.table-inner { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
table.table-inner th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-40);
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-10);
}
table.table-inner td { padding: 7px 10px; border-bottom: 1px solid var(--line-10); vertical-align: top; }
table.table-inner tr:last-child td { border-bottom: 0; }

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-40);
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 10px;
  border-radius: 14px;
  background: var(--surface-3);
  border: 1px solid var(--line-10);
  color: var(--text-40);
}
.empty-icon svg { width: 20px; height: 20px; }
td .empty { padding: 26px 12px; }

/* ==========================================================================
   Бейджи, чипы, метки
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  background: var(--surface-3);
  border: 1px solid var(--line-10);
  color: var(--text-55);
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.badge-run { background: var(--info-soft); border-color: transparent; color: var(--info); }
.badge-wait { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.badge-err { background: var(--err-soft); border-color: transparent; color: var(--err); }
.badge-plain::before { display: none; }

/* Пульсация у выполняющегося аудита — единственная анимация в админке,
   отключается при prefers-reduced-motion. */
.badge-run::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-3);
  border: 1px solid var(--line-10);
  color: var(--text-55);
}

.mark-yes { color: var(--ok); font-weight: 700; }
.mark-no { color: var(--text-40); }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin: 0;
}
.meta-item { min-width: 0; }
.meta-item dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-40);
}
.meta-item dd { margin: 2px 0 0; font-size: 13.5px; font-weight: 500; }

.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background-image: var(--grad-btn);
  transition: width 0.4s ease;
}

.alert {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  border: 1px solid transparent;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert-err { background: var(--err-soft); border-color: rgba(179, 38, 30, 0.28); color: var(--err); }
.alert-info { background: var(--surface-2); border-color: var(--line-10); color: var(--text-70); }

/* ==========================================================================
   Раскрывающиеся блоки
   ========================================================================== */

.disclosure {
  border: 1px solid var(--line-10);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.disclosure + .disclosure { margin-top: 10px; }
.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-70);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: none;
  border-right: 1.8px solid currentColor;
  border-bottom: 1.8px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  margin-left: 2px;
}
.disclosure[open] > summary::before { transform: rotate(45deg); }
.disclosure > summary:hover { color: var(--accent); }
.disclosure-body { padding: 4px 14px 16px; }

/* Компактный вариант внутри ячейки таблицы. */
.disclosure-inline { border: 0; background: none; }
.disclosure-inline > summary { padding: 2px 0; font-size: 12.5px; color: var(--accent); }
.disclosure-inline .disclosure-body { padding: 8px 0 0; }

.answer {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line-10);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-70);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow: auto;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-list-label {
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-40);
}

.check-list { margin: 0; padding: 0; list-style: none; display: grid; }
.check-list li {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-10);
  font-size: 13.5px;
}
.check-list li:last-child { border-bottom: 0; }
.check-list .k { flex: none; width: 190px; color: var(--text-40); }
.check-list .v { min-width: 0; word-break: break-word; }

.prose { font-size: 13.5px; line-height: 1.65; color: var(--text-70); white-space: pre-wrap; }

/* График динамики индекса. Цвета заданы правилами, а не атрибутами SVG:
   переменные темы в презентационных атрибутах не разрешаются. */
.trend { display: block; width: 100%; height: auto; overflow: visible; }
.trend-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.trend-dot { fill: var(--accent); }
.trend-value { fill: var(--text); font-size: 12px; font-weight: 600; }
.trend-label { fill: var(--text-40); font-size: 11px; }

/* ==========================================================================
   Страница входа
   ========================================================================== */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line-10);
}
.auth-card .brand { justify-content: center; padding: 0 0 20px; }
.auth-card h1 { font-size: 20px; text-align: center; }
.auth-card .lead { margin: 6px 0 22px; text-align: center; color: var(--text-40); font-size: 13px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-40); }

/* ==========================================================================
   Адаптив
   ========================================================================== */

@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: var(--shadow-pop);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(23, 19, 15, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
    border: 0;
    padding: 0;
  }
  .nav-toggle { display: grid; }
  .topbar { padding: 12px 18px; }
  .content { padding: 20px 18px 56px; }
  .page-head h1 { font-size: 22px; }
}

@media (max-width: 640px) {
  .page-head { align-items: flex-start; }
  .page-head-actions { margin-left: 0; width: 100%; }
  .check-list li { flex-direction: column; gap: 2px; }
  .check-list .k { width: auto; }
  .card-body { padding: 16px; }
  .card-body > .table-wrap:only-child { margin: -16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
