/* ============================================================
   UGC Test Dashboard — Design System
   Palette: UGC Charte Graphique (Bleu Nuit, Cyan, Vert, Rouge...)
   Font: Montserrat (400/500/600) — NO heavy weights
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

/* --- Auth Gate --- */
.auth-gate {
  position: fixed; inset: 0; z-index: 99999;
  background: var(--bg-primary, #060e24);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Montserrat', sans-serif;
}
.auth-gate-card {
  background: var(--bg-secondary, #0c1638);
  border: 1px solid var(--bg-tertiary, #141e48);
  border-radius: 12px; padding: 40px; text-align: center;
  max-width: 400px; width: 90%;
}
.auth-gate-card h2 { color: var(--accent, #00aaff); margin-bottom: 8px; font-size: 1.3rem; }
.auth-gate-card p { color: var(--text-secondary, #8899bb); font-size: 0.85rem; margin-bottom: 20px; }
.auth-token-input {
  width: 100%; padding: 12px 16px; border-radius: 8px;
  border: 1px solid var(--bg-tertiary, #141e48);
  background: var(--bg-primary, #060e24); color: var(--text-primary, #e8eaf0);
  font-family: monospace; font-size: 0.9rem; outline: none;
}
.auth-token-input:focus { border-color: var(--accent, #00aaff); }
.auth-error { color: var(--red, #d50032); font-size: 0.8rem; margin-top: 8px; }
.auth-submit-btn {
  margin-top: 16px; width: 100%; padding: 12px;
  background: var(--accent, #00aaff); color: #fff; border: none;
  border-radius: 8px; font-weight: 600; font-size: 0.9rem;
  cursor: pointer; font-family: 'Montserrat', sans-serif;
}
.auth-submit-btn:hover { filter: brightness(1.15); }
.auth-gate.hidden { display: none; }


:root {
  /* UGC Brand */
  --ugc-bleu-nuit: #00134d;
  --ugc-cyan: #00aaff;
  --ugc-vert: #00c292;
  --ugc-rouge: #d50032;
  --ugc-orange: #ff7700;
  --ugc-violet: #9e00ff;
  --ugc-dore: #bd9b60;

  /* Dashboard derived — warmer, friendlier palette */
  --bg-primary: #060e24;
  --bg-secondary: #0c1638;
  --bg-tertiary: #141e48;
  --bg-card: #1a2658;
  --bg-hover: #222e68;
  --accent: var(--ugc-cyan);
  --accent-dim: #0088cc;
  --green: var(--ugc-vert);
  --red: var(--ugc-rouge);
  --orange: var(--ugc-orange);
  --violet: var(--ugc-violet);
  --text-primary: #f0f2f8;
  --text-secondary: #a0b0cc;
  --text-muted: #7b92b8;
  --border: rgba(100, 140, 200, 0.15);
  --border-light: rgba(100, 140, 200, 0.25);
  --radius: 10px;
  --radius-lg: 14px;

  /* Glassmorphism — slightly warmer */
  --glass-bg: rgba(20, 30, 72, 0.45);
  --glass-border: rgba(0, 170, 255, 0.1);
  --glass-blur: 16px;

  /* Elevation — soft, modern */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-glow-cyan: 0 4px 24px rgba(0, 170, 255, 0.2);
  --shadow-glow-green: 0 4px 24px rgba(0, 194, 146, 0.2);
  --shadow-glow-red: 0 4px 24px rgba(213, 0, 50, 0.2);

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Responsive tokens */
  --sidebar-width: 280px;
  --header-height: 56px;
  --tab-height: 44px;
  --bottom-nav-height: 56px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --min-tap-target: 44px;
}

body {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(160deg, var(--bg-primary) 0%, #080820 50%, #0a0c28 100%);
  color: var(--text-primary);
  height: 100dvh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   Global Progress Bar (YouTube-style, fixed top)
   ============================================================ */
.global-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.global-progress.active { opacity: 1; }

.global-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 0 2px 2px 0;
  transition: width 0.6s ease;
  box-shadow: 0 0 8px var(--accent);
}

/* ============================================================
   Layout
   ============================================================ */
.layout {
  display: grid;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100dvh;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  grid-column: 1 / -1;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.header::after {
  display: none;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.header-title-text {
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--ugc-dore));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-secondary);
}

/* Environment selector */
.env-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px 4px;
  flex-shrink: 0;
  margin-left: 20px;
  margin-right: 12px;
}
.env-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  padding: 0 6px;
  font-variant: small-caps;
}
.env-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-out-expo);
  font-family: inherit;
}
.env-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.env-btn.active-staging {
  background: var(--accent);
  color: var(--bg-primary);
  box-shadow: 0 0 8px rgba(0, 170, 255, 0.3);
}
.env-btn.active-prod {
  background: var(--red);
  color: white;
  box-shadow: 0 0 8px rgba(213, 0, 50, 0.3);
}

.header-center .progress-info {
  display: flex;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

.header-center .progress-text {
  font-weight: 500;
  color: var(--accent);
}

.header-center .progress-mini-bar {
  width: 120px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.header-center .progress-mini-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.3s;
}

.status-dot.running {
  background: var(--accent);
  animation: pulse 1.5s infinite;
  box-shadow: 0 0 6px var(--accent);
}

.status-dot.passed { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.failed { background: var(--red); box-shadow: 0 0 6px var(--red); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.filter-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.tag-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
}

.tag-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(0, 170, 255, 0.08); }
.tag-btn.active { background: var(--accent); color: var(--ugc-bleu-nuit); border-color: var(--accent); font-weight: 500; box-shadow: 0 2px 8px rgba(0, 170, 255, 0.25); }

.test-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
}

.test-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
}

.test-item:hover { background: var(--bg-tertiary); }

.test-item input[type="checkbox"] {
  accent-color: var(--accent);
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.test-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-secondary);
  font-weight: 400;
}

.test-item-count {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: 8px;
}

.test-item-toggle {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 8px;
  padding: 2px 4px;
  border-radius: 3px;
  transition: transform 0.2s, color 0.15s;
  line-height: 1;
}

.test-item-toggle:hover {
  color: var(--accent);
  background: var(--bg-tertiary);
}

.test-item-toggle.open {
  transform: rotate(90deg);
}

.test-item-details {
  padding: 2px 0 6px 28px;
  border-left: 2px solid var(--bg-tertiary);
  margin-left: 15px;
  margin-bottom: 2px;
}

.test-item-suite {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 0 4px 0;
}

.test-item-test {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 0;
  line-height: 1.4;
}

.test-item-dot {
  flex-shrink: 0;
  font-size: 8px;
  color: var(--text-muted);
}

.test-item-tags {
  font-size: 9px;
  color: var(--accent);
  opacity: 0.7;
  margin-left: auto;
  white-space: nowrap;
}

/* Sidebar controls */
.sidebar-controls {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-select { display: flex; gap: 4px; }

.project-btn {
  flex: 1;
  padding: 7px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-radius: var(--radius);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
  font-weight: 500;
}

.project-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(0, 170, 255, 0.06); }
.project-btn.active { background: var(--accent); color: var(--ugc-bleu-nuit); border-color: var(--accent); box-shadow: 0 2px 8px rgba(0, 170, 255, 0.2); }

.run-btn {
  padding: 12px;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
  background: var(--accent);
  color: var(--ugc-bleu-nuit);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 12px rgba(0, 170, 255, 0.2);
  letter-spacing: 0.5px;
}

.run-btn:hover { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 170, 255, 0.35); }
.run-btn:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(0, 170, 255, 0.2); }

.run-btn.stop {
  background: var(--red);
  color: white;
}

.run-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.rerun-btn {
  padding: 9px;
  border: 1px solid rgba(255, 119, 0, 0.4);
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: rgba(255, 119, 0, 0.08);
  color: var(--orange);
  transition: all 0.2s var(--ease-out-expo);
}

.rerun-btn:hover { background: rgba(255, 119, 0, 0.15); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(255, 119, 0, 0.15); }

.select-actions { display: flex; gap: 4px; }

.select-actions button {
  flex: 1;
  padding: 5px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.select-actions button:hover { color: var(--accent); border-color: var(--accent); }

.shortcuts-hint {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
  padding-top: 4px;
}

.shortcuts-hint kbd {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 10px;
  font-family: inherit;
  margin: 0 1px;
}

/* ============================================================
   Main content
   ============================================================ */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  gap: 2px;
}

.tab {
  padding: 11px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: all 0.2s var(--ease-out-expo);
  display: flex;
  align-items: center;
  gap: 7px;
}

.tab:hover { color: var(--text-secondary); background: rgba(255, 255, 255, 0.03); }
.tab.active { color: var(--ugc-dore); border-bottom-color: var(--ugc-dore); background: rgba(189, 155, 96, 0.06); }
.tab svg { opacity: 0.5; transition: opacity 0.2s; }
.tab:hover svg { opacity: 0.7; }
.tab.active svg { opacity: 1; }

/* Tab panels */
.tab-content { flex: 1; overflow: hidden; }

.tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
}

.tab-panel.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

/* ============================================================
   Terminal / Logs
   ============================================================ */
.terminal {
  flex: 1;
  background: #080e1e;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.7;
  padding: 16px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: #a8ddb8;
  border-radius: 0 0 var(--radius) var(--radius);
}

.terminal-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-muted);
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
}

.terminal-placeholder kbd {
  display: inline-block;
  background: var(--accent);
  color: var(--ugc-bleu-nuit);
  border-radius: 4px;
  padding: 2px 10px;
  font-weight: 600;
  font-size: 12px;
}

/* ============================================================
   Results panel
   ============================================================ */
.results-summary {
  display: flex;
  gap: 12px;
  padding: 20px;
  flex-wrap: wrap;
  animation: slideUp 0.3s ease;
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 18px 22px;
  min-width: 130px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s var(--ease-out-back), border-color 0.3s, box-shadow 0.3s;
  box-shadow: var(--shadow-sm);
  animation: cardSlideUp 0.4s var(--ease-out-expo) both;
}

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }
.stat-card:nth-child(5) { animation-delay: 0.24s; }

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.stat-card.total:hover { box-shadow: var(--shadow-glow-cyan); }
.stat-card.passed:hover { box-shadow: var(--shadow-glow-green); }
.stat-card.failed:hover { box-shadow: var(--shadow-glow-red); }

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 16px 16px 0 0;
}

.stat-card.total::before { background: linear-gradient(90deg, var(--ugc-dore), var(--accent), var(--ugc-dore)); }
.stat-card.passed::before { background: var(--green); }
.stat-card.failed::before { background: var(--red); }
.stat-card.skipped::before { background: var(--orange); }
.stat-card.duration::before { background: var(--violet); }

.stat-card .stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card.total .stat-icon { background: rgba(0, 170, 255, 0.12); color: var(--accent); }
.stat-card.passed .stat-icon { background: rgba(0, 194, 146, 0.12); color: var(--green); }
.stat-card.failed .stat-icon { background: rgba(213, 0, 50, 0.12); color: var(--red); }
.stat-card.skipped .stat-icon { background: rgba(255, 119, 0, 0.12); color: var(--orange); }
.stat-card.duration .stat-icon { background: rgba(158, 0, 255, 0.12); color: var(--violet); }

.stat-card .value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-card .label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-top: 2px;
  font-weight: 500;
}

.stat-card.total .value { color: var(--accent); }
.stat-card.passed .value { color: var(--green); }
.stat-card.failed .value { color: var(--red); }
.stat-card.skipped .value { color: var(--orange); }
.stat-card.duration .value { color: var(--violet); font-size: 20px; }

/* Results ratio bar */
.results-ratio {
  margin: 0 20px 16px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
  display: flex;
}

.results-ratio .ratio-passed { background: var(--green); transition: width 0.5s ease; }
.results-ratio .ratio-failed { background: var(--red); transition: width 0.5s ease; }
.results-ratio .ratio-skipped { background: var(--orange); transition: width 0.5s ease; }

/* Results table */
.results-table {
  padding: 0 20px 20px;
  overflow-y: auto;
  flex: 1;
}

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

.results-table th {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  position: sticky;
  top: 0;
  background: var(--bg-primary);
  z-index: 1;
}

.results-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

.results-table tr { transition: background 0.1s; }
.results-table tr:hover td { background: rgba(0, 170, 255, 0.04); }

/* Sparkline (test trend) */
.sparkline {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  vertical-align: middle;
}

.sparkline-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sparkline-dot.passed { background: var(--green); }
.sparkline-dot.failed { background: var(--red); }
.sparkline-dot.flaky { background: var(--orange); }
.sparkline-dot.skipped { background: var(--text-muted); opacity: 0.4; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-passed { background: rgba(0, 194, 146, 0.12); color: var(--green); border: 1px solid rgba(0, 194, 146, 0.25); }
.badge-failed { background: rgba(213, 0, 50, 0.12); color: var(--red); border: 1px solid rgba(213, 0, 50, 0.25); }
.badge-flaky { background: rgba(255, 119, 0, 0.12); color: var(--orange); border: 1px solid rgba(255, 119, 0, 0.25); }
.badge-skipped { background: rgba(74, 122, 173, 0.15); color: var(--text-muted); border: 1px solid rgba(74, 122, 173, 0.2); }
.badge-running { background: rgba(0, 170, 255, 0.12); color: var(--accent); border: 1px solid rgba(0, 170, 255, 0.25); }
.badge-stopped { background: rgba(74, 122, 173, 0.15); color: var(--text-muted); border: 1px solid rgba(74, 122, 173, 0.2); }

.error-msg {
  margin-top: 6px;
  padding: 8px 10px;
  background: rgba(213, 0, 50, 0.06);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px;
  color: #ff6b8a;
  white-space: pre-wrap;
  max-height: 80px;
  overflow-y: auto;
}

/* ============================================================
   Gallery
   ============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 20px;
}

.gallery-item {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s var(--ease-out-expo);
}

.gallery-item-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.gallery-item:hover .gallery-item-delete {
  opacity: 1;
}

.gallery-item-delete:hover {
  background: var(--red);
}

.gallery-item:hover {
  border-color: rgba(0, 170, 255, 0.3);
  transform: translateY(-3px);
  box-shadow: 0 6px 24px rgba(0, 170, 255, 0.12);
}

.gallery-item img, .gallery-item video {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.gallery-item .caption {
  padding: 8px 10px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 400;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 10, 38, 0.95);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.lightbox.open { display: flex; }

.lightbox img, .lightbox video {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 80px rgba(0, 170, 255, 0.05);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

/* ============================================================
   History
   ============================================================ */
.history-chart {
  padding: 20px;
  height: 180px;
  flex-shrink: 0;
}

.history-chart canvas { width: 100%; height: 100%; }

.history-table {
  padding: 0 16px 20px;
  overflow-y: auto;
  flex: 1;
}

/* History run cards */
.history-runs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hist-run {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.hist-run:hover {
  border-color: var(--accent);
}

.hist-run-passed { border-left: 3px solid var(--green); }
.hist-run-failed { border-left: 3px solid var(--red); }
.hist-run-running { border-left: 3px solid var(--accent); }
.hist-run-stopped { border-left: 3px solid var(--text-muted); }

.hist-run-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
}

.hist-run-status { flex-shrink: 0; }

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

.hist-dot-passed { background: var(--green); }
.hist-dot-failed { background: var(--red); }
.hist-dot-running { background: var(--accent); animation: pulse-dot 1.5s infinite; }
.hist-dot-stopped { background: var(--text-muted); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hist-run-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hist-run-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.hist-run-id {
  font-weight: 600;
  color: var(--text-primary);
}

.hist-run-date {
  color: var(--text-muted);
  font-size: 12px;
}

.hist-run-project {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 3px;
  background: rgba(0, 170, 255, 0.1);
  color: var(--accent);
  font-weight: 500;
  text-transform: uppercase;
}
.hist-run-env {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.hist-run-env-recette {
  background: rgba(0, 200, 120, 0.15);
  color: #00c878;
}
.hist-run-env-prod {
  background: rgba(255, 140, 0, 0.15);
  color: #ff8c00;
}

/* Logs toolbar */
.logs-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.hist-filter {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.hist-run-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hist-rate-bar {
  flex: 0 0 100px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
}

.hist-rate-passed { background: var(--green); height: 100%; }
.hist-rate-failed { background: var(--red); height: 100%; }
.hist-rate-skipped { background: var(--orange); height: 100%; }

.hist-run-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.hist-stat strong { font-weight: 600; }

.hist-pass-rate {
  font-weight: 600;
  color: var(--text-secondary);
}

.hist-run-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.hist-run:hover .hist-run-delete {
  opacity: 1;
}

.hist-run-delete:hover {
  color: var(--red);
  background: rgba(255, 59, 48, 0.1);
}

.hist-run-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.hist-expanded .hist-run-chevron {
  transform: rotate(180deg);
}

/* Expanded detail */
.hist-run-detail { overflow: hidden; }
.hist-run-detail:empty { display: none; }

.hist-loading, .hist-empty {
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.hist-results-actions {
  padding: 0 12px 8px;
  display: flex;
  gap: 8px;
}

.btn-xs {
  padding: 3px 10px;
  font-size: 11px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}

.btn-xs.btn-accent {
  background: rgba(0, 170, 255, 0.12);
  color: var(--accent);
}

.btn-xs.btn-accent:hover {
  background: rgba(0, 170, 255, 0.25);
}

.hist-results-list {
  border-top: 1px solid var(--border-color);
  max-height: 300px;
  overflow-y: auto;
}

.hist-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.hist-result:last-child { border-bottom: none; }

.hist-result-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
}

.hist-result-icon-passed { color: var(--green); }
.hist-result-icon-failed { color: var(--red); }
.hist-result-icon-flaky { color: var(--orange); }
.hist-result-icon-skipped { color: var(--text-muted); }

.hist-result-file {
  flex-shrink: 0;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-result-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.hist-result-retry {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 170, 0, 0.12);
  color: var(--orange);
}

.hist-result-dur {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-muted);
  min-width: 35px;
  text-align: right;
}

.hist-result-error {
  padding: 4px 12px 6px 38px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--red);
  opacity: 0.8;
  white-space: pre-wrap;
  word-break: break-all;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Light theme */
[data-theme="light"] .hist-run {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

[data-theme="light"] .hist-result {
  border-bottom-color: var(--border-color);
}

[data-theme="light"] .hist-result-error {
  opacity: 1;
}

/* ============================================================
   Panel Help (collapsible)
   ============================================================ */
.panel-help {
  margin: 12px 16px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  flex-shrink: 0;
}
.panel-help summary {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-help summary::before {
  content: '?';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.panel-help summary::-webkit-details-marker { display: none; }
.panel-help summary:hover { color: var(--text-secondary); }
.panel-help[open] { border-color: var(--accent); }
.panel-help[open] summary { color: var(--accent); border-bottom: 1px solid var(--border); }
.panel-help-content {
  padding: 10px 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.panel-help-content strong { color: var(--text-primary); }
.panel-help-content kbd {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 11px;
  font-family: inherit;
}

/* ============================================================
   Empty states
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 10px;
  padding: 48px 40px;
  animation: fadeIn 0.4s ease;
}

.empty-state svg { margin-bottom: 8px; opacity: 0.25; }

.empty-state > div:first-of-type {
  font-size: 14px;
  font-weight: 500;
}

.empty-hint {
  font-size: 12px;
  opacity: 0.5;
}

/* ============================================================
   Toast notifications
   ============================================================ */
#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.4s var(--ease-out-back);
  max-width: 380px;
  position: relative;
  overflow: hidden;
}

.toast.passed { border-left: 4px solid var(--green); }
.toast.failed { border-left: 4px solid var(--red); }
.toast.warning { border-left: 4px solid var(--orange); }

.toast-icon { font-size: 18px; flex-shrink: 0; }

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 2px 0 0;
  animation: toastProgressShrink 4s linear forwards;
}

.toast.passed .toast-progress { background: var(--green); }
.toast.failed .toast-progress { background: var(--red); }
.toast.warning .toast-progress { background: var(--orange); }

@keyframes toastProgressShrink {
  from { width: 100%; }
  to { width: 0%; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.9); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(60px) scale(0.9); }
}

/* Shake animation (errors) */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-4px); }
  30%, 70% { transform: translateX(4px); }
}

.shake { animation: shake 0.5s var(--ease-out-expo); }

/* Confetti canvas */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

/* Count-up animation helper */
.count-up {
  display: inline-block;
  transition: transform 0.2s var(--ease-out-back);
}

.count-up.bumped {
  transform: scale(1.15);
}

/* Skeleton shimmer */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-hover) 40%, var(--bg-card) 80%);
  background-size: 800px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

.skeleton-card {
  height: 80px;
  margin-bottom: 8px;
  border-radius: var(--radius-lg);
}

.skeleton-line {
  height: 14px;
  margin-bottom: 8px;
  width: 70%;
}

.skeleton-line.short { width: 40%; }

/* ============================================================
   Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   Tab separator
   ============================================================ */
.tab-separator {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
  align-self: center;
}

/* ============================================================
   Shared buttons
   ============================================================ */
.btn-sm {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0099ee; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg-hover); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #00a87e; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover { background: #e66a00; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #b8002a; }
.btn-sm:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-sm.btn-outline:hover:not(:disabled) {
  background: rgba(0, 170, 255, 0.1);
}
.btn-icon {
  padding: 4px 8px;
  font-size: 16px;
  line-height: 1;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-icon:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   Scenario Builder
   ============================================================ */
.builder-layout {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  height: 100%;
  gap: 0;
}

/* Palette */
.builder-palette {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.palette-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.palette-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.palette-search {
  width: 100%;
  padding: 7px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.palette-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.1); }
.palette-categories {
  overflow-y: auto;
  flex: 1;
  padding: 8px;
}
.palette-category {
  margin-bottom: 4px;
}
.palette-category-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
}
.palette-category-header:hover { background: var(--bg-hover); }
.palette-category-header .arrow {
  font-size: 10px;
  transition: transform 0.2s;
}
.palette-category-header .arrow { transform: rotate(90deg); }
.palette-category.collapsed .palette-category-header .arrow { transform: rotate(0deg); }
.palette-category-items {
  display: block;
  padding-left: 8px;
}
.palette-category.collapsed .palette-category-items {
  display: none;
}
.palette-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 2px 0;
  border-radius: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: grab;
  user-select: none;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.palette-action:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.palette-action:active { cursor: grabbing; }
.palette-action .action-icon { font-size: 14px; flex-shrink: 0; }
.palette-action .action-label { flex: 1; }
.palette-action .action-auth {
  font-size: 9px;
  background: var(--violet);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
}

/* Canvas */
.builder-canvas {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid rgba(189, 155, 96, 0.2);
  border-right: 1px solid rgba(189, 155, 96, 0.2);
}
.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-wrap: wrap;
}
.canvas-toolbar-left, .canvas-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.scenario-select, .scenario-name-input {
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.scenario-select:focus, .scenario-name-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.1); }
.scenario-name-input { width: 180px; }
.canvas-steps {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.canvas-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 13px;
  gap: 8px;
}
.step-card {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
  position: relative;
}
.step-card:hover { border-color: var(--accent); }
.step-card.selected { border-color: var(--ugc-dore); box-shadow: 0 0 0 1px var(--ugc-dore), 0 4px 20px rgba(189, 155, 96, 0.15); }
.step-card.passed { border-left: 3px solid var(--green); }
.step-card.failed { border-left: 3px solid var(--red); }
.step-card.running { border-left: 3px solid var(--accent); animation: pulse 1.5s infinite; }
.step-card.skipped { border-left: 3px solid var(--yellow); opacity: 0.7; }
.step-card.step-optional { border-style: dashed; }
.step-color-bar {
  width: 4px;
  flex-shrink: 0;
}
.step-content {
  flex: 1;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.step-icon { font-size: 16px; flex-shrink: 0; }
.step-info { flex: 1; min-width: 0; }
.step-info .step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}
.step-info .step-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.step-status.passed { background: rgba(0,194,146,0.15); color: var(--green); }
.step-status.failed { background: rgba(213,0,50,0.15); color: var(--red); }
.step-status.running { background: rgba(0,170,255,0.15); color: var(--accent); }
.step-status.skipped { background: rgba(255,193,7,0.15); color: var(--yellow); }
.badge-optional {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,193,7,0.15);
  color: var(--yellow);
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.step-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
}
.step-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 3px;
}
.step-actions button:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Connector line between steps */
.step-connector {
  display: flex;
  justify-content: center;
  padding: 0 0 0 30px;
  height: 16px;
}
.step-connector::after {
  content: '';
  width: 2px;
  height: 100%;
  background: var(--border);
}

/* Params panel */
.builder-params {
  background: var(--bg-secondary);
  border-left: 1px solid var(--ugc-dore);
  box-shadow: inset 1px 0 0 rgba(189, 155, 96, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.params-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.params-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.params-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.params-empty {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: 32px 16px;
}
.param-group {
  margin-bottom: 12px;
}
.param-group label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.param-group input, .param-group select {
  width: 100%;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.param-group input:focus, .param-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.1); }
.param-help {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.param-group .toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.param-group .toggle-wrapper input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

/* ============================================================
   Quick Asserts
   ============================================================ */
.asserts-layout {
  display: grid;
  grid-template-columns: 400px 1fr;
  height: 100%;
  gap: 0;
}
.assert-form-section {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
}
.assert-form-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.assert-form .form-row {
  margin-bottom: 12px;
}
.assert-form label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.assert-form input, .assert-form select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.assert-form input:focus, .assert-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 170, 255, 0.1); }
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.assert-list-section {
  padding: 16px;
  overflow-y: auto;
}
.assert-list-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.assert-list { display: flex; flex-direction: column; gap: 8px; }
.assert-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  transition: all 0.2s var(--ease-out-expo);
}
.assert-card:hover { border-color: var(--accent); }
.assert-card-info { flex: 1; min-width: 0; }
.assert-card-info .assert-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.assert-card-info .assert-card-detail {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.assert-card-actions {
  display: flex;
  gap: 6px;
}

/* ============================================================
   Test Chains
   ============================================================ */
.chains-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  height: 100%;
  gap: 0;
}
.chain-editor {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chain-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.chain-steps {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.chain-step-card {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 8px;
  gap: 12px;
  transition: all 0.2s var(--ease-out-expo);
}
.chain-step-card:hover { border-color: var(--accent); }
.chain-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.chain-step-card.passed .chain-step-number { background: var(--green); }
.chain-step-card.failed .chain-step-number { background: var(--red); }
.chain-step-info { flex: 1; }
.chain-step-info .chain-step-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}
.chain-step-info .chain-step-detail {
  font-size: 11px;
  color: var(--text-muted);
}
.chain-step-card .chain-stop-badge {
  font-size: 10px;
  background: var(--red);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
}
.chain-add-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.chain-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.chain-checkbox input { accent-color: var(--accent); }
.chain-results {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 16px;
  overflow-y: auto;
}
.chain-results h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* ============================================================
   Matrix Modal
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.4), 0 0 0 1px rgba(0, 170, 255, 0.05);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-body p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.modal-footer span {
  margin-right: auto;
  font-size: 12px;
  color: var(--text-muted);
}
.matrix-param-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.matrix-param-row input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.matrix-param-row input:focus { border-color: var(--accent); }
.matrix-param-row .remove-param {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
}

/* Drop zone highlight */
.canvas-steps.drag-over {
  background: rgba(0,170,255,0.05);
  border: 2px dashed var(--accent);
  border-radius: 8px;
}

/* Palette action being dragged */
.palette-action.dragging {
  opacity: 0.4;
}

/* ============================================================
   Donut Chart (Results)
   ============================================================ */
.results-donut-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px 12px;
}

.donut-chart-container {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.donut-chart-container svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.donut-chart-container .donut-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.donut-chart-container .donut-passed {
  fill: none;
  stroke: var(--green);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dasharray 1s var(--ease-out-expo);
}

.donut-chart-container .donut-failed {
  fill: none;
  stroke: var(--red);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dasharray 1s var(--ease-out-expo);
}

.donut-center-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.donut-center-label .donut-pct {
  font-size: 22px;
  font-weight: 600;
  color: var(--green);
  line-height: 1;
}

.donut-center-label .donut-sub {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.donut-legend-dot.passed { background: var(--green); }
.donut-legend-dot.failed { background: var(--red); }
.donut-legend-dot.skipped { background: var(--orange); }

/* ============================================================
   Gallery Filters
   ============================================================ */
.gallery-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gallery-filters select {
  padding: 6px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
}
.gallery-filters select:focus { border-color: var(--accent); }

/* Gallery item badge */
.gallery-item {
  position: relative;
}
.gallery-item-badge {
  position: absolute;
  bottom: 32px;
  left: 6px;
  background: rgba(0, 10, 38, 0.8);
  color: var(--accent);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-item.selected {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-glow-cyan);
}
.gallery-item.compare-mode { cursor: crosshair; }

/* Gallery timeline (horizontal scroll) */
.gallery-timeline {
  display: flex;
  gap: 14px;
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
}
.gallery-timeline .gallery-item {
  flex: 0 0 220px;
}

/* Gallery compare overlay */
.gallery-compare-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 10, 38, 0.95);
  backdrop-filter: blur(6px);
  flex-direction: column;
}
.gallery-compare-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.gallery-compare-header .modal-close {
  position: static;
}
.gallery-compare-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.gallery-compare-left,
.gallery-compare-right {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-compare-left img,
.gallery-compare-right img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
}
.gallery-compare-slider {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  z-index: 10;
  accent-color: var(--accent);
}

/* ============================================================
   Enhanced Gallery
   ============================================================ */
.gallery-item {
  transition: all 0.3s var(--ease-out-expo);
}

.gallery-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-glow-cyan);
}

.gallery-item img {
  transition: transform 0.4s var(--ease-out-expo);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

/* ============================================================
   Enhanced Sidebar
   ============================================================ */
.sidebar {
  transition: width 0.3s var(--ease-out-expo);
}

.test-item {
  transition: all 0.2s var(--ease-out-expo);
}

.test-item:hover {
  background: var(--bg-tertiary);
  transform: translateX(2px);
}

/* ============================================================
   Enhanced Step Cards (Builder)
   ============================================================ */
.step-card {
  transition: all 0.2s var(--ease-out-expo);
  box-shadow: var(--shadow-sm);
}

.step-card:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow-md);
}

.step-card.selected {
  box-shadow: 0 0 0 1px var(--ugc-dore), 0 4px 20px rgba(189, 155, 96, 0.15);
  border-color: var(--ugc-dore);
}

/* ============================================================
   Category Color Bars (Builder Palette)
   ============================================================ */
.palette-category[data-category="navigation"] .palette-category-header { border-left: 3px solid var(--accent); }
.palette-category[data-category="auth"] .palette-category-header { border-left: 3px solid var(--violet); }
.palette-category[data-category="search"] .palette-category-header { border-left: 3px solid var(--orange); }
.palette-category[data-category="films"] .palette-category-header { border-left: 3px solid var(--green); }
.palette-category[data-category="reservation"] .palette-category-header { border-left: 3px solid var(--ugc-dore); }
.palette-category[data-category="account"] .palette-category-header { border-left: 3px solid #e06090; }
.palette-category[data-category="carte"] .palette-category-header { border-left: 3px solid var(--ugc-dore); }
.palette-category[data-category="cinemas"] .palette-category-header { border-left: 3px solid #40c8e0; }
.palette-category[data-category="evenements"] .palette-category-header { border-left: 3px solid #c080ff; }
.palette-category[data-category="interaction"] .palette-category-header { border-left: 3px solid var(--orange); }
.palette-category[data-category="assertion"] .palette-category-header { border-left: 3px solid var(--green); }
.palette-category[data-category="wait"] .palette-category-header { border-left: 3px solid var(--text-muted); }

/* ============================================================
   Enhanced Drop Zone (Builder)
   ============================================================ */
.canvas-steps.drag-over {
  background: rgba(0, 170, 255, 0.06);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 30px rgba(0, 170, 255, 0.05);
}

/* Drop guideline between steps */
.drop-guideline {
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  margin: 4px 0;
  animation: fadeIn 0.15s ease;
  box-shadow: 0 0 8px var(--accent);
}

/* ============================================================
   Circular Progress (Run Status)
   ============================================================ */
.circular-progress {
  position: relative;
  width: 40px;
  height: 40px;
}

.circular-progress svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.circular-progress .progress-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3;
}

.circular-progress .progress-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s var(--ease-out-expo);
}

.circular-progress .progress-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
}

/* ============================================================
   Enhanced Sparklines (SVG mini chart)
   ============================================================ */
.sparkline-svg {
  display: inline-block;
  vertical-align: middle;
  overflow: visible;
}

.sparkline-svg .sparkline-line {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-svg .sparkline-area {
  opacity: 0.15;
}

.sparkline-svg .sparkline-dot-end {
  r: 2.5;
}

/* ============================================================
   Enhanced Results Table Rows
   ============================================================ */
.results-table tr {
  transition: all 0.15s;
}

.results-table tr:hover td {
  background: rgba(0, 170, 255, 0.06);
}

.results-table tr td:first-child {
  border-left: 3px solid transparent;
  transition: border-color 0.15s;
}

.results-table tr:hover td:first-child {
  border-left-color: var(--accent);
}

/* ============================================================
   Run Button Glow Animation
   ============================================================ */
.run-btn {
  position: relative;
  overflow: hidden;
}

.run-btn::after {
  display: none;
}

.run-btn.stop {
  animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(213, 0, 50, 0.3); }
  50% { box-shadow: 0 0 0 8px rgba(213, 0, 50, 0); }
}

/* ============================================================
   Enhanced Modal
   ============================================================ */
.modal-overlay {
  animation: modalOverlayIn 0.2s ease;
}

.modal-content {
  animation: modalContentIn 0.3s var(--ease-out-back);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(0, 0, 0, 0.3);
}

@keyframes modalOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalContentIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ============================================================
   Cinematic Effects — Scanning Line on Stat Cards
   ============================================================ */
@keyframes scanLine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.stat-card::after {
  display: none;
}

/* ============================================================
   Cinematic Effects — Blueprint Grid on Builder Canvas
   ============================================================ */
.canvas-steps {
  background-image:
    linear-gradient(rgba(0, 170, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 170, 255, 0.015) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ============================================================
   Recording Mode — Red Pulsing Border
   ============================================================ */
@keyframes recordingPulse {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(213, 0, 50, 0.4); }
  50% { box-shadow: inset 0 0 0 2px rgba(213, 0, 50, 0.8); }
}

body.recording .layout {
  animation: recordingPulse 2s ease-in-out infinite;
}

/* ============================================================
   Recorder UI
   ============================================================ */
.recorder-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 6px 16px;
  background: linear-gradient(90deg, rgba(213, 0, 50, 0.15), rgba(213, 0, 50, 0.05));
  border-bottom: 1px solid rgba(213, 0, 50, 0.3);
  font-size: 12px;
  animation: fadeIn 0.3s ease;
}

body.recording .recorder-bar { display: flex; }

.recorder-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}

body.recording.recorder-paused .recorder-dot {
  animation: none;
  opacity: 0.4;
}

.recorder-label {
  color: var(--red);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
}

.recorder-actions-count {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.recorder-controls {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.recorder-controls button {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.recorder-controls button:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.recorder-controls .btn-stop {
  background: rgba(213, 0, 50, 0.15);
  border-color: var(--red);
  color: var(--red);
}

.recorder-controls .btn-stop:hover {
  background: var(--red);
  color: #fff;
}

/* Recorder button in builder toolbar */
.btn-recorder {
  background: rgba(213, 0, 50, 0.12);
  color: var(--red);
  border: 1px solid rgba(213, 0, 50, 0.3);
}

.btn-recorder:hover {
  background: rgba(213, 0, 50, 0.25);
  border-color: var(--red);
}

body.recording .btn-recorder {
  display: none;
}

/* VNC remote browser viewer */
.vnc-viewer-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  margin: 0 0 4px 0;
  animation: fadeIn 0.3s ease;
}

.vnc-viewer-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
}

.vnc-viewer-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  flex: 1;
}

.vnc-frame {
  width: 100%;
  height: 600px;
  border: none;
  background: #000;
  display: block;
}

.vnc-viewer-container.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  margin: 0;
  border-radius: 0;
}

.vnc-viewer-container.fullscreen .vnc-frame {
  height: calc(100vh - 38px);
}

/* Step card recorded badge */
.step-recorded-badge {
  font-size: 9px;
  background: rgba(213, 0, 50, 0.15);
  color: var(--red);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}

/* ============================================================
   Debug Button
   ============================================================ */
.btn-debug {
  background: rgba(158, 0, 255, 0.15);
  color: var(--violet);
  border: 1px solid rgba(158, 0, 255, 0.3);
}
.btn-debug:hover { background: rgba(158, 0, 255, 0.25); border-color: var(--violet); }

/* ============================================================
   Debug Bar + Step Highlighting
   ============================================================ */
.debug-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(90deg, rgba(158, 0, 255, 0.12), rgba(158, 0, 255, 0.04));
  border-bottom: 1px solid rgba(158, 0, 255, 0.3);
  font-size: 12px;
  animation: fadeIn 0.3s ease;
}
.debug-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--violet);
  animation: pulse 1.5s infinite;
  flex-shrink: 0;
}
.debug-label {
  color: var(--violet);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
}
.debug-step-info {
  color: var(--text-secondary);
  flex: 1;
}
.debug-controls {
  display: flex;
  gap: 6px;
}
.step-card.debug-current {
  border-color: var(--violet) !important;
  box-shadow: 0 0 0 2px rgba(158, 0, 255, 0.3), 0 4px 20px rgba(158, 0, 255, 0.15);
  animation: debugPulse 2s infinite;
}
.step-card.debug-done {
  border-left: 3px solid var(--green);
  opacity: 0.7;
}
@keyframes debugPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(158, 0, 255, 0.3); }
  50% { box-shadow: 0 0 0 4px rgba(158, 0, 255, 0.15); }
}

/* ============================================================
   Focus Mode (per-test detail)
   ============================================================ */
.focus-modal-content {
  width: 800px;
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 18px;
}
.focus-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 0 !important;
}
.focus-left {
  padding: 20px;
  overflow-y: auto;
  max-height: 60vh;
}
.focus-right {
  padding: 20px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  max-height: 60vh;
}
.focus-error {
  background: rgba(213, 0, 50, 0.06);
  border: 1px solid rgba(213, 0, 50, 0.2);
  border-radius: var(--radius);
  padding: 12px;
  overflow: auto;
  max-height: 300px;
}
.focus-error pre {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px;
  color: #ff6b8a;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}
.focus-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.focus-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
}
.focus-stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}
.focus-stat-label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}
.focus-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.focus-media-thumb {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.focus-media-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.03);
  box-shadow: var(--shadow-glow-cyan);
}

@media (max-width: 700px) {
  .focus-body { grid-template-columns: 1fr; }
  .focus-right { border-left: none; border-top: 1px solid var(--border); }
}

/* ============================================================
   Executive Summary
   ============================================================ */
.summary-layout {
  padding: 20px;
  overflow-y: auto;
  max-height: 100%;
}
.summary-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 24px;
  animation: slideUp 0.3s ease;
}
.summary-gauge {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.summary-gauge svg { width: 100%; height: 100%; }
.summary-gauge-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.summary-gauge-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.summary-gauge-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}
.summary-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}
.summary-section {
  margin-bottom: 20px;
}
.summary-section h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.summary-trend {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  height: 100px;
  display: flex;
  align-items: center;
}
.summary-trend-chart {
  width: 100%;
  height: 80px;
}
.summary-trend-labels {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px 0;
}
.trend-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
}
.trend-day-label { color: var(--text-muted); }
.trend-day-rate { font-weight: 600; color: var(--text-secondary); }
.summary-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.summary-table th {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.summary-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.summary-flaky-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.summary-flaky-item {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 8px;
}
.summary-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
@media (max-width: 900px) {
  .summary-header { flex-direction: column; align-items: stretch; }
  .summary-bottom { grid-template-columns: 1fr; }
}

/* ============================================================
   Templates Grid
   ============================================================ */
.templates-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.template-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}
.template-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.template-icon { font-size: 28px; flex-shrink: 0; }
.template-info { flex: 1; min-width: 0; }
.template-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.template-desc { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.template-steps { font-size: 10px; color: var(--accent); margin-top: 4px; }

/* ============================================================
   SELECTOR EDITOR
   ============================================================ */
.selector-editor-modal-content {
  width: 90vw;
  max-width: 1200px;
  height: 80vh;
  display: flex;
  flex-direction: column;
}
.selector-url-bar {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.selector-url-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}
.selector-url-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 170, 255, 0.15);
}
.selector-iframe-container {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #fff;
}
.selector-iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.selector-picked-bar {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
  align-items: center;
}
.selector-picked-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.selector-picked-value {
  flex: 1;
  font-size: 13px;
  color: var(--accent);
  background: var(--bg-primary);
  padding: 4px 8px;
  border-radius: var(--radius);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .selector-editor-modal-content {
    width: 98vw;
    height: 90vh;
  }
}

/* ============================================================
   LIGHT THEME
   ============================================================ */
[data-theme="light"] {
  --bg-primary: #f4f6fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eaeff6;
  --bg-card: #f0f3fa;
  --bg-hover: #dce2f0;
  --text-primary: #1a2332;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border: rgba(0, 20, 80, 0.08);
  --border-color: rgba(0, 20, 80, 0.1);
  --border-light: rgba(0, 20, 80, 0.12);
  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.06), 0 4px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] body {
  background: var(--bg-primary);
  color: var(--text-primary);
}

[data-theme="light"] .header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .header-title-text {
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--ugc-bleu-nuit));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="light"] .header-logo {
  filter: brightness(0.9) saturate(1.2);
}

[data-theme="light"] .sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
}

[data-theme="light"] .main {
  background: var(--bg-primary);
}

[data-theme="light"] .tab {
  color: var(--text-secondary);
}

[data-theme="light"] .tab.active {
  color: var(--bleu-nuit);
}

[data-theme="light"] .terminal {
  background: #1a2332;
  color: #a0d8b0;
}

[data-theme="light"] .tab-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

[data-theme="light"] .stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] .stat-card .value {
  color: var(--text-primary);
}

[data-theme="light"] .stat-card .label {
  color: var(--text-secondary);
}

[data-theme="light"] .test-item {
  border-bottom: 1px solid var(--bg-tertiary);
}

[data-theme="light"] .test-item:hover {
  background: var(--bg-tertiary);
}

[data-theme="light"] .test-item-label {
  color: var(--text-primary);
}

[data-theme="light"] .test-item-details {
  border-left-color: var(--border-color);
}

[data-theme="light"] .test-item-test {
  color: var(--text-primary);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="light"] .builder-palette {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
}

[data-theme="light"] .builder-canvas {
  background: var(--bg-primary);
}

[data-theme="light"] .builder-params {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
}

[data-theme="light"] .step-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

[data-theme="light"] table {
  color: var(--text-primary);
}

[data-theme="light"] thead th {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] tbody tr {
  border-bottom: 1px solid var(--bg-tertiary);
}

[data-theme="light"] tbody tr:hover {
  background: var(--bg-tertiary);
}

[data-theme="light"] .command-palette {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
}

[data-theme="light"] .command-item:hover,
[data-theme="light"] .command-item.active {
  background: var(--bg-tertiary);
}

[data-theme="light"] .toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

[data-theme="light"] .modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .tag-btn {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .tag-btn.active {
  background: var(--accent);
  color: white;
}

[data-theme="light"] .run-btn {
  box-shadow: var(--shadow-md);
}

[data-theme="light"] h3 {
  color: var(--text-primary);
}

[data-theme="light"] .shortcuts-hint {
  color: var(--text-muted);
}

[data-theme="light"] .shortcuts-hint kbd {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

[data-theme="light"] .env-btn {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .btn-sm.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .scenario-select,
[data-theme="light"] .scenario-name-input {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

[data-theme="light"] .palette-category-header {
  color: var(--text-primary);
}

[data-theme="light"] .palette-action {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

[data-theme="light"] .palette-action:hover {
  background: var(--bg-tertiary);
}

[data-theme="light"] .error-msg {
  background: rgba(213, 0, 50, 0.08);
  border-left: 3px solid var(--red);
}

[data-theme="light"] .panel-help {
  background: var(--bg-tertiary);
  border-color: var(--border-color);
}
[data-theme="light"] .panel-help summary { color: var(--text-secondary); }
[data-theme="light"] .panel-help-content { color: var(--text-primary); }
[data-theme="light"] .gallery-filters {
  background: var(--bg-tertiary);
  border-bottom-color: var(--border-color);
}
[data-theme="light"] .gallery-item-badge {
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
}

[data-theme="light"] .results-table {
  background: var(--bg-secondary);
}

/* ============================================================
   Programmation tab
   ============================================================ */
.prog-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.prog-film-input {
  flex: 0 1 280px;
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.prog-film-input:focus {
  border-color: var(--accent);
}

.prog-film-input:disabled {
  opacity: 0.5;
}

.prog-date-input {
  padding: 5px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  color-scheme: dark;
}

.prog-date-input:focus {
  border-color: var(--accent);
}

.prog-date-input:disabled {
  opacity: 0.5;
}

[data-theme="light"] .prog-date-input {
  color-scheme: light;
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.prog-progress {
  flex: 1 1 120px;
  max-width: 200px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.prog-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.prog-counters {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: auto;
}

.prog-counter strong {
  color: var(--text-primary);
}

.prog-counter-found strong {
  color: var(--green);
}

.prog-counter-showings strong {
  color: var(--accent);
}

.prog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
}

.prog-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.prog-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 170, 255, 0.08);
}

.prog-card-found {
  border-left: 3px solid var(--green);
}

.prog-card-none {
  opacity: 0.6;
}

.prog-card-error {
  border-left: 3px solid var(--red);
}

.prog-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.prog-card-name {
  flex: 1;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prog-status-icon {
  font-size: 10px;
  line-height: 1;
}

.prog-status-found { color: var(--green); }
.prog-status-none { color: var(--text-muted); }
.prog-status-error { color: var(--red); }

.prog-showing-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: rgba(0, 194, 146, 0.15);
  color: var(--green);
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.prog-showings-list {
  display: flex;
  flex-direction: column;
}

.prog-showing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 12px;
  color: var(--text-secondary);
}

.prog-showing-row:last-child {
  border-bottom: none;
}

.prog-showing-hour {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  min-width: 40px;
}

.prog-showing-film {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prog-showing-salle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.prog-reserve-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--accent);
  text-decoration: none;
  border-radius: 4px;
  background: rgba(0, 170, 255, 0.08);
  transition: background 0.15s, color 0.15s;
}

.prog-reserve-link:hover {
  background: rgba(0, 170, 255, 0.25);
  color: #fff;
}

.prog-reserve-link svg {
  width: 14px;
  height: 14px;
}

.prog-version-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
  text-transform: uppercase;
}

.prog-version-vf {
  background: rgba(0, 170, 255, 0.12);
  color: var(--accent);
}

.prog-version-vostf {
  background: rgba(158, 0, 255, 0.12);
  color: #c084fc;
}

.prog-card-error {
  font-size: 11px;
  padding: 6px 12px;
  color: var(--red);
}

.prog-card-skeleton {
  padding: 16px;
  min-height: 60px;
}

.skeleton-line {
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, rgba(255,255,255,0.06) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 8px;
}

.skeleton-w60 { width: 60%; }
.skeleton-w40 { width: 40%; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Light theme overrides for programmation */
[data-theme="light"] .prog-toolbar {
  background: var(--bg-tertiary);
  border-bottom-color: var(--border-color);
}
[data-theme="light"] .prog-film-input {
  background: var(--bg-primary);
  border-color: var(--border-color);
  color: var(--text-primary);
}
[data-theme="light"] .prog-card {
  background: var(--bg-primary);
  border-color: var(--border-color);
}
[data-theme="light"] .prog-showing-row {
  border-bottom-color: var(--border-color);
}

/* ============================================================
   Catalogue Films
   ============================================================ */
.cat-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.cat-compare-input,
.cat-search-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.cat-compare-input { width: 260px; }
.cat-search-input { width: 200px; }
.cat-compare-input:focus,
.cat-search-input:focus { border-color: var(--accent-cyan); }
.cat-progress {
  flex: 1;
  min-width: 80px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.cat-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-cyan);
  border-radius: 2px;
  transition: width 0.3s;
}
.cat-counters {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.cat-counter strong { color: var(--text-primary); }
.cat-counter-films strong { color: var(--accent-cyan); }
/* Filter bar */
.cat-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 10px 0;
}
.cat-filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.cat-filter-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 48px;
  flex-shrink: 0;
}
.cat-filter-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.cat-filter-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}
.cat-filter-btn.active {
  background: var(--accent-cyan);
  color: #fff;
  border-color: var(--accent-cyan);
}
/* List layout */
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Horizontal film row */
.cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: background 0.15s;
}
.cat-row:hover {
  background: var(--bg-tertiary);
}
.cat-row-poster {
  width: 36px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}
.cat-row-poster-empty {
  width: 36px;
  height: 50px;
  background: var(--bg-tertiary);
  border-radius: 4px;
}
.cat-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cat-row-title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.cat-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-row-genre {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}
.cat-badge-label {
  font-weight: 600;
  font-size: 10px;
}
.cat-row-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cat-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}
.cat-row-id {
  font-size: 11px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  font-family: monospace;
}
.cat-row-link {
  font-size: 16px;
  color: var(--accent-cyan);
  text-decoration: none;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.cat-row:hover .cat-row-link { opacity: 1; }
.cat-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 13px;
}
.cat-empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-tertiary);
}
.cat-empty-icon { font-size: 40px; margin-bottom: 8px; }
.cat-empty-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.cat-empty-desc { font-size: 12px; margin-top: 4px; }
.cat-diff-section {
  margin-bottom: 12px;
}
.cat-diff-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
}
.cat-diff-group {
  margin-bottom: 12px;
}
.cat-diff-group-title {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 4px;
  padding: 4px 8px;
  border-radius: 4px;
}
.cat-diff-only-a { background: rgba(231,76,60,0.15); color: #e74c3c; }
.cat-diff-only-b { background: rgba(52,152,219,0.15); color: #3498db; }
.cat-diff-both { background: rgba(46,204,113,0.15); color: #2ecc71; }
.cat-diff-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0;
}
.cat-diff-item {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.cat-row-skeleton {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  height: 62px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* ============================================================
   Health Check
   ============================================================ */
.hc-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.hc-compare-toggle {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.hc-compare-toggle input { cursor: pointer; }
.hc-compare-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  outline: none;
  width: 260px;
  transition: border-color 0.2s;
}
.hc-compare-input:focus { border-color: var(--accent-cyan); }
.hc-progress {
  flex: 1;
  min-width: 80px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}
.hc-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-cyan);
  border-radius: 2px;
  transition: width 0.3s;
}
.hc-counters {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.hc-counter strong { color: var(--text-primary); }
.hc-summary {
  margin-bottom: 12px;
}
.hc-summary-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hc-summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 120px;
  text-align: center;
}
.hc-summary-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}
.hc-summary-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
}
.hc-summary-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.hc-summary-ok .hc-summary-value { color: var(--accent-green); }
.hc-summary-warning .hc-summary-value { color: #f39c12; }
.hc-summary-error .hc-summary-value { color: var(--accent-red); }
.hc-summary-time .hc-summary-value { color: var(--accent-cyan); }
.hc-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hc-check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 12px;
  transition: background 0.15s;
  cursor: pointer;
}
.hc-check:hover { background: var(--bg-tertiary); }
.hc-check-status-icon {
  flex-shrink: 0;
}
.hc-status-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.hc-status-ok { background: rgba(46,204,113,0.2); color: #2ecc71; }
.hc-status-warning { background: rgba(243,156,18,0.2); color: #f39c12; }
.hc-status-error { background: rgba(231,76,60,0.2); color: #e74c3c; }
.hc-check-name {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 130px;
  flex-shrink: 0;
}
.hc-check-site {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.hc-check-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  background: rgba(46,204,113,0.15);
  color: #2ecc71;
}
.hc-check-error .hc-check-code { background: rgba(231,76,60,0.15); color: #e74c3c; }
.hc-check-time {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 55px;
  text-align: right;
  flex-shrink: 0;
}
.hc-check-title {
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.hc-check-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.hc-check-badge-warning { background: rgba(243,156,18,0.15); color: #f39c12; }
.hc-check-badge-error { background: rgba(231,76,60,0.15); color: #e74c3c; }
.hc-check-details {
  display: none;
  padding: 8px 14px 10px 46px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: none;
  border-radius: 0 0 8px 8px;
  margin-top: -7px;
}
.hc-check-details.open { display: block; }
.hc-check-details-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.hc-check-details-item {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  padding: 2px 0;
  color: var(--text-secondary);
}
.hc-check-details-item.warning { color: #f39c12; }
.hc-check-details-item.error { color: #e74c3c; }
.hc-check.expanded { border-radius: 8px 8px 0 0; }
/* Filter bar */
.hc-filter-bar {
  display: flex;
  gap: 6px;
  padding: 0 0 8px 0;
  flex-wrap: wrap;
}
.hc-filter-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.hc-filter-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}
.hc-filter-btn.active {
  background: var(--accent-cyan);
  color: #fff;
  border-color: var(--accent-cyan);
}
.hc-filter-ok.active { background: #2ecc71; border-color: #2ecc71; }
.hc-filter-warning.active { background: #f39c12; border-color: #f39c12; }
.hc-filter-error.active { background: #e74c3c; border-color: #e74c3c; }
/* Chevron indicator */
.hc-check-chevron {
  font-size: 10px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: transform 0.2s;
}
.hc-check.expanded .hc-check-chevron { transform: rotate(180deg); }
.hc-check-expandable { cursor: pointer; }
.hc-check-badge-info { background: rgba(52,152,219,0.15); color: #3498db; }
/* Enhanced detail panel */
.hc-detail-section {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}
.hc-detail-section:last-child { border-bottom: none; }
.hc-detail-section-title {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.hc-title-error { color: #e74c3c; }
.hc-title-warning { color: #f39c12; }
.hc-detail-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
  font-size: 11px;
}
.hc-detail-key {
  font-weight: 600;
  color: var(--text-tertiary);
  min-width: 70px;
  flex-shrink: 0;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.5px;
}
.hc-detail-val {
  color: var(--text-secondary);
  word-break: break-all;
}
.hc-val-warning { color: #f39c12; }
.hc-detail-link {
  color: var(--accent-cyan);
  text-decoration: none;
  word-break: break-all;
  font-size: 11px;
}
.hc-detail-link:hover { text-decoration: underline; }
.hc-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
}
.hc-item-icon {
  flex-shrink: 0;
  font-size: 10px;
  margin-top: 2px;
}
.hc-item-ok .hc-item-icon { color: #2ecc71; }
.hc-item-warning .hc-item-icon { color: #f39c12; }
.hc-item-error .hc-item-icon { color: #e74c3c; }
.hc-item-warn .hc-item-icon { color: #f39c12; }
.hc-item-ok code, .hc-item-warning code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  background: var(--bg-tertiary);
  padding: 1px 5px;
  border-radius: 3px;
}
.hc-item-label {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(243,156,18,0.15);
  color: #f39c12;
  font-weight: 600;
}
.hc-item-content {
  min-width: 0;
  flex: 1;
}
.hc-item-text {
  color: var(--text-secondary);
  word-break: break-word;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  line-height: 1.4;
}
.hc-item-error .hc-item-text { color: #e74c3c; }
.hc-item-warn .hc-item-text { color: #f39c12; }
.hc-item-source {
  font-size: 9px;
  color: var(--text-tertiary);
  word-break: break-all;
  margin-top: 1px;
}
.hc-empty {
  text-align: center;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Light theme overrides */
[data-theme="light"] .cat-row {
  background: var(--bg-primary);
  border-color: var(--border-color);
}
[data-theme="light"] .cat-filter-btn {
  background: var(--bg-primary);
}
[data-theme="light"] .cat-filter-btn.active {
  background: var(--accent-cyan);
  color: #fff;
}
[data-theme="light"] .hc-check {
  background: var(--bg-primary);
  border-color: var(--border-color);
}
[data-theme="light"] .hc-check-details {
  background: var(--bg-primary);
  border-color: var(--border-color);
}
[data-theme="light"] .hc-filter-btn {
  background: var(--bg-primary);
}
[data-theme="light"] .hc-summary-card {
  background: var(--bg-primary);
  border-color: var(--border-color);
}

/* ============================================================
   AI Scenario Generator Panel
   ============================================================ */
.ai-gen-panel {
  background: linear-gradient(135deg, rgba(158, 0, 255, 0.08), rgba(0, 170, 255, 0.06));
  border-bottom: 1px solid rgba(158, 0, 255, 0.2);
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s var(--ease-out-expo), padding 0.35s var(--ease-out-expo);
}
.ai-gen-panel.open {
  max-height: 200px;
  padding: 12px 16px;
}
.ai-gen-panel-inner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.ai-gen-textarea {
  flex: 1;
  resize: none;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid rgba(158, 0, 255, 0.25);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  min-height: 60px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-gen-textarea:focus {
  border-color: var(--ugc-violet);
  box-shadow: 0 0 0 3px rgba(158, 0, 255, 0.12);
}
.ai-gen-textarea::placeholder {
  color: var(--text-muted);
}
.ai-gen-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.ai-gen-btn {
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--ugc-violet), #6a00ff);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap;
}
.ai-gen-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.ai-gen-btn:active { transform: translateY(0); }
.ai-gen-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.ai-gen-status {
  font-size: 11px;
  color: var(--text-secondary);
  min-height: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-gen-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(158, 0, 255, 0.25);
  border-top-color: var(--ugc-violet);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.ai-gen-explanation {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(158, 0, 255, 0.06);
  border-radius: 6px;
  border-left: 3px solid var(--ugc-violet);
}
/* Toggle button in toolbar */
.btn-ai {
  background: linear-gradient(135deg, var(--ugc-violet), #6a00ff);
  color: #fff;
  border: none;
}
.btn-ai:hover { opacity: 0.9; }

/* ============================================================
   Film Watcher
   ============================================================ */
.fw-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}
.fw-counters {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: auto;
}
.fw-counter strong { color: var(--text-primary); }
.fw-counter-active strong { color: var(--green); }

.fw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 180px);
}

.fw-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.fw-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 170, 255, 0.08);
}
.fw-card-active { border-left: 3px solid var(--green); }
.fw-card-paused { border-left: 3px solid var(--text-muted); opacity: 0.7; }
.fw-card-checking { border-left: 3px solid var(--accent); }

.fw-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}
.fw-card-name {
  flex: 1;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fw-card-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 10px;
}
.fw-status-active { background: rgba(0, 194, 146, 0.15); color: var(--green); }
.fw-status-paused { background: rgba(136, 153, 187, 0.15); color: var(--text-muted); }
.fw-status-checking {
  background: rgba(0, 170, 255, 0.15); color: var(--accent);
  animation: fwPulse 1.5s ease-in-out infinite;
}
@keyframes fwPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.fw-card-body {
  padding: 10px 12px;
}
.fw-card-film {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}
.fw-card-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.fw-card-showings {
  font-size: 12px;
  color: var(--text-primary);
}
.fw-card-showings strong { color: var(--accent); }

.fw-card-actions {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

/* Modal form */
.fw-form .form-row {
  margin-bottom: 10px;
}
.fw-form .form-row label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}
.fw-form .form-row input[type="text"],
.fw-form .form-row input[type="number"],
.fw-form .form-row input[type="datetime-local"] {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  color-scheme: dark;
}
.fw-form .form-row input:focus { border-color: var(--accent); }
.fw-form .form-row input[type="checkbox"] { margin-right: 6px; }

/* Log drawer */
.fw-log-drawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 420px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}
.fw-log-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}
.fw-log-drawer-header h3 {
  font-size: 14px;
  color: var(--text-primary);
}
.fw-log-drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.fw-log-loading, .fw-log-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}
.fw-log-entry {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.fw-log-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  font-size: 12px;
}
.fw-log-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 11px; font-weight: 600;
}
.fw-log-icon-ok { background: rgba(0, 194, 146, 0.15); color: var(--green); }
.fw-log-icon-new { background: rgba(0, 170, 255, 0.15); color: var(--accent); }
.fw-log-icon-removed { background: rgba(255, 119, 0, 0.15); color: var(--orange); }
.fw-log-icon-error { background: rgba(213, 0, 50, 0.15); color: var(--red); }
.fw-log-date { color: var(--text-secondary); flex: 1; }
.fw-log-count { color: var(--text-primary); font-weight: 500; }
.fw-log-slack {
  font-size: 10px;
  background: rgba(0, 170, 255, 0.1);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 8px;
}
.fw-log-detail { padding: 6px 10px; }
.fw-log-new-detail { border-left: 2px solid var(--green); }
.fw-log-removed-detail { border-left: 2px solid var(--orange); }
.fw-log-showing {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 2px 0;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.fw-log-more { font-size: 10px; color: var(--text-muted); padding: 2px 0; }
.fw-log-error {
  font-size: 11px;
  color: var(--red);
  padding: 6px 10px;
}

/* Light theme overrides */
[data-theme="light"] .fw-toolbar {
  background: var(--bg-tertiary);
  border-bottom-color: var(--border-color);
}
[data-theme="light"] .fw-card {
  background: var(--bg-primary);
  border-color: var(--border-color);
}
[data-theme="light"] .fw-log-drawer {
  background: var(--bg-primary);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .fw-form .form-row input[type="text"],
[data-theme="light"] .fw-form .form-row input[type="number"],
[data-theme="light"] .fw-form .form-row input[type="datetime-local"] {
  color-scheme: light;
}

/* ============================================================
   Film Watcher — Env Toggle (Prod / Recette)
   ============================================================ */
.fw-env-toggle {
  display: flex;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.fw-env-btn {
  flex: 1;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  border: none;
  background: var(--bg-primary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s var(--ease-out-expo);
}

.fw-env-btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.fw-env-btn:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.fw-env-btn.active[data-url="https://www.ugc.fr"] {
  background: rgba(213, 0, 50, 0.15);
  color: var(--red);
}

.fw-env-btn.active[data-url="https://recette.ugc.fr"] {
  background: rgba(0, 170, 255, 0.15);
  color: var(--accent);
}

/* ============================================================
   Slack Controls (sidebar + builder toolbar)
   ============================================================ */
.slack-controls {
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slack-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.slack-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.slack-webhook-input {
  width: 100%;
  padding: 6px 10px;
  font-size: 11px;
  font-family: monospace;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
}

.slack-webhook-input:focus {
  border-color: var(--accent);
}

.slack-webhook-input::placeholder {
  color: var(--text-muted);
}

.slack-toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  white-space: nowrap;
}

.slack-toggle-inline:hover {
  border-color: var(--border-light);
}

.slack-toggle-inline input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* Light theme overrides */
[data-theme="light"] .slack-webhook-input {
  background: var(--bg-primary);
  border-color: var(--border);
  color: var(--text-primary);
}

/* Workers Controls */
.workers-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.workers-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.workers-input {
  width: 60px;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  text-align: center;
}

.workers-input:focus {
  border-color: var(--accent);
}

.workers-input::placeholder {
  color: var(--text-muted);
  font-size: 11px;
}

/* ============================================================
   Source Viewer — Action Buttons + Modal + Syntax Highlighting
   ============================================================ */

/* Inline action buttons on test items (visible on hover) */
.test-item-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s;
}
.test-item-wrapper:hover .test-item-actions,
.test-item-wrapper:focus-within .test-item-actions {
  opacity: 1;
}
.test-item-action {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.test-item-action:hover {
  color: var(--accent);
  background: var(--bg-tertiary);
}
.test-item-clone:hover {
  color: var(--green);
  background: rgba(0, 194, 146, 0.1);
}

/* Source modal */
.source-modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.source-modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 850px; max-width: 95vw; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.source-modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.source-modal-header h3 {
  font-size: 14px; font-weight: 600; color: var(--text-primary);
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.source-modal-body {
  flex: 1; overflow: auto; padding: 0;
}
.source-code {
  margin: 0; padding: 16px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  font-size: 12px; line-height: 1.65;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: auto; tab-size: 2;
  white-space: pre;
}

/* Syntax highlighting classes */
.hl-linenum { color: var(--text-muted); user-select: none; margin-right: 16px; display: inline-block; min-width: 2.5em; text-align: right; }
.hl-keyword { color: var(--violet); }
.hl-test { color: var(--accent); font-weight: 600; }
.hl-string { color: var(--green); }
.hl-comment { color: var(--text-muted); font-style: italic; }
.hl-number { color: var(--orange); }

/* Light theme overrides for source viewer */
[data-theme="light"] .source-modal-content { background: #fff; }
[data-theme="light"] .source-code { background: #f7f9fc; color: #1a2332; }
[data-theme="light"] .hl-linenum { color: #a0aec0; }
[data-theme="light"] .hl-comment { color: #718096; }
[data-theme="light"] .hl-string { color: #0a7558; }
[data-theme="light"] .hl-keyword { color: #7c3aed; }

/* ============================================================
   RESPONSIVE — Hamburger Button
   ============================================================ */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius);
  flex-shrink: 0;
  margin-right: 4px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ============================================================
   RESPONSIVE — Sidebar Backdrop
   ============================================================ */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 499;
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar-backdrop.visible {
  display: block;
  opacity: 1;
}

/* ============================================================
   RESPONSIVE — Mobile Bottom Nav
   ============================================================ */
.mobile-bottom-nav {
  display: none;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 6px 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item:active { transform: scale(0.95); }
.mobile-nav-item.active { color: var(--accent); }
.mobile-nav-item.active svg { stroke: var(--accent); }

/* ============================================================
   RESPONSIVE — Mobile Tab Picker (bottom sheet)
   ============================================================ */
.mobile-tab-picker-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 599;
}
.mobile-tab-picker-overlay.visible { display: block; }

.mobile-tab-picker {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 600;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.35s var(--ease-out-expo);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
  max-height: 70vh;
  overflow-y: auto;
}
.mobile-tab-picker.open {
  display: block;
  transform: translateY(0);
}

.mobile-tab-picker-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-light);
  margin: 0 auto 12px;
}

.mobile-tab-picker-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-align: center;
}

.mobile-tab-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mobile-tab-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.mobile-tab-picker-item:active { transform: scale(0.95); }
.mobile-tab-picker-item.active { background: rgba(0, 170, 255, 0.12); color: var(--accent); }

/* ============================================================
   RESPONSIVE — Builder FABs (mobile only)
   ============================================================ */
.builder-fab {
  display: none;
  position: fixed;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  z-index: 400;
  box-shadow: var(--shadow-md);
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.builder-fab:active { transform: scale(0.92); }
.builder-fab-palette { bottom: calc(var(--bottom-nav-height) + 20px); left: 16px; }
.builder-fab-params { bottom: calc(var(--bottom-nav-height) + 20px); right: 16px; background: var(--ugc-dore); }

/* ============================================================
   RESPONSIVE — Tablet (641-1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .sidebar-toggle { display: flex; }

  .layout {
    grid-template-columns: 0px 1fr;
    transition: grid-template-columns 0.3s var(--ease-out-expo);
  }
  .layout.sidebar-expanded {
    grid-template-columns: var(--sidebar-width) 1fr;
  }

  .sidebar {
    min-width: 0;
    overflow: hidden;
  }
  .layout.sidebar-expanded .sidebar {
    overflow-y: auto;
  }

  /* Tabs scrollable */
  .tabs {
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; white-space: nowrap; }

  /* Builder 2 columns */
  .builder-layout {
    grid-template-columns: 1fr 280px;
  }
  .builder-palette {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease-out-expo);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
  }
  .builder-palette.open {
    transform: translateX(0);
  }

  /* Env selector compact */
  .env-label { display: none; }
  .env-selector { margin-left: 8px; }

  /* Header title hide on smaller tablets */
  .header-title-text { display: none; }
}

/* ============================================================
   RESPONSIVE — Mobile (<=640px)
   ============================================================ */
@media (max-width: 640px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) 1fr;
  }

  /* Sidebar as drawer */
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 85vw;
    max-width: 320px;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform 0.35s var(--ease-out-expo);
    background: var(--bg-secondary);
    box-shadow: none;
  }
  .sidebar.drawer-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
  }

  /* Header compact */
  .header { padding: 0 12px; gap: 8px; }
  .header-title-text { display: none; }
  .header-center { display: none; }
  .env-label { display: none; }
  .env-selector { margin-left: 4px; margin-right: 4px; }
  .env-btn { padding: 4px 10px; font-size: 10px; }

  /* Hide desktop tabs, show bottom nav */
  .tabs { display: none; }
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Main needs bottom padding for bottom nav */
  .main {
    padding-bottom: var(--bottom-nav-height);
  }

  /* Builder fully stacked */
  .builder-layout {
    grid-template-columns: 1fr;
  }
  .builder-palette {
    position: fixed;
    bottom: var(--bottom-nav-height);
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    max-width: none;
    height: 50vh;
    transform: translateY(100%);
    transition: transform 0.35s var(--ease-out-expo);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 400;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
  }
  .builder-palette.open {
    transform: translateY(0);
  }
  .builder-params {
    position: fixed;
    bottom: var(--bottom-nav-height);
    left: 0;
    right: 0;
    height: 50vh;
    transform: translateY(100%);
    transition: transform 0.35s var(--ease-out-expo);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 400;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
    border-left: none;
  }
  .builder-params.open {
    transform: translateY(0);
  }

  /* Show FABs when builder tab is active (toggled via JS) */
  body.builder-active .builder-fab {
    display: flex;
  }

  /* Canvas toolbar wrapping */
  .canvas-toolbar {
    flex-wrap: wrap;
    padding: 6px 8px;
    gap: 4px;
  }
  .canvas-toolbar-left,
  .canvas-toolbar-right {
    flex-wrap: wrap;
    gap: 4px;
  }
  .scenario-name-input { width: 120px; }

  /* Asserts stacked */
  .asserts-layout {
    grid-template-columns: 1fr;
  }
  .assert-form-section {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  /* Chains stacked */
  .chains-layout {
    grid-template-columns: 1fr;
  }
  .chain-results {
    border-left: none;
    border-top: 1px solid var(--border);
  }

  /* Results responsive */
  .results-summary { flex-direction: column; padding: 12px; }
  .stat-card { min-width: 100%; }
  .results-donut-wrapper { flex-direction: column; align-items: flex-start; padding: 12px; }

  /* Gallery smaller cards */
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    padding: 12px;
  }

  /* Modals full-screen */
  .modal-content,
  .focus-modal-content,
  .source-modal-content {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }

  /* Toasts above bottom nav */
  #toastContainer {
    bottom: calc(var(--bottom-nav-height) + 12px);
    left: 12px;
    right: 12px;
  }
  .toast { max-width: 100%; }

  /* Toolbars wrap */
  .prog-toolbar,
  .cat-toolbar,
  .hc-toolbar,
  .fw-toolbar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
  }
  .prog-film-input { flex: 1 1 100%; }
  .cat-compare-input { width: 100%; }
  .hc-compare-input { width: 100%; }

  /* Programmation grid */
  .prog-grid {
    grid-template-columns: 1fr;
    padding: 12px;
    max-height: calc(100dvh - 240px);
  }

  /* Film watcher grid */
  .fw-grid {
    grid-template-columns: 1fr;
    padding: 12px;
    max-height: calc(100dvh - 240px);
  }

  /* Film watcher log drawer full width */
  .fw-log-drawer {
    width: 100vw;
    max-width: 100vw;
  }

  /* Focus modal body single column (already exists at 700px) */
  .focus-body { grid-template-columns: 1fr; }
  .focus-right { border-left: none; border-top: 1px solid var(--border); }

  /* Summary */
  .summary-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .summary-bottom { grid-template-columns: 1fr; }
  .summary-layout { padding: 12px; }

  /* Templates grid single column */
  .templates-grid { grid-template-columns: 1fr; }

  /* History chart smaller */
  .history-chart { height: 120px; padding: 12px; }
}

/* ============================================================
   RESPONSIVE — Tablet breakpoint for panels
   ============================================================ */
@media (min-width: 641px) and (max-width: 1024px) {
  .asserts-layout {
    grid-template-columns: 1fr;
  }
  .assert-form-section {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .chains-layout {
    grid-template-columns: 1fr;
  }
  .chain-results {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* ============================================================
   RESPONSIVE — Light theme overrides for new components
   ============================================================ */
[data-theme="light"] .sidebar-backdrop {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .mobile-bottom-nav {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .mobile-tab-picker {
  background: var(--bg-secondary);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .mobile-tab-picker-item {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

[data-theme="light"] .mobile-tab-picker-item.active {
  background: rgba(0, 170, 255, 0.1);
  color: var(--accent);
}

[data-theme="light"] .builder-fab {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .header {
  background: var(--bg-secondary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* ============================================================
   RESPONSIVE — Touch targets + iOS polish
   ============================================================ */
@media (max-width: 640px) {
  /* Minimum 44px touch targets */
  .btn-sm { min-height: var(--min-tap-target); padding: 10px 14px; }
  .btn-xs { min-height: 36px; padding: 6px 12px; }
  .tag-btn { min-height: 36px; padding: 8px 14px; }
  .test-item { min-height: var(--min-tap-target); padding: 10px 8px; }
  .env-btn { min-height: 36px; }

  /* Prevent iOS auto-zoom on input focus */
  input, select, textarea { font-size: 16px !important; }
}

/* Safe area insets for iPhone notch/home indicator */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
  @media (max-width: 640px) {
    .sidebar {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}

/* ============================================================
   Accessibility: respect user motion preferences
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Accessibility: focus-visible
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   Confirm modal (custom replacement for native confirm())
   ============================================================ */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 100000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.15s ease-out;
}

.confirm-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.confirm-dialog p {
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

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