/* Админка «Контроль сервиса». Без сборки: один файл стилей. */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #18222d;
  --muted: #5d6975;
  --line: #d8dee5;
  --accent: #245b8f;
  --accent-soft: #e7eff7;
  --red: #b3261e;
  --red-soft: #fbe9e7;
  --yellow: #8a6100;
  --yellow-soft: #fdf3d3;
  --green: #256b3f;
  --green-soft: #e3f3e8;
  --grey-soft: #eceff2;
  --radius: 6px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 10px; }
p { margin: 0 0 10px; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }

.sidebar { background: var(--ink); color: #dfe6ee; padding: 18px 0; display: flex; flex-direction: column; }
.sidebar .brand { padding: 0 18px 16px; font-weight: 600; font-size: 15px; color: #fff; }
.sidebar nav a { display: block; padding: 8px 18px; color: #dfe6ee; text-decoration: none; }
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.sidebar .user { margin-top: auto; padding: 14px 18px 0; font-size: 13px; color: #a9b5c2; }
.sidebar .user form { margin-top: 6px; }
.sidebar .user button { background: none; border: 0; padding: 0; color: #dfe6ee; cursor: pointer; text-decoration: underline; font: inherit; }

.main { padding: 26px 30px 40px; min-width: 0; }

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

.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; background: var(--surface); }
table.data th, table.data td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data th { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
table.data td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.yellow { background: var(--yellow-soft); color: var(--yellow); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.grey { background: var(--grey-soft); color: var(--muted); }
.pill.blue { background: var(--accent-soft); color: var(--accent); }

.muted { color: var(--muted); }
.note { font-size: 13px; color: var(--muted); }
.error { background: var(--red-soft); color: var(--red); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }

form .field { margin-bottom: 12px; }
form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); font: inherit; background: #fff; color: var(--ink);
}
button.primary, a.button {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: var(--radius);
  padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 14px; font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.auth { max-width: 380px; margin: 12vh auto 0; padding: 0 16px; }
.auth h1 { text-align: center; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 0; }
  .sidebar .brand { padding: 0 14px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar .user { margin: 0 0 0 auto; padding: 0 14px; }
  .main { padding: 18px 16px 30px; }
}

/* --- Оценки: список и карточка разговора */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.filters .field { margin: 0; flex: 1 1 150px; min-width: 0; }
.filters .field.wide { flex: 2 1 260px; }
.filters .field.actions { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-value.bad { color: var(--red); }
.stat-value.good { color: var(--green); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat-zones { display: flex; flex-wrap: wrap; gap: 6px; min-height: 31px; align-items: center; }

.pill.big { font-size: 13px; padding: 3px 12px; }
.pill.ghost { background: transparent; border: 1px dashed currentColor; text-decoration: line-through; }

.banner { background: var(--yellow-soft); color: var(--yellow); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }

details.fold > summary { cursor: pointer; font-weight: 600; }
details.fold[open] > summary { margin-bottom: 12px; }

.facts dl { display: flex; flex-wrap: wrap; gap: 10px 32px; margin: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; }
.facts .summary { margin: 12px 0 0; }
.facts audio { display: block; width: 100%; max-width: 520px; margin-top: 12px; }

.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.split > section > h2:first-child { margin-top: 0; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }

table.data tr.dim td { color: var(--muted); }
table.data tr.hit td:first-child { box-shadow: inset 3px 0 0 var(--red); }
table.criteria .code { display: inline-block; min-width: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }

.quote { margin: 6px 0 0; padding: 4px 0 4px 10px; border-left: 3px solid var(--line); }
.quote.unverified { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.quote .refs { font-size: 12px; margin-left: 6px; white-space: nowrap; text-decoration: none; display: inline-block; }
.note.warn { color: var(--yellow); }

ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li + li { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.talk { padding: 6px 0; max-height: 78vh; overflow-y: auto; position: sticky; top: 16px; }
.utt { padding: 8px 16px; border-left: 3px solid transparent; }
.utt + .utt { border-top: 1px solid var(--grey-soft); }
.utt.employee { background: var(--accent-soft); }
.utt.cited { border-left-color: var(--red); }
.utt:target { outline: 2px solid var(--accent); outline-offset: -2px; }
.utt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.utt-idx { font-variant-numeric: tabular-nums; min-width: 18px; }
.utt-who { font-weight: 600; color: var(--ink); }
.utt-text { margin-top: 2px; overflow-wrap: anywhere; }

.pager { display: flex; gap: 16px; align-items: center; margin-top: 14px; font-size: 13px; }

/* --- Оспаривания и эталонный набор */
.notice { background: var(--green-soft); color: var(--green); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.note.fixed { color: var(--accent); }
a.disagree { display: block; margin-top: 4px; font-size: 12px; white-space: nowrap; }
.reason { margin: 8px 0 0; white-space: pre-line; }
.choices { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; }
.choices label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); margin: 0; }
table.data tr.marked td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
table.data select { min-width: 150px; padding: 5px 8px; }
form.inline { display: inline; }
label.check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); margin: 0; }

/* --- Правила: редактор версии и сравнение */
h3 { font-size: 14px; margin: 18px 0 8px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select, fieldset:disabled textarea { background: var(--bg); color: var(--ink); }
textarea { resize: vertical; }
textarea.mono, code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
input.short { width: 110px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
details.fold > form, details.fold > p { margin-top: 4px; }
.crit { padding: 10px 0; border-top: 1px solid var(--line); }
.crit:first-child { border-top: 0; }
.crit-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) 170px 150px; gap: 10px; align-items: center; }
.crit-head .code { font-weight: 600; }
.inline-label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 13px; }
.crit-more { margin: 8px 0 0 54px; }
.crit-more > summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.crit-more[open] > summary { margin-bottom: 10px; }
.actions-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-items: start; }
ul.compact li + li { margin-top: 6px; padding-top: 0; border-top: 0; }
.group-title { margin: 12px 0 4px; }
.error ul, .note ul { margin: 6px 0 0; padding-left: 20px; }
@media (max-width: 800px) { .crit-head { grid-template-columns: 44px minmax(0, 1fr); } .crit-more { margin-left: 0; } }

/* --- Обзор и расходы */
a.stat.link { display: block; color: inherit; text-decoration: none; }
a.stat.link:hover { border-color: var(--accent); }
.bar { height: 6px; background: var(--grey-soft); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-fill.full { background: var(--red); }

/* --- Переписка */
.utt.context { background: var(--bg); color: var(--muted); }
.utt-text { white-space: pre-line; }

/* Раздел «Расчёты» (specs/003): текст письма и черновика, запрос и ответ калькулятора */
.letter { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
pre.json { font-size: 12px; line-height: 1.45; background: var(--grey-soft); border-radius: var(--radius); padding: 10px 12px; margin: 6px 0 0; overflow-x: auto; max-height: 420px; }
