/* ============================================================
   CAD Group — VoIP & WebRTC Diagnostics UI Style
   ============================================================ */

:root {
  --bg-main: #0B132B;
  --bg-card: rgba(26, 38, 57, 0.75);
  --bg-card-hover: rgba(36, 52, 77, 0.9);
  --border: rgba(255, 255, 255, 0.1);
  --border-focus: #3B82F6;
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-glow: rgba(59, 130, 246, 0.25);
  
  --success: #10B981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #06B6D4;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
}

/* Light theme support */
[data-theme="light"] {
  --bg-main: #F1F5F9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: #FFFFFF;
  --border: #E2E8F0;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --primary-glow: rgba(59, 130, 246, 0.15);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Header ── */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #1E3A8A, #3B82F6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text p {
  font-size: 12px;
  color: var(--text-secondary);
}

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

/* ── 3-Zones Health Overview ── */
.zones-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 860px) {
  .zones-grid {
    grid-template-columns: 1fr;
  }
}

.zone-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.zone-card.status-good { border-left: 4px solid var(--success); }
.zone-card.status-warn { border-left: 4px solid var(--warning); }
.zone-card.status-danger { border-left: 4px solid var(--danger); }

.zone-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zone-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.zone-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 4px;
}

.badge-good { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

.zone-name {
  font-size: 16px;
  font-weight: 600;
}

.zone-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.zone-score-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.zone-score-val {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
}

/* ── Controls Section ── */
.control-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.controls-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 180px;
}

.control-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.control-select, .control-input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 12px;
  height: 42px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

[data-theme="light"] .control-select, [data-theme="light"] .control-input {
  background: #FFFFFF;
}

.control-select:focus, .control-input:focus {
  border-color: var(--border-focus);
}

.btn {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed !important;
  pointer-events: none;
  filter: grayscale(0.5);
  transform: none !important;
  box-shadow: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, #2563EB, #3B82F6);
  color: #FFFFFF;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1D4ED8, #2563EB);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #DC2626, #EF4444);
  color: #FFFFFF;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ── Live Test Dashboard Grid ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 990px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(12px);
}

.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-val {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Real-Time Call Simulation & Audio Visualizer ── */
.call-monitor {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .call-monitor {
    grid-template-columns: 1fr;
  }
}

.call-timer-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3B82F6, #10B981);
  width: 0%;
  transition: width 0.3s ease;
}

.audio-visualizer-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

canvas#audio-canvas {
  width: 100%;
  height: 60px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

/* ── Timeline of Events ── */
.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

.timeline-item.sev-warn { border-left-color: var(--warning); background: var(--warning-bg); }
.timeline-item.sev-danger { border-left-color: var(--danger); background: var(--danger-bg); }
.timeline-item.sev-good { border-left-color: var(--success); }

.timeline-time {
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

.timeline-zone {
  font-weight: 700;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}

/* ── Modal Dialog for Full Report ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100050 !important;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#media-help-modal.modal-overlay,
#queue-detail-modal.modal-overlay,
#guide-help-modal.modal-overlay,
#audio-help-modal.modal-overlay,
#transport-help-modal.modal-overlay,
#report-modal.modal-overlay {
  z-index: 100050 !important;
}

#media-help-modal .modal-content,
#queue-detail-modal .modal-content,
#guide-help-modal .modal-content,
#audio-help-modal .modal-content,
#transport-help-modal .modal-content,
#report-modal .modal-content {
  position: relative !important;
  z-index: 100051 !important;
}

.modal-content {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  position: sticky;
  top: -24px;
  background: var(--bg-main);
  z-index: 10;
  margin: -24px -24px 16px -24px;
  padding: 20px 24px 14px 24px;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
  color: #EF4444;
  transform: scale(1.08);
}

.report-verdict-box {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 13px;
  line-height: 1.6;
}

.report-section-block {
  margin-top: 22px;
  margin-bottom: 14px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.report-table th, .report-table td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.report-table th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 600;
}

.test-guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-left: 4px solid var(--primary);
  transition: all 0.3s ease;
}

.guide-content-box {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.guide-step-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.guide-step-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.speedtest-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  text-align: center;
}

/* ── Responsive Mobile & Tablet Design ── */

@media (max-width: 1024px) {
  .zones-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .guide-content-box {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .speedtest-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .scores-grid-modal {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 14px;
  }
  .header-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }
  .logo-text h1 {
    font-size: 17px;
  }
  .logo-text p {
    font-size: 12px;
  }
  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .control-group {
    width: 100%;
    min-width: 100%;
  }
  .action-btn-group {
    width: 100%;
  }
  .action-btn-group button {
    width: 100%;
  }
  .call-monitor {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .speedtest-grid {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .modal-content {
    padding: 16px;
    max-height: 95vh;
  }
  .scores-grid-modal {
    grid-template-columns: 1fr 1fr !important;
  }
  .modal-actions-bar button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .logo-text h1 {
    font-size: 15px;
  }
  .logo-area {
    gap: 8px;
  }
  .logo-icon {
    font-size: 20px;
    width: 38px;
    height: 38px;
  }
  .scores-grid-modal {
    grid-template-columns: 1fr !important;
  }
}

/* ── Sequential Monitoring (Mode Sentinelle) Styles ── */
.seq-preset-btn {
  transition: all 0.2s ease;
}
.seq-preset-btn.active {
  background: #8B5CF6 !important;
  border-color: #8B5CF6 !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
}
.seq-timeline-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: #F8FAFC;
  cursor: pointer;
  transition: all 0.2s ease;
}
.seq-timeline-pill:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: rgba(30, 41, 59, 0.9);
}
.seq-timeline-pill.good {
  border-left: 3px solid #10B981;
}
.seq-timeline-pill.warn {
  border-left: 3px solid #F59E0B;
}
.seq-timeline-pill.danger {
  border-left: 3px solid #EF4444;
}
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.7; }
}

/* ── Print / PDF Professional Executive Optimization ── */
@media print {
  @page {
    size: A4 portrait;
    margin: 16mm 14mm 16mm 14mm;
  }

  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 10pt !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Isolation stricte : masquer TOUT le contenu d'arrière-plan ET toutes les autres modales */
  body > .container,
  #guide-help-modal,
  #audio-help-modal,
  #modal-session-history-strip,
  .modal-overlay:not(#report-modal),
  header, .header, .control-panel, .timeline-card, .test-guide-card,
  .status-bar, .modal-actions-bar, #btn-close-modal, #btn-ack-guide-help,
  #btn-ack-audio-help, .modal-close-btn, .export-storage-warning,
  .themed-alert-overlay, #queue-box, #speedtest-panel, .btn,
  .zones-grid, #running-panel, .metrics-grid {
    display: none !important;
    visibility: hidden !important;
  }

  /* Affichage exclusif de la modale de rapport en pleine page */
  #report-modal.modal-overlay {
    display: block !important;
    position: static !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  #report-modal .modal-content {
    display: block !important;
    position: static !important;
    background: #ffffff !important;
    color: #0f172a !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* En-tête officiel du rapport (fond blanc pur, texte noir contrasté, sans bandeau sombre) */
  #report-modal .modal-header, .modal-header {
    position: static !important;
    background: #ffffff !important;
    color: #0f172a !important;
    margin: 0 0 16px 0 !important;
    padding: 0 0 10px 0 !important;
    border-bottom: 2px solid #0f172a !important;
    box-shadow: none !important;
  }

  #report-modal .modal-header * {
    background: transparent !important;
  }

  #report-modal .modal-header h3, #report-modal .modal-header .modal-title {
    color: #0f172a !important;
    font-size: 16pt !important;
    font-weight: 800 !important;
    margin: 0 !important;
  }

  #report-modal .modal-header p, #report-modal .modal-header .modal-subtitle {
    color: #334155 !important;
    font-size: 9.5pt !important;
    margin: 4px 0 0 0 !important;
  }

  /* Empêcher les titres orphelins en bas de page */
  h1, h2, h3, h4, .modal-title, summary, .report-section-block > h4 {
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    color: #0f172a !important;
  }

  /* Section Usages & Titre */
  .report-section-block {
    margin-top: 24px !important;
    padding-top: 8px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Blocs et Cartes Indivisibles */
  .table-responsive-box, .report-verdict-box, #rep-methodology-box,
  #rep-usages-grid, details, .timeline-card, .scores-grid-modal,
  table, tr, td, th, tbody, thead {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Encadré Méthodologie */
  #rep-methodology-box {
    background: #eff6ff !important;
    border: 1px solid #bfdbfe !important;
    color: #1e3a8a !important;
    margin-bottom: 12px !important;
  }

  #rep-methodology-title {
    color: #1e3a8a !important;
  }

  #rep-methodology-desc {
    color: #334155 !important;
  }

  /* Encadré Verdict */
  .report-verdict-box {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
    padding: 10px 14px !important;
  }

  /* Tableaux Récapitulatif et Benchmark */
  .table-responsive-box {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    margin: 8px 0 !important;
  }

  table {
    width: 100% !important;
    border-collapse: collapse !important;
    background: #ffffff !important;
  }

  table tr {
    border-bottom: 1px solid #e2e8f0 !important;
  }

  table th {
    background: #f1f5f9 !important;
    color: #1e293b !important;
    font-weight: 700 !important;
    padding: 6px 8px !important;
    font-size: 9pt !important;
    border: 1px solid #cbd5e1 !important;
  }

  table td {
    color: #0f172a !important;
    padding: 6px 8px !important;
    font-size: 9pt !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
  }

  table td strong {
    color: #0f172a !important;
  }

  /* Cartes d'Éligibilité des Usages Réseau */
  #rep-usages-grid {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-bottom: 10px !important;
  }

  #rep-usages-grid > div {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    color: #0f172a !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  #rep-usages-grid > div strong {
    color: #0f172a !important;
    font-size: 9.5pt !important;
  }

  #rep-usages-grid > div div {
    color: #334155 !important;
    font-size: 8.5pt !important;
  }

  /* Scores par Zone */
  .scores-grid-modal {
    margin: 10px 0 !important;
  }

  .scores-grid-modal > div {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 6px !important;
  }

  .scores-grid-modal > div > div:first-child {
    color: #475569 !important;
    font-weight: 700 !important;
    font-size: 8pt !important;
  }

  .scores-grid-modal > div > div:last-child {
    color: #15803d !important;
    font-size: 13pt !important;
    font-weight: 800 !important;
  }

  #rep-score-global {
    color: #1d4ed8 !important;
  }

  /* Guide des Métriques (Plus aucun gris sur gris !) */
  details {
    display: block !important;
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 10px 12px !important;
    margin-top: 10px !important;
  }

  details summary {
    color: #0f172a !important;
    font-size: 10pt !important;
    font-weight: 800 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding-bottom: 4px !important;
    margin-bottom: 8px !important;
  }

  details > div > div {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    padding: 6px 8px !important;
    color: #1e293b !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  details > div > div strong {
    color: #0f172a !important;
    font-size: 9pt !important;
  }

  details > div > div p {
    color: #334155 !important;
    font-size: 8pt !important;
    margin: 3px 0 !important;
  }

  details > div > div span {
    font-size: 8pt !important;
    font-weight: 700 !important;
  }

  /* Badges */
  .zone-badge {
    display: inline-block !important;
    padding: 2px 8px !important;
    font-size: 8.5pt !important;
    font-weight: 700 !important;
    border-radius: 4px !important;
    border: 1px solid transparent !important;
  }

  .badge-good {
    background: #dcfce7 !important;
    color: #15803d !important;
    border-color: #86efac !important;
  }

  .badge-warn {
    background: #fef9c3 !important;
    color: #a16207 !important;
    border-color: #fde047 !important;
  }

  .badge-danger {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
  }

  /* Remplacement forcé de toutes les couleurs claires en couleurs contrastées sombres */
  [style*="#60A5FA"], [style*="color:#60A5FA"], [style*="color: #60A5FA"] {
    color: #1e40af !important;
  }
  [style*="#34D399"], [style*="color:#34D399"], [style*="color: #34D399"] {
    color: #15803d !important;
  }
  [style*="#10B981"], [style*="color:#10B981"], [style*="color: #10B981"] {
    color: #15803d !important;
  }
  [style*="#A7F3D0"], [style*="color:#A7F3D0"] {
    color: #15803d !important;
  }
  [style*="#FBBF24"], [style*="color:#FBBF24"], [style*="color: #FBBF24"] {
    color: #9a3412 !important;
  }
  [style*="#F87171"], [style*="color:#F87171"], [style*="color: #F87171"] {
    color: #991b1b !important;
  }
  [style*="#94A3B8"], [style*="#CBD5E1"], [style*="#94a3b8"] {
    color: #475569 !important;
  }
  [style*="color:var(--text-muted)"], [style*="color: var(--text-muted)"], .text-muted {
    color: #475569 !important;
  }
  [style*="color:var(--text-secondary)"], [style*="color: var(--text-secondary)"] {
    color: #334155 !important;
  }
  [style*="color:var(--text-primary)"], [style*="color: var(--text-primary)"] {
    color: #0f172a !important;
  }
  [style*="color:var(--primary)"], [style*="color: var(--primary)"] {
    color: #1e40af !important;
  }
}

/* ── Themed Alert & Dialog Modal ── */
.themed-alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 29, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.themed-alert-overlay.active {
  opacity: 1;
  visibility: visible;
}

.themed-alert-box {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(59, 130, 246, 0.25);
  border-radius: 16px;
  width: 90%;
  max-width: 440px;
  padding: 24px;
  text-align: center;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: #f8fafc;
}

.themed-alert-overlay.active .themed-alert-box {
  transform: scale(1);
}

.themed-alert-icon {
  font-size: 38px;
  line-height: 1;
  margin-bottom: 14px;
  display: inline-block;
}

.themed-alert-title {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.themed-alert-message {
  font-size: 13.5px;
  color: #94a3b8;
  line-height: 1.5;
  margin-bottom: 20px;
}

.themed-alert-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 10px 28px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transition: all 0.18s ease;
  outline: none;
}

.themed-alert-btn:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.themed-alert-btn:active {
  transform: translateY(0);
}

/* ============================================================
   HUD Dédié & Compte à Rebours Central SIP ALG
   ============================================================ */
.sipalg-hud-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 19, 43, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.sipalg-hud-card {
  background: linear-gradient(145deg, #1E293B, #0F172A);
  border: 2px solid #8B5CF6;
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(139, 92, 246, 0.35);
  max-width: 680px;
  width: 100%;
  padding: 24px;
  text-align: center;
  color: #F8FAFC;
  position: relative;
  overflow: hidden;
  max-height: 90vh;
  overflow-y: auto;
}

.sipalg-hud-card.paused {
  border-color: #F59E0B;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(245, 158, 11, 0.35);
}

.sipalg-hud-card.success {
  border-color: #10B981;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(16, 185, 129, 0.35);
}

.sipalg-hud-timer-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.15);
  border: 3px solid #8B5CF6;
  color: #DDD6FE;
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 10px;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
  font-family: var(--font-mono);
}

.sipalg-hud-card.paused .sipalg-hud-timer-badge {
  border-color: #F59E0B;
  color: #FBBF24;
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.sipalg-hud-card.success .sipalg-hud-timer-badge {
  border-color: #10B981;
  color: #34D399;
  background: rgba(16, 185, 129, 0.15);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}


