/* Служебная страница без бренда: системные шрифты, высокий контраст, видимый фокус (REQ-13). */
:root {
  --text: #1a1a1a;
  --muted: #4a4a4a;
  --bg: #ffffff;
  --surface: #f4f4f2;
  --border: #8a8a8a;
  --accent: #0b5cad;
  --accent-text: #ffffff;
  --focus: #b35c00;
  --higher: #9b1c1c;
  --lower: #1d6b2f;
  --level: #3d3d3d;
  --warning-bg: #fff4d6;
  --warning-border: #8a6100;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  color: var(--accent);
  border: 2px solid var(--accent);
}
.skip-link:focus { top: 0.5rem; }

.site-header, .site-footer, .page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header { padding-top: 1rem; }
.site-title { margin: 0; font-weight: 600; }
.site-title a { color: var(--text); text-decoration: none; }
.site-title a:hover { text-decoration: underline; }

.page { padding-bottom: 2rem; }

h1 { font-size: 1.75rem; line-height: 1.25; margin: 1.5rem 0 0.75rem; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 0.5rem; }
.lead { color: var(--muted); margin-top: 0; }

.check-form { margin: 1.5rem 0; }
.check-form label { display: block; font-weight: 600; }
.hint { margin: 0.25rem 0 0.5rem; color: var(--muted); font-size: 0.9375rem; }

.field-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.field-row input {
  flex: 1 1 18rem;
  min-width: 0;
  font: inherit;
  padding: 0.625rem 0.75rem;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 4px;
}
.field-row input[aria-invalid="true"] { border-color: var(--higher); }

.field-row button {
  flex: 0 0 auto;
  font: inherit;
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  color: var(--accent-text);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
}
.field-row button:hover { background: #084a8c; }

.notice {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  background: var(--warning-bg);
  border-left: 4px solid var(--warning-border);
}

.verdict, .object, .again {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: 6px;
}
.verdict { border-left: 6px solid var(--level); }
.verdict--higher { border-left-color: var(--higher); }
.verdict--lower { border-left-color: var(--lower); }
.verdict--none { border-left-color: var(--warning-border); }
.verdict__headline { font-size: 1.5rem; }
.verdict--higher .verdict__headline { color: var(--higher); }
.verdict--lower .verdict__headline { color: var(--lower); }

.disclaimer {
  margin-bottom: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9375rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
}
.facts dt { color: var(--muted); font-size: 0.875rem; }
.facts dd { margin: 0; font-weight: 600; }
.address { margin: 0.75rem 0 0; color: var(--muted); overflow-wrap: anywhere; }

.again { background: transparent; border: 1px solid var(--border); }
.again .check-form { margin: 0.5rem 0 0; }

.site-footer {
  padding-bottom: 2rem;
  color: var(--muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 30rem) {
  h1 { font-size: 1.5rem; }
  .verdict__headline { font-size: 1.3rem; }
  .field-row button { flex: 1 1 100%; }
}

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

/* SPEC-004: оценка по модели — диапазон и факторы в том же языке страницы. */
.expected { font-size: 1.125rem; }
.reference { color: var(--muted); }

.factors {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: 6px;
}
.factors .hint { margin-top: 0; }
.factor-list { list-style: none; margin: 0; padding: 0; }
.factor {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}
.factor:first-child { border-top: 0; }
.factor__label { overflow-wrap: anywhere; }
.factor__value { font-weight: 600; white-space: nowrap; }

/* SPEC-006: вход и проверка оценок — те же токены и компоненты, одна колонка. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}
.site-nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.site-nav__name { color: var(--muted); }
.site-nav__logout { display: inline; margin: 0; }
.link-button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.button {
  font: inherit;
  font-weight: 600;
  min-height: 2.75rem;
  padding: 0.625rem 1.25rem;
  color: var(--accent-text);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
}
.button:hover { background: #084a8c; }
.button--secondary { color: var(--accent); background: var(--bg); }
.button--secondary:hover { background: var(--surface); }

.field { margin: 0 0 1rem; }
.field label, .stack-form label { display: block; font-weight: 600; }
.field input, .field select, .stack-form input, .comps-mark select {
  width: 100%;
  max-width: 100%;
  font: inherit;
  padding: 0.625rem 0.75rem;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 4px;
}
.field input[aria-invalid="true"], .field select[aria-invalid="true"],
.stack-form input[aria-invalid="true"], .comps-mark select[aria-invalid="true"] {
  border-color: var(--higher);
}
.stack-form { max-width: 24rem; margin: 1.5rem 0; }
.stack-form .field input { margin-top: 0.25rem; }
.optional { font-weight: 400; color: var(--muted); }

.notice--error { border-left-color: var(--higher); }
.notice--saved { border-left-color: var(--lower); background: var(--surface); }
.field-error { margin: 0.25rem 0 0; color: var(--higher); font-weight: 600; }
.error-summary {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  border: 2px solid var(--higher);
  border-radius: 6px;
}
.error-summary p { margin: 0; }
.error-summary ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }

.progress-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin: 0; }
.progress-line progress { flex: 1 1 8rem; max-width: 16rem; height: 0.75rem; accent-color: var(--accent); }
.review-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0.5rem 0 0; }

.tag {
  display: inline-block;
  padding: 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: middle;
}
.source-link { margin: 0.5rem 0 0; }
.subhead { font-size: 1.0625rem; margin: 1rem 0 0.25rem; }
.verdict p.verdict__headline { margin: 0 0 0.5rem; font-weight: 700; }

.comps, .answer { margin: 1.5rem 0; }
.comps-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.comps-table th, .comps-table td {
  padding: 0.5rem 0.375rem;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--border);
}
.comps-table th { font-size: 0.875rem; color: var(--muted); font-weight: 600; }
.comps-table td:first-child { overflow-wrap: anywhere; }
.comps-table tr.is-rejected td { background: var(--warning-bg); }
.comps-mark { min-width: 11rem; }
.comps-mark .check { display: flex; align-items: center; gap: 0.375rem; margin-bottom: 0.25rem; }
.comps-mark input[type="checkbox"] { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--accent); }
.comps-mark select { padding: 0.375rem 0.5rem; }

.skip {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.skip legend { padding: 0 0.25rem; font-weight: 600; }

.summary-list, .reviewed-list { padding-left: 1.25rem; }
.summary-list li, .reviewed-list li { margin: 0.375rem 0; overflow-wrap: anywhere; }

/* Страница проверки шире (таблица похожих из восьми колонок), но всё так же одна колонка. */
.page-wide .site-header, .page-wide .page, .page-wide .site-footer { max-width: 64rem; }
.comps-table td:first-child { min-width: 10rem; overflow-wrap: break-word; }
.comps-mark { min-width: 14rem; }
.comps-table td:not(:first-child):not(.comps-mark) { white-space: nowrap; }

/* Узкий экран: таблица похожих — карточки в одну колонку, факты в две, подписи из data-label. */
@media (max-width: 56rem) {
  .comps-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .comps-table, .comps-table tbody { display: block; width: 100%; }
  .comps-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.125rem 0.75rem;
    padding: 0.5rem 0.75rem;
    margin: 0 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
  }
  .comps-table td { display: block; min-width: 0; padding: 0; border-top: 0; white-space: normal; }
  .comps-table td:not(:first-child):not(.comps-mark) { white-space: normal; }
  .comps-table td::before { content: attr(data-label) " "; color: var(--muted); font-size: 0.875rem; }
  .comps-table td:first-child, .comps-table td.comps-mark { grid-column: 1 / -1; min-width: 0; }
  .comps-table td:first-child { font-weight: 600; }
  .comps-table td:first-child::before, .comps-table td.comps-mark::before { content: none; }
  .comps-table td.comps-mark { margin-top: 0.375rem; }
  .comps-table tr.is-rejected td { background: transparent; }
  .comps-table tr.is-rejected { background: var(--warning-bg); }
}
@media (max-width: 30rem) {
  .button { width: 100%; }
}
