/* ═══════════════════════════════════════════
   LYRRA Test Runner — Cypress-Inspired Theme
   ═══════════════════════════════════════════ */

:root {
  --sidebar-bg: #F8FAFC;
  --sidebar-w: 280px;
  --topbar-h: 48px;
  --main-bg: #FFFFFF;
  --card-bg: #F1F5F9;
  --card-bg-hover: #E8EDF3;
  --border: #E2E8F0;
  --border-light: #CBD5E1;
  --green: #059669;
  --green-dim: rgba(5, 150, 105, 0.1);
  --red: #DC2626;
  --red-dim: rgba(220, 38, 38, 0.1);
  --blue: #4F46E5;
  --blue-dim: rgba(79, 70, 229, 0.1);
  --yellow: #CA8A04;
  --yellow-dim: rgba(202, 138, 4, 0.1);
  --text: #1E293B;
  --text-bright: #0F172A;
  --muted: #64748B;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: var(--font);
  background: var(--main-bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ═══════════════════
   LOGIN PAGE
   ═══════════════════ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(145deg, #EEF2FF 0%, #E0E7FF 50%, #F1F5F9 100%);
  overflow: auto;
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand .icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
}

.login-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.02em;
}

.login-brand p {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.form-group { margin-bottom: 0.875rem; }

.form-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--main-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

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

.form-input::placeholder { color: var(--muted); opacity: 0.6; }

.form-input--otp {
  font-family: var(--mono);
  font-size: 1.3rem;
  letter-spacing: 0.4em;
  text-align: center;
  padding: 0.75rem;
}

.login-msg {
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.875rem;
  display: none;
}

.login-msg--success { display: block; background: var(--green-dim); color: var(--green); }
.login-msg--error { display: block; background: var(--red-dim); color: var(--red); }

/* ═══════════════════
   BUTTONS
   ═══════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover:not(:disabled) { background: #5558E6; }

.btn--green { background: var(--green); color: #fff; }
.btn--green:hover:not(:disabled) { background: #03B082; }

.btn--danger { background: var(--red); color: #fff; }
.btn--danger:hover:not(:disabled) { background: #D04360; }

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn--ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }

.btn--link {
  background: transparent;
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  border: none;
}
.btn--link:hover { color: var(--text); }

.btn--block { width: 100%; }
.btn--sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn--xs { padding: 0.2rem 0.5rem; font-size: 0.68rem; }
.btn--lg { padding: 0.65rem 1.25rem; font-size: 0.85rem; }

/* ═══════════════════
   SHELL LAYOUT
   ═══════════════════ */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  z-index: 20;
  transition: transform 0.3s;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand .logo-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--blue), #9333EA);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand .brand-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-bright);
  line-height: 1.2;
}

.sidebar-brand .brand-sub {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-section-title {
  padding: 0.75rem 1rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Spec list ─── */
.spec-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.spec-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.5rem 0;
  margin: 1px 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s;
  border-left: 3px solid transparent;
  font-size: 0.8rem;
  position: relative;
}

.spec-item:hover { background: rgba(0,0,0,0.04); }
.spec-item.active { background: rgba(99, 102, 241, 0.12); border-left-color: var(--blue); }

.spec-item--passed { border-left-color: var(--green); }
.spec-item--failed { border-left-color: var(--red); }
.spec-item--none { border-left-color: var(--border); }
.spec-item.active.spec-item--passed { border-left-color: var(--green); }
.spec-item.active.spec-item--failed { border-left-color: var(--red); }

.spec-item .spec-icon {
  flex-shrink: 0;
  width: 18px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  margin-left: 0.5rem;
}

.spec-item .spec-name {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spec-item .spec-count {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.spec-item .spec-count .ct-pass { color: var(--green); }
.spec-item .spec-count .ct-fail { color: var(--red); }

.spec-item .running-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
  animation: pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
  margin-left: 0.5rem;
}

/* ─── Sidebar footer ─── */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 0.75rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-footer .btn { font-size: 0.75rem; }

/* ─── Main area ─── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ─── Topbar ─── */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  min-width: 0;
}

.topbar-left .ctx-label {
  color: var(--muted);
  font-weight: 500;
}

.topbar-left .ctx-value {
  color: var(--text-bright);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-pill--idle { background: var(--green-dim); color: var(--green); }
.status-pill--running { background: var(--yellow-dim); color: var(--yellow); }

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

.status-pill--idle .dot { background: var(--green); }
.status-pill--running .dot { background: var(--yellow); animation: pulse 1.2s ease-in-out infinite; }

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* ─── Content area ─── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

/* ═══════════════════
   DASHBOARD VIEW
   ═══════════════════ */
.overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.ov-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  transition: border-color 0.15s;
}

.ov-card:hover { border-color: var(--border-light); }

.ov-card .ov-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.ov-card .ov-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.ov-card .ov-value--green { color: var(--green); }
.ov-card .ov-value--red { color: var(--red); }
.ov-card .ov-value--blue { color: var(--blue); }
.ov-card .ov-value--muted { color: var(--muted); font-size: 1rem; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-header h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── History table ─── */
.runs-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.runs-table th {
  text-align: left;
  padding: 0.55rem 0.875rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0,0,0,0.03);
  border-bottom: 1px solid var(--border);
}

.runs-table td {
  padding: 0.55rem 0.875rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.runs-table tbody tr { cursor: pointer; transition: background 0.1s; }
.runs-table tbody tr:hover td { background: var(--card-bg-hover); }
.runs-table tbody tr:last-child td { border-bottom: none; }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--mono);
}

.badge--pass { background: var(--green-dim); color: var(--green); }
.badge--fail { background: var(--red-dim); color: var(--red); }
.badge--running { background: var(--yellow-dim); color: var(--yellow); }
.badge--neutral { background: rgba(116,121,148,0.15); color: var(--muted); }

.suite-id-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--blue);
  background: var(--blue-dim);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

/* ═══════════════════
   SPEC DETAIL VIEW
   ═══════════════════ */
.spec-detail-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.spec-detail-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
}

.spec-meta-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.spec-meta-row span { display: flex; align-items: center; gap: 0.3rem; }

/* ═══════════════════
   RUNNER VIEW (Cypress-like split)
   ═══════════════════ */
.runner-cypress {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.runner-split {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
}

/* ─── LEFT PANEL (steps + inline logs) ─── */
.runner-left {
  width: 440px;
  min-width: 350px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
}

.rl-header {
  padding: 0.75rem 1rem;
  background: var(--main-bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.rl-header-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.rl-header-top .rh-icon { font-size: 1.1rem; flex-shrink: 0; }

.rl-header-top h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-bright);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rl-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
}

.rl-stat { color: var(--text); font-weight: 500; }
.rl-stat .stat-val--green { color: var(--green); font-weight: 700; font-family: var(--mono); }
.rl-stat .stat-val--red { color: var(--red); font-weight: 700; font-family: var(--mono); }
.rl-stat--muted { color: var(--muted); font-family: var(--mono); font-weight: 600; }

/* Tests section (top, scrollable) */
.rl-tests-section {
  flex: 3;
  overflow-y: auto;
  min-height: 0;
  border-bottom: 1px solid var(--border);
}

/* Command log section (bottom, always visible) */
.rl-command-log {
  flex: 2;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  overflow: hidden;
}

.rl-empty {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.rl-test-counter {
  padding: 0.4rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}

.rl-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* ─── Test rows ─── */
.test-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.test-row:last-child { border-bottom: none; }
.test-row:hover { background: rgba(0,0,0,0.02); }

.test-row-main {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  gap: 0.5rem;
}

.test-row .t-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

.t-icon--pass { background: var(--green-dim); color: var(--green); }
.t-icon--fail { background: var(--red-dim); color: var(--red); }
.t-icon--pending { background: var(--yellow-dim); color: var(--yellow); }
.t-icon--running {
  background: var(--blue-dim);
  color: var(--blue);
  animation: icon-spin 1s linear infinite;
}

.test-row .t-name {
  flex: 1;
  font-size: 0.78rem;
  color: var(--text);
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.test-row .t-duration {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.t-screenshot-count {
  font-size: 0.68rem;
  color: var(--muted);
  cursor: pointer;
}

.t-screenshots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0.25rem 0.75rem 0.5rem 2.5rem;
}

.t-screenshot-thumb {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.t-screenshot-thumb:hover {
  border-color: var(--blue);
  transform: scale(1.1);
}

/* ─── RIGHT PANEL (Browser preview) ─── */
.runner-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #1E1E2E;
  min-width: 0;
}

.browser-chrome {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  overflow: hidden;
}

.browser-toolbar {
  height: 36px;
  background: #2B2B3B;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  flex-shrink: 0;
  border-bottom: 1px solid #3D3D50;
}

.browser-dots {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot--red { background: #FF5F57; }
.dot--yellow { background: #FEBC2E; }
.dot--green { background: #28C840; }

.browser-url-bar {
  flex: 1;
  height: 24px;
  background: #1E1E2E;
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  gap: 0.35rem;
  overflow: hidden;
}

.url-icon { font-size: 0.65rem; flex-shrink: 0; }
.url-text {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: #8888A0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browser-toolbar-actions { margin-left: auto; flex-shrink: 0; }

.live-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #28C840;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-dot-sm {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #28C840;
  animation: pulse 1.2s ease-in-out infinite;
}

.browser-viewport {
  flex: 1;
  position: relative;
  background: #0A0A1A;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Live preview image fills the viewport */
.browser-viewport img#live-preview-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.browser-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #5A5A7A;
  gap: 0.75rem;
  padding: 2rem;
  text-align: center;
}

.bp-icon { font-size: 2.5rem; opacity: 0.6; }
.bp-text { font-size: 0.85rem; font-weight: 500; }
.bp-sub { font-size: 0.72rem; color: #4A4A6A; }

.bp-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(79,70,229,0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: icon-spin 0.8s linear infinite;
}

.browser-result-screenshot {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: transform 0.2s;
}
.browser-result-screenshot:hover { transform: scale(1.02); }

.bp-screenshot-nav {
  padding-top: 0.5rem;
}
.bp-screenshot-counter {
  font-size: 0.72rem;
  color: #6A6A8A;
}

/* ─── Log terminal (in left panel) ─── */
.log-terminal {
  flex: 1;
  background: #0A0E18;
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.6;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 100px;
}

.log-terminal .log-line { padding: 0; }
.log-terminal .log-line.stderr { color: var(--red); }
.log-terminal .log-line.stdout { color: #b0b8c4; }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--green);
}

.live-indicator .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.2s ease-in-out infinite;
}

/* ═══════════════════
   EMPTY STATE
   ═══════════════════ */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

.empty-state .es-icon { font-size: 2.5rem; margin-bottom: 0.75rem; opacity: 0.6; }
.empty-state p { font-size: 0.85rem; }

/* ═══════════════════
   TOAST
   ═══════════════════ */
#toast-container {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.8rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast--success { border-left: 3px solid var(--green); }
.toast--error { border-left: 3px solid var(--red); }
.toast--info { border-left: 3px solid var(--blue); }

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

@keyframes icon-spin {
  to { transform: rotate(360deg); }
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fade-in 0.2s ease; }

/* ═══════════════════
   TEST STEPS
   ═══════════════════ */
.test-steps-info {
  margin-top: 0.5rem;
}

.steps-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.steps-meta-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  background: var(--blue-dim);
  color: var(--blue);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.step-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.step-card:hover {
  border-color: var(--border-light);
}

.step-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.875rem;
}

.step-card-num {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue-dim);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
}

.step-card-name {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.step-card-chevron {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.step-card.open .step-card-chevron {
  transform: rotate(90deg);
}

.step-card-body {
  display: none;
  padding: 0 0.875rem 0.75rem 2.75rem;
}

.step-card.open .step-card-body {
  display: block;
}

.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.step-list li {
  position: relative;
  padding: 0.3rem 0 0.3rem 1.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

.step-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-light);
}

.step-list li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 2.5px;
  top: 1rem;
  width: 1px;
  height: calc(100% - 0.4rem);
  background: var(--border);
}

/* ═══════════════════
   SPINNER
   ═══════════════════ */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: icon-spin 0.7s linear infinite;
}

/* ═══════════════════
   SIDEBAR OVERLAY (MOBILE)
   ═══════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 15;
}

/* ═══════════════════
   RESPONSIVE
   ═══════════════════ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: 20;
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-overlay { display: block; }

  .hamburger { display: block; }

  .content { padding: 1rem; }

  .overview-cards { grid-template-columns: repeat(2, 1fr); }

  .runner-stats { flex-wrap: wrap; gap: 0.5rem; }
}

@media (max-width: 480px) {
  .overview-cards { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════
   CONFIG PANEL (right slide-in)
   ═══════════════════════════════════ */
.config-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 90;
}
.config-overlay.open { display: block; }

.config-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 92vw;
  height: 100vh;
  background: #FFFFFF;
  border-left: 1px solid #E2E8F0;
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.config-panel.open { transform: translateX(0); }

.config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #E2E8F0;
  background: #F8FAFC;
}
.config-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1E293B;
}
.config-close {
  background: none;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  color: #64748B;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.config-close:hover { background: #F1F5F9; color: #1E293B; }

.config-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem 2rem;
}
.config-loading, .config-error {
  padding: 2rem;
  text-align: center;
  color: #64748B;
}
.config-error { color: #EF4444; }

/* Sections */
.cfg-section {
  margin-bottom: 0.75rem;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  overflow: hidden;
  background: #FAFBFC;
}
.cfg-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  user-select: none;
  background: #F1F5F9;
  transition: background 0.15s;
}
.cfg-section-title:hover { background: #E8EEF4; }
.cfg-chevron { font-size: 0.7rem; color: #94A3B8; transition: transform 0.2s; }
.cfg-section.collapsed .cfg-chevron { transform: rotate(-90deg); }
.cfg-section.collapsed .cfg-section-body { display: none; }
.cfg-section-body { padding: 0.75rem 0.85rem; }

/* Form fields */
.cfg-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748B;
  margin-bottom: 0.6rem;
}
.cfg-input {
  display: block;
  width: 100%;
  padding: 0.45rem 0.6rem;
  margin-top: 0.2rem;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #1E293B;
  background: #FFFFFF;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.cfg-input:focus {
  outline: none;
  border-color: #6366F1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.cfg-input.cfg-mono { font-family: 'JetBrains Mono', monospace; font-size: 0.78rem; }

.cfg-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.cfg-row--3 { grid-template-columns: 1fr 1fr 1fr; }

/* Toggle */
.cfg-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.cfg-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6366F1;
}
.cfg-toggle span {
  font-size: 0.8rem;
  color: #475569;
}

/* Actions */
.cfg-actions {
  padding-top: 1rem;
  border-top: 1px solid #E2E8F0;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Topbar icon button */
.topbar-icon-btn {
  background: none;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.topbar-icon-btn:hover { background: #F1F5F9; border-color: #CBD5E1; }

.btn--outline {
  background: transparent;
  border: 1px solid #D1D5DB;
  color: #475569;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn--outline:hover { background: #F1F5F9; border-color: #94A3B8; }
.btn--sm { padding: 0.35rem 0.7rem; font-size: 0.75rem; }

/* ═══════════════════════════════════
   SCREENSHOT THUMBNAILS & LIGHTBOX
   ═══════════════════════════════════ */
.test-row--has-screenshots { flex-direction: column; }
.test-row-main {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}
.t-screenshot-count {
  margin-left: auto;
  font-size: 0.7rem;
  color: #6366F1;
  white-space: nowrap;
  cursor: pointer;
}
.t-screenshots {
  display: flex;
  gap: 6px;
  padding: 6px 0 2px 28px;
  flex-wrap: wrap;
}
.t-screenshot-thumb {
  width: 80px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #E2E8F0;
  cursor: pointer;
  transition: all 0.2s;
  background: #F1F5F9;
}
.t-screenshot-thumb:hover {
  transform: scale(1.08);
  border-color: #6366F1;
  box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: lightboxIn 0.2s ease;
}
@keyframes lightboxIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: #FFFFFF;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  color: #475569;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background 0.15s;
}
.lightbox-close:hover { background: #F1F5F9; }
.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.lightbox-caption {
  margin-top: 0.5rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ═══════════════════
   TOPBAR BACK LINK
   ═══════════════════ */
.topbar-back {
  cursor: pointer;
  color: var(--blue);
  font-weight: 500;
  transition: color 0.15s;
}
.topbar-back:hover { color: var(--text-bright); text-decoration: underline; }

/* ═══════════════════
   SIDEBAR DASHBOARD BTN
   ═══════════════════ */
.sidebar-dashboard-btn {
  background: var(--blue-dim) !important;
  color: var(--blue) !important;
  font-weight: 600 !important;
  border: 1px solid transparent !important;
}
.sidebar-dashboard-btn:hover {
  background: var(--blue) !important;
  color: white !important;
}

/* ═══════════════════
   SCREENSHOTS GALLERY (left panel)
   ═══════════════════ */
.screenshots-gallery {
  padding: 0.75rem;
}
.gallery-header {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}
.gallery-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--card-bg);
}
.gallery-item:hover {
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(79,70,229,0.15);
  transform: translateY(-2px);
}
.gallery-item img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
}
.gallery-item-label {
  padding: 0.25rem 0.4rem;
  font-size: 0.65rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid var(--border);
}

/* ═══════════════════
   HISTORY TABLE
   ═══════════════════ */
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--blue-dim); }
.view-link {
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ═══════════════════
   EMPTY STATE
   ═══════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--muted);
}
.empty-state .es-icon { font-size: 2rem; margin-bottom: 0.5rem; }
