/* ============================================================
   PreChecker — Design System
   Inspired by WPMU DEV: clean, professional SaaS dashboard
   Dark mode · Blue accent · Generous spacing · Card-centric
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Custom Properties — WPMU DEV dark palette ─────────────── */
:root {
  --bg:           #111111;
  --surface:      #1A1A1A;
  --surface-2:    #242424;
  --border:       #333333;
  --border-light: #3D3D3D;

  --accent:       #0059FF;
  --accent-dim:   rgba(0,89,255,.12);
  --accent-hover: #3380FF;
  --accent-green: #1ABC9C;
  --accent-amber: #FF8A00;
  --accent-red:   #FF6D6D;

  --text:         #FFFFFF;
  --text-secondary:rgba(255,255,255,.7);
  --text-muted:   #AAAAAA;
  --text-dim:     #666666;

  --font-body:  'Roboto', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm:  6px;
  --radius:     8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  --transition: 180ms ease;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.3);
  --shadow:     0 2px 8px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 24px rgba(0,0,0,.5);
}

/* ── Light Theme Override ──────────────────────────────────── */
[data-theme="light"] {
  --bg:           #F4F5F7;
  --surface:      #FFFFFF;
  --surface-2:    #EDEEF1;
  --border:       #D8DAE0;
  --border-light: #C4C7CF;

  --accent:       #0059FF;
  --accent-dim:   rgba(0,89,255,.08);
  --accent-hover: #1A6FFF;
  --accent-green: #0F9D7A;
  --accent-amber: #D97706;
  --accent-red:   #DC3545;

  --text:         #1A1D23;
  --text-secondary:rgba(26,29,35,.72);
  --text-muted:   #6B7280;
  --text-dim:     #9CA3AF;

  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 2px 6px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 20px rgba(0,0,0,.1);
}

[data-theme="light"] .alert-error {
  color: var(--accent-red);
}

[data-theme="light"] .compare-slider__label {
  background: rgba(0,0,0,.55);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.app-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  height: 60px;
  gap: 2rem;
}

.app-brand {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  gap: .5rem;
  white-space: nowrap;
}

.app-brand__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 1;
}

.app-nav__link {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}

.app-nav__link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.app-nav__link.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.user-email {
  font-size: .8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .8rem;
  font-family: var(--font-body);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.btn-logout:hover {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(255,109,109,.05);
}

.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
}

.card-body {
  padding: 1.5rem;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.75rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: .3rem;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,89,255,.35);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 4px 14px rgba(0,89,255,.4); }

.btn-success {
  background: var(--accent-green);
  color: #fff;
  border-color: var(--accent-green);
}
.btn-success:hover { background: #17a78a; border-color: #17a78a; }

.btn-danger {
  background: transparent;
  color: var(--accent-red);
  border-color: var(--accent-red);
}
.btn-danger:hover { background: var(--accent-red); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-light); }

.btn-sm {
  padding: .35rem .7rem;
  font-size: .8rem;
}

.btn-lg {
  padding: .75rem 1.75rem;
  font-size: .95rem;
  border-radius: var(--radius);
}

.btn-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ── Status Badges ──────────────────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .65rem;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: .02em;
  text-transform: uppercase;
}

.status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status.pending  { background: rgba(254,207,47,.15); color: var(--accent-amber); }
.status.pending::before  { background: var(--accent-amber); }

.status.running  { background: var(--accent-dim); color: var(--accent-hover); }
.status.running::before  { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }

.status.completed { background: rgba(26,188,156,.15); color: var(--accent-green); }
.status.completed::before { background: var(--accent-green); }

.status.failed   { background: rgba(255,109,109,.15); color: var(--accent-red); }
.status.failed::before   { background: var(--accent-red); }

.status.cancelled { background: rgba(170,170,170,.12); color: var(--text-muted); }
.status.cancelled::before { background: var(--text-muted); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

/* ── Score Badges ─────────────────────────────────────────────── */
.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  padding: .15rem .45rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .8rem;
  font-weight: 700;
}

.score-good     { background: rgba(26,188,156,.18); color: var(--accent-green); }
.score-moderate { background: rgba(254,207,47,.18);  color: var(--accent-amber); }
.score-poor     { background: rgba(255,109,109,.18); color: var(--accent-red); }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .5rem;
}

.form-control {
  width: 100%;
  padding: .7rem .9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: .875rem;
  line-height: 1.5;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder { color: var(--text-dim); }

.form-help {
  font-size: .775rem;
  color: var(--text-muted);
  margin-top: .4rem;
}

.form-error {
  font-size: .8rem;
  color: var(--accent-red);
  margin-top: .4rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* Checkbox modules — WPMU DEV style option cards */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .6rem;
  margin-top: .25rem;
}

.module-option {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem 1rem;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.module-option:hover {
  border-color: var(--accent);
}

.module-option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-dim);
}

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

.module-option-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
}

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  padding: .65rem 1rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg);
}

tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

/* No row hover — only links highlight on hover */

.td-url {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-muted);
  max-width: 280px;
}

/* Flex row inside the URL cell — keeps the copy button visible while the
   URL text still ellipsises within remaining space. */
.td-url__row {
  display: flex;
  align-items: center;
  gap: .35rem;
}
.td-url__text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}
.td-url__copy {
  flex: 0 0 auto;
  padding: .15rem .35rem;
  font-size: .7rem;
  opacity: .85;
}
.td-url__copy:hover,
.td-url__copy.is-copied {
  opacity: 1;
}

.td-mono {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-muted);
}

.td-actions {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: nowrap;
}

/* ── PSI Score Summary Bar ──────────────────────────────────── */
.psi-summary {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.psi-summary__label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.psi-summary__item {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.psi-summary__vp {
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .25rem;
}

.psi-score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: .2rem .55rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 700;
}

.psi-score-badge.good     { background: rgba(26,188,156,.2); color: var(--accent-green); }
.psi-score-badge.moderate { background: rgba(254,207,47,.2);  color: var(--accent-amber); }
.psi-score-badge.poor     { background: rgba(255,109,109,.2); color: var(--accent-red); }

.psi-summary__count {
  font-size: .75rem;
  color: var(--text-dim);
}

/* ── Progress & Scan Status ─────────────────────────────────── */
.scan-progress {
  padding: 1.25rem 1.5rem;
  background: var(--accent-dim);
  border: 1px solid rgba(40,110,250,.15);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.scan-progress__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
  gap: 1rem;
}

.scan-progress__title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  font-weight: 600;
  color: var(--accent);
}

.scan-progress__percent {
  font-family: var(--font-mono);
  font-size: .875rem;
  font-weight: 700;
  color: var(--accent);
}

.progress-track {
  height: 6px;
  background: rgba(40,110,250,.1);
  border-radius: 3px;
  overflow: hidden;
}

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

.scan-progress__url {
  margin-top: .6rem;
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: .35rem;
}

/* ── Recovery banner + Activity log ────────────────────────── */
.recovery-banner {
  margin-top: .75rem;
  padding: .55rem .85rem;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.recovery-banner--warning {
  background: rgba(232, 156, 0, .12);
  border: 1px solid rgba(232, 156, 0, .35);
  color: #b07000;
}
.recovery-banner--danger {
  background: rgba(220, 60, 60, .1);
  border: 1px solid rgba(220, 60, 60, .35);
  color: #a83030;
}
.recovery-banner--recovered {
  margin: 0 0 1.25rem 0;
  background: rgba(40, 160, 90, .12);
  border: 1px solid rgba(40, 160, 90, .35);
  color: #1d7a48;
}

.scan-activity-log {
  margin: 0 0 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.scan-activity-log > summary {
  cursor: pointer;
  list-style: none;
  padding: .65rem .9rem;
  font-size: .85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .4rem;
  user-select: none;
}
.scan-activity-log > summary::-webkit-details-marker { display: none; }
.scan-activity-log > summary::before {
  content: "▶";
  font-size: .65rem;
  color: var(--text-muted);
  transition: transform .15s ease;
}
.scan-activity-log[open] > summary::before { transform: rotate(90deg); }
.scan-activity-log__hint {
  margin-left: auto;
  font-weight: 400;
  font-size: .72rem;
  color: var(--text-muted);
}
.scan-activity-log[open] .scan-activity-log__hint { display: none; }
.scan-activity-log__toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .35rem .9rem .15rem;
  border-top: 1px dashed var(--border);
  font-size: .72rem;
  color: var(--text-muted);
}
.scan-activity-log__autoscroll { display: flex; align-items: center; gap: .25rem; cursor: pointer; }
.btn-ghost-sm {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  padding: .15rem .55rem;
  border-radius: 4px;
  font-size: .7rem;
  cursor: pointer;
}
.btn-ghost-sm:hover { color: var(--text); border-color: var(--border-light); }
.scan-activity-log__stream {
  margin: 0;
  padding: .35rem 0;
  font-family: var(--font-mono);
  font-size: .72rem;
  line-height: 1.6;
  color: #d6deeb;
  background: #0d1117;
  max-height: 360px;
  overflow-y: auto;
  border-radius: 0 0 var(--radius) var(--radius);
  border-top: 1px solid rgba(255,255,255,.08);
  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}
.scan-activity-log__stream::-webkit-scrollbar { width: 8px; }
.scan-activity-log__stream::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }

.log-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem;
  padding: .15rem .9rem;
  border-left: 3px solid transparent;
  transition: background .12s ease;
}
.log-row:hover { background: rgba(255,255,255,.03); }

.log-time {
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  font-size: .68rem;
}
.log-level {
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .05rem .35rem;
  border-radius: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.log-ctx {
  color: #82aaff;
  font-size: .68rem;
  background: rgba(130,170,255,.08);
  padding: 0 .35rem;
  border-radius: 3px;
  flex-shrink: 0;
}
.log-event {
  color: #c792ea;
  font-weight: 600;
  flex-shrink: 0;
}
.log-msg {
  color: #d6deeb;
  word-break: break-word;
  flex: 1 1 auto;
  min-width: 0;
}
.log-url {
  color: #7fdbca;
  font-size: .68rem;
  word-break: break-all;
  flex-basis: 100%;
  margin-left: 4.5rem;
  opacity: .8;
}

/* Level-coded left border + level badge */
.log-lvl-warning { border-left-color: #f0b429; }
.log-lvl-warning .log-level { background: rgba(240,180,40,.18); color: #ffcf66; }
.log-lvl-error { border-left-color: #ef4444; background: rgba(239,68,68,.05); }
.log-lvl-error .log-level { background: rgba(239,68,68,.2); color: #fca5a5; }
.log-lvl-error .log-msg { color: #fca5a5; }

/* Event-type accents */
.log-evt-start .log-event { color: #82aaff; }
.log-evt-complete .log-event { color: #56d364; }
.log-evt-complete { border-left-color: rgba(86,211,100,.5); }
.log-evt-failed .log-event { color: #ef4444; }
.log-evt-failed { border-left-color: #ef4444; }
.log-evt-warn .log-event { color: #f0b429; }
.log-evt-restart {
  background: rgba(240,180,40,.07);
  border-left-color: #f0b429;
}
.log-evt-restart .log-event { color: #ffb454; font-weight: 700; }
.log-evt-watchdog .log-event { color: #ffb454; }
.log-evt-skip {
  opacity: .55;
}
.log-evt-skip .log-event { color: #6b7280; }

/* Informational accent (page_info, nav.cache_cleared, bypass_applied) */
.log-evt-info { border-left-color: rgba(130,170,255,.45); }
.log-evt-info .log-event { color: #82aaff; }

/* Progress ticks (scroll.progress, psi.progress) — subtle, no border */
.log-evt-progress { opacity: .8; }
.log-evt-progress .log-event { color: #5cd6cf; }
.log-evt-progress .log-msg { color: #9aa5b1; }

/* PageSpeed score badge */
.log-evt-score .log-event { color: #ffd166; font-weight: 700; }
.log-evt-score { border-left-color: rgba(255,209,102,.45); }

/* ── Per-result warning chips & retest button ──────────────── */
.result-warning {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: rgba(232, 156, 0, .14);
  color: #b07000;
  border: 1px solid rgba(232, 156, 0, .35);
  font-size: .68rem;
  font-weight: 600;
  cursor: help;
  white-space: nowrap;
}
.result-warning i { font-size: .72rem; }

.btn-retest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.btn-retest:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.btn-retest:disabled {
  cursor: progress;
  opacity: .6;
}
.btn-retest i { font-size: .9rem; }

.row-retesting {
  background: rgba(232, 156, 0, .05) !important;
}
.row-retesting td {
  opacity: .65;
}
.row-retesting .btn-retest {
  color: var(--accent);
  border-color: var(--accent);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Scan Detail Meta ───────────────────────────────────────── */
.scan-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: .75rem;
  margin-bottom: 1.75rem;
}

.scan-meta-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  box-shadow: var(--shadow-sm);
}

.scan-meta-item__label {
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: .3rem;
}

.scan-meta-item__value {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--text);
  font-weight: 500;
}

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state__icon {
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.empty-state__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .4rem;
}

.empty-state__text {
  font-size: .875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* ── Viewport label ─────────────────────────────────────────── */
.vp-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── File Link ──────────────────────────────────────────────── */
.file-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  color: var(--accent);
  font-size: .8rem;
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.file-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-family: var(--font-mono);
  text-decoration: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all var(--transition);
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .875rem;
  border: 1px solid;
  display: flex;
  gap: .5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.alert-error {
  background: rgba(255,109,109,.1);
  border-color: rgba(255,109,109,.25);
  color: #ff9090;
}

.alert-success {
  background: rgba(26,188,156,.1);
  border-color: rgba(26,188,156,.25);
  color: var(--accent-green);
}

.alert-info {
  background: var(--accent-dim);
  border-color: rgba(40,110,250,.2);
  color: var(--accent-hover);
}

/* ── URL list in scan card ──────────────────────────────────── */
.url-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.url-list li {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

/* ── New Scan Form ───────────────────────────────────────────── */
.scan-form-wrap {
  max-width: 720px;
}

.scan-hero {
  margin-bottom: 2rem;
}

.scan-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .5rem;
  font-weight: 600;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app-header__inner { padding: 0 1rem; gap: 1rem; }
  .main-content { padding: 1.25rem 1rem; }
  .user-email { display: none; }
  .page-header { flex-direction: column; }
  .scan-meta-grid { grid-template-columns: repeat(2, 1fr); }
  thead th:nth-child(3),
  tbody td:nth-child(3) { display: none; }
}

@media (max-width: 480px) {
  .app-nav__link span { display: none; }
  .module-grid { grid-template-columns: 1fr; }
  .scan-meta-grid { grid-template-columns: 1fr; }
}

/* ── Utility ─────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .875rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: .5rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* ── Image Comparison ──────────────────────────────────────── */

/* Upload form grid */
.compare-upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 768px) {
  .compare-upload-grid { grid-template-columns: 1fr; }
}

.file-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 2rem;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
  min-height: 140px;
}
.file-drop-zone:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.file-drop-zone i { font-size: 2rem; }
.file-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Tabs */
.compare-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
}
.compare-tab {
  padding: .5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.compare-tab:hover { background: var(--surface-2); color: var(--text); }
.compare-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Slider comparison */
.compare-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
}
.compare-slider__img-wrap { line-height: 0; }
.compare-slider__img {
  width: 100%;
  height: auto;
  display: block;
}
.compare-slider__overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  clip-path: inset(0 0 0 50%);
}
.compare-slider__overlay .compare-slider__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.compare-slider__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  z-index: 10;
}
.compare-slider__handle-line {
  flex: 1;
  width: 2px;
  background: var(--accent);
}
.compare-slider__handle-grip {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}
.compare-slider__label {
  position: absolute;
  top: .75rem;
  padding: .25rem .75rem;
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .03em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 5;
}
.compare-slider__label--before { left: .75rem; }
.compare-slider__label--after  { right: .75rem; }

/* Diff overlay view */
.compare-diff-view { text-align: center; }
.compare-diff-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.compare-diff-legend {
  margin-top: .75rem;
  color: var(--text-muted);
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.diff-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: rgba(255, 0, 255, 0.6);
}

/* Side by side */
.compare-side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 768px) {
  .compare-side-by-side { grid-template-columns: 1fr; }
}
.compare-side__title {
  font-size: .85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .5rem;
}
.compare-side__img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* Console error diff tab badge */
.error-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 .35rem;
  margin-left: .35rem;
  border-radius: 999px;
  background: var(--accent-red);
  color: #fff;
  font-size: .7rem;
  font-weight: 600;
  line-height: 1;
}
.compare-tab.active .error-tab-badge {
  background: rgba(255,255,255,.25);
}

/* Console error messages */
.error-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.error-msg {
  margin: 0;
  padding: .6rem .8rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.error-msg--new {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.25);
  color: #fca5a5;
}
.error-msg--removed {
  background: rgba(34,197,94,.08);
  border-color: rgba(34,197,94,.25);
  color: #86efac;
  text-decoration: line-through;
  opacity: .8;
}
.error-msg--unchanged {
  background: var(--surface);
  color: var(--text-muted);
}

/* HB Bypass full-width row */
.hb-bypass-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.hb-bypass-row__label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  margin-right: .25rem;
}
.module-option--inline {
  padding: .2rem .5rem;
  font-size: .8rem;
}

/* ── Theme Toggle ──────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}
.theme-toggle .ti-sun   { display: none; }
.theme-toggle .ti-moon  { display: inline; }
[data-theme="light"] .theme-toggle .ti-sun   { display: inline; }
[data-theme="light"] .theme-toggle .ti-moon  { display: none; }
