/* Mindmatrix brand: navy wordmark, arc gradient from blue through
   violet into orange, Poppins type. Sampled from mindmatrix.net. */
:root {
  --brand-navy: #081120;
  --brand-navy-soft: #16213a;
  --brand-orange: #EF6B2A;
  --brand-orange-dark: #d55c1f;
  --brand-blue: #0F8EFB;
  --brand-violet: #7A4FC8;
  --brand-font: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #1f2933;
  --muted: #6b7280;
  --accent: #346FE2;
  --accent-soft: #e7effc;
  --pass: #16a34a;
  --pass-soft: #e6f7ec;
  --fail: #dc2626;
  --fail-soft: #fdecec;
  --warn: #d97706;
  --run: #346FE2;
  --skip: #9ca3af;
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .5; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button, input, select { font: inherit; color: inherit; }

.app {
  display: grid;
  grid-template-columns: 270px 1fr;
  height: 100vh;
  transition: grid-template-columns .18s ease;
}

/* Collapsed navigation: the drawer slides away and the workspace takes the space. */
.app.nav-collapsed { grid-template-columns: 0 1fr; }
.app.nav-collapsed > .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}
.sidebar { transition: transform .18s ease, opacity .18s ease; }
.nav-toggle { display: inline-grid; place-items: center; }

/* ---------- sidebar ---------- */

.sidebar {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  background: var(--brand-navy);
  border-bottom-color: var(--brand-navy);
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
}

.brand-name {
  font-family: var(--brand-font);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: .02em;
  color: #fff;
}

.brand-sub {
  font-family: var(--brand-font);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #9fb0c9;
}

/* The auth card sits on light ground, so the lockup inverts there. */
.auth-brand { background: transparent; border-bottom: none; }
.auth-brand .brand-name { color: var(--brand-navy); }
.auth-brand .brand-sub { color: var(--muted); }

.sidebar-actions { padding: 12px 16px 4px; }

.test-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}

.test-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius);
  cursor: pointer;
}

.test-item:hover { background: var(--bg); }
.test-item.active { background: var(--accent-soft); }

.test-item .dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--skip);
}

.test-item .meta { min-width: 0; flex: 1; }
.test-item .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.test-item .sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.sidebar-footer a { color: var(--accent); text-decoration: none; }

/* ---------- main ---------- */

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
  margin-bottom: 8px;
}

.workspace { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.toolbar-title { min-width: 0; flex: 1; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; }

.input-title {
  font-family: var(--brand-font);
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 18px;
  font-weight: 600;
  background: transparent;
}

.input-title:hover, .input-title:focus { border-color: var(--border); background: var(--bg); outline: none; }

.file-name { font-family: var(--mono); font-size: 11px; color: var(--muted); padding-left: 6px; }

.dirty { font-size: 12px; color: var(--warn); }

.panes {
  display: grid;
  /* Steps are a list; the run and preview panel is where the work is watched,
     so it gets the room. */
  grid-template-columns: minmax(320px, 0.8fr) minmax(520px, 1.6fr);
  gap: 16px;
  padding: 16px 20px;
  flex: 1;
  min-height: 0;
}

.pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.pane-head h2 {
  margin: 0;
  font-family: var(--brand-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-navy);
}
.count { color: var(--muted); font-weight: 400; margin-left: 4px; }

.input-desc {
  margin: 12px 16px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--bg);
}

/* ---------- step editor ---------- */

.steps { overflow-y: auto; padding: 12px 16px 16px; flex: 1; }

.step-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: #fff;
}

.step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.step-index {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.step-head select { flex: 1; min-width: 0; }
.step-desc { flex: 1; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-tools { display: flex; gap: 2px; }

.step-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px 12px;
  padding: 10px;
}

.field label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.field label .req { color: var(--fail); }
.field input, .field select, .step-head select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff;
}
.field input.wide { font-family: var(--mono); font-size: 12px; }
.field input:focus, .field select:focus, .step-head select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field.span-2 { grid-column: span 2; }

/* ---------- buttons ---------- */

.btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: var(--bg); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover { background: var(--brand-orange-dark); border-color: var(--brand-orange-dark); }
.btn-danger { background: var(--fail); border-color: var(--fail); color: #fff; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--fail); background: var(--fail-soft); }
.btn-small { padding: 3px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-icon { border: none; background: transparent; padding: 2px 6px; border-radius: 4px; cursor: pointer; color: var(--muted); }
.btn-icon:hover { background: var(--panel); color: var(--text); }
.btn-icon:disabled { opacity: .3; cursor: default; }

/* ---------- run panel ---------- */

.pane-run { display: flex; flex-direction: column; }
.pane-run .muted { padding: 16px; }
.muted { color: var(--muted); }

#run-body, #suite-run-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.run-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.badge.running { background: var(--accent-soft); color: var(--accent); }
.badge.passed { background: var(--pass-soft); color: var(--pass); }
.badge.failed { background: var(--fail-soft); color: var(--fail); }

.run-split {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 260px;
  flex: 1;
  min-height: 0;
}

.run-steps {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.run-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.run-step:hover { background: var(--bg); }
.run-step.selected { background: var(--accent-soft); }

.run-step .icon {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--skip);
}

.run-step.pending .icon { background: transparent; border: 1.5px solid var(--border); }
.run-step.running .icon { background: var(--run); animation: pulse 1s ease-in-out infinite; }
.run-step.passed .icon { background: var(--pass); }
.run-step.failed .icon { background: var(--fail); }
.run-step.skipped .icon { background: var(--skip); }

.run-step .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-step .label small { color: var(--muted); }
.run-step .time { font-size: 11px; color: var(--muted); font-family: var(--mono); }

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

.viewer { padding: 12px; overflow: auto; min-width: 0; background: #fafbfc; }
.viewer-title { font-weight: 600; margin-bottom: 8px; font-size: 13px; }
.viewer img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.viewer .muted { padding: 0; }

.error {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: var(--fail-soft);
  color: #7f1d1d;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}

.log { border-top: 1px solid var(--border); }
.log summary { padding: 8px 16px; cursor: pointer; font-size: 12px; color: var(--muted); }
.log pre {
  margin: 0;
  padding: 8px 16px 12px;
  max-height: 200px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11px;
  background: #0f172a;
  color: #e2e8f0;
}

.history-head { border-top: 1px solid var(--border); }

.history {
  list-style: none;
  margin: 0;
  padding: 6px 8px;
  max-height: 170px;
  overflow-y: auto;
}

.history li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.history li:hover { background: var(--bg); }
.history li.active { background: var(--accent-soft); }
.history .when { flex: 1; }
.history .dur { font-family: var(--mono); color: var(--muted); }
.history .empty-history { color: var(--muted); cursor: default; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  font-size: 13px;
  z-index: 50;
}

.toast.error { background: var(--fail); }
.toast.ok { background: var(--pass); }

@media (max-width: 1100px) {
  .panes { grid-template-columns: 1fr; overflow-y: auto; }
  .panes .pane { min-height: 420px; }
}

/* ---------- search + status filter (sidebar) ---------- */

.sidebar-search { padding: 8px 16px 0; }

.sidebar-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--bg);
}

.sidebar-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); background: #fff; }

.status-filter {
  display: flex;
  gap: 6px;
  padding: 10px 16px 4px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.chip:hover { background: var(--bg); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.test-list .no-match { padding: 12px 10px; color: var(--muted); font-size: 12px; }

/* ---------- screenshot lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .78);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 40px;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  cursor: default;
}

.lightbox .lightbox-caption {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(0,0,0,.4);
  padding: 4px 12px;
  border-radius: 999px;
}

.lightbox .lightbox-close {
  position: absolute;
  top: 14px;
  right: 20px;
  color: #fff;
  background: rgba(255,255,255,.12);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.lightbox .lightbox-close:hover { background: rgba(255,255,255,.22); }

.viewer img { cursor: zoom-in; }

/* ---------- failure callout ---------- */

.error-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #7f1d1d;
  margin-bottom: 4px;
}

/* ---------- auth screens ---------- */

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}

.auth-brand { padding: 0 0 18px; border-bottom: none; }

.auth-card h1 { font-size: 17px; margin: 4px 0 6px; }
.auth-card .muted { margin: 0 0 16px; font-size: 12px; }

.auth-card form { display: flex; flex-direction: column; gap: 12px; }

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.auth-card input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
}

.auth-card input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.auth-error {
  background: var(--fail-soft);
  color: #7f1d1d;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}

.auth-switch { margin-top: 14px; font-size: 12px; text-align: center; color: var(--muted); }
.auth-switch button { border: none; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* ---------- sidebar account bar ---------- */

.sidebar-account {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-info { display: flex; flex-direction: column; min-width: 0; }
.account-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-role { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

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

.btn-link {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

.btn-link:hover { text-decoration: underline; }

/* ---------- modal (users management) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  display: grid;
  place-items: center;
  z-index: 55;
  padding: 20px;
}

.modal {
  width: 100%;
  max-width: 420px;
  max-height: 80vh;
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 { margin: 0; font-size: 15px; }

.modal-close { position: static; background: transparent; color: var(--muted); width: 26px; height: 26px; }
.modal-close:hover { background: var(--bg); color: var(--text); }

.add-user-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.add-user-form input {
  flex: 1 1 130px;
  min-width: 0;
}

.add-user-form select {
  flex: 0 0 auto;
}

.add-user-form button {
  flex: 1 1 100%;
}

.add-user-form input, .add-user-form select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
}

#users-error.auth-error { margin: 0 16px 10px; }

.users-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }

.users-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
}

.users-list li:hover { background: var(--bg); }
.users-list .u-name { font-weight: 500; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.users-list .u-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}
.users-list .u-role.admin { color: var(--accent); border-color: var(--accent-soft); background: var(--accent-soft); }

/* ---------- AI analysis ---------- */

.ai-btn { margin-top: 10px; }

.ai-note { margin-top: 8px; font-size: 12px; }

.ai-analysis {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.ai-analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
}

.ai-model { font-weight: 400; color: var(--muted); font-family: var(--mono); font-size: 10px; }

.ai-summary { margin: 0 0 10px; font-size: 13px; }

.ai-field { margin-bottom: 8px; }
.ai-field strong { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.ai-field p { margin: 0; font-size: 13px; }

/* ---------- confirm / prompt modal (replaces native dialogs) ---------- */

.confirm-modal { max-width: 380px; }

.confirm-body { padding: 14px 16px; }
.confirm-body p { margin: 0 0 10px; font-size: 13px; }

.confirm-body input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 9px;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* ---------- sidebar tabs (Tests / Suites) ---------- */

.sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-tabs .tab {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.sidebar-tabs .tab:hover { color: var(--text); }
.sidebar-tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.sidebar-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.btn-secondary-action { margin-top: 6px; }

/* ---------- folder tree ---------- */

.folder-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px 5px 0;
  border-radius: var(--radius);
  cursor: default;
  font-size: 13px;
}

.folder-row:hover { background: var(--bg); }
.folder-row:hover .folder-actions { opacity: 1; }

.folder-toggle {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  width: 18px;
  padding: 0;
  font-size: 10px;
}

.folder-name {
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 0 7px;
}

.folder-actions {
  display: flex;
  gap: 0;
  opacity: 0;
  transition: opacity .12s;
}

.share-badge { font-size: 10px; }

/* ---------- test toolbar extras ---------- */

.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 6px;
}

.access-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: 999px;
  padding: 1px 8px;
}

.fieldset-reset {
  all: unset;
  display: contents;
}

/* ---------- share modal ---------- */

.share-modal { max-width: 460px; }

.share-body { padding: 14px 16px; }

.share-link-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--bg);
}

.share-visibility {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.share-visibility label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

#share-restricted-body { margin-top: 12px; }
#share-restricted-body .add-user-form { padding: 0 0 10px; border-bottom: none; }
#share-restricted-body .users-list { padding: 0; max-height: 180px; }

/* ---------- suites ---------- */

.suite-continue {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 16px 0;
  font-size: 12px;
  color: var(--muted);
}

.suite-add-select {
  margin: 10px 16px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
}

.suite-test-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: #fff;
}

.suite-test-row:hover .step-tools { opacity: 1; }

.suite-test-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
}

/* ---------- suite run: per-test group headers ---------- */

.run-step-group {
  padding: 8px 8px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.run-steps .run-step-group:first-child { border-top: none; margin-top: 0; }

/* ---------- notification bell ---------- */

.bell {
  position: relative;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  padding: 0 2px;
  line-height: 1;
}

.bell-count {
  position: absolute;
  top: -6px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--fail);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.modal-head-actions { display: flex; align-items: center; gap: 12px; }

.notifications-list {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
  max-height: 420px;
}

.notifications-list .muted { padding: 16px; }

.notification {
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  border-left: 3px solid transparent;
}

.notification:hover { background: var(--bg); }
.notification.unread { background: var(--accent-soft); border-left-color: var(--accent); }

.n-head { display: flex; align-items: center; gap: 8px; }
.n-title { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; }
.n-when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.n-body { font-size: 12px; color: var(--muted); margin-top: 2px; }

.n-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--skip); }
.n-dot.run { background: var(--accent); }
.n-dot.share { background: var(--pass); }
.n-dot.system { background: var(--warn); }

/* ---------- feature access modal ---------- */

.features-body { padding: 14px 16px; overflow-y: auto; max-height: 60vh; }

.feature-role-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.feature-role-row select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
}

.feature-hint { font-size: 12px; margin: 0 0 12px; }

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

.feature-row {
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.feature-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.feature-name { font-size: 13px; font-weight: 500; }
.feature-desc { font-size: 11px; color: var(--muted); padding-left: 22px; }

/* ---------- reports ---------- */

.report-range { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.report-range select { border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }
.report-side-note { font-size: 11px; padding: 10px 16px; margin: 0; }
.report-title { border-color: transparent; }

.report-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }

.report-pane { overflow: visible; flex: none; }

.report-trend {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 130px;
  padding: 16px;
}

.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.trend-bars { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; }
.trend-bar { width: 100%; border-radius: 2px; min-height: 0; }
.trend-bar.passed { background: var(--pass); }
.trend-bar.failed { background: var(--fail); }
.trend-label { font-size: 9px; color: var(--muted); }

.report-table-wrap { overflow-x: auto; }

.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.report-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.report-table tbody tr { cursor: pointer; }
.report-table tbody tr:hover { background: var(--bg); }

.rate { font-weight: 600; }
.rate.good { color: var(--pass); }
.rate.mid { color: var(--warn); }
.rate.bad { color: var(--fail); }

.report-failures { list-style: none; margin: 0; padding: 8px; }
.report-failures .muted { padding: 12px; }

.report-failure {
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.report-failure:hover { background: var(--bg); }
.rf-head { display: flex; align-items: center; gap: 8px; }
.rf-name { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; }
.rf-when { font-size: 11px; color: var(--muted); }
.rf-detail { font-size: 12px; color: var(--muted); margin-top: 3px; }
.rf-error { font-family: var(--mono); font-size: 11px; color: var(--fail); margin-top: 4px; word-break: break-word; }

/* ---------- per-user report row ---------- */

.report-user { display: flex; align-items: center; gap: 8px; }

.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.rate.none { color: var(--muted); }

/* ---------- recorder ---------- */

.record-modal { width: min(640px, 94vw); }
.record-body { padding: 16px; }

.record-url-row { display: flex; gap: 8px; margin-top: 10px; }
.record-url-row input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 12px;
}

.record-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.record-status .btn { margin-left: auto; }

.record-steps {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  max-height: 320px;
  overflow-y: auto;
}

.record-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 6px;
  border-radius: 6px;
}
.record-step:hover { background: var(--bg); }
.record-step-body { flex: 1; min-width: 0; }
.record-step-action { font-weight: 600; font-size: 13px; }
.record-step-detail {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.fragile-flag {
  font-size: 10px;
  font-weight: 600;
  color: var(--warn);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.record-mode {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- per-run report ---------- */

.run-report-box { border-top: 1px solid var(--border); }
.run-report-box > summary { padding: 8px 16px; cursor: pointer; font-size: 12px; color: var(--muted); }
.run-report { padding: 4px 16px 16px; max-height: 460px; overflow-y: auto; }

.rr-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.rr-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel);
}

.rr-card-value { font-size: 18px; font-weight: 600; }
.rr-card-value.passed { color: var(--pass); }
.rr-card-value.failed { color: var(--fail); }
.rr-card-label { font-size: 11px; color: var(--muted); margin-top: 1px; }
.rr-card-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }

.rr-section { margin-top: 14px; }
.rr-section-title {
  margin: 0 0 7px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.rr-insight {
  border-left: 3px solid var(--border);
  padding: 6px 10px;
  margin-bottom: 6px;
  background: var(--bg);
  border-radius: 0 6px 6px 0;
}
.rr-insight.good { border-left-color: var(--pass); }
.rr-insight.warn { border-left-color: var(--warn); }
.rr-insight.bad  { border-left-color: var(--fail); }
.rr-insight.info { border-left-color: var(--accent); }
.rr-insight-title { font-weight: 600; font-size: 12px; }
.rr-insight-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

.rr-failure {
  border: 1px solid var(--fail-soft);
  background: var(--fail-soft);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.rr-failure-head { font-weight: 600; font-size: 12px; display: flex; gap: 8px; align-items: center; }
.rr-failure-error {
  margin: 5px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  color: #7f1d1d;
  white-space: pre-wrap;
  word-break: break-word;
}

.rr-chip {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--muted);
}

.rr-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1.4fr) 2fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
  font-size: 12px;
}
.rr-bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rr-bar-sub { color: var(--muted); font-size: 11px; }
.rr-bar-track { background: var(--bg); border-radius: 999px; height: 8px; overflow: hidden; }
.rr-bar-fill { background: var(--accent); height: 100%; border-radius: 999px; }
.rr-bar-value { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }

.rr-history { font-size: 12px; }
.rr-ai .ai-analysis { margin-top: 0; }

/* ---------- per-project report row ---------- */

.report-project { display: flex; align-items: center; gap: 8px; }
.project-icon { flex: none; font-size: 12px; width: 16px; text-align: center; }

.never-run {
  display: inline-block;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

/* Editor feedback and account forms */
.validation-message { background: var(--fail-soft); color: #991b1b; border-left: 3px solid var(--fail); padding: 12px; margin-bottom: 12px; }
.step-card.invalid { border-color: var(--fail); }
.password-form { display: grid; gap: 14px; padding: 20px; }
.password-form label { display: grid; gap: 6px; }
.password-form input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Access that no longer matches the role's defaults, shown on the member row. */
.member-role-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.u-role.role-custom {
  background: #fef3c7;
  color: #92400e;
  cursor: help;
}

/* ---------- project / environment tree ---------- */

.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  padding: 2px 4px 2px 0;
}
.tree-row:hover { background: var(--bg); }
.tree-row:hover .folder-actions { opacity: 1; }

.tree-disclosure {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  cursor: pointer;
  padding: 7px 6px;
  border-radius: 8px;
  text-align: left;
}

.tree-caret { color: var(--muted); font-size: 10px; width: 10px; flex: none; }
.tree-icon { flex: none; font-size: 10px; }
.tree-icon-project { color: var(--brand-orange); }
.tree-icon-environment { color: var(--brand-blue); }

.tree-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-project .tree-label { font-weight: 600; font-size: 14px; }
.tree-environment .tree-label { font-weight: 500; font-size: 13px; }

.tree-count {
  margin-left: auto;
  flex: none;
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 1px 7px;
}
.tree-row:hover .tree-count { background: var(--panel); }

/* Environments read at a glance: production should never be mistaken for sandbox. */
.env-tag {
  flex: none;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 2px 7px;
}
.env-prod { background: var(--fail-soft); color: #b91c1c; }
.env-stage { background: #fef3c7; color: #92400e; }
.env-sandbox { background: var(--accent-soft); color: var(--accent); }
.env-neutral { background: var(--bg); color: var(--muted); }

/* Indent by nesting the list, not by fiddling with padding on each row. */
.tree-children { list-style: none; }
.tree-sublist { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 1px solid var(--border); margin-left: 12px; }
.tree-children-project > .tree-sublist { margin-bottom: 4px; }

.tree-empty {
  margin: 0 0 6px 30px;
  font-size: 12px;
  color: var(--muted);
}

.folder-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s ease; flex: none; }
.folder-actions:focus-within { opacity: 1; }

/* ---------- live browser inside the record panel ---------- */

.record-modal { width: min(1180px, 96vw); }

.record-workspace {
  display: grid;
  /* The screen is the point; the step list is a narrow companion. */
  grid-template-columns: minmax(0, 2.1fr) minmax(230px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.record-screen-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--brand-navy);
}

.record-screen-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--brand-navy);
  color: #cbd5e1;
  font-size: 11px;
}

.screen-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pass); flex: none; }

.record-screen-url {
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.record-screen-state { flex: none; color: #94a3b8; }

.record-screen {
  position: relative;
  background: #0b1220;
  min-height: 320px;
  display: grid;
  place-items: center;
  cursor: crosshair;
  outline: none;
}
.record-screen:focus-visible { box-shadow: inset 0 0 0 2px var(--brand-orange); }
.record-screen img { display: block; width: 100%; height: auto; }

.record-screen-hint {
  position: absolute;
  color: #94a3b8;
  font-size: 12px;
  margin: 0;
}

.record-workspace .record-steps { max-height: 460px; }

@media (max-width: 900px) {
  .record-workspace { grid-template-columns: 1fr; }
}

/* ---------- step description ---------- */

.step-desc {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A description someone wrote (or that came in with an import) is about this
   step, not about the action in general, so it reads as content. */
.step-desc-authored { color: var(--text); font-style: normal; }

/* ---------- keep the run panel inside the window ---------- */

/* Grid children refuse to shrink below their content unless told to, which let
   the run panel grow past the bottom of the window instead of scrolling. */
.panes > .pane { min-height: 0; }

.pane-run { overflow: hidden; }
#run-body, #suite-run-body { overflow: hidden; }

/* The screenshot is the thing being looked at, so it takes the slack and the
   supporting sections stay compact. */
.run-split { flex: 1; min-height: 0; }
.pane-run .viewer { overflow: auto; min-height: 0; }
.run-steps { overflow-y: auto; min-height: 0; }

.history { max-height: 132px; overflow-y: auto; flex: none; }
.run-report { max-height: 260px; }
.log pre { max-height: 160px; }
