/* П. 63: таблица сохраняет подписи и горизонтальную прокрутку, не скрывает переполнение страницы. */

/* Защита светлой темы страницы от перехвата prefers-color-scheme: dark в xp-ui.css */
html:has(body.compatibility-guide),
body.compatibility-guide {
  color-scheme: light;
  --xp-brand: #2563eb;
  --xp-brand-hover: #1d4ed8;
  --xp-brand-soft: #eff6ff;
  --xp-brand-fill: #2563eb;
  --xp-brand-text: #1d4ed8;
  --xp-on-brand: #ffffff;
  --xp-ink: #0f172a;
  --xp-text: #334155;
  --xp-muted: #475569;
  --xp-line: #cbd5e1;
  --xp-line-strong: #64748b;
  --xp-surface: #ffffff;
  --xp-surface-2: #f1f5f9;
  --xp-soft: #eff6ff;
  background: #ffffff;
  color: #334155;
}

/* Легенда статусов и виджет быстрой сверки SHA-256 */
.evidence-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-block: 24px;
  padding: 18px 20px;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #2563eb;
  border-radius: 10px;
  background: #f8fafc;
}
.evidence-legend > div { display: flex; flex-direction: column; gap: 4px; }
.evidence-legend dt {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1d4ed8;
}
.evidence-legend dd { margin: 0; font-size: 0.875rem; line-height: 1.5; color: #334155; }

.hash-quick-matcher {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  margin: 20px 0 24px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}
.hash-quick-matcher__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}
.hash-quick-matcher__head strong { font-size: 0.95rem; color: #0f172a; }
.hash-quick-matcher__controls { display: flex; flex-wrap: wrap; gap: 10px; }
.hash-quick-matcher input {
  flex: 1 1 320px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  font: 400 0.875rem/1.4 Consolas, monospace;
  color: #0f172a;
  background: #f8fafc;
}
.hash-quick-matcher input:focus-visible { outline: 2px solid #2563eb; border-color: #2563eb; background: #ffffff; }
.hash-quick-matcher__status { margin: 0; font-size: 0.875rem; font-weight: 500; }
.hash-quick-matcher__status[data-state="match"] {
  padding: 8px 12px;
  border-radius: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}
.hash-quick-matcher__status[data-state="miss"] {
  padding: 8px 12px;
  border-radius: 6px;
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: #b42318;
}

/* Таблица совместимости: чистые границы и sticky-колонка */
.compatibility-scroll {
  overflow-x: auto;
  margin: 16px 0 28px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}
.compatibility-scroll:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.compatibility-scroll table {
  width: 100%;
  min-width: 740px;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
}
.compatibility-scroll caption {
  text-align: left;
  padding: 14px 18px;
  font-size: 0.925rem;
  font-weight: 600;
  color: #0f172a;
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
}
.compatibility-scroll th,
.compatibility-scroll td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  border-right: 1px solid #f1f5f9;
}
.compatibility-scroll tr > :last-child { border-right: 0; }
.compatibility-scroll tbody tr:last-child > * { border-bottom: 0; }
.compatibility-scroll thead th {
  background: #f1f5f9;
  color: #334155;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #cbd5e1;
}
.compatibility-scroll thead th:first-child,
.compatibility-scroll tbody th {
  position: sticky;
  left: 0;
  z-index: 2;
  border-right: 1px solid #cbd5e1;
  box-shadow: inset -1px 0 0 #cbd5e1;
}
.compatibility-scroll tbody th { background: #ffffff; font-weight: 600; color: #0f172a; }
.compatibility-scroll tbody th a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #2563eb;
}
.compatibility-scroll tbody tr:has(:target),
.compatibility-scroll tbody tr.is-hash-matched { background: #eff6ff; }
.compatibility-scroll tbody tr:has(:target) th,
.compatibility-scroll tbody tr.is-hash-matched th {
  background: #dbeafe;
  box-shadow: inset 3px 0 0 #2563eb, inset -1px 0 0 #cbd5e1;
}
.compatibility-scroll :target { outline: none; }
td.unknown { color: #5f6678; }

/* Карточки криптографических свидетельств */
.compatibility-evidence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  padding: 0;
  margin: 20px 0 28px;
  list-style: none;
}
.compatibility-evidence li {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 22px 24px;
  border: 1px solid #cbd5e1;
  border-top: 3px solid #2563eb;
  border-radius: 10px;
  background: #f8fafc;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.compatibility-evidence li:target,
.compatibility-evidence li.is-hash-matched {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
  outline: none;
}
.compatibility-evidence li h3 { margin: 0; font-size: 1.2rem; color: #0f172a; }
.compatibility-evidence li p { margin: 0; font-size: 0.875rem; }
.compatibility-evidence code {
  display: block;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  font: 500 0.8125rem/1.55 Consolas, monospace;
  color: #0f172a;
  overflow-wrap: anywhere;
  user-select: all;
}
.evidence-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}
.evidence-card-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.evidence-card-actions .xp-btn { min-height: 34px; padding: 4px 12px; font-size: 0.8125rem; }
.evidence-card-actions a { display: inline-flex; align-items: center; min-height: 34px; font-size: 0.8125rem; }

/* U8: на узком экране первый столбец остаётся на месте при горизонтальной прокрутке. */
.compatibility-hint { display: none; font-size: 14px; color: #5f6678; }

@media (max-width: 760px) {
  .evidence-legend { grid-template-columns: 1fr; }
  .compatibility-evidence { grid-template-columns: 1fr; }
  .compatibility-hint { display: block; }
}
@media (forced-colors: active) {
  .compatibility-evidence li, .evidence-legend, .hash-quick-matcher, .compatibility-scroll { border-color: CanvasText; }
}
@media print {
  .compatibility-scroll { overflow: visible; }
  .compatibility-scroll table { min-width: 0; font-size: 9pt; }
  .compatibility-scroll th, .compatibility-scroll td { padding: 6px; }
  .compatibility-evidence { display: block; }
  .compatibility-evidence li { break-inside: avoid; background: #fff; margin-block: 16px; }
  .compatibility-evidence a, .compatibility-scroll a { display: none; }
  .evidence-card-actions, .hash-quick-matcher, .compatibility-hint { display: none !important; }
}
