/* Vortex Components — v3 (modern redesign) */

/* ---- Utility Classes ---- */
.flex-row { display: flex; align-items: center; }
.flex-row-gap-1 { display: flex; align-items: center; gap: var(--sp-1); }
.flex-row-gap-2 { display: flex; align-items: center; gap: var(--sp-2); }
.flex-row-gap-3 { display: flex; align-items: center; gap: var(--sp-3); }
.flex-col { display: flex; flex-direction: column; }
.flex-col-gap-2 { display: flex; flex-direction: column; gap: var(--sp-2); }
.flex-col-gap-3 { display: flex; flex-direction: column; gap: var(--sp-3); }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-pass { color: var(--color-pass); }
.text-fail { color: var(--color-fail); }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.p-3 { padding: var(--sp-3); }
.p-4 { padding: var(--sp-4); }
.p-5 { padding: var(--sp-5); }
.px-3 { padding-left: var(--sp-3); padding-right: var(--sp-3); }
.px-4 { padding-left: var(--sp-4); padding-right: var(--sp-4); }
.py-2 { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.border-default { border: 1px solid var(--border-default); }
.bg-card { background: var(--bg-card); }
.bg-primary { background: var(--bg-primary); }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.text-lg { font-size: var(--text-lg); }
.text-3xl { font-size: var(--text-3xl); }

/* ---- Error Page Center ---- */
.error-page-center {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- DB Disconnection Banner ---- */
.db-banner {
  background: var(--color-fail, #DC2626);
  color: #fff;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  text-align: center;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

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

/* ---- Header / Nav ---- */
.header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  padding: 0 var(--sp-8);
  height: 56px;
  display: flex; align-items: center; gap: var(--sp-2);
}

.logo {
  font-size: var(--text-lg); font-weight: 700; color: var(--text-primary);
  letter-spacing: -0.4px; white-space: nowrap;
  display: flex; align-items: center; gap: var(--sp-2);
  text-decoration: none; margin-right: var(--sp-6);
}
.logo em { color: var(--text-primary); font-style: normal; }
.nav-logo-mark {
  width: 28px; height: 28px; background: var(--accent-blue);
  border-radius: 8px; display: grid; place-items: center;
  font-size: 14px; color: #fff; flex-shrink: 0; font-style: normal;
}

.nav { display: flex; gap: 1px; flex: 1; margin-left: 0; }
.nav a {
  padding: 8px var(--sp-3); border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--text-muted); transition: all var(--transition-base);
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  position: relative;
}
.nav a:hover { color: var(--text-primary); background: var(--bg-surface); text-decoration: none; }
.nav a.active {
  color: var(--accent-blue); font-weight: 600; background: transparent;
}
.nav a.active::after {
  content: ''; position: absolute; bottom: -17px; left: var(--sp-3); right: var(--sp-3);
  height: 2px; background: var(--accent-blue); border-radius: 1px;
}

.header-right { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }

/* Run Tests CTA button in nav */
.btn-run-nav {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px;
  background: var(--accent-blue); color: #fff;
  font-size: var(--text-sm); font-weight: 600;
  border: none; border-radius: var(--radius-md);
  cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-accent);
  transition: all var(--transition-base);
}
.btn-run-nav:hover { background: var(--accent-blue-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; color: #fff; }

/* Header divider */
.header-divider { width: 1px; height: 20px; background: var(--border-default); margin: 0 4px; }

/* Avatar */
.header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-blue), #7C3AED);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff; cursor: pointer;
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 3px var(--border-default);
  flex-shrink: 0;
}

/* Icon button (bell, etc) */
.btn-icon {
  width: 34px; height: 34px; border-radius: var(--radius-md);
  border: 1px solid var(--border-default); background: var(--bg-card);
  display: grid; place-items: center; cursor: pointer;
  color: var(--text-muted); transition: all var(--transition-base);
  position: relative; font-size: var(--text-base);
}
.btn-icon:hover { border-color: var(--accent-blue); color: var(--accent-blue); background: var(--accent-blue-dim); }

.nav-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 22px; cursor: pointer; padding: var(--sp-1); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.nav-indicator {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--color-pass); display: inline-block; animation: pulse 2s infinite;
}

/* ---- Buttons ---- */
.btn {
  background: var(--bg-card); border: 1px solid var(--border-default);
  color: var(--text-secondary); padding: 7px var(--sp-4);
  border-radius: var(--radius-md); cursor: pointer;
  font-size: var(--text-sm); font-weight: 500; font-family: var(--font-sans);
  transition: all var(--transition-base);
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-xs);
  line-height: 1.4;
}
.btn:hover { border-color: var(--border-hover); color: var(--text-primary); text-decoration: none; background: var(--bg-card); box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  background: var(--accent-blue); border-color: var(--accent-blue-hover);
  color: #fff; box-shadow: var(--shadow-accent); font-weight: 600;
}
.btn-primary:hover { background: var(--accent-blue-hover); color: #fff; border-color: var(--accent-blue-hover); box-shadow: var(--shadow-md); }
.btn-danger {
  background: var(--bg-card); border-color: var(--border-default);
  color: var(--color-fail);
}
.btn-danger:hover { background: var(--color-fail-hover); border-color: var(--color-fail-border); color: var(--color-fail); }
.btn-sm { padding: 5px var(--sp-3); font-size: var(--text-sm); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-surface); color: var(--text-primary); border-color: transparent; box-shadow: none; }
.btn-link { background: none; border: none; box-shadow: none; color: var(--text-muted); padding: 5px var(--sp-2); font-size: var(--text-xs); }
.btn-link:hover { background: none; border: none; box-shadow: none; color: var(--text-secondary); text-decoration: underline; }
.btn-link.text-fail { color: var(--text-muted); }
.btn-link.text-fail:hover { color: var(--color-fail); }

/* ---- KPI Strip ---- */
.summary {
  background: var(--bg-card); border-bottom: 1px solid var(--border-light);
  padding: var(--sp-6) var(--sp-8);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-3);
}
.kpi {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-xs); position: relative; overflow: hidden;
  transition: all var(--transition-base);
}
.kpi::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: transparent;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
/* Only colored variants show the top accent bar */
.kpi.green::before { background: var(--color-pass); }
.kpi.red::before   { background: var(--color-fail); }
.kpi.amber::before { background: var(--color-flaky); }
.kpi.blue::before  { background: var(--accent-blue); }
.kpi-n { font-size: var(--text-3xl); font-weight: 700; line-height: 1.1; font-family: var(--font-mono); letter-spacing: -0.5px; color: var(--text-primary); }
.kpi-l { font-size: var(--text-2xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; margin-bottom: var(--sp-1); }
.kpi.green .kpi-n { color: var(--color-pass); }
.kpi.red   .kpi-n { color: var(--color-fail); }
.kpi.amber .kpi-n { color: var(--color-flaky); }
.kpi.blue  .kpi-n { color: var(--accent-blue); }
.kpi a { color: inherit; text-decoration: none; }
.kpi a:hover { text-decoration: underline; }
.kpi-text .kpi-n {
  font-size: var(--text-lg); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 200px; line-height: 1.4; font-family: var(--font-sans);
}

/* ---- Dashboard Summary Card ---- */
.dash-summary {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--sp-6);
  margin: var(--sp-6) var(--sp-8);
  box-shadow: var(--shadow-sm);
}
.dash-summary-grid {
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr;
  gap: var(--sp-8);
  align-items: start;
}
.dash-health {
  text-align: center; min-width: 120px;
}
.dash-health-score {
  font-size: var(--text-5xl); font-weight: 800; line-height: 1;
  font-family: var(--font-mono); letter-spacing: -1px;
}
.dash-health-label {
  font-size: var(--text-sm); color: var(--text-muted); margin-top: var(--sp-1);
}
.dash-health-trend {
  font-size: var(--text-sm); margin-top: var(--sp-2);
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-pill);
  font-weight: 600;
}
.dash-section-title {
  font-size: var(--text-xs); color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: var(--sp-3);
}
.dash-sparkline {
  display: flex; align-items: flex-end; gap: 2px; height: 52px;
}
.dash-sparkline-bar {
  flex: 1; min-width: 0; border-radius: 2px;
  transition: opacity var(--transition-fast);
}
.dash-sparkline-bar:hover { opacity: 0.75; }
.dash-failing-list {
  list-style: none; padding: 0; margin: 0;
}
.dash-failing-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; gap: var(--sp-3);
  border-bottom: 1px solid var(--border-light);
  font-size: var(--text-sm);
}
.dash-failing-list li:last-child { border-bottom: none; }
.dash-failing-list .fail-link {
  color: var(--color-fail); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-failing-list .fail-count {
  color: var(--text-muted); font-size: var(--text-xs); font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
  background: var(--bg-surface); padding: 2px 8px; border-radius: var(--radius-pill);
}
.dash-endpoint-list {
  list-style: none; padding: 0; margin: 0;
}
.dash-endpoint-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; gap: var(--sp-3);
  border-bottom: 1px solid var(--border-light);
  font-size: var(--text-sm);
}
.dash-endpoint-list li:last-child { border-bottom: none; }
.dash-endpoint-url {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text-primary); font-family: var(--font-mono); font-size: var(--text-xs);
}
.dash-endpoint-count {
  color: var(--text-muted); font-size: var(--text-xs); font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
  background: var(--bg-surface); padding: 2px 8px; border-radius: var(--radius-pill);
}

/* ---- Monitor Widget ---- */
.monitor-widget {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  margin-bottom: var(--sp-4);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-xs);
}
.monitor-label {
  font-weight: 600; color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 6px;
}
.monitor-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}
.monitor-uptime {
  font-weight: 700; font-size: var(--text-lg);
}
.monitor-meta {
  color: var(--text-muted);
}
.monitor-last {
  color: var(--text-muted); margin-left: auto;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  padding: var(--sp-2) var(--sp-8); font-size: var(--text-sm);
  color: var(--text-muted); background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}
.breadcrumb a { color: var(--accent-blue); }

/* ---- Sub-header ---- */
.sub-header {
  display: flex; gap: var(--sp-3); align-items: center;
  padding: var(--sp-3) var(--sp-8); border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
}

/* ---- Content ---- */
.content { padding: var(--sp-6) var(--sp-8); }
.section-head {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: var(--sp-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- Insight Rows (expandable) ---- */
.insight-row .insight-content {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.insight-row.expanded .insight-content {
  -webkit-line-clamp: unset;
  display: block;
}

/* ---- Spec File Multi-Select ---- */
.spec-select { position: relative; }
.spec-select-trigger {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; background: var(--bg-input);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  font-family: var(--font-sans); font-size: var(--text-base); color: var(--text-primary);
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; text-align: left;
}
.spec-select-trigger:hover { border-color: var(--border-hover); }
.spec-select.open .spec-select-trigger {
  border-color: var(--accent-blue); box-shadow: 0 0 0 3px var(--accent-blue-ring);
}
.trigger-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trigger-text.placeholder { color: var(--text-muted); }
.trigger-count {
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent-blue); color: #fff; font-size: 11px; font-weight: 600;
}
.trigger-chevron {
  flex-shrink: 0; width: 16px; height: 16px; color: var(--text-muted); transition: transform 0.2s;
}
.spec-select.open .trigger-chevron { transform: rotate(180deg); }

.spec-select-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 100;
  min-width: 320px; width: max-content; max-width: 400px;
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  overflow: hidden; display: none;
}
.spec-select.open .spec-select-panel {
  display: block; animation: specDropIn 0.15s ease-out;
}
@keyframes specDropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.spec-select-search { padding: 10px 12px; border-bottom: 1px solid var(--border-light); }
.spec-select-search input {
  width: 100%; padding: 7px 10px 7px 32px;
  border: 1px solid var(--border-default); border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: var(--text-sm); color: var(--text-primary);
  background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238993A4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='6' cy='6' r='4.5'/%3E%3Cline x1='9.5' y1='9.5' x2='13' y2='13'/%3E%3C/svg%3E") 10px center no-repeat;
  outline: none; transition: border-color 0.15s;
}
.spec-select-search input::placeholder { color: var(--text-muted); }
.spec-select-search input:focus { border-color: var(--accent-blue); }

.spec-select-header {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 6px 14px; border-bottom: 1px solid var(--border-light);
}
.all-count { font-size: 11px; color: var(--text-muted); font-weight: 500; }

.spec-select-items { max-height: 260px; overflow-y: auto; padding: 4px 0; }
.spec-select-items::-webkit-scrollbar { width: 6px; }
.spec-select-items::-webkit-scrollbar-track { background: transparent; }
.spec-select-items::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }

.spec-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; transition: background 0.1s;
  white-space: nowrap;
}
.spec-item:hover { background: var(--bg-hover); }
.spec-item.checked { background: var(--accent-blue-dim); }
.item-name { flex: 1; font-size: var(--text-sm); color: var(--text-primary); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; }
.item-badge {
  flex-shrink: 0; font-size: 10px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 2px 6px; border-radius: 999px;
}
.item-badge.beta { background: var(--color-flaky-bg); color: var(--color-flaky); }

/* Custom checkbox — visual only (no input, for Select All) */
.spec-cb-visual {
  width: 18px; height: 18px; min-width: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border-strong); border-radius: 4px;
  background: var(--bg-card); transition: all 0.15s; cursor: pointer;
}
.spec-cb-visual svg { width: 12px; height: 12px; }
.spec-cb-visual .check-icon { opacity: 0; transition: opacity 0.1s; }
.spec-cb-visual .dash-icon { opacity: 0; transition: opacity 0.1s; }
.spec-cb-visual.checked { background: var(--accent-blue); border-color: var(--accent-blue); }
.spec-cb-visual.checked .check-icon { opacity: 1; }
.spec-cb-visual.indeterminate { background: var(--accent-blue); border-color: var(--accent-blue); }
.spec-cb-visual.indeterminate .check-icon { opacity: 0; }
.spec-cb-visual.indeterminate .dash-icon { opacity: 1; }

/* Custom checkbox — with hidden input (for spec items) */
.spec-cb { position: relative; width: 18px; height: 18px; min-width: 18px; flex-shrink: 0; display: inline-flex; vertical-align: middle; }
.spec-cb input {
  position: absolute; opacity: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; z-index: 1;
}
.spec-cb-box {
  width: 18px; height: 18px; border: 1.5px solid var(--border-strong); border-radius: 4px;
  background: var(--bg-card); display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s; pointer-events: none;
}
.spec-cb input:checked + .spec-cb-box {
  background: var(--accent-blue); border-color: var(--accent-blue);
}
.spec-cb input:checked + .spec-cb-box .check-icon { opacity: 1; }
.spec-cb-box svg { width: 12px; height: 12px; }
.spec-cb-box .check-icon { opacity: 0; transition: opacity 0.1s; }

.spec-select-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-top: 1px solid var(--border-light); background: var(--bg-surface);
  white-space: nowrap; gap: 12px;
}
.footer-count { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.footer-actions { display: flex; gap: 8px; }
.footer-btn {
  padding: 5px 12px; border-radius: var(--radius-sm); font-family: var(--font-sans);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: all 0.12s; border: none;
}
.footer-btn.clear { background: transparent; color: var(--text-secondary); }
.footer-btn.clear:hover { background: var(--bg-hover); }
.footer-btn.done { background: var(--accent-blue); color: #fff; }
.footer-btn.done:hover { background: var(--accent-blue-hover); }

/* Selected chips */
.spec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.spec-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 10px; border-radius: 999px;
  background: var(--accent-blue-dim); border: 1px solid var(--accent-blue-light);
  font-size: 12px; color: var(--accent-blue); font-weight: 500; line-height: 1.3;
}
.spec-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 14px; color: var(--accent-blue); cursor: pointer; transition: background 0.1s; line-height: 1;
}
.spec-chip-x:hover { background: var(--accent-blue-light); }

/* ---- Section Label (quiet, muted) ---- */
.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-3);
}

/* ---- Run Card Results (inline pass/fail counts) ---- */
.run-card-results {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.run-card-results .rc-pass { color: var(--color-pass); }
.run-card-results .rc-fail { color: var(--color-fail); }
.run-card-results .rc-total { color: var(--text-muted); }
.run-card-duration {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.run-card-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.run-card-actions a {
  font-size: var(--text-xs);
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  padding: 2px 0;
}
.run-card-actions a:hover { text-decoration: underline; }
.run-card-actions .rc-sep {
  color: var(--text-dim);
  font-size: var(--text-xs);
}

/* ---- Page header ---- */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: var(--sp-6);
}
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; color: var(--text-primary); }
.page-header p { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 3px; }
.page-header-actions { display: flex; gap: var(--sp-2); }

/* ---- Tables ---- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
thead th {
  background: var(--bg-surface); padding: var(--sp-3) var(--sp-4); text-align: left;
  font-size: var(--text-2xs); font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.7px;
  border-bottom: 1px solid var(--border-light); white-space: nowrap;
}
thead th a { color: inherit; text-decoration: none; }
thead th a:hover { color: var(--text-primary); text-decoration: underline; }
.run-row {
  border-bottom: 1px solid var(--border-light); cursor: pointer;
  transition: background var(--transition-fast);
}
.run-row:last-child { border-bottom: none; }
.run-row:hover { background: var(--bg-hover); }
.run-row:focus-within { background: var(--bg-hover); }
.run-row td { padding: var(--sp-3) var(--sp-4); font-size: var(--text-sm); vertical-align: middle; }
/* Fade action buttons until row hover */
.run-row .btn-link { opacity: 0.5; transition: opacity var(--duration-fast); }
.run-row:hover .btn-link { opacity: 1; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 8px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600;
  line-height: 1.4;
}
.badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.badge-pass    { background: var(--color-pass-bg);    color: var(--color-pass); }
.badge-fail    { background: var(--color-fail-bg);    color: var(--color-fail); }
.badge-flaky   { background: var(--color-flaky-bg);   color: var(--color-flaky); }
.badge-skipped { background: var(--color-skipped-bg); color: var(--color-skipped); }
.badge-running { background: var(--color-running-bg); color: var(--color-running); animation: pulse 1.5s infinite; }
.badge-running::before { animation: pulse 1.5s infinite; }
.badge-cancelled { background: var(--bg-surface); color: var(--text-muted); }
.badge-cancelled::before { display: none; }
.badge-beta { background: rgba(99,102,241,.08); color: #6366f1; }
.badge-beta::before { display: none; }
.badge-warn { background: var(--color-flaky-bg); color: var(--color-flaky); }
.badge-warn::before { background: var(--color-flaky); }
.badge-source { background: var(--bg-surface); color: var(--text-secondary); font-weight: 500; }
.badge-source::before { display: none; }

/* ---- Cell helpers ---- */
.label-cell { font-weight: 600; color: var(--text-primary); }
.date-cell  { color: var(--text-muted); font-size: var(--text-sm); white-space: nowrap; }
.num        { font-weight: 700; font-size: var(--text-sm); font-family: var(--font-mono); }
.pass-num   { color: var(--color-pass); }
.fail-num   { color: var(--color-fail); }
.flaky-num  { color: var(--color-flaky); }
.total-num  { color: var(--accent-blue); }
.dur-cell   { color: var(--text-muted); font-size: var(--text-sm); font-family: var(--font-mono); }

/* ---- Bar chart (pass rate) ---- */
.bar-wrap {
  position: relative; background: var(--bg-surface);
  border-radius: var(--radius-sm); height: 22px; min-width: 90px; overflow: hidden;
}
.bar-fill {
  height: 100%; border-radius: var(--radius-sm);
  background: var(--color-pass-grad);
  transition: width 0.3s ease;
}
.bar-fill-red { background: var(--color-fail-grad); }
.bar-fill-amber { background: var(--color-flaky-grad); }
.bar-label {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-size: var(--text-xs); font-weight: 700; color: var(--text-primary);
  text-shadow: 0 0 4px var(--bg-card);
  pointer-events: none;
}

/* ---- Empty state ---- */
.empty { text-align: center; padding: var(--sp-12) var(--sp-8); color: var(--text-muted); }
.empty-icon { font-size: 48px; margin-bottom: var(--sp-4); opacity: 0.7; }
.empty p { font-size: var(--text-xl); margin-bottom: var(--sp-2); color: var(--text-primary); font-weight: 600; }
.empty small { font-size: var(--text-base); color: var(--text-muted); }
.empty code { background: var(--bg-surface); padding: 2px 6px; border-radius: var(--radius-xs); color: var(--text-secondary); font-family: var(--font-mono); }

/* ---- Error block ---- */
.error-block {
  background: var(--color-fail-block); border: 1px solid var(--color-fail-border);
  border-radius: var(--radius-md); padding: var(--sp-4); margin: var(--sp-4) 0;
}
.error-block code {
  font-family: var(--font-mono); font-size: var(--text-sm);
  color: var(--color-fail); white-space: pre-wrap; word-break: break-all;
}

/* ---- Pagination ---- */
.pagination { display: flex; gap: var(--sp-2); justify-content: center; align-items: center; margin-top: var(--sp-6); }
.pagination-info { padding: var(--sp-2) var(--sp-3); color: var(--text-muted); font-size: var(--text-sm); }

/* ---- Test row accents ---- */
.test-row-fail  td:first-child { border-left: 3px solid var(--color-fail); }
.test-row-pass  td:first-child { border-left: 3px solid var(--color-pass); }
.test-row-flaky td:first-child { border-left: 3px solid var(--color-flaky); }
.test-row-skipped td:first-child { border-left: 3px solid var(--color-skipped); }

/* ---- Trend dots ---- */
.trend-dots { display: flex; gap: 3px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 2px; }
.dot-pass    { background: var(--color-pass); }
.dot-fail    { background: var(--color-fail); }
.dot-flaky   { background: var(--color-flaky); }
.dot-skipped { background: var(--bg-surface); border: 1px solid var(--border-default); }

/* ---- Report link ---- */
.report-link { color: var(--text-muted); font-size: var(--text-lg); text-decoration: none; transition: color var(--transition-fast); }
.report-link:hover { color: var(--accent-blue); }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex; gap: var(--sp-2); margin-bottom: var(--sp-5); align-items: center; flex-wrap: wrap;
}
.filter-bar select,
.filter-bar input {
  background: var(--bg-card); border: 1px solid var(--border-default);
  color: var(--text-primary); padding: 8px var(--sp-3);
  border-radius: var(--radius-md); font-size: var(--text-sm); font-family: var(--font-sans);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-xs);
  line-height: 1.4;
}
.filter-bar select:hover,
.filter-bar input:hover { border-color: var(--border-hover); }
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--accent-blue); outline: none; box-shadow: 0 0 0 3px var(--accent-blue-ring); }
.filter-bar input { min-width: 180px; }

/* ---- Forms ---- */
.form-group { margin-bottom: var(--sp-4); }
.form-group label {
  display: block; font-size: var(--text-xs); color: var(--text-secondary);
  margin-bottom: 6px; font-weight: 600; letter-spacing: 0.02em;
}
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input); border: 1px solid var(--border-default);
  color: var(--text-primary); padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md); font-size: var(--text-base); font-family: var(--font-sans);
  width: 100%; max-width: 420px;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-xs);
}
.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--border-hover); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent-blue); outline: none; box-shadow: 0 0 0 3px var(--accent-blue-ring); }
.form-row { display: flex; gap: var(--sp-4); flex-wrap: wrap; }

/* ---- Console / VNC ---- */
.console-wrap {
  background: var(--bg-console); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: var(--sp-5);
  font-family: var(--font-mono); font-size: var(--text-sm); color: #a0aec0;
  max-height: 500px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
  line-height: 1.7;
}
.vnc-wrap {
  background: #000; border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); overflow: hidden;
  margin-bottom: var(--sp-4); position: relative;
}
.vnc-wrap canvas { display: block; width: 100%; }
.vnc-status {
  position: absolute; top: 8px; right: 8px;
  font-size: var(--text-xs); padding: 3px 8px; border-radius: var(--radius-xs);
}
.vnc-connected    { background: var(--color-pass-bg); color: var(--color-pass); }
.vnc-disconnected { background: var(--color-fail-bg); color: var(--color-fail); }

/* ---- Completion card ---- */
.completion-card {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--sp-6);
  text-align: center; margin: var(--sp-6) 0;
  box-shadow: var(--shadow-sm);
}
.completion-card .badge { font-size: var(--text-md); padding: 6px var(--sp-5); margin-bottom: var(--sp-4); }
.completion-stats { display: flex; gap: var(--sp-6); justify-content: center; margin: var(--sp-4) 0; font-size: var(--text-lg); flex-wrap: wrap; }
.completion-actions { display: flex; gap: var(--sp-3); justify-content: center; margin-top: var(--sp-4); flex-wrap: wrap; }

/* ---- Stats strip ---- */
.stats-strip { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin: var(--sp-4) 0; }
.stat-item {
  background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-xs);
}
.stat-val { font-size: var(--text-3xl); font-weight: 700; font-family: var(--font-mono); }
.stat-lbl { font-size: var(--text-sm); color: var(--text-muted); }

/* ---- Test detail ---- */
.test-title { font-size: var(--text-3xl); font-weight: 700; margin-bottom: var(--sp-1); }
.test-subtitle { color: var(--text-secondary); font-size: var(--text-md); }
.test-meta { color: var(--text-muted); font-size: var(--text-base); margin-top: var(--sp-1); }

/* ---- Pattern list ---- */
.pattern-list { list-style: none; }
.pattern-item {
  padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--bg-hover);
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4);
}
.pattern-msg { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--color-fail); word-break: break-all; }
.pattern-count { color: var(--text-muted); font-size: var(--text-base); white-space: nowrap; }

/* ---- Screen reader only ---- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.sr-only:focus-visible {
  position: static; width: auto; height: auto; padding: var(--sp-2) var(--sp-4);
  margin: 0; overflow: visible; clip: auto; white-space: normal;
  background: var(--accent-blue); color: #fff; font-size: var(--text-md); z-index: 9999;
}

/* ---- HTMX loading indicator ---- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

#main-content { position: relative; min-height: 200px; }
#main-content.htmx-request::after {
  content: ''; position: absolute; inset: 0; z-index: var(--z-overlay);
  background: var(--bg-body); opacity: 0.5; pointer-events: none;
  border-radius: var(--radius-md);
}
#main-content.htmx-request::before {
  content: ''; position: absolute; top: 40%; left: 50%; z-index: 51;
  width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 3px solid var(--border-default); border-top-color: var(--accent-blue);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}

/* ---- HTMX toast ---- */
.htmx-toast {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5);
  background: var(--color-fail-deep); color: var(--color-fail);
  border: 1px solid var(--color-fail-border); border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-5); font-size: var(--text-sm);
  z-index: var(--z-toast); max-width: 400px; box-shadow: var(--shadow-lg);
  transform: translateY(0); transition: transform 0.3s ease, opacity 0.3s ease;
}
.htmx-toast[hidden] { display: none; }
.htmx-toast.toast-success {
  background: var(--color-pass);
  color: #fff;
}
.htmx-toast.toast-info {
  background: var(--color-info, #3b82f6);
  color: #fff;
}
/* ---- Confidence Progress Bar ---- */
.confidence-bar { margin-bottom: var(--sp-3); max-width: 320px; }
.confidence-bar-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--sp-1); }
.confidence-bar-label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.confidence-bar-value { font-size: var(--text-sm); font-weight: 700; font-family: var(--font-mono); }
.confidence-bar-track { height: 6px; background: var(--bg-surface); border-radius: 3px; overflow: hidden; }
.confidence-bar-fill { height: 100%; border-radius: 3px; transition: width 0.5s var(--ease-out, ease); }
.confidence-bar-breakdown { display: flex; gap: var(--sp-4); margin-top: var(--sp-2); font-size: var(--text-xs); color: var(--text-secondary); }

.htmx-swapping { opacity: 0.5; transition: opacity 0.2s; }

/* ---- HTMX swap transitions ---- */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
#main-content.htmx-settling > *:not(style):not(script) {
  animation: fadeSlideIn 0.2s ease-out;
}
tr.htmx-settling { animation: fadeSlideIn 0.25s ease-out; }
tr.htmx-swapping { opacity: 0; transition: opacity 0.15s ease; }
.htmx-row-highlight { transition: background 1.5s ease; }

/* ---- Full row link ---- */
.row-link { cursor: pointer; }
.row-link:hover { background: var(--bg-hover); }
.row-link .row-link-anchor {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap;
}
.row-link .row-link-anchor:focus-visible {
  position: static; width: auto; height: auto; overflow: visible;
  clip: auto; white-space: normal;
  outline: 2px solid var(--accent-blue); outline-offset: -2px;
}
.row-link a:not(.row-link-anchor), .row-link button { position: relative; z-index: 2; }

/* ---- Loading spinner ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border-default); border-top-color: var(--accent-blue);
  border-radius: 50%; animation: spin 0.6s linear infinite;
  vertical-align: middle; margin-left: var(--sp-2);
}

/* ---- Tab navigation (underline style) ---- */
.tab-nav {
  display: flex;
  gap: 0;
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border-default);
  flex-wrap: wrap;
}
/* Override .btn styling inside tabs — tabs are NOT buttons */
.tab-nav .btn,
.tab-nav a,
.tab-nav button {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  box-shadow: none;
  cursor: pointer;
  transition: color var(--duration-fast), border-color var(--duration-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: -1px;
}
.tab-nav .btn:hover,
.tab-nav a:hover,
.tab-nav button:hover {
  color: var(--text-primary);
  text-decoration: none;
  background: none;
  box-shadow: none;
  transform: none;
}
.tab-nav .btn.btn-primary,
.tab-nav .btn.active,
.tab-nav a.active,
.tab-nav button.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  font-weight: 600;
  background: none;
  box-shadow: none;
}

/* ---- Run Tests: Multi-run layout ---- */
.run-tests-layout {
  display: grid; grid-template-columns: 360px 1fr;
  gap: var(--sp-6); align-items: start;
}
@media (max-width: 1024px) { .run-tests-layout { grid-template-columns: 1fr; } }
.run-config-panel {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--sp-6); box-shadow: var(--shadow-sm);
}
.run-output-panel { min-width: 0; }

/* ---- Run list ---- */
.run-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.run-empty-state { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--text-muted); font-size: var(--text-base); }

/* ---- Run card ---- */
.run-card {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-left: 3px solid transparent; border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4); cursor: pointer;
  transition: all var(--transition-base); box-shadow: var(--shadow-xs);
}
.run-card:hover { background: var(--bg-hover); border-left-color: var(--border-hover); box-shadow: var(--shadow-sm); }
.run-card.selected { border-left-color: var(--accent-blue); background: var(--accent-blue-dim); }
.run-card-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.run-card-label { font-weight: 600; font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.run-card-meta { font-size: var(--text-sm); color: var(--text-muted); white-space: nowrap; }

/* ---- Live Step Panel ---- */
.live-step-panel {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-4); box-shadow: var(--shadow-sm);
}
.live-step-header {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-sm); font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: var(--sp-3);
}
.live-chapter {
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  margin-bottom: var(--sp-2); overflow: hidden; transition: border-color 0.2s ease;
}
.live-chapter.active { border-color: var(--accent-blue); }
.live-chapter.ch-failed { border-color: var(--color-fail-border); }
.live-chapter.ch-selected { border-color: var(--accent-blue); background: var(--accent-blue-dim); }
.live-chapter-header {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3); background: var(--bg-surface);
  cursor: pointer; font-size: var(--text-sm); user-select: none;
  transition: background 0.15s ease;
}
.live-chapter-header:hover { background: var(--bg-hover); }
.live-chapter-num { color: var(--text-muted); font-weight: 700; font-size: var(--text-xs); min-width: 20px; }
.live-chapter-title { flex: 1; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-chapter-dur { color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; }
.live-chapter.collapsed .live-step-list { display: none; }
.live-step-list { padding: var(--sp-1) 0; border-top: 1px solid var(--border-light); }
.live-step-item { display: flex; align-items: center; gap: var(--sp-2); padding: 3px var(--sp-3) 3px var(--sp-5); font-size: var(--text-sm); }
.live-step-item.step-failed { background: var(--color-fail-bg); }
.live-step-icon { width: 14px; text-align: center; flex-shrink: 0; font-size: var(--text-xs); }
.live-step-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.live-step-dur { color: var(--text-muted); font-size: var(--text-xs); white-space: nowrap; }
.live-step-error { padding: 2px var(--sp-3) 4px var(--sp-5); margin-left: 22px; font-size: 11px; color: var(--color-fail); font-family: var(--font-mono); }
.step-icon-pass { color: var(--color-pass); }
.step-icon-fail { color: var(--color-fail); }
.step-icon-running { color: var(--accent-blue); animation: pulse 1.5s infinite; }

/* ---- Donut Chart ---- */
.donut-wrap { position: relative; width: 64px; height: 64px; flex-shrink: 0; }
.donut {
  width: 64px; height: 64px; border-radius: 50%;
  -webkit-mask: radial-gradient(closest-side, transparent 70%, black 71%);
  mask: radial-gradient(closest-side, transparent 70%, black 71%);
}
.donut-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: var(--text-sm); font-weight: 700; color: var(--text-primary);
}

/* ---- Filter Pills ---- */
.filter-pills { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.filter-pill { transition: all 0.15s ease; }
.filter-pill.active {
  background: var(--pill-color, var(--accent-blue)); color: #fff;
  border-color: var(--pill-color, var(--accent-blue));
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.filter-pill:not(.active):hover { border-color: var(--pill-color, var(--border-hover)); }

/* ---- Recording Notification ---- */
.rec-notification {
  position: fixed;
  bottom: var(--sp-4, 16px);
  right: var(--sp-4, 16px);
  z-index: 10001;
  background: var(--bg-card, #161b22);
  border: 1px solid var(--border-default, #30363d);
  border-left: 3px solid var(--color-pass, #22c55e);
  border-radius: var(--radius-md, 6px);
  padding: var(--sp-3, 12px) var(--sp-4, 16px);
  max-width: 340px;
  min-width: 260px;
  font-size: var(--text-sm, 13px);
  color: var(--text-primary, #c9d1d9);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: recNotifSlideIn 0.3s ease-out;
}
.rec-notification[hidden] { display: none; }
.rec-notification.rec-notification--error {
  border-left-color: var(--color-fail, #f85149);
}
@keyframes recNotifSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.rec-notification-title {
  font-weight: 600;
  margin-bottom: var(--sp-1, 4px);
  display: flex;
  align-items: center;
  gap: var(--sp-2, 8px);
}
.rec-notification-body {
  font-size: 12px;
  color: var(--text-secondary, #8b949e);
  margin-bottom: var(--sp-2, 8px);
}
.rec-notification-actions {
  display: flex;
  gap: var(--sp-2, 8px);
  align-items: center;
}
.rec-notification-actions .btn {
  font-size: 11px;
  padding: 2px 10px;
}
.rec-notification-dismiss {
  position: absolute;
  top: var(--sp-2, 8px);
  right: var(--sp-2, 8px);
  background: none;
  border: none;
  color: var(--text-muted, #6e7681);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px;
}
.rec-notification-dismiss:hover { color: var(--text-primary, #c9d1d9); }

/* --- Profile dropdown --- */
[x-cloak] { display: none !important; }

.profile-dropdown { position: relative; }

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  padding: var(--sp-2) 0;
}

.profile-menu-header {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-default);
  margin-bottom: var(--sp-1);
}

.profile-menu-item {
  display: block;
  width: 100%;
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.profile-menu-item:hover {
  background: var(--bg-secondary);
}

.profile-menu-danger {
  color: var(--color-fail);
}

/* ---- Test Card Grid ---- */
.test-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-4);
}
.test-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl, 10px);
  overflow: hidden;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-xs);
}
.test-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.test-card-bar {
  height: 3px;
  width: 100%;
}
.test-card-body {
  padding: var(--sp-4);
}
.test-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
  word-break: break-word;
}
.test-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.test-card-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-light, var(--border-default));
}

/* ---- Schedule Cards ---- */
.sched-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.schedule-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-xs);
}
.schedule-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}
.schedule-card-active {
  border-color: var(--color-pass-border);
}
.schedule-card-active:hover {
  border-color: var(--color-pass);
}
.schedule-card-paused {
  opacity: 0.65;
}

.sc-main {
  padding: var(--sp-4) var(--sp-5);
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: var(--sp-4);
  align-items: center;
}

.sc-toggle {
  display: flex;
  align-items: center;
}

/* Toggle switch button */
.schedule-toggle {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  position: relative;
  background: var(--border-default);
  transition: background var(--duration-fast);
  padding: 0;
}
.schedule-toggle.active {
  background: var(--color-pass);
}
.schedule-toggle::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform var(--duration-fast);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.schedule-toggle.active::after {
  transform: translateX(16px);
}

.sc-info { min-width: 0; }

.sc-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.sc-badges {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.sc-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-wrap: wrap;
}

.sc-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sc-meta-item svg {
  opacity: 0.6;
  flex-shrink: 0;
}

.sc-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.sc-next-run {
  text-align: right;
}
.sc-next-label {
  font-size: var(--text-2xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.sc-next-time {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.sc-actions {
  display: flex;
  gap: 6px;
}

/* ---- Schedule Create Form (card layout) ---- */
.create-section {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cs-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border-light);
}
.cs-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}
.cs-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.cs-body {
  padding: var(--sp-5);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.cs-field {
  margin-bottom: 0;
}
.cs-field-full {
  grid-column: 1 / -1;
}
.cs-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.cs-body .form-group select,
.cs-body .form-group input[type="text"] {
  max-width: 100%;
}
.cs-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

/* ---- Responsive: Schedule cards stack on small screens ---- */
@media (max-width: 768px) {
  .sc-main {
    grid-template-columns: 1fr;
    gap: var(--sp-3);
  }
  .sc-toggle {
    order: -1;
  }
  .sc-right {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }
  .sc-next-run {
    text-align: left;
  }
  .cs-body {
    grid-template-columns: 1fr;
  }
}
