/* ATM Placement — минимальный стиль без фреймворка. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: #1f2937; background: #f3f4f6; }
.container { max-width: 1080px; margin: 0 auto; padding: 16px 20px; }
.topbar { background: #0f172a; color: #f9fafb; padding: 14px 0; }
.topbar .logo { color: #f9fafb; font-weight: 700; font-size: 18px; text-decoration: none; }
.topbar .sub { color: #cbd5e1; margin-left: 14px; font-size: 14px; }
.topbar .version-badge {
  background: #1e3a8a; color: #dbeafe;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
}
.topbar .version-badge .version-built {
  font-weight: 400; opacity: 0.78; letter-spacing: 0; margin-left: 2px;
}
footer { padding: 24px 20px 40px; }

.card { background: white; border: 1px solid #e5e7eb; border-radius: 10px; padding: 18px 22px; margin: 18px 0; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.muted { color: #6b7280; }
.small { font-size: 13px; }
.row { display: flex; align-items: flex-start; }
.row.between { justify-content: space-between; gap: 16px; }
.row.gap { gap: 16px; flex-wrap: wrap; }
.m0 { margin: 0; }

input[type="text"] { width: 100%; padding: 12px 14px; font-size: 16px; border: 1px solid #d1d5db; border-radius: 8px; margin: 6px 0 10px; }
input[type="text"]:focus { outline: 2px solid #3b82f6; border-color: #3b82f6; }
button.primary { background: #1d4ed8; color: white; border: 0; padding: 10px 18px; font-size: 16px; border-radius: 8px; cursor: pointer; }
button.primary:hover { background: #1e40af; }
button.link, a.link { background: none; border: 0; color: #1d4ed8; cursor: pointer; padding: 0 4px; font-size: inherit; text-decoration: none; }
button.link:hover, a.link:hover { text-decoration: underline; }
.examples { color: #6b7280; font-size: 14px; margin: 4px 0 14px; }

.verdict-card .verdict-block { color: white; padding: 10px 18px; border-radius: 10px; min-width: 140px; text-align: center; }
.verdict-card .verdict-score { font-size: 32px; font-weight: 800; line-height: 1; }
.verdict-card .verdict-label { font-size: 13px; letter-spacing: 0.05em; margin-top: 6px; }
.verdict-pair { gap: 16px; }
.verdict-pair > .card { margin: 18px 0; }
@media (max-width: 760px) { .verdict-pair { flex-direction: column; } .verdict-pair > .card { flex: unset; } }
.summary { background: #f0f9ff; border-color: #bae6fd; }
.summary-text { font-size: 16px; line-height: 1.55; margin-top: 4px; }

label.checkbox { display: flex; gap: 8px; align-items: center; font-size: 14px; color: #4b5563; margin: 8px 0 14px; cursor: pointer; }
label.checkbox input { width: auto; margin: 0; }

.coverage .cov-bar {
  display: inline-flex; width: 280px; height: 14px; border-radius: 7px; overflow: hidden;
  background: #e5e7eb; box-shadow: inset 0 0 0 1px #d1d5db;
}
.coverage .cov-bar > span { display: inline-block; height: 100%; }
.coverage .cov-bar .cov-ok      { background: #16a34a; }
.coverage .cov-bar .cov-empty   { background: #fcd34d; }
.coverage .cov-bar .cov-error   { background: #dc2626; }
.coverage .cov-bar .cov-skipped { background: #9ca3af; }
.cov-warning {
  margin: 10px 0 0; padding: 10px 14px; border-radius: 6px; font-size: 14px;
  border-left: 4px solid #6b7280; background: #f9fafb;
}
.cov-warning.sev-critical { background: #fee2e2; border-left-color: #b91c1c; color: #7f1d1d; }
.cov-warning.sev-warning  { background: #fef3c7; border-left-color: #b45309; color: #78350f; }
.cov-warning.sev-info     { background: #dbeafe; border-left-color: #1d4ed8; color: #1e3a8a; }
.cov-details { margin-top: 10px; padding: 8px 12px; background: #f9fafb; border-radius: 6px; }
.cov-details summary { cursor: pointer; font-weight: 600; color: #4b5563; padding: 4px 0; font-size: 14px; }
.cov-list { list-style: none; padding: 6px 0 0 0; margin: 0; font-size: 14px; }
.cov-list li { padding: 4px 0; border-top: 1px solid #f3f4f6; line-height: 1.5; }
.cov-list li:first-child { border-top: 0; }
.cov-status {
  display: inline-block; min-width: 110px; padding: 1px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 600; margin-right: 8px; text-align: center;
}
.cov-status-empty   { background: #fef3c7; color: #78350f; }
.cov-status-error   { background: #fee2e2; color: #7f1d1d; }
.cov-status-skipped { background: #e5e7eb; color: #374151; }
.cov-key { font-weight: 500; color: #1f2937; }
.history-card { background: #f8fafc; padding: 14px 20px; }
.history-card .badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600; margin-top: 8px;
}
.badge-fresh   { background: #dcfce7; color: #14532d; }
.badge-cached  { background: #fef3c7; color: #78350f; }
.badge-mixed   { background: #dbeafe; color: #1e3a8a; }
.btn-refresh {
  background: white; border: 1px solid #d1d5db; padding: 8px 14px; border-radius: 8px;
  color: #1f2937; text-decoration: none; font-size: 14px; font-weight: 500;
  white-space: nowrap;
}
.btn-refresh:hover { background: #f3f4f6; border-color: #9ca3af; }

.budget-card { padding: 14px 20px; }
.budget-rows { margin-top: 10px; }
.budget-row {
  display: grid; grid-template-columns: 200px 1fr 160px;
  gap: 12px; align-items: center; padding: 6px 0;
  border-top: 1px solid #f3f4f6;
}
.budget-row:first-child { border-top: 0; }
.budget-label { font-size: 14px; color: #374151; }
.budget-num { font-size: 13px; color: #6b7280; text-align: right; font-variant-numeric: tabular-nums; }
.budget-num .warn { color: #b91c1c; font-weight: 600; }
.bar { height: 10px; background: #e5e7eb; border-radius: 5px; overflow: hidden; }
.bar-fill { display: block; height: 100%; transition: width 0.3s; }
.bar-ok      { background: #16a34a; }
.bar-warn    { background: #f59e0b; }
.bar-danger  { background: #dc2626; }
@media (max-width: 760px) {
  .budget-row { grid-template-columns: 1fr; gap: 4px; }
  .budget-num { text-align: left; }
}

/* Batch */
.progress-wrap { width: 100%; }
.progress-bar {
  width: 100%; height: 16px; background: #e5e7eb; border-radius: 8px; overflow: hidden;
  box-shadow: inset 0 0 0 1px #d1d5db;
}
.progress-bar > span {
  display: block; height: 100%; background: linear-gradient(90deg, #16a34a, #22c55e);
  transition: width 0.4s;
}
.batch-status {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.batch-status-pending   { background: #e5e7eb; color: #4b5563; }
.batch-status-running   { background: #dbeafe; color: #1e40af; }
.batch-status-done      { background: #dcfce7; color: #14532d; }
.batch-status-error     { background: #fee2e2; color: #7f1d1d; }
.batch-status-cancelled { background: #f3f4f6; color: #6b7280; }
.batch-status-paused    { background: #fef3c7; color: #78350f; }
table.batch-table { font-size: 13px; }
table.batch-table td { padding: 6px 10px; }
.batch-controls button[disabled] { opacity: 0.4; cursor: not-allowed; }
.recommendations { background: #fef3c7; border-radius: 6px; padding: 10px 14px; margin: 12px 0; font-size: 14px; }
.recommendations ul { margin: 6px 0 0; padding-left: 20px; }
.recommendations .rec-warning { color: #92400e; }
.recommendations .rec-info { color: #555; }

/* === Карта v3: layout 'карта + легенда сбоку' === */
.map-with-legend { display: flex; gap: 12px; align-items: stretch; }
.map-canvas { flex: 1; min-height: 480px; border-radius: 8px; }
.map-legend {
  width: 260px; max-height: 480px; overflow-y: auto;
  background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px;
  font-size: 13px;
}
.map-legend .legend-list { list-style: none; margin: 8px 0; padding: 0; }
.map-legend .legend-item { padding: 3px 0; }
.map-legend .legend-item label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.map-legend .legend-item input:disabled + .legend-dot { opacity: 0.3; }
.map-legend .legend-item input:disabled ~ .legend-label { color: #9ca3af; }
.map-legend .legend-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px #00000022;
  flex-shrink: 0;
}
.map-legend .legend-label { flex: 1; }
.map-legend .legend-count { font-size: 11px; min-width: 22px; text-align: right; }
.map-legend .legend-actions { display: flex; gap: 6px; margin-top: 8px; }
.map-legend .btn-small {
  flex: 1; padding: 4px 8px; font-size: 12px; cursor: pointer;
  background: #fff; border: 1px solid #d1d5db; border-radius: 4px;
}
.map-legend .btn-small:hover { background: #f3f4f6; }

/* === POI-маркеры на карте === */
.poi-wrap { position: relative; }
.poi-marker {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 1px 3px #00000044;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.poi-wrap:hover .poi-marker {
  transform: scale(1.4);
  z-index: 100;
}

/* Tooltip над маркером — появляется по :hover мгновенно */
.poi-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 6px #00000055;
}
.poi-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #111827;
}
.poi-tooltip-name { font-weight: 600; }
.poi-tooltip-meta { color: #d1d5db; font-size: 11px; margin-top: 2px; }
.poi-wrap:hover .poi-tooltip { display: block; }

/* На узких экранах легенда снизу */
@media (max-width: 720px) {
  .map-with-legend { flex-direction: column; }
  .map-legend { width: auto; max-height: 220px; }
}

/* === v3.3+: блок сравнения «Скоринг + N LLM» ===
   Максимум 4 плашки в ряд. При большем числе моделей — перенос на новый ряд.
   Все плашки одной высоты благодаря .compare-card { display: flex; min-height: ... }.
   На узких экранах количество колонок уменьшается по breakpoint'ам. */
.compare-grid {
  display: grid;
  gap: 12px;
  margin: 12px 0;
  grid-template-columns: 1fr;
}
@media (min-width: 520px) {
  .compare-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 820px) {
  .compare-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .compare-grid { grid-template-columns: repeat(4, 1fr); }
}
.compare-pairs { margin: 6px 0 0; padding-left: 20px; font-size: 13px; }
.compare-pairs li { margin: 2px 0; }
.compare-pairs code { background: #ffffff66; padding: 1px 4px; border-radius: 3px; font-size: 12px; }
.pair-exact      { color: #166534; font-weight: 600; }
.pair-neighbour  { color: #854d0e; font-weight: 600; }
.pair-contradict { color: #991b1b; font-weight: 600; }

/* Notable: блок с «заметными расхождениями» — внутри compare-summary */
.compare-notable { margin: 4px 0; }

/* Details для полного списка пар — свёрнут по умолчанию */
.compare-details {
  margin: 6px 0 0;
  background: transparent;
  border: none;
  padding: 0;
}
.compare-details > summary {
  cursor: pointer;
  padding: 2px 0;
  user-select: none;
}
.compare-details > summary:hover { color: #4b5563; }

/* === v3.3: демо-блок на главной — описание сервиса === */
.demo-intro .lead {
  font-size: 16px;
  color: #374151;
  margin: 8px 0 10px;
}
.demo-howto {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 8px 14px;
  margin: 10px 0;
}
.demo-howto > summary {
  cursor: pointer;
  font-weight: 600;
  color: #0369a1;
  padding: 4px 0;
  user-select: none;
}
.demo-howto > summary:hover { color: #075985; }
.demo-howto-body {
  padding: 6px 0 4px;
  font-size: 14px;
  color: #1e3a52;
}
.demo-howto-body p { margin: 8px 0; }
.demo-howto-body ul { margin: 6px 0; padding-left: 22px; }
.demo-howto-body li { margin: 3px 0; }
.demo-howto-body code {
  background: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}

/* v3.2: предупреждение fact-check (упоминание банка, которого нет в данных) */
.fact-check-warn {
  background: #fef3c7;
  border-left: 3px solid #d97706;
  border-radius: 4px;
  padding: 6px 10px;
  margin: 4px 0 12px;
  font-size: 12px;
  color: #92400e;
}
.fact-check-warn ul { margin: 4px 0 0; padding-left: 18px; }
.fact-check-warn li { margin: 2px 0; }
.compare-card {
  border-radius: 8px;
  padding: 12px 14px;
  background: #f9fafb;
  border-left: 6px solid #6b7280;
  /* v3.3: единая структура — flex column, выравнивание блоков по высоте */
  display: flex;
  flex-direction: column;
  min-height: 180px;
  gap: 8px;
}
.compare-card.scoring { border-left-color: #2185d0; }
.compare-card.llm { border-left-color: #a333c8; }

/* Header плашки: название провайдера, одна строка */
.compare-card .card-header {
  min-height: 32px;
  line-height: 1.25;
  display: flex;
  align-items: flex-start;
}

/* Body: вердикт + цветная плашка с баллом, центр плашки */
.compare-card .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

/* Сам вердикт — h3 уменьшен, одна строка */
.compare-card .card-verdict {
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
}

/* Цветная плашка с баллом и подписью — фиксированный размер */
.compare-card .verdict-block {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  align-self: flex-start;
}

/* Footer: имя модели + метаинфа, всегда внизу плашки */
.compare-card .card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: #9ca3af;
  overflow: hidden;
}
.compare-card .card-footer code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: #6b7280;
  /* Если имя модели длинное (claude-haiku-4-5-20251001) — обрезаем с многоточием */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-card .card-footer .model-meta {
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compare-summary {
  padding: 10px 14px; border-radius: 6px; margin: 6px 0 12px;
  font-size: 14px;
}
.compare-summary.exact      { background: #d4edda; color: #155724; }
.compare-summary.neighbour  { background: #fff3cd; color: #856404; }
.compare-summary.contradict { background: #f8d7da; color: #721c24; }
@media (max-width: 720px) {
  .compare-grid { grid-template-columns: 1fr; }
}

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #e5e7eb; }
table.tbl th { background: #f9fafb; }
table.tbl tr.row-diagnostic { color: #9ca3af; background: #fafafa; }
table.tbl tr.row-diagnostic code { color: #9ca3af; }
table.tbl tr.row-info { color: #6b7280; background: #fbfbfd; }
table.tbl tr.row-info code { color: #6b7280; }

details { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px; margin: 8px 0; background: #fcfcfd; }
details summary { cursor: pointer; padding: 6px 0; }
details summary .key { color: #9ca3af; font-size: 12px; margin-left: 8px; font-family: ui-monospace, SFMono-Regular, monospace; }
.crit-body { padding: 8px 0 4px; }
.src-box { flex: 1; min-width: 280px; padding: 10px 12px; background: #f9fafb; border: 1px solid #eef2f7; border-radius: 8px; }
.src-box code { background: #eef2f7; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.src-box .err { color: #b91c1c; }
ol.poi { margin: 6px 0; padding-left: 20px; }
ol.poi li { margin-bottom: 4px; line-height: 1.5; }
ol.poi .muted { margin-left: 6px; }
.tag { display: inline-block; background: #e0e7ff; color: #1e3a8a; padding: 1px 6px; border-radius: 4px; font-size: 11px; margin-left: 4px; }
.tag.risk { background: #fee2e2; color: #991b1b; }
.tag-prov { background: #d1fae5; color: #065f46; }
.queries { padding: 6px 10px; background: #f1f5f9; border-radius: 6px; margin: 6px 0; }
.alt-pop { margin-top: 6px; }
.cc { margin-top: 8px; font-size: 13px; }
.cc .ok { color: #065f46; font-weight: 600; }
.cc .warn { color: #92400e; font-weight: 600; }

/* Overlay */
#overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.78); display: flex; align-items: center; justify-content: center; z-index: 50; }
#overlay[hidden] { display: none; }
.overlay-card { background: white; padding: 26px 32px; border-radius: 12px; max-width: 480px; text-align: center; }
.overlay-card h2 { margin: 18px 0 6px; }
.spinner { width: 56px; height: 56px; border: 6px solid #e5e7eb; border-top-color: #1d4ed8; border-radius: 50%; animation: spin 0.9s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
#overlay-steps { margin-top: 16px; text-align: left; font-size: 14px; color: #4b5563; }
#overlay-steps .step { padding: 4px 0; border-top: 1px solid #f3f4f6; }
#overlay-steps .step::before { content: "•  "; color: #94a3b8; }
