/* Лавандовая палитра отчёта (radar/report.py::_STYLE) — общая для всех
   экранов: карта-пикер (.autopilot/picker-search-and-design/spec.md §2),
   вход и второй экран (.autopilot/polish/spec.md). --ok/--danger — цвета
   статусов второго экрана. */
:root {
  --bg: #f2eefb;
  --panel: #fff;
  --ink: #1c1730;
  --dim: #716c8a;
  --line: #e7e2f7;
  --radius: 22px;
  --shadow: 0 16px 40px -20px rgba(88, 66, 178, 0.35);
  --accent: #7c5cff;
  --ok: #1f7a4d;
  --danger: #b3352b;
}

/* Тёмная тема: по системной настройке, пока пользователь не выбрал сам
   кнопкой ☀/☾ (static/theme.js ставит data-theme на <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1830;
    --panel: #262040;
    --ink: #f0edfa;
    --dim: #a49dc4;
    --line: #382f57;
    --shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.6);
    --ok: #5cc98f;
    --danger: #ff8f84;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #1c1830;
  --panel: #262040;
  --ink: #f0edfa;
  --dim: #a49dc4;
  --line: #382f57;
  --shadow: 0 16px 40px -20px rgba(0, 0, 0, 0.6);
  --ok: #5cc98f;
  --danger: #ff8f84;
  color-scheme: dark;
}

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

.theme-toggle {
  position: fixed;
  right: 16px;
  bottom: 28px;
  z-index: 2000; /* выше панелей Leaflet */
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
  transform: rotate(-20deg) scale(1.06);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media print {
  .theme-toggle {
    display: none;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  display: flex;
}

body {
  background: var(--bg);
  color: var(--ink);
}

#panel {
  width: 360px;
  min-width: 320px;
  padding: 20px;
  overflow-y: auto;
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
}

#map {
  flex: 1;
  height: 100vh;
}

h1 {
  font-size: 20px;
  margin: 0 0 8px;
}

#panel h1 {
  color: var(--ink);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

#how-it-works-link,
#all-points-link {
  font-size: 13px;
  color: var(--accent);
  white-space: nowrap;
}

#all-points-link {
  display: inline-block;
  margin-bottom: 8px;
}

.how-it-works {
  margin: 0 0 16px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
}

.how-it-works h2 {
  font-size: 16px;
  margin: 0 0 8px;
}

.how-it-works ol {
  margin: 0 0 12px;
  padding-left: 20px;
  font-size: 14px;
}

.how-it-works .hint {
  margin-bottom: 12px;
}

.hint {
  color: var(--dim);
  font-size: 14px;
  margin: 0 0 16px;
}

#address-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

#address-input {
  flex: 1;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

button {
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

/* Кнопки первого экрана — акцентная заливка (та же, что OWN_COLOR в
   отчёте); .shop-search-candidates ниже переопределяет это для строк
   списка через более специфичный селектор. */
#panel button {
  color: #fff;
  font-weight: 650;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  transition: opacity 0.15s;
}

#panel button:hover:not(:disabled) {
  opacity: 0.88;
}

.message {
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}

.error {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.success {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}

.info {
  color: var(--accent);
  background: #7c5cff1a;
}

#confirm-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

#confirm-block label {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--dim);
}

#confirm-block input,
#confirm-block select {
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.question {
  font-weight: 600;
  margin-top: 14px;
  color: var(--ink);
}

#confirm-button {
  width: 100%;
  margin-top: 8px;
}

#discover-block hr {
  margin: 20px 0;
  border: none;
  border-top: 1px solid var(--line);
}

#discover-block h2 {
  font-size: 16px;
  margin: 0 0 8px;
  color: var(--ink);
}

#discover-button {
  width: 100%;
}

#candidates-block {
  margin-top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

#candidates-summary {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--dim);
}

.candidates-group {
  margin: 10px 0 4px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}

.candidates-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}

.candidates-list li {
  padding: 4px 0;
  font-size: 14px;
  color: var(--ink);
}

.candidates-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#confirm-competitors-button {
  width: 100%;
}

/* «Выбрано N из 10» — создаётся в app.js сразу под кнопкой подтверждения. */
.competitors-counter {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--dim);
  text-align: center;
}

/* Список магазинов, найденных по имени (R02.2) — создаётся в app.js,
   подвешивается в #panel; специфичность (id+class+element) обязана
   превзойти `#panel button` выше, иначе акцентная заливка кнопки
   продавит стиль строки списка. */
.shop-search-candidates {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.shop-search-candidates li {
  border-bottom: 1px solid var(--line);
}

.shop-search-candidates li:last-child {
  border-bottom: 0;
}

#panel .shop-search-candidates button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  color: var(--ink);
  font-weight: 500;
  text-align: left;
  background: transparent;
  border-radius: 0;
}

#panel .shop-search-candidates button:hover {
  background: #7c5cff1a;
}

/* Второй экран (ожидание и результат) — на тех же переменных :root, что
   карта, вход и отчёт, включая тёмную тему (.autopilot/polish/spec.md,
   истории 5–7). Статусы — --ok/--danger, их полупрозрачные фоны —
   color-mix от них же, чтобы тёмная тема не требовала своих правил. */
.results-page {
  display: block;
  min-height: 100%;
  height: auto;
}

/* Экран — ровно высота окна: отчёт (или ожидание) забирает остаток,
   поэтому кнопки под ним всегда видны без прокрутки страницы. Раньше
   iframe был `100vh - 210px`, а шапка+статус+кнопки занимают больше —
   кнопки уезжали под край. Ниже min-height страница просто прокручивается. */
#results-screen {
  display: flex;
  flex-direction: column;
  width: min(1440px, 100%);
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 520px;
  margin: 0 auto;
  padding: 24px;
}

#results-screen > * {
  flex: none;
}

#results-screen > #report-panel,
#results-screen > #report-waiting {
  flex: 1 1 auto;
  min-height: 0;
}

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.results-header h1 {
  margin-bottom: 0;
  font-size: clamp(24px, 3vw, 36px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#back-to-map,
.secondary-action {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

#back-to-map:hover,
.secondary-action:hover {
  text-decoration: underline;
}

.result-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 18px;
  background: var(--panel);
}

.result-status p {
  margin: 0;
}

.status-indicator {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
  background: var(--dim);
}

.result-status[data-status="running"] .status-indicator {
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
}

.result-status[data-status="ready"] .status-indicator {
  background: var(--ok);
}

.result-status[data-status="error"] {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
}

.result-status[data-status="error"] .status-indicator {
  background: var(--danger);
}

#report-waiting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--dim);
  text-align: left;
  background: var(--panel);
}

#report-waiting h2,
#report-waiting p {
  margin: 0;
}

#report-waiting h2 {
  color: var(--ink);
}

#report-waiting p {
  max-width: 540px;
  margin-top: 6px;
  line-height: 1.5;
}

.report-loader {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: report-spin 0.9s linear infinite;
}

@keyframes report-spin {
  to {
    transform: rotate(360deg);
  }
}

#report-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

#report-frame {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  border: 0;
  background: var(--bg);
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

#retry-report-button,
#download-pdf-link {
  min-height: 42px;
  border-radius: 10px;
  font-weight: 650;
  transition: opacity 0.15s, background 0.15s;
}

#retry-report-button {
  border: 0;
  color: #fff;
  background: var(--accent);
}

#retry-report-button:hover:not(:disabled) {
  opacity: 0.88;
}

/* «Скачать PDF» — ссылка на /report.pdf с `download` (файл сразу на диск),
   оформленная контурной кнопкой рядом с залитой «Построить отчёт заново». */
#download-pdf-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--accent);
  background: transparent;
}

#download-pdf-link:hover {
  text-decoration: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* «Распечатать» — прежняя печать браузера (/report/print), второстепенная:
   приглушённая текстовая ссылка. */
#print-report-link {
  color: var(--dim);
  font-weight: 500;
}

/* Окно «Оценка отчёта» (R13): открывает звезда в отчёте (iframe шлёт
   postMessage), static/results.js. Нативный <dialog> — фокус и Esc сам. */
.feedback-dialog {
  width: min(460px, calc(100% - 32px));
  padding: 22px 24px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.feedback-dialog::backdrop {
  background: color-mix(in srgb, var(--ink) 35%, transparent);
}

.feedback-dialog h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.feedback-dialog-stars {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
}

.feedback-dialog-star {
  padding: 0 4px;
  color: var(--accent);
  font-size: 32px;
  line-height: 1.1;
  background: none;
  border: 0;
  border-radius: 8px;
}

.feedback-dialog-star:focus-visible,
.feedback-dialog textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feedback-dialog label {
  display: block;
  margin-bottom: 6px;
  color: var(--dim);
  font-size: 14px;
}

.feedback-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
}

.feedback-counter {
  margin: 4px 0 12px;
  color: var(--dim);
  font-size: 12px;
  text-align: right;
}

.feedback-dialog .message {
  margin: 0 0 12px;
}

.feedback-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.feedback-dialog-actions button {
  min-height: 40px;
  font-weight: 650;
  border-radius: 10px;
}

#feedback-submit,
#feedback-close {
  color: #fff;
  background: var(--accent);
  border: 0;
}

#feedback-cancel {
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
}

/* Список точек на главной (R28): карточка на точку, «Добавить точку» —
   залитая акцентная кнопка, «Удалить» — контур цвета --danger. */
#points-screen {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.add-point {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  background: var(--accent);
  transition: opacity 0.15s;
}

.add-point:hover {
  opacity: 0.88;
}

.points-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* «Кабинет» владельца — контурная кнопка рядом с залитой «Добавить точку». */
.admin-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
}

.admin-link:hover {
  border-color: var(--accent);
}

.points-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.point-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.point-info {
  flex: 1 1 280px;
  min-width: 0;
}

.point-name {
  margin: 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.point-address {
  margin: 4px 0 0;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.point-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 10px 0 0;
  color: var(--dim);
  font-size: 14px;
}

.point-running {
  color: var(--accent);
  font-weight: 650;
}

.point-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.point-actions a,
.point-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  background: transparent;
  transition: background 0.15s;
}

.point-actions a:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.point-actions .point-open {
  border-color: var(--accent);
  color: var(--accent);
}

.point-delete {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  color: var(--danger);
}

.point-delete:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

@media (max-width: 700px) {
  body:not(.results-page) {
    display: flex;
    height: auto;
    min-height: 100%;
    flex-direction: column;
  }

  #panel {
    width: 100%;
    min-width: 0;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid #ddd;
  }

  #address-form {
    flex-wrap: wrap;
  }

  #address-input {
    min-width: 0;
  }

  #map {
    width: 100%;
    min-height: 420px;
    height: 55vh;
    flex: none;
  }

  #results-screen,
  #points-screen {
    padding: 16px;
  }

  /* Кнопки карточки — на всю ширину телефона, на узком переносятся. */
  .point-actions {
    width: 100%;
  }

  .point-actions > * {
    flex: 1 1 auto;
  }

  .results-header {
    flex-direction: column;
    gap: 10px;
  }

  #report-waiting {
    align-items: flex-start;
    flex-direction: column;
  }

  /* Внизу экрана результата теперь всегда кнопки — плавающая кнопка
     темы их перекрывала; на телефоне она уходит в верхний угол. */
  .results-page .theme-toggle {
    top: 12px;
    bottom: auto;
  }

  /* Две колонки, а не столбик из четырёх: столбик съедал полэкрана
     телефона, отчёту оставалась щель. */
  .results-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
  }

  #retry-report-button,
  .secondary-action {
    width: 100%;
    min-height: 44px;
  }

  .secondary-action {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .report-loader {
    animation: none;
  }
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.login-card {
  width: 320px;
  padding: 24px;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card h1 {
  color: var(--ink);
}

.login-card .hint {
  color: var(--dim);
}

.login-card label {
  display: block;
  margin: 12px 0 4px;
  font-size: 14px;
  color: var(--dim);
}

.login-card input,
.login-card textarea {
  width: 100%;
  font-family: inherit;
  padding: 8px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
}

.login-card button {
  width: 100%;
  margin-top: 16px;
  color: #fff;
  font-weight: 650;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  transition: opacity 0.15s;
}

.login-card button:hover:not(:disabled) {
  opacity: 0.88;
}

.login-card textarea {
  resize: vertical;
}

/* Регистрация, «Забыли пароль?», «На страницу входа» — под формой. */
.login-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin: 16px 0 0;
  font-size: 14px;
}

.login-links a {
  color: var(--accent);
}

/* Заявки на доступ: страница решения, ответ заявителя, список /access. */
.access-row {
  margin-top: 16px;
}

.login-card.access-card {
  width: min(560px, calc(100vw - 32px));
}

.access-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.access-log {
  margin: 0 0 12px;
  padding-left: 18px;
}

.access-log li {
  margin-bottom: 8px;
}

.access-log .access-text {
  display: block;
}

.access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.access-actions a {
  padding: 9px 16px;
  border-radius: 999px;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
}

.access-card .access-action-approve,
.access-actions .access-action-approve {
  background: var(--ok);
}

.access-card .access-action-deny,
.access-actions .access-action-deny {
  background: var(--danger);
}

.access-card .access-action-comment,
.access-actions .access-action-comment {
  background: var(--dim);
}

/* Экономика прогонов: правила намеренно изолированы от карты и экрана
   результата. Цвета берутся только из общей палитры, поэтому отдельная
   тёмная тема этой странице не нужна. */
.economics-page {
  display: block;
  min-height: 100%;
  height: auto;
  background: var(--bg);
  color: var(--ink);
}

.economics-shell {
  width: min(1600px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

/* Кабинет владельца: вкладки служебных страниц (`_admin_nav.html`). */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.admin-nav a {
  color: var(--dim);
  font-weight: 600;
  text-decoration: none;
}

.admin-nav a:hover {
  color: var(--ink);
}

.admin-nav a[aria-current="page"] {
  color: var(--accent);
}

.admin-nav-back {
  margin-right: 12px;
}

.economics-head,
.economics-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.economics-head h1 {
  margin: 8px 0;
  font-size: clamp(26px, 4vw, 42px);
}

.economics-head p,
.economics-section-head p,
.economics-note,
.economics-muted {
  margin: 0;
  color: var(--dim);
}

.economics-download,
.economics-filters button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 15px;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  background: var(--accent);
  border: 0;
  border-radius: 11px;
}

.economics-warnings {
  margin-top: 24px;
  padding: 18px 20px;
  color: var(--ink);
  background: color-mix(in srgb, var(--danger) 8%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--danger) 32%, var(--line));
  border-radius: 16px;
}

.economics-warnings h2,
.economics-card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.economics-warnings ul {
  margin: 0;
  padding-left: 20px;
}

.economics-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin: 24px 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.economics-filters label {
  display: grid;
  gap: 6px;
  color: var(--dim);
  font-size: 13px;
}

.economics-filters select,
.economics-filters input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.economics-card {
  min-width: 0;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.economics-section-head > span {
  min-width: 34px;
  padding: 6px 9px;
  color: var(--accent);
  text-align: center;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 999px;
}

.economics-empty {
  margin: 28px 0 8px;
  padding: 24px;
  color: var(--dim);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
}

.economics-table-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.economics-table {
  width: 100%;
  min-width: 3000px;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.economics-table th,
.economics-table td {
  padding: 9px 10px;
  text-align: right;
  white-space: nowrap;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.economics-table th {
  color: var(--dim);
  font-weight: 650;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}

.economics-table th:first-child,
.economics-table td:first-child,
.economics-table th:nth-child(2),
.economics-table td:nth-child(2),
.economics-table th:nth-child(3),
.economics-table td:nth-child(3),
.economics-table th:nth-child(4),
.economics-table td:nth-child(4) {
  text-align: left;
}

.economics-table .failed-run {
  color: var(--dim);
  background: color-mix(in srgb, var(--dim) 7%, transparent);
}

.economics-total {
  color: var(--accent);
  font-weight: 750;
}

.economics-note {
  margin-top: 12px;
  font-size: 13px;
}

.economics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.economics-card h3 {
  margin: 18px 0 8px;
  color: var(--dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.economics-stats {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.economics-stats li,
.economics-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.economics-stats span,
.economics-facts dt {
  color: var(--dim);
}

.economics-formula {
  margin: 0;
  padding: 16px;
  font-size: 17px;
  line-height: 1.5;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 14px;
}

.economics-facts {
  margin: 0;
}

.economics-facts dd {
  margin: 0;
  font-weight: 700;
}

.economics-facts .economics-fact-total {
  margin-top: 6px;
  color: var(--accent);
  font-size: 17px;
  border-bottom: 0;
}

@media (max-width: 1000px) {
  .economics-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .economics-shell {
    width: min(100% - 20px, 1600px);
    padding-top: 18px;
  }

  .economics-head,
  .economics-section-head {
    flex-direction: column;
  }

  .economics-download {
    width: 100%;
  }

  .economics-filters,
  .economics-grid {
    grid-template-columns: 1fr;
  }
}

/* Журнал сбоев (/incidents) — поверх каркаса страницы экономики. */
.incidents-card {
  margin-top: 24px;
}

.incidents-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.incidents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.incidents-table th,
.incidents-table td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.incidents-table th {
  color: var(--dim);
  font-weight: 650;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}

.incidents-when,
.incidents-table td:nth-child(2) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.incidents-dim {
  color: var(--dim);
  font-size: 12px;
}

.incidents-message {
  min-width: 260px;
  overflow-wrap: anywhere;
}

.incidents-message pre {
  max-height: 320px;
  margin: 8px 0 0;
  padding: 10px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 12px;
  background: color-mix(in srgb, var(--dim) 7%, transparent);
  border-radius: 8px;
}

.incidents-level-error,
.incidents-status-new,
.incidents-status-needs-human {
  color: var(--danger);
  font-weight: 650;
}

.incidents-level-warning,
.incidents-status-logged,
.incidents-status-not-code {
  color: var(--dim);
}

.incidents-status-fix-ready,
.incidents-status-deployed {
  color: var(--ok);
  font-weight: 650;
}

.incidents-status-investigating {
  color: var(--accent);
}

/* Оценки отчёта (/feedback) — таблица журнала сбоев, текст с переносами. */
.feedback-rating {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.feedback-rating-stars {
  color: var(--accent);
  letter-spacing: 0.05em;
}

.feedback-text {
  min-width: 260px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
