:root {
  --bg: #1a1d21;
  --bg-elevated: #22262c;
  --bg-panel: #262b32;
  --bg-sidebar: #15181c;
  --border: #343a43;
  --text: #e8eaed;
  --text-muted: #9aa3af;
  --accent: #3d9a6a;
  --accent-hover: #48b07a;
  --danger: #d45d5d;
  --warning: #c9a227;
  --success: #3d9a6a;
  --radius: 8px;
  --sidebar-width: 220px;
  --font: "Segoe UI", "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --mono: "Consolas", "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

a { color: #8fbfa8; text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { color: var(--text-muted); font-size: 12px; margin: 0 0 1rem; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #2f3a34;
  color: #9fd4b5;
  font-size: 11px;
  font-weight: 700;
}
.brand-text { font-weight: 600; font-size: 14px; }
.sidebar-nav { display: flex; flex-direction: column; padding: 0.75rem 0.5rem; gap: 0.15rem; flex: 1; }
.nav-link {
  color: var(--text-muted);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  text-decoration: none;
}
.nav-link:hover { background: #1e2329; color: var(--text); text-decoration: none; }
.nav-link.active { background: #24302a; color: #c5e6d3; }
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.user-chip {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-heading { margin: 0; font-size: 1.05rem; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: 0.5rem; }
.content { padding: 1.25rem; }
.menu-toggle { display: none; }

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.panel-header h2 { margin: 0; font-size: 0.95rem; font-weight: 600; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.stats-grid.kpi-strip {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.45rem;
}
.stat-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  min-height: 2.4rem;
  background: rgba(48, 53, 60, 0.55);
  border: 1px solid #3a414b;
  border-radius: 7px;
  padding: 0.4rem 0.65rem;
}
.stat-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.stat-value {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1;
  margin: 0;
  text-align: right;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-card.success,
.stat-card.tone-success {
  background: rgba(45, 90, 65, 0.28);
  border-color: #355746;
}
.stat-card.success .stat-value,
.stat-card.tone-success .stat-value { color: #8fbfa0; }
.stat-card.warning,
.stat-card.tone-warning {
  background: rgba(120, 95, 40, 0.24);
  border-color: #5c5130;
}
.stat-card.warning .stat-value,
.stat-card.tone-warning .stat-value { color: #d4c07a; }
.stat-card.danger,
.stat-card.tone-danger {
  background: rgba(110, 55, 55, 0.28);
  border-color: #6a3a3a;
}
.stat-card.danger .stat-value,
.stat-card.tone-danger .stat-value { color: #d4a0a0; }
.stat-card.tone-neutral {
  background: rgba(55, 60, 68, 0.55);
  border-color: #3d444e;
}
.stat-card.tone-neutral .stat-value { color: #c5cbd4; }
.stat-card.tone-blue {
  background: rgba(55, 85, 120, 0.28);
  border-color: #3d5570;
}
.stat-card.tone-blue .stat-value { color: #9db7d4; }
.stat-card.tone-slate {
  background: rgba(70, 85, 105, 0.26);
  border-color: #44566c;
}
.stat-card.tone-slate .stat-value { color: #a8b8cc; }
.stat-card.tone-amber {
  background: rgba(120, 88, 48, 0.24);
  border-color: #63502e;
}
.stat-card.tone-amber .stat-value { color: #d4b88a; }
.stat-card.tone-rose {
  background: rgba(105, 70, 70, 0.26);
  border-color: #5e4040;
}
.stat-card.tone-rose .stat-value { color: #d0a8a0; }

.panels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th { color: var(--text-muted); font-weight: 560; font-size: 12px; }
.row-actions { white-space: nowrap; text-align: right; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: #2a3038;
}
.badge-success, .badge-success { color: #9fd4b5; border-color: #355746; }
.badge-error, .badge-danger, .badge-critical { color: #f0b0b0; border-color: #6a3a3a; }
.badge-warning, .badge-high, .badge-medium { color: #e6d28a; border-color: #5c5130; }
.badge-muted, .badge-queued, .badge-low { color: var(--text-muted); }
.badge-running { color: #c5d4e6; border-color: #3a4a5c; }

.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text);
}
.empty-state p { margin: 0.35rem 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: #2c323a;
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; filter: none; }
.btn-sm { padding: 0.28rem 0.55rem; font-size: 12px; }
.btn-block { width: 100%; }
.btn-primary { background: #2f5a43; border-color: #3d7a5a; color: #dff5e8; }
.btn-primary:hover { background: #35684d; }
.btn-secondary { background: #2c323a; }
.btn-ghost { background: transparent; }
.btn-danger { background: #5a2f2f; border-color: #7a3d3d; color: #f5dfdf; }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.85rem; }
.field span { color: var(--text-muted); font-size: 12px; }
.field-hint { color: var(--text-muted); font-size: 11px; }
.field input, .field select, .field textarea {
  background: #1b1f24;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  font: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 1px solid #4a7a60;
  border-color: #4a7a60;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-row.checks { display: flex; gap: 1.25rem; margin-bottom: 1rem; }
.check { display: flex; align-items: center; gap: 0.45rem; color: var(--text-muted); }
.fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 0.25rem;
  margin: 0 0 1rem;
}
.fieldset legend { padding: 0 0.35rem; color: var(--text-muted); font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.danger-zone { justify-content: flex-start; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.form-panel { max-width: 720px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.25rem;
  margin: 0;
}
.detail-grid dt { color: var(--text-muted); font-size: 12px; margin-bottom: 0.2rem; }
.detail-grid dd { margin: 0; }

.alert {
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--border);
}
.alert-error { background: #3a2424; border-color: #6a3a3a; color: #f0c0c0; }
.alert-info {
  background: rgba(55, 85, 120, 0.22);
  border: 1px solid #3d5570;
  color: #9db7d4;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}
.alert-muted {
  background: rgba(55, 60, 68, 0.45);
  border: 1px solid #3d444e;
  color: var(--text-muted);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: radial-gradient(ellipse at top, #22282e 0%, var(--bg) 55%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}
.auth-brand { text-align: center; margin-bottom: 1.25rem; }
.auth-brand h1 { margin: 0.6rem 0 0.25rem; font-size: 1.25rem; }
.auth-brand .brand-mark { width: 36px; height: 36px; font-size: 13px; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 30;
}

@media (max-width: 1280px) {
  .stats-grid.kpi-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .panels-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-grid.kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row, .detail-grid { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .page-heading { font-size: 1rem; }
  html, body { overflow-x: hidden; max-width: 100%; }
  .app-shell, .main, .content, .panel, .table-wrap { max-width: 100%; }
  .kpi-strip .stat-card { min-width: 0; }
}

.filters-bar { margin-bottom: 0.75rem; }
.filters-form { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.filters-form input, .filters-form select, .compact-select {
  background: #1b1f24; border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 0.35rem 0.5rem; font: inherit; font-size: 12px;
}
.inline-run-form { display: flex; gap: 0.4rem; align-items: center; }
.form-wide { max-width: 960px; }
.breadcrumbs { color: var(--text-muted); font-size: 12px; margin-bottom: 0.75rem; }
.breadcrumbs a { color: var(--text-muted); }
.steps-editor { display: flex; flex-direction: column; gap: 0.65rem; margin-top: 0.75rem; }
.step-card { border: 1px solid var(--border); border-radius: 6px; background: #1e2329; }
.step-card-head, .step-card-body { padding: 0.55rem 0.7rem; }
.step-card-head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; border-bottom: 1px solid var(--border); }
.step-num { background: #2f3a34; color: #9fd4b5; border-radius: 4px; padding: 0.1rem 0.4rem; font-size: 11px; }
.step-sum { flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.35rem; }
.step-toolbar { display: flex; gap: 0.5rem; align-items: center; }
.step-toolbar select { flex: 1; background: #1b1f24; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 0.35rem; }
textarea.invalid { border-color: var(--danger) !important; }
.form.inline, form.inline { display: inline; }
.artifact-list { list-style: none; padding: 0; margin: 0; }
.artifact-list li { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.run-scenario { border: 1px solid var(--border); border-radius: 6px; padding: 0.5rem 0.7rem; margin-bottom: 0.5rem; background: #1e2329; }
.run-scenario summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.badge-passed, .badge-success { color: #9fd4b5; border-color: #355746; }
.badge-failed, .badge-error { color: #f0b0b0; border-color: #6a3a3a; }
.badge-interrupted, .badge-cancelled, .badge-skipped, .badge-warning { color: #e6d28a; border-color: #5c5130; }
.badge-pending { color: var(--text-muted); }
.badge-new { color: #9db7e8; border-color: #3a4a6a; }
.badge-confirmed, .badge-in_progress, .badge-ready_for_retest { color: #e6d28a; border-color: #5c5130; }
.badge-resolved { color: #9fd4b5; border-color: #355746; }
.badge-ignored { color: var(--text-muted); }
.badge-reopened { color: #e8b89d; border-color: #6a4a3a; }
.badge-high { color: #e8b89d; border-color: #6a4a3a; }
.row-critical td { background: rgba(120, 50, 50, 0.12); }
.issue-critical { border-left: 3px solid #8a5050; }
.filters-panel { padding: 0.65rem 0.75rem; }
.filters-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.compact-input { background: #1b1f24; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 0.35rem 0.5rem; font: inherit; font-size: 12px; max-width: 160px; }
.check-inline { font-size: 12px; color: var(--text-muted); display: inline-flex; gap: 0.3rem; align-items: center; }
.compact-stats .stat-card { padding: 0.35rem 0.55rem; min-height: 2.2rem; }
.compact-stats .stat-label { font-size: 10.5px; }
.compact-stats .stat-value { font-size: 0.98rem; }

.shot-preview { max-width: 360px; max-height: 240px; width: auto; height: auto; border: 1px solid var(--border); border-radius: 4px; background: #111; }
.video-preview { max-width: 420px; max-height: 240px; width: 100%; background: #111; border: 1px solid var(--border); border-radius: 4px; }
.artifact-preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.code-block { background: #15191e; border: 1px solid var(--border); padding: 0.6rem; border-radius: 4px; white-space: pre-wrap; word-break: break-word; font-size: 12px; max-height: 220px; overflow: auto; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.timeline li { padding: 0.4rem 0 0.4rem 0.9rem; position: relative; }
.timeline li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #6a8f7a; position: absolute; left: -5px; top: 0.7rem; }
.timeline time { display: block; font-size: 11px; color: var(--text-muted); }
.actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.6rem; }
.status-form, .assign-form { border: 1px solid var(--border); border-radius: 6px; padding: 0.55rem; background: #1e2329; display: flex; flex-direction: column; gap: 0.4rem; }
.topbar-actions-group { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.simple-list { margin: 0; padding-left: 1.1rem; }
.simple-list li { margin: 0.35rem 0; }
.nowrap { white-space: nowrap; }
.alert-success { background: rgba(60, 110, 80, 0.25); border: 1px solid #355746; color: #9fd4b5; padding: 0.55rem 0.75rem; border-radius: 6px; margin-bottom: 0.75rem; }


