/* ============== CSS Reset & Variables ============== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* SentryXP-inspired palette */
  --color-pass: #71b06c;
  --color-pass-bg: #dff0dd;
  --color-pass-border: #b8ddb5;
  --color-fail: #e05252;
  --color-fail-bg: #fdeaea;
  --color-fail-border: #f5bcbc;
  --color-timeout: #e8a838;
  --color-timeout-bg: #fdf3de;
  --color-timeout-border: #f5dda0;
  --color-info: #4c6bcd;
  --color-info-bg: #e3f0ff;
  --color-info-border: #c5d5f5;
  --color-bg: #f1f3fa;
  --color-surface: #ffffff;
  --color-text: #080331;
  --color-text-muted: #555770;
  --color-text-light: #8b8fa8;
  --color-border: #e2e6f8;
  --color-primary: #4c6bcd;
  --color-primary-hover: #3a56b0;
  --color-danger: #e05252;
  --color-danger-hover: #c93c3c;
  --shadow-sm: 0 1px 3px rgba(8,3,49,0.06);
  --shadow-md: 0 4px 6px -1px rgba(8,3,49,0.08), 0 2px 4px -2px rgba(8,3,49,0.05);
  --shadow-lg: 0 10px 20px -4px rgba(8,3,49,0.12), 0 4px 8px -4px rgba(8,3,49,0.06);
  --radius: 12px;
  --radius-sm: 8px;

  /* New feature variables */
  --color-warning: #e8a838;
  --color-warning-bg: #fdf3de;
  --color-warning-border: #f5dda0;
  --color-warning-hover: #d49520;
  --color-response-fast: #71b06c;
  --color-response-medium: #e8a838;
  --color-response-slow: #e05252;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

/* ============== Header ============== */
.app-header {
  background: linear-gradient(135deg, #4c6bcd, #080331);
  color: white;
  padding: 20px 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-logo { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.header-left h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.header-left .subtitle { font-size: 0.85rem; opacity: 0.8; }
.header-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.mode-toggle {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.mode-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}
.mode-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.mode-btn.active { background: rgba(255,255,255,0.25); color: white; }

.btn {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-run {
  background: white;
  color: var(--color-primary);
}
.btn-run:hover { background: #f0f0ff; transform: translateY(-1px); }
.btn-run:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-stop {
  background: var(--color-danger);
  color: white;
  display: none;
}
.btn-stop:hover { background: var(--color-danger-hover); }
.btn-outline {
  padding: 8px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-outline:hover { border-color: #4c6bcd; color: #3a56b0; background: #eef2fc; }
.btn-outline:disabled { opacity: 0.4; cursor: not-allowed; }
.header-link { text-decoration: none; color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.1); font-size: 0.82rem; }
.header-link:hover { color: white; border-color: rgba(255,255,255,0.5); background: rgba(255,255,255,0.15); }

/* ============== Main Content ============== */
.main-content { padding: 24px 0 48px; }

/* ============== Summary Cards ============== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-border);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.card-total { border-left-color: var(--color-info); }
.stat-card.card-pass { border-left-color: var(--color-pass); }
.stat-card.card-fail { border-left-color: var(--color-fail); }
.stat-card.card-timeout { border-left-color: var(--color-timeout); }
.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.stat-label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-total .stat-icon { background: var(--color-info-bg); color: var(--color-info); }
.card-pass .stat-icon { background: var(--color-pass-bg); color: var(--color-pass); }
.card-fail .stat-icon { background: var(--color-fail-bg); color: var(--color-fail); }
.card-timeout .stat-icon { background: var(--color-timeout-bg); color: var(--color-timeout); }
.stat-value { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.card-total .stat-value { color: var(--color-info); }
.card-pass .stat-value { color: var(--color-pass); }
.card-fail .stat-value { color: var(--color-fail); }
.card-timeout .stat-value { color: var(--color-timeout); }
.stat-subtitle { font-size: 0.75rem; color: var(--color-text-light); margin-top: 4px; }

/* Pass rate card - special */
.summary-cards-wrapper {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}
.pass-rate-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 12px 20px;
  box-shadow: var(--shadow-sm);
}
.pass-rate-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.pass-rate-track {
  flex: 1;
  height: 10px;
  background: var(--color-fail-bg);
  border-radius: 5px;
  overflow: hidden;
}
.pass-rate-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--color-pass);
  transition: width 0.6s ease;
}
.pass-rate-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-pass);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.slow-videos-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(234, 179, 8, 0.15);
  color: #d97706;
  border: 1px solid rgba(234, 179, 8, 0.35);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s;
}
.slow-videos-pill:hover { background: rgba(234, 179, 8, 0.25); }

/* ============== Progress Section ============== */
.progress-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: none;
}
.progress-section.visible { display: block; }

.phase-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.phase {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--color-bg);
  color: var(--color-text-muted);
  transition: all 0.3s;
}
.phase.active { background: #4c6bcd; color: white; }
.phase.done { background: var(--color-pass-bg); color: var(--color-pass); }
.phase-arrow { color: var(--color-text-light); font-size: 1.2rem; }

.progress-bar-wrapper {
  height: 12px;
  background: var(--color-bg);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4c6bcd, #7b94e0);
  border-radius: 6px;
  transition: width 0.4s ease;
  width: 0%;
}
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}
.current-video {
  font-size: 0.9rem;
  color: var(--color-text);
  padding: 8px 12px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  min-height: 36px;
}

/* ============== Activity Log ============== */
.log-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.log-header:hover { background: var(--color-bg); }
.log-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.log-header h3 svg { color: var(--color-text-light); flex-shrink: 0; }
.log-count-badge {
  font-size: 0.68rem;
  font-weight: 700;
  background: var(--color-bg);
  color: var(--color-text-muted);
  padding: 1px 7px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.log-toggle { font-size: 0.75rem; color: var(--color-text-muted); transition: transform 0.2s; }
.log-toggle.open { transform: rotate(180deg); }
.log-body {
  display: none;
  max-height: 300px;
  overflow-y: auto;
  padding: 0 24px 16px;
  border-top: 1px solid var(--color-border);
}
.log-body.open { display: block; }
.log-entry {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.78rem;
  padding: 5px 0;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.log-entry:last-child { border-bottom: none; }
.log-entry .log-time {
  color: var(--color-text-light);
  flex-shrink: 0;
  font-size: 0.72rem;
}
.log-entry .log-msg { flex: 1; }
.log-entry.error { color: var(--color-fail); }
.log-entry.error .log-time { color: var(--color-fail); opacity: 0.7; }
.log-entry.success .log-msg { color: var(--color-pass); font-weight: 600; }

/* ============== Section Breakdown ============== */
.section-breakdown {
  margin-bottom: 24px;
  display: none;
}
.section-breakdown.visible { display: block; }
.section-breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-breakdown-header h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.section-recheck-select {
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  outline: none;
}
.section-recheck-select:focus { border-color: var(--color-primary); }
.section-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) { .section-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px)  { .section-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px)  { .section-grid { grid-template-columns: 1fr; } }
.section-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.section-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.section-name { font-weight: 600; font-size: 0.95rem; }
.section-page-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}
.badge-story { background: #e2e6f8; color: #3a56b0; }
.badge-music { background: #f5e0f0; color: #a14d8a; }
.section-bar-wrapper {
  height: 8px;
  background: var(--color-fail-bg);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.section-bar-fill {
  height: 100%;
  background: var(--color-pass);
  border-radius: 4px;
  transition: width 0.5s ease;
}
.section-stats {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.section-stats .pass-count { color: var(--color-pass); font-weight: 600; }
.section-stats .fail-count { color: var(--color-fail); font-weight: 600; }

/* ============== Results Table ============== */
.results-section {
  display: none;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}
.results-section.visible { display: block; }
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 12px;
}
.results-header h2 { font-size: 1.15rem; font-weight: 700; }
.table-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.table-controls select, .table-controls input {
  padding: 7px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s;
}
.table-controls select:focus, .table-controls input:focus { border-color: var(--color-primary); }
.table-controls input { width: 200px; }
.result-count { font-size: 0.8rem; color: var(--color-text-muted); }

.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-bottom: 2px solid var(--color-border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s;
}
thead th:hover { color: var(--color-primary); }
thead th .sort-arrow { margin-left: 4px; font-size: 0.7rem; }
tbody tr {
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
  cursor: pointer;
}
tbody tr:hover { background: #f8fafc; }
tbody td {
  padding: 10px 16px;
  font-size: 0.88rem;
  vertical-align: middle;
}
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-PASS { background: var(--color-pass-bg); color: var(--color-pass); border: 1px solid var(--color-pass-border); }
.status-FAIL { background: var(--color-fail-bg); color: var(--color-fail); border: 1px solid var(--color-fail-border); }
.status-TIMEOUT { background: var(--color-timeout-bg); color: var(--color-timeout); border: 1px solid var(--color-timeout-border); }
.detail-row td {
  padding: 0;
  cursor: default;
}
.detail-content {
  padding: 12px 16px 12px 48px;
  background: #f8fafc;
  font-size: 0.82rem;
  line-height: 1.8;
}
.detail-content a { color: var(--color-primary); word-break: break-all; }
.detail-content strong { color: var(--color-text); }

/* ============== Download Section ============== */
.download-section {
  display: none;
  margin-bottom: 24px;
}
.download-section.visible { display: block; }
.download-section h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 16px; }
.download-buttons { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============== Empty State ============== */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}
.empty-state-icon { font-size: 4rem; margin-bottom: 16px; }
.empty-state h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; color: var(--color-text); }
.empty-state p { color: var(--color-text-muted); font-size: 1rem; max-width: 400px; margin: 0 auto; }

/* ============== Responsive ============== */
@media (max-width: 768px) {
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .stat-value { font-size: 1.6rem; }
  /* Header title fits on one line when stacked vertically */
  .header-left h1 { font-size: 1.25rem; letter-spacing: -0.01em; white-space: nowrap; }
}

/* ============== Spinner ============== */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2.5px solid rgba(76,107,205,0.25);
  border-top-color: #4c6bcd;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* ============== Progress Modal ============== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,3,49,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 700px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0 4px;
}
.modal-close:hover { color: var(--color-text); }
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #f4f5f7;
}
.modal-step:last-child { border-bottom: none; }
.step-icon { font-size: 1rem; width: 22px; text-align: center; }
.step-name { flex: 1; }
.step-name.active { font-weight: 600; color: var(--color-primary); }
.modal-log-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin: 16px 0 8px;
}
.modal-log {
  background: #0a0825;
  color: #c4cbde;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============== Print Styles ============== */
#print-report { display: none; }

@media print {
  body > *:not(#print-report) { display: none !important; }
  #print-report { display: block !important; }
  @page { margin: 0.5in; size: 11in 8.5in; }
}
#print-report {
  padding: 24px 28px;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #111;
  background: #fff;
}

/* Header */
.print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 3px solid #4f46e5;
  padding-bottom: 12px;
  margin-bottom: 20px;
}
.print-header-left h1 { font-size: 1.4rem; margin: 0 0 2px; color: #1e1b4b; }
.print-header-left p { font-size: 0.8rem; color: #6b7280; margin: 0; }
.print-header-right { text-align: right; font-size: 0.78rem; color: #6b7280; }
.print-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.print-badge.pass { background: #dcfce7; color: #15803d; }
.print-badge.fail { background: #fef2f2; color: #dc2626; }

/* Stat row */
.print-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.print-stat-card {
  flex: 1;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  background: #f9fafb;
}
.print-stat-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em; color: #6b7280; margin-bottom: 4px; }
.print-stat-value { font-size: 1.5rem; font-weight: 700; color: #111; }
.print-stat-value.green { color: #16a34a; }
.print-stat-value.red { color: #dc2626; }

/* Section breakdown cards */
.print-section-title { font-size: 0.9rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #374151; margin: 18px 0 10px; border-left: 3px solid #4f46e5; padding-left: 8px; }
.print-section-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.print-section-card {
  flex: 1 1 calc(25% - 8px);
  min-width: 160px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f9fafb;
}
.print-section-name { font-size: 0.82rem; font-weight: 700; color: #1e1b4b; margin-bottom: 2px; }
.print-section-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.print-section-tag.story { background: #ede9fe; color: #6d28d9; }
.print-section-tag.music { background: #fce7f3; color: #be185d; }
.print-section-bar-bg { height: 5px; background: #e5e7eb; border-radius: 3px; margin-bottom: 6px; }
.print-section-bar { height: 5px; background: #22c55e; border-radius: 3px; }
.print-section-bar.has-fail { background: #ef4444; }
.print-section-counts { font-size: 0.72rem; color: #6b7280; display: flex; justify-content: space-between; }
.print-section-counts .green { color: #16a34a; font-weight: 600; }
.print-section-counts .red { color: #dc2626; font-weight: 600; }

/* Results table */
.print-table { width: 100%; border-collapse: collapse; margin: 8px 0 20px; font-size: 0.72rem; }
.print-table th { background: #f3f4f6; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #374151; padding: 6px 8px; border-bottom: 2px solid #d1d5db; text-align: left; }
.print-table td { padding: 5px 8px; border-bottom: 1px solid #f0f0f0; color: #374151; }
.print-table tr:nth-child(even) td { background: #f9fafb; }
.print-fail td { background: #fef2f2 !important; }
.print-timeout td { background: #fffbeb !important; }
.print-status-pass { color: #16a34a; font-weight: 600; }
.print-status-fail { color: #dc2626; font-weight: 600; }
.print-status-timeout { color: #d97706; font-weight: 600; }


/* ========================================================================
   NEW FEATURES
   ======================================================================== */

/* ============== 1. Health Summary Banner ============== */
.health-banner {
  display: none;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
}
.health-banner.visible { display: flex; }

.health-banner-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  min-height: 100%;
}
.health-banner.health-green .health-banner-icon { background: var(--color-pass); color: white; }
.health-banner.health-yellow .health-banner-icon { background: var(--color-timeout); color: white; }
.health-banner.health-red .health-banner-icon { background: var(--color-fail); color: white; }

.health-banner-body {
  flex: 1;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.health-banner-text {
  flex: 1;
  min-width: 200px;
}
.health-banner-text .health-message {
  font-size: 1rem;
  font-weight: 600;
}
.health-banner-text .health-detail {
  font-size: 0.82rem;
  font-weight: 400;
  margin-top: 2px;
  opacity: 0.85;
}
.health-banner-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.health-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(0,0,0,0.06);
  white-space: nowrap;
}
.health-metric-pill svg { flex-shrink: 0; }
.health-metric-pill .metric-value { font-variant-numeric: tabular-nums; }

/* Green: healthy (>= 99% pass) */
.health-banner.health-green {
  background: var(--color-pass-bg);
  border: 1.5px solid var(--color-pass-border);
  color: #2d6629;
}
.health-banner.health-green .health-metric-pill { background: rgba(45,102,41,0.1); }

/* Yellow: warning (90-99% pass) */
.health-banner.health-yellow {
  background: var(--color-timeout-bg);
  border: 1.5px solid var(--color-timeout-border);
  color: #7a5a11;
}
.health-banner.health-yellow .health-metric-pill { background: rgba(122,90,17,0.1); }

/* Red: critical (< 90% pass) */
.health-banner.health-red {
  background: var(--color-fail-bg);
  border: 1.5px solid var(--color-fail-border);
  color: #8b2020;
}
.health-banner.health-red .health-metric-pill { background: rgba(139,32,32,0.1); }

/* ============== 2. Last Checked Info Bar ============== */
.last-checked-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}
.last-checked-bar.visible { display: flex; }

.last-checked-bar .last-checked-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.last-checked-bar .last-checked-label .check-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: var(--color-pass-bg);
  color: var(--color-pass);
  border: 1px solid var(--color-pass-border);
}
.last-checked-bar .last-checked-datetime {
  font-weight: 600;
  color: var(--color-text);
}
.last-checked-bar .last-checked-relative {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-light);
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: 10px;
}
.last-checked-bar .last-checked-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============== 3. Re-check Failed Button ============== */
.btn-recheck {
  padding: 8px 18px;
  border: 1.5px solid var(--color-warning-border);
  border-radius: var(--radius-sm);
  background: var(--color-warning-bg);
  color: #7a5a11;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-recheck:hover {
  background: #f9ebb8;
  border-color: var(--color-warning);
  color: #5c430a;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-recheck:active {
  transform: translateY(0);
  box-shadow: none;
}
.btn-recheck:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-recheck .recheck-icon {
  font-size: 0.95rem;
}
.btn-recheck .recheck-count {
  background: var(--color-warning);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 2px;
}

/* ============== 4. Health Badge Display ============== */
.health-badge-section {
  display: none;
  margin-bottom: 24px;
}
.health-badge-section.visible { display: block; }

.health-badge-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text);
}

.health-badge-container {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.health-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  overflow: hidden;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  line-height: 1;
  text-decoration: none;
  color: inherit;
}
.health-badge .badge-label {
  background: #555770;
  color: white;
  padding: 5px 10px;
}
.health-badge .badge-value {
  padding: 5px 10px;
  color: white;
}
.health-badge .badge-value.badge-passing {
  background: var(--color-pass);
}
.health-badge .badge-value.badge-degraded {
  background: var(--color-warning);
}
.health-badge .badge-value.badge-failing {
  background: var(--color-fail);
}

.badge-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.badge-card-preview { flex-shrink: 0; }
.badge-card-url { flex: 1; min-width: 200px; }
.badge-card-url label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-url-row { display: flex; gap: 8px; align-items: center; }
.badge-url-row input {
  flex: 1;
  padding: 7px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  color: var(--color-text-muted);
  background: var(--color-bg);
  outline: none;
  transition: border-color 0.2s;
}
.badge-url-row input:focus { border-color: var(--color-primary); }
.btn-copy-badge {
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-primary);
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.btn-copy-badge:hover { background: var(--color-primary); color: #fff; }
.badge-card-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 6px 0 0;
}
.health-badge-embed {
  margin-top: 10px;
}
.health-badge-embed label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 4px;
}
.health-badge-embed input {
  width: 100%;
  max-width: 500px;
  padding: 7px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  color: var(--color-text-muted);
  background: var(--color-bg);
  outline: none;
  transition: border-color 0.2s;
}
.health-badge-embed input:focus {
  border-color: var(--color-primary);
}

/* ============== 5. Trend Chart Container ============== */
.trend-chart-section {
  display: none;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.trend-chart-section.visible { display: block; }

.trend-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.trend-chart-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.trend-chart-header h2 svg { color: var(--color-text-light); }
.trend-chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.trend-chart-controls select {
  padding: 6px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.trend-chart-controls select:focus {
  border-color: var(--color-primary);
}

.trend-chart-canvas {
  width: 100%;
  min-height: 220px;
  max-height: 340px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
  padding: 8px 4px;
}
.trend-chart-canvas svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.trend-chart-canvas .trend-empty {
  font-size: 0.9rem;
  color: var(--color-text-light);
  text-align: center;
  padding: 40px 20px;
}

/* Chart tooltip */
.chart-tooltip {
  position: absolute;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.78rem;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
}
.chart-tooltip.visible { opacity: 1; }
.chart-tooltip-title { font-weight: 600; color: var(--color-text); margin-bottom: 4px; }
.chart-tooltip-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chart-tooltip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.chart-tooltip-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Chart bar hover */
.trend-chart-canvas svg rect.chart-bar { transition: opacity 0.15s; cursor: pointer; }
.trend-chart-canvas svg rect.chart-bar:hover { opacity: 1 !important; filter: brightness(1.1); }

/* Chart legend */
.trend-chart-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 12px;
}
.trend-chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}
.trend-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.trend-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.trend-legend-dot.dot-pass { background: var(--color-pass); }
.trend-legend-dot.dot-fail { background: var(--color-fail); }
.trend-legend-dot.dot-timeout { background: var(--color-timeout); }
.trend-legend-dot.dot-total { background: var(--color-info); }
.trend-chart-summary {
  font-size: 0.78rem;
  color: var(--color-text-light);
}

/* ============== 6. Response Time Indicators ============== */
.response-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.response-time .rt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Fast: under 3 seconds -- green */
.response-time.rt-fast { color: var(--color-response-fast); }
.response-time.rt-fast .rt-dot { background: var(--color-response-fast); }

/* Medium: 3 to 8 seconds -- yellow/orange */
.response-time.rt-medium { color: var(--color-response-medium); }
.response-time.rt-medium .rt-dot { background: var(--color-response-medium); }

/* Slow: over 8 seconds -- red */
.response-time.rt-slow { color: var(--color-response-slow); }
.response-time.rt-slow .rt-dot { background: var(--color-response-slow); }

/* Response time column in table */
.response-time-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.response-time-bar .rt-bar-track {
  flex: 1;
  height: 6px;
  background: var(--color-bg);
  border-radius: 3px;
  overflow: hidden;
  max-width: 80px;
}
.response-time-bar .rt-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.response-time-bar .rt-bar-fill.rt-fill-fast { background: var(--color-response-fast); }
.response-time-bar .rt-bar-fill.rt-fill-medium { background: var(--color-response-medium); }
.response-time-bar .rt-bar-fill.rt-fill-slow { background: var(--color-response-slow); }

/* Response time summary in stat cards area */
.response-time-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}
.response-time-summary .rts-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.response-time-summary .rts-label {
  font-weight: 500;
}
.response-time-summary .rts-value {
  font-weight: 700;
}
.response-time-summary .rts-value.rts-fast { color: var(--color-response-fast); }
.response-time-summary .rts-value.rts-medium { color: var(--color-response-medium); }
.response-time-summary .rts-value.rts-slow { color: var(--color-response-slow); }

/* ============== 7. Diff Report Section ============== */
.diff-report {
  display: none;
  background: var(--color-surface);
  border-radius: var(--radius);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.diff-report.visible { display: block; }

.diff-report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--color-border);
}
.diff-report-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}
.diff-report-header .diff-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.diff-report-body {
  padding: 20px 24px;
}

.diff-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.diff-card {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--color-border);
}
.diff-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.diff-card-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
}

/* New failures: red theme */
.diff-card.diff-new-failures {
  background: var(--color-fail-bg);
  border-left-color: var(--color-fail);
}
.diff-card.diff-new-failures .diff-card-label { color: #8b2020; }
.diff-card.diff-new-failures .diff-card-value { color: var(--color-fail); }

/* Fixed since last run: green theme */
.diff-card.diff-fixed {
  background: var(--color-pass-bg);
  border-left-color: var(--color-pass);
}
.diff-card.diff-fixed .diff-card-label { color: #2d6629; }
.diff-card.diff-fixed .diff-card-value { color: var(--color-pass); }

/* Unchanged failures: neutral/gray theme */
.diff-card.diff-unchanged {
  background: var(--color-bg);
  border-left-color: var(--color-text-light);
}
.diff-card.diff-unchanged .diff-card-label { color: var(--color-text-muted); }
.diff-card.diff-unchanged .diff-card-value { color: var(--color-text-muted); }

/* Diff detail lists */
.diff-detail-group {
  margin-bottom: 16px;
}
.diff-detail-group:last-child { margin-bottom: 0; }

.diff-detail-group h4 {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.diff-detail-group h4 .diff-icon {
  font-size: 0.95rem;
}
.diff-detail-group.diff-group-new h4 { color: var(--color-fail); }
.diff-detail-group.diff-group-fixed h4 { color: var(--color-pass); }
.diff-detail-group.diff-group-unchanged h4 { color: var(--color-text-muted); }

.diff-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.diff-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  font-size: 0.84rem;
  border-bottom: 1px solid #f4f5f7;
  transition: background 0.1s;
}
.diff-list li:last-child { border-bottom: none; }
.diff-list li:hover { background: #f8fafc; }

.diff-list .diff-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.diff-list .diff-status-dot.dot-new-fail { background: var(--color-fail); }
.diff-list .diff-status-dot.dot-fixed { background: var(--color-pass); }
.diff-list .diff-status-dot.dot-unchanged { background: var(--color-text-light); }

.diff-list .diff-video-name {
  flex: 1;
  color: var(--color-text);
}
.diff-list .diff-video-section {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.diff-empty {
  font-size: 0.85rem;
  color: var(--color-text-light);
  font-style: italic;
  padding: 12px 0;
}

/* ============== 8. Screenshot Thumbnail ============== */
.screenshot-thumb {
  display: inline-block;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  max-width: 160px;
}
.screenshot-thumb:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.screenshot-thumb img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.screenshot-thumb .screenshot-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(8, 3, 49, 0.7);
  color: white;
  font-size: 0.68rem;
  font-weight: 500;
  padding: 3px 8px;
  text-align: center;
}

/* Screenshot in the detail/expanded row */
.detail-screenshot {
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.detail-screenshot .screenshot-thumb {
  max-width: 220px;
}

/* Full-size screenshot overlay (lightbox) */
.screenshot-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 3, 49, 0.85);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: zoom-out;
}
.screenshot-lightbox.open { display: flex; }
.screenshot-lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  object-fit: contain;
}
.screenshot-lightbox .lightbox-close {
  position: absolute;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.screenshot-lightbox .lightbox-close:hover { opacity: 1; }

/* ============== Responsive Additions for New Features ============== */
@media (max-width: 768px) {
  .health-banner { font-size: 0.95rem; }
  .health-banner-body { flex-direction: column; gap: 10px; }
  .health-banner-metrics { justify-content: flex-start; }
  .last-checked-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .diff-summary-cards {
    grid-template-columns: 1fr;
  }
  .trend-chart-canvas {
    min-height: 180px;
  }
  .health-badge-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .response-time-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .pass-rate-bar { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .diff-summary-cards {
    grid-template-columns: 1fr;
  }
  .diff-card-value {
    font-size: 1.4rem;
  }
  .screenshot-thumb {
    max-width: 120px;
  }

  /* Header: shrink title so it fits on one line */
  .header-left h1 { font-size: 1.1rem; letter-spacing: -0.01em; }
  .header-left .subtitle { font-size: 0.75rem; }
  .header-logo { width: 30px; height: 30px; }

  /* Badge URL: stack input + Copy button vertically */
  .badge-url-row { flex-direction: column; align-items: stretch; }
  .badge-url-row input { width: 100%; min-width: 0; }
  .btn-copy-badge { width: 100%; justify-content: center; }

  /* Section breakdown header: stack on very small screens */
  .section-breakdown-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-recheck-select { width: 100%; }

  /* Heatmap legend: full-width wrap */
  .heatmap-legend { gap: 6px; }
  .heatmap-legend-note { width: 100%; margin-top: 4px; }

  /* Container: tighter padding on small phones */
  .container { padding: 0 12px; }
}

/* ============== Credentials Modal ============== */
.credentials-modal {
  max-width: 420px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(76, 107, 205, 0.15);
}

.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.password-toggle:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

.remember-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.remember-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.credentials-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.credentials-note svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--color-info);
}

.cred-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.cred-btn-primary {
  width: 100%;
  justify-content: center;
}

.cred-btn-secondary {
  width: 100%;
  justify-content: center;
  background: var(--color-surface);
  color: var(--color-danger);
  border: 1.5px solid var(--color-danger);
}

.cred-btn-secondary:hover {
  background: var(--color-fail-bg);
}

.btn-recheck-modal .recheck-count {
  background: var(--color-danger);
  color: white;
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: 10px;
  margin-left: 6px;
  font-weight: 700;
}

/* ============== Pagination ============== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0 8px;
  flex-wrap: wrap;
}

.pagination-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-info-bg);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-pages {
  display: flex;
  gap: 4px;
}

.pagination-pages button {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-pages button:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.pagination-pages button.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

.pagination-pages .page-ellipsis {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.pagination-info {
  margin-left: 12px;
}

.pagination-info select {
  padding: 8px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 0.82rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.pagination-info select:focus {
  outline: none;
  border-color: var(--color-primary);
}

@media (max-width: 600px) {
  .pagination {
    gap: 6px;
  }
  .pagination-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
  .pagination-pages button {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }
  .pagination-info {
    margin-left: 0;
    margin-top: 8px;
  }
}

/* ============== Auto-Refresh Bar ============== */
.auto-refresh-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--color-info);
  margin-bottom: 16px;
}
.auto-refresh-bar svg { flex-shrink: 0; }
.auto-refresh-dismiss {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-info);
  opacity: 0.6;
  padding: 2px;
}
.auto-refresh-dismiss:hover { opacity: 1; }

/* ============== Sound Toggle ============== */
.sound-toggle {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.sound-toggle:hover {
  background: rgba(255,255,255,0.2);
  color: white;
  border-color: rgba(255,255,255,0.4);
}
.sound-toggle .icon-sound-on,
.sound-toggle .icon-sound-off { display: none; }
.sound-toggle.sound-enabled .icon-sound-on { display: block; }
.sound-toggle:not(.sound-enabled) .icon-sound-off { display: block; }

/* ============== Uptime Section ============== */
.uptime-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.uptime-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.uptime-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.uptime-card {
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
}
.uptime-card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.uptime-card-value {
  font-size: 1.6rem;
  font-weight: 700;
}
.uptime-card-value.uptime-good { color: var(--color-pass); }
.uptime-card-value.uptime-warn { color: var(--color-timeout); }
.uptime-card-value.uptime-bad { color: var(--color-fail); }
.uptime-card-sub {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 2px;
}

/* ============== Watchlist Section ============== */
.watchlist-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.watchlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.watchlist-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}
.watchlist-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.watchlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: background 0.15s;
}
.watchlist-item:hover { background: var(--color-info-bg); }
.watchlist-item .wl-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.watchlist-item .wl-status.status-PASS { background: var(--color-pass); }
.watchlist-item .wl-status.status-FAIL { background: var(--color-fail); }
.watchlist-item .wl-status.status-TIMEOUT { background: var(--color-timeout); }
.watchlist-item .wl-title { flex: 1; font-weight: 500; }
.watchlist-item .wl-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  padding: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.watchlist-item:hover .wl-remove { opacity: 1; }
.watchlist-item .wl-remove:hover { color: var(--color-fail); }
.watchlist-empty {
  color: var(--color-text-light);
  font-size: 0.85rem;
  font-style: italic;
  padding: 8px 0;
}

/* Star/favorite button in results table */
.star-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  font-size: 1.1rem;
  padding: 0 4px;
  transition: color 0.15s;
}
.star-btn:hover { color: var(--color-timeout); }
.star-btn.starred { color: var(--color-timeout); }

.video-title-link {
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}
.video-title-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.screenshot-indicator {
  font-size: 0.75rem;
  margin-left: 4px;
  opacity: 0.6;
}

/* ============== Recheck Actions ============== */
.recheck-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.section-recheck-select {
  padding: 8px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  cursor: pointer;
}
.section-recheck-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* ============== Heatmap Section ============== */
.heatmap-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.heatmap-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}
.heatmap-cell {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.heatmap-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  z-index: 1;
}
.heatmap-cell-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.heatmap-cell-time {
  font-size: 0.72rem;
  opacity: 0.8;
}
.heatmap-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}
/* Playwright explanation note shown above the color dots */
.heatmap-legend-playwright-note {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  opacity: 0.85;
  font-style: italic;
}
.heatmap-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.heatmap-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.heatmap-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
/* Real-browser equivalent time shown in muted smaller text */
.heatmap-legend-real {
  opacity: 0.6;
  font-size: 0.7rem;
}

/* ============== Comparison Section ============== */
.comparison-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.comparison-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.comparison-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}
.comparison-selects {
  display: flex;
  align-items: center;
  gap: 10px;
}
.comparison-selects select {
  padding: 8px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.82rem;
  cursor: pointer;
}
.comparison-selects select:focus {
  outline: none;
  border-color: var(--color-primary);
}
.comparison-body {
  font-size: 0.85rem;
}
.comparison-table {
  width: 100%;
  border-collapse: collapse;
}
.comparison-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  background: var(--color-bg);
}
.comparison-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.84rem;
}
.comparison-table tr:hover { background: var(--color-bg); }
.comparison-table .comp-changed {
  background: var(--color-warning-bg);
}
.comp-arrow {
  display: inline-block;
  margin: 0 6px;
  color: var(--color-text-light);
}

/* ============== Video Detail Modal ============== */
.video-detail-modal {
  max-width: 700px;
  max-height: 80vh;
}
.video-detail-modal .modal-body {
  overflow-y: auto;
  max-height: 60vh;
}
.video-history-chart {
  margin-bottom: 16px;
}
.video-history-list {
  list-style: none;
  padding: 0;
}
.video-history-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.84rem;
  border-bottom: 1px solid var(--color-border);
}
.video-history-list li:last-child { border-bottom: none; }
.vh-date { color: var(--color-text-muted); font-size: 0.78rem; min-width: 120px; }
.vh-status { font-weight: 600; }
.vh-status.status-PASS { color: var(--color-pass); }
.vh-status.status-FAIL { color: var(--color-fail); }
.vh-status.status-TIMEOUT { color: var(--color-timeout); }
.vh-load { color: var(--color-text-light); font-size: 0.78rem; }

/* ============== Comparison Modal ============== */
.comparison-modal {
  max-width: 900px;
  max-height: 80vh;
}
.comparison-modal .modal-body {
  overflow-y: auto;
  max-height: 60vh;
}

/* ============== Bulk Actions ============== */
.bulk-actions-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card-bg);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
  z-index: 50;
  border-radius: 8px 8px 0 0;
}
.bulk-actions-bar span {
  font-weight: 600;
  margin-right: 8px;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 0.82rem;
  border-radius: 4px;
}
tr.false-positive {
  opacity: 0.5;
  text-decoration: line-through;
}
.row-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

/* ============== Schedule Settings ============== */
.settings-section {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  margin-top: 16px;
}
.settings-section h3 {
  margin-bottom: 12px;
}
/* Schedule: read-only info row showing the GitHub Actions cron times */
.schedule-info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.schedule-note {
  margin-top: 8px;
  color: var(--color-text-muted);
}
.schedule-note code {
  font-size: 0.8rem;
  background: rgba(255,255,255,0.07);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Push notifications: dimmed "not available" state */
.push-unavailable {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* ============================================================
   POLISH — Animations, Toasts, Skeletons, Personality
   ============================================================ */

/* ---- Toast Notifications ---- */
/* Stack of transient feedback messages in bottom-right corner */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 3px solid var(--color-border);
  pointer-events: all;
  max-width: 300px;
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--color-text);
}
.toast-success { border-left-color: var(--color-pass); }
.toast-error   { border-left-color: var(--color-fail); }
.toast-info    { border-left-color: var(--color-info); }
.toast.removing { animation: toast-out 0.25s ease forwards; }
@keyframes toast-in  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(0); opacity: 1; }   to { transform: translateX(110%); opacity: 0; } }
.toast-icon { font-size: 1rem; flex-shrink: 0; }

/* ---- Modal Slide-in ---- */
/* Modals animate up from a slight offset on open */
.modal-overlay.open .modal {
  animation: modal-in 0.25s cubic-bezier(0.34, 1.2, 0.64, 1);
}
@keyframes modal-in {
  from { transform: translateY(24px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ---- Skeleton Loaders ---- */
/* Used while cloud report is fetching */
.skeleton {
  background: linear-gradient(90deg, var(--color-bg) 25%, #e8ecf4 50%, var(--color-bg) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.4s ease-in-out infinite;
  border-radius: 4px;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.stat-value.skeleton {
  display: inline-block;
  width: 3.5rem;
  height: 2.2rem;
  vertical-align: middle;
}

/* ---- Counter Animation ---- */
/* .counting class applied during number count-up */
.stat-value.counting { transition: color 0.2s; }

/* ---- Section Cards Entrance ---- */
/* Cards start hidden; IntersectionObserver adds .in-view when they scroll into view */
@keyframes section-enter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.section-card {
  opacity: 0;
  transition: box-shadow 0.2s, transform 0.2s;
}
/* Animation fires only when JS adds .in-view (triggered by scroll into viewport) */
.section-card.in-view {
  animation: section-enter 0.4s ease both;
}
.section-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ---- Heatmap Cell Fade-in ---- */
.heatmap-cell {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.35s ease, transform 0.35s ease, filter 0.2s;
}
.heatmap-cell.visible {
  opacity: 1;
  transform: scale(1);
}
.heatmap-cell:hover {
  filter: brightness(0.93);
  z-index: 1;
}

/* ---- Health Banner Pulse (red state) ---- */
/* Gentle pulsing glow to draw attention to failures */
.health-banner.health-red {
  animation: health-pulse 2.5s ease-in-out 3;
}
@keyframes health-pulse {
  0%, 100% { box-shadow: var(--shadow-md); }
  50%       { box-shadow: 0 0 0 6px rgba(224, 82, 82, 0.18), var(--shadow-md); }
}

/* ---- Health Banner Celebrate (100% green) ---- */
.health-banner.health-green .health-message::after {
  content: ' 🎉';
}

/* ---- Pass Rate Bar Entrance ---- */
/* Bar starts at 0; the width transition in existing CSS handles the animation */
.pass-rate-fill {
  transition: width 1s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ---- Progress Steps ---- */
/* Smoother transition for phase badges */
.phase {
  transition: background 0.4s ease, color 0.4s ease, box-shadow 0.3s;
}
.phase.active {
  box-shadow: 0 0 0 3px rgba(76, 107, 205, 0.2);
}

/* ---- Better Empty State ---- */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  animation: fade-up 0.5s ease;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.empty-state-illustration {
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e3ebff, #f0e3ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: 0 8px 24px rgba(76,107,205,0.12);
}
.empty-state-features {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.empty-state-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  max-width: 90px;
}
.empty-state-feature-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ---- Direct Link Button in Detail Row ---- */
.btn-open-page {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-surface);
  color: var(--color-primary);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
  margin-top: 6px;
}
.btn-open-page:hover { border-color: var(--color-primary); background: #eef2fc; }

/* ---- Keyboard Shortcut Badges ---- */
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.12);
  color: var(--color-text-muted);
  font-family: monospace;
  letter-spacing: 0;
  vertical-align: middle;
}

/* ---- Run Button Glow on Hover ---- */
.btn-run:hover:not(:disabled) {
  box-shadow: 0 0 0 3px rgba(255,255,255,0.3);
}

/* ---- Result Row Status Colors ---- */
/* Subtle row tinting for failed/timeout rows */
tbody tr.row-fail   { background: rgba(224, 82, 82, 0.03); }
tbody tr.row-timeout { background: rgba(232, 168, 56, 0.03); }
tbody tr.row-fail:hover   { background: rgba(224, 82, 82, 0.07); }
tbody tr.row-timeout:hover { background: rgba(232, 168, 56, 0.07); }

/* ---- Stat Cards Slide-up Entrance ---- */
/* Each card enters from below with a slight spring. Delays stagger left→right. */
@keyframes stat-card-enter {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-card {
  animation: stat-card-enter 0.55s cubic-bezier(0.34, 1.3, 0.64, 1) both;
}
.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 70ms; }
.stat-card:nth-child(3) { animation-delay: 140ms; }
.stat-card:nth-child(4) { animation-delay: 210ms; }
.stat-card:nth-child(5) { animation-delay: 280ms; }

/* ---- Section Card Hover Glow ---- */
/* Override the basic hover with a more dramatic lift + shadow */
.section-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 32px rgba(76, 107, 205, 0.18);
}

/* ---- Section Bar Fill Animation ---- */
/* Bar starts at 0% width in JS, then transitions to the real value */
.section-bar-fill {
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Results Table Row Entrance ---- */
/* Rows slide in from the left, staggered via inline animation-delay */
@keyframes row-enter {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
tbody tr.row-animated {
  animation: row-enter 0.28s ease both;
}

/* ---- Health Banner Green Shimmer ---- */
/* Subtle moving highlight gives the green banner a live feel */
@keyframes banner-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}
.health-banner.health-green {
  background: linear-gradient(
    105deg,
    var(--color-pass-bg) 0%,
    var(--color-pass-bg) 38%,
    #d1fae5 50%,
    var(--color-pass-bg) 62%,
    var(--color-pass-bg) 100%
  );
  background-size: 300% 100%;
  animation: banner-shimmer 5s ease-in-out infinite;
}

/* ============================================================
   INTRO OVERLAY — one-shot splash screen
   ============================================================ */
#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #0d1121 0%, #161c38 55%, #1a1230 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Ambient radial glow behind the logo */
.intro-bg-glow {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 107, 205, 0.18) 0%, transparent 70%);
  animation: intro-glow-pulse 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes intro-glow-pulse {
  0%, 100% { transform: scale(1);   opacity: 0.7; }
  50%       { transform: scale(1.1); opacity: 1; }
}

.intro-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}

/* Logo bounces in with a spring */
.intro-logo-wrap {
  margin-bottom: 24px;
  animation: intro-logo-in 0.7s cubic-bezier(0.34, 1.3, 0.64, 1) 0.15s both;
}
@keyframes intro-logo-in {
  from { transform: scale(0.4) translateY(24px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}
.intro-logo {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow: 0 0 48px rgba(76, 107, 205, 0.45), 0 8px 24px rgba(0,0,0,0.4);
}

/* Title and tagline fade up */
@keyframes intro-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.intro-title {
  font-size: 2.4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  animation: intro-fade-up 0.6s ease 0.55s both;
}
.intro-tagline {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 44px;
  font-weight: 400;
  animation: intro-fade-up 0.6s ease 0.8s both;
}

/* Enter button — fades in, then pulses */
@keyframes btn-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(76, 107, 205, 0.5), 0 6px 24px rgba(76,107,205,0.3); }
  50%       { box-shadow: 0 0 0 14px rgba(76, 107, 205, 0),  0 6px 24px rgba(76,107,205,0.3); }
}
.intro-enter-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 36px;
  background: #4c6bcd;
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  animation: intro-fade-up 0.6s ease 1.05s both,
             btn-glow-pulse 2.4s ease-in-out 1.8s infinite;
  transition: transform 0.15s ease, background 0.15s;
}
.intro-enter-btn:hover {
  transform: scale(1.05);
  background: #5b7ae0;
}
.intro-enter-btn:active { transform: scale(0.97); }

/* "or wait Ns" hint */
.intro-skip {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.25);
  margin: 18px 0 0;
  animation: intro-fade-up 0.5s ease 1.5s both;
}
#intro-countdown { font-variant-numeric: tabular-nums; }

/* Exit: overlay fades out and scales away */
@keyframes intro-out {
  0%   { opacity: 1; transform: scale(1);    }
  100% { opacity: 0; transform: scale(1.06); pointer-events: none; }
}
#intro-overlay.dismissing {
  animation: intro-out 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: none;
}

/* ---- Heatmap Live Animations ---- */

/* Radar scan line: a vertical beam sweeps left→right across the grid every 9s */
#heatmap-grid {
  position: relative;
  overflow: hidden;
}
@keyframes heatmap-scan {
  0%   { left: -8%;  opacity: 0; }
  4%   { opacity: 1; }
  96%  { opacity: 1; }
  100% { left: 108%; opacity: 0; }
}
#heatmap-grid::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -8%;
  width: 48px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.07) 50%, transparent 100%);
  animation: heatmap-scan 9s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  pointer-events: none;
  z-index: 2;
}

/* Slow cell heartbeat: orange cells breathe, red cells beat faster */
@keyframes cell-heartbeat {
  0%, 100% { opacity: 1;    box-shadow: none; }
  50%       { opacity: 0.72; box-shadow: 0 0 8px rgba(249, 115, 22, 0.35); }
}
@keyframes cell-heartbeat-fast {
  0%, 100% { opacity: 1;    box-shadow: none; }
  50%       { opacity: 0.68; box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
}
.heatmap-cell.visible.heatmap-slow {
  animation: cell-heartbeat 2.8s ease-in-out infinite;
}
.heatmap-cell.visible.heatmap-very-slow {
  animation: cell-heartbeat-fast 1.9s ease-in-out infinite;
}

/* ---- Stat Card Enhancements ---- */

/* Position relative so ::after shimmer pseudo-element is contained */
.stat-card { position: relative; }

/* Color-matched hover glow — each card glows its own accent color */
.stat-card.card-total:hover   { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(76, 107, 205, 0.28); }
.stat-card.card-pass:hover    { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(34, 197, 94,  0.28); }
.stat-card.card-fail:hover    { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(224, 82, 82,  0.28); }
.stat-card.card-timeout:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(232, 168, 56, 0.28); }

/* Left border pulse — brief colored glow along the accent border on load */
@keyframes border-pulse {
  0%   { box-shadow: var(--shadow-sm); }
  40%  { box-shadow: -5px 0 18px 0 var(--stat-pulse-color), var(--shadow-md); }
  100% { box-shadow: var(--shadow-sm); }
}
.stat-card.card-total   { --stat-pulse-color: rgba(76, 107, 205, 0.45); }
.stat-card.card-pass    { --stat-pulse-color: rgba(34, 197, 94,  0.45); }
.stat-card.card-fail    { --stat-pulse-color: rgba(224, 82, 82,  0.45); }
.stat-card.card-timeout { --stat-pulse-color: rgba(232, 168, 56, 0.45); }

/* Run both entrance + border-pulse as a sequence */
.stat-card {
  animation: stat-card-enter 0.55s cubic-bezier(0.34, 1.3, 0.64, 1) both,
             border-pulse     0.7s ease-out both;
}
/* Delays: first value = entrance, second = border pulse (fires after entrance) */
.stat-card:nth-child(1) { animation-delay:   0ms, 620ms; }
.stat-card:nth-child(2) { animation-delay:  70ms, 690ms; }
.stat-card:nth-child(3) { animation-delay: 140ms, 760ms; }
.stat-card:nth-child(4) { animation-delay: 210ms, 830ms; }
.stat-card:nth-child(5) { animation-delay: 280ms, 900ms; }

/* Stat icon bounce in after the card settles */
@keyframes icon-bounce {
  0%   { transform: scale(0) rotate(-20deg); opacity: 0; }
  65%  { transform: scale(1.25) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg);   opacity: 1; }
}
.stat-icon {
  animation: icon-bounce 0.4s cubic-bezier(0.34, 1.5, 0.64, 1) both;
}
.stat-card:nth-child(1) .stat-icon { animation-delay: 480ms; }
.stat-card:nth-child(2) .stat-icon { animation-delay: 550ms; }
.stat-card:nth-child(3) .stat-icon { animation-delay: 620ms; }
.stat-card:nth-child(4) .stat-icon { animation-delay: 690ms; }
.stat-card:nth-child(5) .stat-icon { animation-delay: 760ms; }

/* Number pop — scale bounce after count-up finishes */
@keyframes counter-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.stat-value.counter-pop {
  animation: counter-pop 0.35s cubic-bezier(0.34, 1.6, 0.64, 1);
}

/* PASSED card celebration shimmer — via ::after so it doesn't fight entrance animation */
@keyframes pass-shimmer {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}
.stat-card.card-pass.celebrate::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(34, 197, 94, 0.08) 50%,
    transparent 62%
  );
  background-size: 300% 100%;
  animation: pass-shimmer 4s ease-in-out infinite;
}

/* ---- Confetti ---- */
/* Pure DOM confetti — tiny divs, CSS keyframe, auto-removed after animation */
.confetti-piece {
  position: fixed;
  border-radius: 2px;
  pointer-events: none;
  z-index: 9999;
  will-change: transform, opacity;
  animation: confetti-fall linear both;
}
@keyframes confetti-fall {
  0%   { transform: translateY(0)     rotate(var(--rot-start, 0deg)); opacity: 1; }
  100% { transform: translateY(360px) rotate(var(--rot-end, 720deg)); opacity: 0; }
}

/* ---- Trend Chart Bar-grow Animation ---- */
/* Bars start at scaleY(0) and grow up; triggered when chart scrolls into view */
.chart-bar {
  transform-box: fill-box;
  transform-origin: center bottom;
}
.trend-chart-ready .chart-bar {
  animation: bar-grow 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes bar-grow {
  from { transform: scaleY(0); opacity: 0; }
  to   { transform: scaleY(1); opacity: 0.85; }
}

/* ---- Jump to Failures button ---- */
.jump-failures-btn {
  position: fixed;
  bottom: 80px;
  left: 24px;
  z-index: 500;
  background: var(--color-fail);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 10px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(224, 82, 82, 0.35);
  display: none;
  align-items: center;
  gap: 6px;
  animation: slide-in-left 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
  transition: transform 0.15s, box-shadow 0.15s;
}
.jump-failures-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(224, 82, 82, 0.45);
}
@keyframes slide-in-left {
  from { transform: translateX(-130%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ---- Back to Top button ---- */
.back-to-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 500;
  width: 40px;
  height: 40px;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  color: var(--color-text);
  transition: transform 0.15s, box-shadow 0.15s;
  animation: fade-in-scale 0.3s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.back-to-top-btn:hover {
  transform: scale(1.12) translateY(-2px);
  box-shadow: var(--shadow-lg);
}
@keyframes fade-in-scale {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
/* Move toast container up so it doesn't sit on top of back-to-top button */
.toast-container { bottom: 72px; }

/* ---- Keyboard Shortcuts Modal ---- */
.shortcuts-list { display: flex; flex-direction: column; gap: 14px; }
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--color-text);
}

/* ---- Smooth Dark Mode Transition ---- */
body, .app-header, .stat-card, .section-card, .modal,
.health-banner, .last-checked-bar, .results-table, .btn,
.heatmap-cell, .section-bar-fill, .filter-bar {
  transition: background-color 0.22s ease, border-color 0.22s ease, color 0.15s ease;
}

/* ---- Result Count Flash ---- */
@keyframes count-flash {
  0%   { opacity: 0.3; transform: scale(0.92); }
  100% { opacity: 1;   transform: scale(1); }
}
.result-count-flash { animation: count-flash 0.22s ease; }

/* ---- Responsive for ≤480px ---- */
@media (max-width: 480px) {
  .toast-container { bottom: 16px; right: 16px; left: 16px; }
  .toast { max-width: 100%; }
  .empty-state-features { gap: 16px; }
}
