/* ==========================================================================
   F1 360° «Атмосфера» — Предпросмотр подготовки пилота (S_M01-E-24)
   Минималистичный инженерный дизайн · Светлая и тёмная темы · Fluid 320–1600
   ========================================================================== */

:root {
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #EFEFF3;
  --surface-hover: #E7E7EE;
  --border: rgba(17, 17, 22, 0.09);
  --border-strong: rgba(17, 17, 22, 0.17);

  --text: #111116;
  --text-2: #4A4A55;
  --text-3: #636370;

  --seg-bg: #EBEBF0;
  --seg-active-bg: #111116;
  --seg-active-fg: #FFFFFF;

  --accent: #D92626;
  --accent-soft: rgba(217, 38, 38, 0.10);
  --ok: #15803D;
  --ok-soft: rgba(21, 128, 61, 0.11);
  --fail: #B91C1C;
  --fail-soft: rgba(185, 28, 28, 0.10);
  --hint-red: #DC2626;
  --focus-ring: #2563EB;

  --v1: #6C8ED4;
  --v2: #58B863;
  --v3: #DF9642;
  --v6: #CE6060;

  --shadow-sm: 0 1px 2px rgba(17, 17, 22, 0.04), 0 4px 14px rgba(17, 17, 22, 0.03);
  --shadow-md: 0 4px 20px rgba(17, 17, 22, 0.07);
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-pill: 999px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0B0C0F;
  --surface: #14161B;
  --surface-2: #1C1F26;
  --surface-hover: #252933;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.19);

  --text: #F4F5F8;
  --text-2: #B4B8C4;
  --text-3: #8D92A2;

  --seg-bg: #1C1F26;
  --seg-active-bg: #F4F5F8;
  --seg-active-fg: #0B0C0F;

  --accent: #F04438;
  --accent-soft: rgba(240, 68, 56, 0.16);
  --ok: #34D399;
  --ok-soft: rgba(52, 211, 153, 0.15);
  --fail: #F87171;
  --fail-soft: rgba(248, 113, 113, 0.15);
  --hint-red: #F87171;
  --focus-ring: #60A5FA;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  -webkit-font-smoothing: antialiased;
}

button, a {
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  color: inherit;
}

button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--seg-active-bg);
  color: var(--seg-active-fg);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  top: 12px;
}

.ico {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

/* Layout Shell */
.page-shell {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(14px, 2.2vw, 28px) clamp(12px, 2.4vw, 32px) clamp(36px, 4vw, 60px);
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: clamp(14px, 2vw, 22px);
}

.header-brand {
  flex: 1 1 320px;
  min-width: 0;
}

.eyebrow-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 6px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.site-title {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.site-subtitle {
  margin: 6px 0 0;
  max-width: 72ch;
  font-size: clamp(13px, 1.15vw, 15px);
  color: var(--text-2);
  line-height: 1.48;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tool-btn:hover {
  background: var(--surface-2);
}

.tool-btn[aria-pressed="true"] {
  background: var(--seg-active-bg);
  color: var(--seg-active-fg);
  border-color: var(--seg-active-bg);
}

html[data-theme="light"] .ico-sun { display: none; }
html[data-theme="dark"] .ico-moon { display: none; }

/* Hints Mode (?hints=1) */
.hints-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 14px;
  margin-bottom: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--hint-red);
  background: var(--accent-soft);
  font-size: 13px;
}

html.hints-on .hints-banner {
  display: flex;
}

.hints-banner-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  flex: 1 1 240px;
  min-width: 0;
}

.hint-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}

.hint-chip strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--hint-red);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.hints-close-btn {
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--hint-red);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.hints-close-btn:hover {
  background: var(--hint-red);
  color: #FFFFFF;
}

html.hints-on [data-hint] {
  position: relative;
  outline: 2px solid var(--hint-red);
  outline-offset: 2px;
  border-radius: var(--radius-lg);
}

html.hints-on [data-hint]::after {
  content: attr(data-hint);
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--hint-red);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
}

/* 360° Viewer Card */
.viewer-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: clamp(10px, 1.5vw, 16px);
  box-shadow: var(--shadow-sm);
}

.viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-bottom: 12px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-lg);
  background: var(--seg-bg);
  max-width: 100%;
}

.seg-btn {
  min-height: 36px;
  padding: 6px 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.is-active,
.seg-btn[aria-pressed="true"] {
  background: var(--seg-active-bg);
  color: var(--seg-active-fg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

.segmented-sm .seg-btn {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 13px;
}

.viewer-aux {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.presets-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.chip-btn {
  min-height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.chip-btn.is-active {
  background: var(--seg-active-bg);
  color: var(--seg-active-fg);
  border-color: var(--seg-active-bg);
}

.telemetry-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.telemetry-pill .sep {
  opacity: 0.45;
}

/* Pano Host */
.pano-stage-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #0B0C0F;
}

.pano-host {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 290px;
  max-height: min(68vh, 660px);
  --tvp-radius: 14px;
}

@supports (height: 1svh) {
  .pano-host {
    max-height: min(68svh, 660px);
  }
}

@media (max-width: 640px) {
  .pano-host {
    aspect-ratio: 4 / 3;
    min-height: 270px;
  }
}

/* Clean Mode (?clean=1) */
.clean-bar {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100% - 24px);
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-pill);
  background: rgba(14, 15, 19, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  color: #FFFFFF;
}

html.clean-mode {
  overflow: hidden;
}

html.clean-mode .pano-stage-wrap {
  position: fixed;
  inset: 0;
  z-index: 900;
  border-radius: 0;
}

html.clean-mode .pano-host {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  max-height: none;
  --tvp-radius: 0px;
}

html.clean-mode .tvp-cap,
html.clean-mode .tvp-hint {
  opacity: 0 !important;
  pointer-events: none !important;
}

html.clean-mode .clean-bar {
  display: flex;
}

.clean-switcher {
  display: inline-flex;
  gap: 4px;
}

.clean-seg {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.clean-seg.is-active,
.clean-seg[aria-pressed="true"] {
  background: #FFFFFF;
  color: #111116;
}

.clean-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.clean-exit-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.clean-exit-btn kbd {
  font-family: inherit;
  font-size: 11px;
  opacity: 0.78;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
}

/* Viewer Footer */
.viewer-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.viewer-honest-note {
  margin: 0;
  flex: 1 1 300px;
  min-width: 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.45;
}

.viewer-honest-note strong {
  color: var(--text);
  font-weight: 600;
}

.owner-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.sw-v1 { background: var(--v1); }
.sw-v2 { background: var(--v2); }
.sw-v3 { background: var(--v3); }
.sw-v6 { background: var(--v6); }

/* KPI Strip — symmetrical 4 -> 2x2 -> 1 (zero orphan cards) */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 980px) {
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .kpi-strip {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
}

.kpi-value {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.kpi-unit {
  font-size: 0.62em;
  font-weight: 500;
  color: var(--text-3);
}

.kpi-ok {
  color: var(--ok);
}

.kpi-sub {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.38;
}

/* Section Tabs */
.tabs-bar {
  margin-top: clamp(20px, 2.5vw, 28px);
  margin-bottom: 18px;
}

.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1 1 140px;
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tab-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tab-btn.is-active,
.tab-btn[aria-selected="true"] {
  background: var(--seg-active-bg);
  color: var(--seg-active-fg);
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: rgba(128, 128, 145, 0.16);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tab-btn.is-active .tab-count,
.tab-btn[aria-selected="true"] .tab-count {
  background: rgba(128, 128, 145, 0.30);
}

/* Panels & Section Headers */
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 18px;
  margin-bottom: 16px;
}

.section-title {
  margin: 0;
  font-size: clamp(18px, 1.8vw, 22px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.section-desc {
  margin: 4px 0 0;
  max-width: 72ch;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.48;
}

/* Media Grids */
.media-grid {
  display: grid;
  gap: 14px;
}

.grid-frames {
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
}

.grid-sheets {
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
}

.grid-seams {
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
}

.media-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.media-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.media-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--surface-2);
  cursor: zoom-in;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.media-thumb-box {
  width: 100%;
  aspect-ratio: var(--ar, 16 / 9);
  background: #101216;
  overflow: hidden;
}

.media-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease;
}

.media-card:hover .media-thumb-box img {
  transform: scale(1.018);
}

.media-zoom-pill {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  background: rgba(12, 13, 18, 0.68);
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.media-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1 1 auto;
}

.media-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.media-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.3;
}

.media-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.media-desc {
  margin: 0;
  font-size: 12.8px;
  color: var(--text-2);
  line-height: 1.44;
}

/* Summary Tab */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(14px, 2vw, 20px);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.table-card {
  margin-top: 14px;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.card-sub {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--text-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

/* Budget Bar */
.budget-bars {
  margin-bottom: 14px;
}

.budget-track {
  display: flex;
  height: 10px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--surface-2);
  gap: 2px;
}

.b-seg {
  height: 100%;
}
.b-probe { background: var(--v1); }
.b-run { background: var(--v2); }
.b-reserve { background: var(--surface-hover); }

.budget-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.budget-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.b-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Key-Value List */
.kv-list {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.kv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
}

.kv-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.kv-row dt {
  color: var(--text-2);
  flex: 1 1 180px;
  min-width: 0;
}

.kv-row dd {
  margin: 0 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 500;
  text-align: right;
}

.kv-total {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border-strong);
  font-weight: 700;
}
.kv-total dt, .kv-total dd {
  color: var(--text);
  font-weight: 700;
}

.num-strong { font-weight: 700; color: var(--ok); }
.num-ok { color: var(--ok); font-weight: 600; }

.card-footnote {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.45;
}

/* Container-Query Responsive Tables (ZERO horizontal overflow!) */
.table-container {
  container-type: inline-size;
  container-name: datatable;
  width: 100%;
  min-width: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

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

.data-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: none;
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr.row-selected {
  background: var(--ok-soft);
}

.view-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-pass, .pill-ok, .pill-fail {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-pass { background: var(--ok); color: #FFFFFF; }
html[data-theme="dark"] .pill-pass { color: #052014; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-fail { background: var(--fail-soft); color: var(--fail); }

@container datatable (max-width: 780px) {
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .data-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    background: var(--bg);
  }

  .data-table tbody tr.row-selected {
    border-color: var(--ok);
    background: var(--ok-soft);
  }

  .data-table td {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }

  .data-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    text-align: left;
    flex: 1 1 110px;
  }
}

/* Footer */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-top: clamp(28px, 4vw, 44px);
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-3);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  color: #FFFFFF;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 9, 12, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.lb-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.lb-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px clamp(12px, 2vw, 20px);
  background: rgba(14, 15, 20, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.lb-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 220px;
}

.lb-titles {
  min-width: 0;
}

.lb-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lb-counter {
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  font-variant-numeric: tabular-nums;
  padding: 0 4px;
}

.lb-zoom-group {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.lb-zoom-btn {
  min-width: 34px;
  height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.lb-zoom-btn.is-active,
.lb-zoom-btn[aria-pressed="true"] {
  background: #FFFFFF;
  color: #111116;
}

.lb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.lb-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.lb-icon-only {
  width: 36px;
  padding: 0;
}

.lb-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}

.lb-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}

.lb-viewport.is-zoomed {
  cursor: grab;
}

.lb-viewport.is-dragging {
  cursor: grabbing;
}

.lb-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  transform-origin: center center;
  transition: transform 0.18s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.lb-viewport.is-dragging .lb-img {
  transition: none;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(14, 15, 20, 0.65);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.lb-nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.lb-prev { left: 14px; }
.lb-next { right: 14px; }

.lb-foot {
  padding: 8px 16px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(14, 15, 20, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

/* Narrow adjustments (never device-locking, only clean polish) */
@media (max-width: 520px) {
  .tool-btn {
    padding: 0 10px;
    font-size: 12.5px;
  }
  .segmented {
    width: 100%;
  }
  .seg-btn {
    flex: 1 1 auto;
    text-align: center;
    padding: 6px 10px;
    font-size: 12.5px;
  }
  .lb-nav {
    width: 38px;
    height: 38px;
  }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
