/* Собственные стили без внешних шрифтов и CDN: приложение должно работать
   из корпоративной сети без доступа наружу. Вёрстка адаптивная — основная
   страница не прокручивается горизонтально ни на ноутбуке, ни на планшете. */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2126;
  --muted: #5c6672;
  --line: #d8dde3;
  --accent: #1f4e79;
  --accent-soft: #e8eff6;
  --ok: #1e6b3a;
  --warn: #8a5b00;
  --err: #9b2226;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-wrap: break-word;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--accent); color: #fff;
}
.brand { font-weight: 600; }
.topbar a { color: #fff; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }

h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.12rem; margin: 20px 0 8px; }
h3 { font-size: 1rem; margin: 14px 0 6px; }

a { color: var(--accent); }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}

.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* Карточка пары: две колонки на широком экране, одна на планшете и уже. */
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .card-grid { grid-template-columns: 1fr; } }

.kv { width: 100%; border-collapse: collapse; }
.kv th, .kv td {
  text-align: left; vertical-align: top; padding: 6px 8px;
  border-bottom: 1px solid var(--line); font-size: 0.94rem;
}
.kv th { width: 45%; color: var(--muted); font-weight: 500; }

.clause {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: 10px 12px; border-radius: 4px; white-space: pre-wrap;
}

details { margin-top: 10px; }
details > summary { cursor: pointer; color: var(--accent); }
details > div { margin-top: 8px; white-space: pre-wrap; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 14px; padding: 12px; }
legend { padding: 0 6px; color: var(--muted); font-size: 0.9rem; }

label.option { display: block; padding: 6px 4px; cursor: pointer; }
label.option input { margin-right: 8px; }
label.option .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; }

/* Эксперт читает русское название, а не код. Код нужен для сверки с файлом
   разметки, поэтому остаётся на экране, но как служебная пометка. */
label.option .name { font-weight: 600; }
label.option .tag {
  margin-left: 8px; padding: 1px 6px; border: 1px solid var(--line);
  border-radius: 4px; background: #fafbfc; color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.72rem;
  vertical-align: 1px;
}
label.option .def { display: block; margin-left: 24px; color: var(--muted); font-size: 0.86rem; }
label.option .def.hint { margin-top: 2px; font-style: italic; }
label.option:hover { background: var(--accent-soft); border-radius: 6px; }

input[type=text], input[type=password], textarea, select {
  width: 100%; max-width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; font: inherit; background: #fff;
}
textarea { min-height: 76px; resize: vertical; }

button, .btn {
  display: inline-block; padding: 9px 16px; border: 1px solid var(--accent);
  border-radius: 6px; background: var(--accent); color: #fff;
  font: inherit; cursor: pointer; text-decoration: none;
}
button.secondary, .btn.secondary { background: #fff; color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.danger { background: var(--err); border-color: var(--err); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

.progress { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bar { flex: 1 1 160px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

.status { min-height: 1.2em; font-size: 0.88rem; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }

.notice { border-left: 3px solid var(--warn); background: #fff8e6; padding: 10px 12px; border-radius: 4px; }
.error { border-left: 3px solid var(--err); background: #fdeced; padding: 10px 12px; border-radius: 4px; }

/* Таблицы админки могут быть шире экрана — прокрутка своя, не у страницы. */
.scroll-x { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
table.grid th, table.grid td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
table.grid th { background: var(--accent-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; padding: 3px 8px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; font-size: 0.85rem; text-decoration: none;
}

.scale { display: flex; gap: 6px; flex-wrap: wrap; }
.scale label {
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px;
  cursor: pointer; background: #fff; min-width: 44px; text-align: center;
}
.scale input { display: none; }
.scale input:checked + span { font-weight: 700; }
.scale label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.rec {
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent-soft); padding: 14px; margin: 16px 0;
}
.rec h3 { margin-top: 0; }

/* Памятка о порядке проверок — над выбором метки, свёрнутая по умолчанию.
   Пошагового мастера нет: эксперт видит порядок и решает сам. */
details.reminder {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; padding: 10px 12px; margin-bottom: 14px;
}
details.reminder > summary { font-weight: 600; }
details.reminder ol { margin: 8px 0 8px 18px; padding: 0; }
details.reminder li { margin-bottom: 4px; }

/* Дата оценки. Часть заданий относится к прошедшим событиям, и практик
   по привычке рассуждает «сейчас действует такая-то редакция». Поэтому дата
   вынесена из мелкого текста наверх — одинаково для всех пар, включая
   сегодняшние: выделять «особые» даты нельзя, это подсказало бы метку. */
.asof {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; background: #fff;
}
.asof-label { color: var(--muted); font-size: 0.86rem; }
.asof-date { font-size: 1.12rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.asof-note { flex-basis: 100%; color: var(--muted); font-size: 0.82rem; }
