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

/* ---------- Шапка отчёта ---------- */
.report-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px 32px;
  align-items: start;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--graphite);
  margin-bottom: 8px;
}

.report-score {
  font-family: var(--font-display, "Unbounded", sans-serif);
  font-size: clamp(3rem, 8vw, 4.6rem);
  line-height: 0.86;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.report-score.good { color: #34d399; }
.report-score.warn { color: #f5a623; }
.report-score.bad { color: #ff922b; }
.report-score.critical { color: #ff6b6b; }

.report-score-cap {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 8px;
}

.report-body { min-width: 0; }

.report-host {
  font-size: 1.28rem;
  font-weight: 600;
  word-break: break-all;
  letter-spacing: -0.01em;
}

.report-host a { color: var(--graphite); text-decoration: none; }
.report-host a:hover { color: var(--amber-press); }

.report-facts {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.7;
}

.report-facts b { color: var(--graphite-2); font-weight: 600; }

/* Счётчики важности — строкой, без «пилюль» */
.sev-tally {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

.sev-tally span { white-space: nowrap; }
.sev-tally .n { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Фильтр по важности ---------- */
.sev-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 22px 0 0;
  border-bottom: 1px solid var(--border);
}

.sev-filter button {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 9px 15px 11px;
  margin-bottom: -1px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  transition: color .15s, border-color .15s;
  min-height: 40px;
}

.sev-filter button:hover { color: var(--graphite); }

.sev-filter button[aria-pressed="true"] {
  color: var(--graphite);
  border-bottom-color: var(--graphite);
  font-weight: 600;
}

.sev-filter .cnt {
  font-size: 0.68rem;
  opacity: 0.62;
  font-variant-numeric: tabular-nums;
}

.sev-filter button:disabled {
  opacity: 0.34;
  cursor: default;
}

.sev-filter button:focus-visible {
  outline: 2px solid var(--amber-press);
  outline-offset: -2px;
}

/* ---------- Запись находки ---------- */
.report-doc { margin-top: 4px; }

.finding-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px 26px;
  padding: 26px 0 24px;
  border-bottom: 1px solid var(--border);
}

.finding-row:last-child { border-bottom: 0; }

/* Левая колонка: индекс + важность текстом */
.finding-rail {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding-top: 4px;
}

.finding-rail .idx {
  display: block;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.finding-rail .lvl {
  display: block;
  font-weight: 700;
  margin-top: 3px;
}

.finding-rail .lvl-critical { color: #ff6b6b; }
.finding-rail .lvl-high { color: #ff922b; }
.finding-rail .lvl-medium { color: #f5a623; }
.finding-rail .lvl-low { color: #74c0fc; }
.finding-rail .lvl-info { color: #8b939c; }

.finding-main { min-width: 0; }

.finding-h {
  font-size: 1.12rem;
  line-height: 1.34;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: -0.008em;
}

/* Ссылка на стандарт — строкой под заголовком, не бейджем */
.finding-refs {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--muted);
  margin: -4px 0 14px;
  letter-spacing: 0.01em;
}

.finding-refs span + span::before { content: " · "; }

/* «Почему критично» — врезка на линии, без плашки */
.finding-why {
  border-left: 2px solid var(--border-strong);
  padding-left: 15px;
  margin: 0 0 14px;
  font-size: 0.94rem;
  line-height: 1.66;
  color: var(--graphite-2);
}

.finding-why .why-lead {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}

.finding-note {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 12px;
}

/* «Что нашли» — моно-текст под волосяной линией */
.finding-ev {
  margin: 0 0 14px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.finding-ev .ev-lead {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.finding-ev pre {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--graphite-2);
  max-height: 240px;
  overflow-y: auto;
}

/* «Как исправить» — обычный абзац с ведущим словом */
.finding-fix {
  font-size: 0.93rem;
  line-height: 1.62;
  margin: 0;
}

.finding-fix .fix-lead {
  font-weight: 700;
  color: var(--amber);
}

.finding-link {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--amber-press);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}

.finding-link:hover { color: var(--graphite); }

/* ---------- Пустое состояние и служебные блоки ---------- */
.report-empty {
  padding: 44px 0;
  border-top: 1px solid var(--border);
}

.report-empty h3 { font-size: 1.16rem; margin: 0 0 8px; }
.report-empty p { color: var(--muted); font-size: 0.92rem; max-width: 52ch; margin: 0; }

.report-note {
  margin: 20px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  font-size: 0.89rem;
  line-height: 1.62;
  color: var(--graphite-2);
}

.report-note a { color: var(--amber-press); }

/* Список проверок на /checks и метрики */
.check-list { margin-top: 6px; }

.check-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 6px 26px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.check-row:last-child { border-bottom: 0; }

.check-row .c-rail {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 3px;
}

.check-row .c-title {
  font-size: 0.98rem;
  line-height: 1.45;
  margin: 0;
}

.check-row .c-meta {
  grid-column: 2;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--muted);
  margin-top: 3px;
}

.check-row .c-meta em {
  font-style: normal;
  color: var(--amber);
}

/* Компактные числовые строки для метрик */
.metric-table { border-top: 2px solid var(--graphite); }

.metric-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.metric-line .m-val {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.metric-line .m-note {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--muted);
  margin-top: -4px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 720px) {
  .report-head {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-bottom: 22px;
  }

  .report-score { font-size: 3.2rem; }
  .report-score-cap { margin-top: 4px; }

  .finding-row,
  .check-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 20px 0;
  }

  /* На узком экране рельс становится строкой над заголовком */
  .finding-rail {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding-top: 0;
  }

  .finding-rail .idx { display: inline; }
  .finding-rail .lvl { display: inline; margin-top: 0; }

  .check-row .c-meta { grid-column: 1; }

  .finding-h { font-size: 1.04rem; }
  .sev-filter { gap: 0; overflow-x: auto; flex-wrap: nowrap; }
  .sev-filter button { padding: 9px 11px 11px; }
}
/* Заголовки секций метрик — строчные, типографикой */
.metrics-h {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 6px;
}

.metrics-h:first-of-type { margin-top: 8px; }

/* ---------- Пояснение оценки (раскрывающийся блок) ---------- */
.score-help {
  margin: 18px 0 0;
  border-bottom: 1px solid var(--border);
}

.score-help > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 0 13px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  color: var(--amber-press);
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
}

.score-help > summary::-webkit-details-marker { display: none; }

.score-help > summary::before {
  content: "?";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.66rem;
  font-weight: 700;
}

.score-help > summary:hover { color: var(--graphite); }
.score-help > summary:focus-visible {
  outline: 2px solid var(--amber-press);
  outline-offset: 2px;
}

.score-help-body {
  padding: 4px 0 22px;
  font-size: 0.92rem;
  line-height: 1.66;
  color: var(--graphite-2);
  max-width: 76ch;
}

.sh-lead { margin: 0 0 12px; }
.sh-line { margin: 0 0 8px; font-weight: 600; color: var(--graphite); }
.sh-hint { margin: 0 0 18px; font-size: 0.87rem; color: var(--muted); }
.sh-disclaimer {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--border-strong);
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
}

/* Таблица расчёта баллов */
.sh-calc {
  border-top: 1px solid var(--border);
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 0.79rem;
}

.sh-calc-head,
.sh-calc-row {
  display: grid;
  grid-template-columns: 1fr 74px 96px;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sh-calc-head {
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.sh-calc-row > span:nth-child(2),
.sh-calc-row > span:nth-child(3),
.sh-calc-head > span:nth-child(2),
.sh-calc-head > span:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sh-calc-total { font-weight: 700; color: var(--graphite); }

.sh-coverage {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.sh-coverage li { padding: 3px 0 3px 15px; position: relative; }

.sh-coverage li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--border-strong);
}

.sh-why {
  margin: 0 0 14px;
  border-left: 2px solid var(--border-strong);
  padding-left: 15px;
}

.sh-incomplete {
  margin: 0;
  border-left: 2px solid var(--amber);
  padding-left: 15px;
}

.sh-incomplete a { color: var(--amber-press); }

/* ---------- Блок выгрузки промпта ---------- */
.prompt-box {
  margin: 20px 0 4px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.pb-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px 26px;
  align-items: center;
}

.pb-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 5px;
  letter-spacing: -0.008em;
}

.pb-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  max-width: 62ch;
}

.pb-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  min-width: 232px;
}

.pb-sev {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.pb-sev select {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--graphite);
  min-height: 36px;
}

.pb-locked {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--graphite-2);
  max-width: 76ch;
}

.pb-locked a { color: var(--amber-press); }

@media (max-width: 720px) {
  .pb-row { grid-template-columns: 1fr; }
  .pb-actions { min-width: 0; }
  .sh-calc-head,
  .sh-calc-row { grid-template-columns: 1fr 54px 78px; }
}

/* Paywall: бесплатный отчёт показывает 1–2 находки, остальное скрыто */
.paywall-box {
  margin-top: 1.5rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--amber);
  border-left-width: 3px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.08), rgba(245, 166, 35, 0.02));
}

.paywall-box h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--graphite);
}

.paywall-box p {
  margin: 0 0 1rem;
  color: var(--graphite-2);
  font-size: 0.92rem;
  line-height: 1.6;
  max-width: 76ch;
}

.paywall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ---------- Платные (заблокированные) уровни глубины ---------- */
.seg button.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.seg button.locked::after {
  content: "🔒";
  margin-left: 7px;
  font-size: 0.78em;
  vertical-align: 0.06em;
}

.seg button.locked:hover,
.seg button.locked:focus-visible {
  opacity: 0.8;
  color: var(--ink-2);
  outline: 1px dashed var(--border-strong);
  outline-offset: -3px;
}

/* Всплывающая подсказка: как разблокировать платный уровень */
.seg-tooltip {
  position: fixed;
  z-index: 60;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-left: 2px solid var(--amber);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 0.82rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lift);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
}

.seg-tooltip.show { opacity: 1; }

/* Постоянная подсказка под переключателем: что делать с платными уровнями */
.lock-hint {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 13px;
  border-left: 2px solid var(--amber);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.lock-hint-ico { flex: none; }
.lock-hint a { color: var(--amber); font-weight: 600; }
.lock-hint a:hover { text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  .seg-tooltip { transition: none; }
}

