/* Cerberus — Sentinel · Amber design system
 * Tokens, fonts, and component classes shared across all templates.
 * Tailwind CDN still provides spacing/flex/grid utilities; this file owns visual identity. */

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

:root {
  /* surfaces */
  --bg: #FAF8F3;
  --bg-soft: #F5EFE2;
  --panel: #ffffff;
  --panel-border: #ece6d8;
  --panel-border-soft: #f1ebde;
  --panel-border-strong: #dccfb3;

  /* text */
  --text: #1a1a1a;
  --text-muted: #5e564a;
  --text-dim: #857d70;
  --text-faint: #a39c8e;

  /* accent */
  --accent: #E85D2C;
  --accent-deep: #B8431A;
  --accent-text: #ffffff;
  --accent-tint: #fff1e8;
  --accent-tint-border: #fad3bc;

  /* surfaces (interactive) */
  --active-row: #fff7e8;
  --chip-bg: #f5f1e8;
  --chip-bg-strong: #ece6d8;

  /* status palette */
  --completed: #16a34a;
  --completed-bg: #f0fdf4;
  --completed-border: #bbf7d0;
  --completed-text: #15803d;

  --failed: #e11d48;
  --failed-bg: #fff1f2;
  --failed-border: #fecdd3;
  --failed-text: #9f1239;

  --running: #E85D2C;
  --running-bg: #fff7e8;
  --running-border: #fde0c7;
  --running-text: #9a3a14;

  --queued: #a16207;
  --queued-bg: #fefce8;
  --queued-border: #fde68a;
  --queued-text: #854d0e;

  --skipped: #cbd5e1;
  --skipped-bg: #f8fafc;
  --skipped-border: #e2e8f0;
  --skipped-text: #64748b;

  --sc: #a16207;
  --sc-bg: #fefce8;
  --sc-border: #fde68a;
  --sc-text: #854d0e;

  --banner-grad: linear-gradient(180deg, #fff7ed, #fff1f2);
  --banner-border: #fecaca;

  --font-sans: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ─── Base ─────────────────────────────────────────────────────────── */

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  letter-spacing: -0.005em;
  font-feature-settings: "ss01", "cv11";
}

/* Override Tailwind's default body bg from base.html */
body.bg-gray-50 { background: var(--bg) !important; }

.font-mono { font-family: var(--font-mono) !important; }
.tabular-nums { font-variant-numeric: tabular-nums; }

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

code, pre, .code-mono { font-family: var(--font-mono); }

/* ─── Shell ────────────────────────────────────────────────────────── */

.shell { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-soft);
  border-right: 1px solid var(--panel-border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  text-decoration: none;
  color: var(--text);
}
.sidebar__brand-name { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; }
.sidebar__workspace {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  cursor: pointer; text-align: left; text-decoration: none; color: var(--text);
  width: 100%;
}
.sidebar__workspace-avatar {
  width: 22px; height: 22px; border-radius: 3px;
  background: var(--accent-tint); color: var(--accent-deep);
  border: 1px solid var(--accent-tint-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; font-family: var(--font-mono);
  overflow: hidden;
}
.sidebar__workspace-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar__workspace-label {
  font-size: 9.5px; color: var(--text-faint);
  font-family: var(--font-mono); letter-spacing: 0.08em; font-weight: 600;
}
.sidebar__workspace-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.sidebar__nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  text-decoration: none;
}
.sidebar__nav-item:hover { background: rgba(0,0,0,.02); color: var(--text); }
.sidebar__nav-item-icon { color: var(--text-dim); display: flex; }
.sidebar__nav-item--active {
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 2px solid var(--accent);
}
.sidebar__nav-item--active .sidebar__nav-item-icon { color: var(--accent); }

.sidebar__cta {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--accent); color: var(--accent-text);
  border: none; border-radius: 4px;
  font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: 0 1px 0 rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.2);
}
.sidebar__cta:hover { background: var(--accent-deep); }
.sidebar__cta kbd {
  margin-left: auto; font-size: 9.5px; font-family: var(--font-mono); opacity: 0.8;
}

.sidebar__user {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 8px 6px;
  border-top: 1px solid var(--panel-border);
}
.sidebar__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--chip-bg-strong); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; font-family: var(--font-mono);
  overflow: hidden; flex-shrink: 0;
}
.sidebar__avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar__user-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar__user-role {
  font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono);
}

.sidebar__lang {
  display: flex; gap: 4px;
  padding: 4px 8px 0;
  font-size: 10.5px; font-family: var(--font-mono);
}
.sidebar__lang a {
  color: var(--text-faint); text-decoration: none; padding: 2px 4px;
}
.sidebar__lang a.active { color: var(--text); font-weight: 600; }
.sidebar__lang a:hover { color: var(--text); }

@media (max-width: 1100px) {
  .sidebar { width: 64px; padding: 16px 0; }
  .sidebar__brand { justify-content: center; padding: 4px 0; }
  .sidebar__brand-name,
  .sidebar__workspace,
  .sidebar__nav-item span:not(.sidebar__nav-item-icon),
  .sidebar__cta span,
  .sidebar__cta kbd,
  .sidebar__user-meta,
  .sidebar__lang { display: none !important; }
  .sidebar__nav-item { justify-content: center; padding: 10px 0; }
  .sidebar__cta { justify-content: center; padding: 10px 0; }
  .sidebar__user { justify-content: center; padding-left: 0; padding-right: 0; }
}

/* ─── Topbar ───────────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--panel-border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}
.breadcrumb { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.breadcrumb__sep { color: var(--text-faint); }
.breadcrumb__item {
  font-size: 12px; color: var(--text-muted);
  text-decoration: none;
}
.breadcrumb__item--mono { font-family: var(--font-mono); }
.breadcrumb__item--last { color: var(--text); font-weight: 600; }
.breadcrumb__item:hover { color: var(--text); }

.search-box {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-size: 12px; color: var(--text-dim);
  min-width: 220px;
}
.search-box span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.kbd {
  font-size: 10px; font-family: var(--font-mono); color: var(--text-dim);
  border: 1px solid var(--panel-border);
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg);
}

.icon-btn {
  width: 32px; height: 32px; padding: 0;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); position: relative;
}
.icon-btn:hover { color: var(--text); border-color: var(--panel-border-strong); }
.icon-btn__dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; background: var(--accent); border-radius: 50%;
}

main.shell__main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
}
.shell__content {
  padding: 28px 32px 64px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Buttons ──────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font-size: 12px; font-weight: 600;
  border-radius: 4px; cursor: pointer;
  text-decoration: none; border: 1px solid transparent;
  font-family: var(--font-sans);
  white-space: nowrap;
}
.btn--sm { padding: 6px 10px; font-size: 11.5px; }
.btn--primary {
  color: var(--accent-text); background: var(--accent);
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(0,0,0,.15), inset 0 1px 0 rgba(255,255,255,.2);
}
.btn--primary:hover { background: var(--accent-deep); }
.btn--ghost {
  color: var(--text-muted); background: var(--panel);
  border-color: var(--panel-border);
  font-weight: 500;
}
.btn--ghost:hover { color: var(--text); border-color: var(--panel-border-strong); }
.btn--danger {
  color: white; background: var(--failed);
}
.btn--danger:hover { filter: brightness(0.92); }
.btn--danger-outline {
  color: var(--failed-text); background: white;
  border-color: var(--failed-border);
}
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Cards ────────────────────────────────────────────────────────── */

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 16px 18px;
}
.card--flush { padding: 0; }
.card--lg { padding: 20px 22px; }
.card--danger { border-color: var(--failed-border); background: #fffafa; }

.card-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.card-header__title { font-size: 13px; font-weight: 600; }

.section-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; margin-bottom: 14px;
}
.section-head__inner { min-width: 0; }
.section-head__title {
  font-size: 18px; font-weight: 600; color: var(--text);
  letter-spacing: -0.015em;
}
.section-head__subtitle {
  font-size: 12.5px; color: var(--text-muted); margin-top: 4px; line-height: 1.5;
}
.kicker {
  font-size: 9.5px; color: var(--text-faint);
  font-weight: 600; letter-spacing: 0.12em;
  font-family: var(--font-mono);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: block;
}

.page-title {
  font-size: 26px; font-weight: 700; letter-spacing: -0.025em;
  margin: 0; color: var(--text);
}
.page-subtitle {
  font-size: 13px; color: var(--text-muted); margin-top: 4px;
}

/* ─── Status pills ─────────────────────────────────────────────────── */

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  border-radius: 3px;
  font-size: 11px; font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border: 1px solid;
}
.status-pill--sm { padding: 2px 7px; font-size: 10px; }
.status-pill__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.status-pill--completed {
  background: var(--completed-bg); color: var(--completed-text); border-color: var(--completed-border);
}
.status-pill--completed .status-pill__dot { background: var(--completed); }
.status-pill--failed {
  background: var(--failed-bg); color: var(--failed-text); border-color: var(--failed-border);
}
.status-pill--failed .status-pill__dot { background: var(--failed); }
.status-pill--running {
  background: var(--running-bg); color: var(--running-text); border-color: var(--running-border);
}
.status-pill--running .status-pill__dot { background: var(--running); animation: pulse 1.6s ease-in-out infinite; }
.status-pill--queued {
  background: var(--queued-bg); color: var(--queued-text); border-color: var(--queued-border);
}
.status-pill--queued .status-pill__dot { background: var(--queued); }
.status-pill--skipped, .status-pill--cancelled {
  background: var(--skipped-bg); color: var(--skipped-text); border-color: var(--skipped-border);
}
.status-pill--skipped .status-pill__dot, .status-pill--cancelled .status-pill__dot { background: var(--skipped); }
.status-pill--short_circuited {
  background: var(--sc-bg); color: var(--sc-text); border-color: var(--sc-border);
}
.status-pill--short_circuited .status-pill__dot { background: var(--sc); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 93, 44, 0.4); }
  50%      { box-shadow: 0 0 0 4px rgba(232, 93, 44, 0); }
}

/* ─── KPI / metrics ───────────────────────────────────────────────── */

.kpi { padding: 16px 18px; flex: 1; }
.kpi__label {
  font-size: 9.5px; color: var(--text-faint); font-weight: 600;
  letter-spacing: 0.12em; margin-bottom: 8px;
  font-family: var(--font-mono); text-transform: uppercase;
}
.kpi__value {
  font-size: 26px; font-weight: 600; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; color: var(--text); line-height: 1;
}
.kpi--accent .kpi__value { color: var(--accent); }
.kpi__sub { font-size: 11px; color: var(--text-dim); margin-top: 8px; font-family: var(--font-mono); }

.kpi-strip {
  display: flex; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 4px; overflow: hidden;
}
.kpi-strip__cell {
  flex: 1 1 150px; min-width: 150px;
  border-right: 1px solid var(--panel-border-soft);
  border-bottom: 1px solid var(--panel-border-soft);
}

/* ─── Filter chips ─────────────────────────────────────────────────── */

.filter-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px;
  background: var(--panel); color: var(--text-muted);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  letter-spacing: -0.005em;
  text-decoration: none;
}
.filter-chip:hover { color: var(--text); }
.filter-chip__count {
  font-size: 10px; font-family: var(--font-mono);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.filter-chip__dot { width: 6px; height: 6px; border-radius: 50%; }
.filter-chip--active {
  background: var(--text); color: var(--bg); border-color: var(--text);
}
.filter-chip--active .filter-chip__count { color: var(--bg); }

/* ─── Tabs ─────────────────────────────────────────────────────────── */

.tab {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  letter-spacing: -0.005em;
  text-decoration: none;
  font-family: var(--font-sans);
}
.tab:hover { color: var(--text); }
.tab--active {
  border-bottom-color: var(--accent);
  font-weight: 600; color: var(--text);
}
.tab__count {
  font-size: 10px; font-family: var(--font-mono);
  padding: 1px 7px;
  background: var(--chip-bg); color: var(--text-muted); border-radius: 8px;
}
.tabs-row {
  display: flex; border-bottom: 1px solid var(--panel-border);
  gap: 4px; margin-bottom: 24px;
}

/* ─── Phase progress (inline bar) ─────────────────────────────────── */

.phase-progress {
  display: flex; align-items: center; gap: 8px; min-width: 140px;
}
.phase-progress__cells { display: flex; gap: 2px; flex: 1; }
.phase-progress__cell { flex: 1; height: 6px; background: var(--chip-bg-strong); border-radius: 1px; }
.phase-progress__cell--done { background: var(--completed); }
.phase-progress__cell--current { background: var(--running); }
.phase-progress__cell--current-failed { background: var(--failed); }
.phase-progress__label {
  font-size: 10.5px; font-family: var(--font-mono);
  color: var(--text-dim);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* ─── Actor avatar ─────────────────────────────────────────────────── */

.actor {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 700; font-family: var(--font-mono);
  flex-shrink: 0;
  overflow: hidden;
}
.actor img { width: 100%; height: 100%; object-fit: cover; }

/* ─── Banners ─────────────────────────────────────────────────────── */

.banner {
  padding: 14px 16px;
  background: var(--banner-grad);
  border: 1px solid var(--banner-border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  display: flex; gap: 14px; align-items: flex-start;
}
.banner__icon {
  width: 24px; height: 24px;
  background: var(--accent); color: var(--accent-text);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0; margin-top: 1px;
}
.banner__kicker {
  font-size: 12px; font-weight: 600; color: var(--failed-text);
  margin-bottom: 3px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.banner__body { font-size: 13px; color: #3f1414; line-height: 1.5; }

/* ─── Forms ────────────────────────────────────────────────────────── */

.form-field { margin-bottom: 16px; }
.form-field__head {
  display: flex; justify-content: space-between; margin-bottom: 6px;
}
.form-field__label { font-size: 12px; font-weight: 600; color: var(--text); }
.form-field__hint {
  font-size: 11px; color: var(--text-dim); font-family: var(--font-mono);
}
.form-field__required { color: var(--accent); }

.input, .textarea, .select {
  width: 100%; padding: 9px 11px;
  font-size: 13px; color: var(--text);
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 4px; outline: none;
  font-family: var(--font-sans);
}
.input--mono { font-family: var(--font-mono); }
.textarea { padding: 10px 12px; line-height: 1.55; resize: vertical; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'><path d='M4 6 L8 10 L12 6' fill='none' stroke='%23857d70' stroke-width='1.6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); }

.toggle {
  width: 36px; height: 20px; padding: 2px;
  background: var(--chip-bg-strong);
  border: none; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: flex-start;
  transition: all .15s;
}
.toggle__handle {
  width: 16px; height: 16px;
  background: white; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.toggle--on { background: var(--accent); justify-content: flex-end; }

/* ─── Tables ───────────────────────────────────────────────────────── */

.data-table { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 4px; overflow: hidden; }
.data-table__head {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--panel-border);
  font-size: 9.5px; font-weight: 600; color: var(--text-faint);
  letter-spacing: 0.12em; font-family: var(--font-mono);
  text-transform: uppercase;
  padding: 10px 16px;
}
.data-table__row {
  border-bottom: 1px solid var(--panel-border-soft);
  text-decoration: none; color: var(--text);
  transition: background .12s;
  padding: 11px 16px;
  display: grid;
  align-items: center;
  gap: 14px;
}
.data-table__row:last-child { border-bottom: none; }
.data-table__row:hover { background: var(--active-row); }
.data-table__empty {
  padding: 60px 20px; text-align: center;
  color: var(--text-faint); font-size: 13px;
}

/* ─── Misc ─────────────────────────────────────────────────────────── */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  background: var(--chip-bg); color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  font-size: 11px; font-family: var(--font-mono);
}
.chip--mute { background: var(--chip-bg); color: var(--text-muted); }

.hr-soft { border: none; border-top: 1px solid var(--panel-border-soft); margin: 8px 0 18px; }
.hr-dashed { border: none; border-top: 1px dashed var(--panel-border-soft); }

.kv-row {
  display: flex; justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px dashed var(--panel-border-soft);
  font-size: 12px;
}
.kv-row__label { color: var(--text-muted); }
.kv-row__value { color: var(--text); font-family: var(--font-mono); font-weight: 500; }
.kv-row__value--accent { color: var(--accent); font-weight: 600; }
.kv-row__value--mute { color: var(--text-faint); }

.empty-state {
  padding: 40px 20px; text-align: center;
  color: var(--text-faint);
  border: 1px dashed var(--panel-border);
  border-radius: 4px;
  background: var(--panel);
  font-size: 13px;
}

/* ─── Markdown override (for run detail messages) ────────────────── */
.md :is(h1, h2, h3, h4) { font-weight: 600; margin: 0.6em 0 0.3em; color: var(--text); }
.md h1 { font-size: 1.15rem; }
.md h2 { font-size: 1.05rem; }
.md h3, .md h4 { font-size: 0.95rem; }
.md p { margin: 0.4em 0; }
.md ul, .md ol { margin: 0.4em 0; padding-left: 1.4em; }
.md ul { list-style: disc; }
.md ol { list-style: decimal; }
.md li { margin: 0.15em 0; }
.md code { background: var(--chip-bg); padding: 0.1em 0.3em; border-radius: 3px; font-size: 0.85em; font-family: var(--font-mono); }
.md pre { background: var(--bg-soft); padding: 0.6em 0.8em; border-radius: 4px; overflow-x: auto; font-size: 0.8em; border: 1px solid var(--panel-border-soft); }
.md pre code { background: none; padding: 0; }
.md a { color: var(--accent); text-decoration: underline; }
.md blockquote { border-left: 3px solid var(--panel-border-strong); padding-left: 0.8em; color: var(--text-muted); margin: 0.4em 0; }
.md hr { border-top: 1px solid var(--panel-border); margin: 0.8em 0; }

/* ─── Workspace settings · 7-tab hub ──────────────────────────── */

.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: flex-start;
}
@media (max-width: 880px) {
  .settings-layout { grid-template-columns: 1fr; }
}
.settings-nav {
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 76px;
}
.settings-nav__item {
  padding: 8px 12px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-left: 2px solid transparent;
  border-radius: 3px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.settings-nav__item:hover { color: var(--text); }
.settings-nav__item.is-active {
  background: var(--panel);
  border-color: var(--panel-border);
  border-left-color: var(--accent);
  font-weight: 600;
  color: var(--text);
}

.settings-panes { min-width: 0; }
.settings-pane { display: none; }
.settings-pane.is-active { display: block; }

.settings-pane__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
}
.settings-table-head {
  display: grid;
  gap: 12px;
  padding: 10px 20px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--panel-border);
  font-size: 9.5px; font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.12em;
  font-family: var(--font-mono);
  text-transform: uppercase;
}
.settings-table-row {
  display: grid;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--panel-border-soft);
  align-items: center;
}
.settings-table-row:last-child { border-bottom: none; }

.danger-row {
  display: flex; justify-content: space-between; gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--failed-border);
}

/* ─── Diff inline review note (Sentinel design) ────────────────────
   Cerberus self-review issues land below the matching diff line. The
   left padding lines up with the diff body's text column (44+44+16). */

.diff-review-note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px 10px 116px;
  font-family: var(--font-sans);
  font-size: 12px; color: var(--text);
  line-height: 1.5;
  border-top: 1px solid;
  border-bottom: 1px solid;
}
.diff-review-note--info {
  background: #f0f9ff; border-color: #bae6fd;
}
.diff-review-note--warn {
  background: var(--queued-bg); border-color: var(--queued-border);
}
.diff-review-note__badge {
  width: 20px; height: 20px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: white; flex-shrink: 0;
}
.diff-review-note--info .diff-review-note__badge { background: #0ea5e9; }
.diff-review-note--warn .diff-review-note__badge { background: var(--queued); }
.diff-review-note__kicker {
  font-size: 10.5px; font-family: var(--font-mono);
  color: var(--text-dim); font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 3px;
}
.diff-review-note__body { line-height: 1.5; }

/* ─── Toggle row (label + sub + toggle) ───────────────────────── */
.toggle-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: var(--bg);
  cursor: pointer;
}
.toggle-row:hover { border-color: var(--panel-border-strong); }

/* ─── 24h activity sparkline (Runs dashboard) ──────────────────── */

.activity-spark {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  height: 50px;
  align-items: end;
}
.activity-spark__bar {
  height: 0;
  display: flex; flex-direction: column; gap: 1px;
  justify-content: flex-end;
  min-height: 2px;
}
.activity-spark__seg {
  display: block;
  min-height: 2px;
  border-radius: 1px;
}

/* ─── Activity feed (Sentinel design) — daily-grouped audit log ─── */

.activity-filters {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.activity-day { margin-bottom: 28px; }
.activity-day__head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.activity-day__card { overflow: hidden; }

.activity-row {
  display: grid;
  grid-template-columns: 70px 30px 130px 1fr 60px;
  gap: 14px; align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--panel-border-soft);
  text-decoration: none; color: var(--text);
  transition: background .12s;
}
.activity-row:hover { background: var(--active-row); }
.activity-row--last { border-bottom: none; }
.activity-row__time {
  font-size: 11px; color: var(--text-dim);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.activity-row__kind {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 8px; border-radius: 2px;
  background: var(--chip-bg);
  color: var(--text);
  width: fit-content;
}
.activity-row__dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
}
.activity-row__text {
  font-size: 13px; color: var(--text);
  line-height: 1.5; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.activity-row__open {
  font-size: 11px; color: var(--accent);
  font-weight: 500; text-align: right;
}
@media (max-width: 880px) {
  .activity-row {
    grid-template-columns: 60px 26px 110px 1fr;
    gap: 10px; padding: 10px 14px;
  }
  .activity-row__open { display: none; }
}

/* ─── Repo Overview · split layout (Sentinel design) ───────────────
   1fr / 320px — main column carries the health calendar + recent runs;
   right rail carries open-tasks banner, configuration kv list, push-gate
   chips, and quick-action links. */

.repo-overview {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .repo-overview { grid-template-columns: 1fr; }
}
.repo-overview__main { min-width: 0; }
.repo-overview__rail {
  display: flex; flex-direction: column; gap: 16px;
}

/* 14-day health calendar (vertical bars, success-stacked-on-fail) */
.health-cal {}
.health-cal__bars {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px; height: 60px; align-items: end;
}
.health-cal__bar {
  height: 0;
  display: flex; flex-direction: column; gap: 1px;
  justify-content: flex-end;
}
.health-cal__bar-fail {
  display: block;
  background: var(--failed);
  min-height: 2px; border-radius: 1px;
}
.health-cal__bar-ok {
  display: block;
  background: var(--completed);
  min-height: 2px; border-radius: 1px;
}
.health-cal__legend {
  display: flex; gap: 14px;
  margin-top: 14px;
  font-size: 10.5px; color: var(--text-dim);
  font-family: var(--font-mono);
}
.health-cal__dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.health-cal__dot--ok   { background: var(--completed); }
.health-cal__dot--fail { background: var(--failed); }

/* Compact run row (used in Recent Runs panel) */
.compact-run-row {
  display: grid;
  grid-template-columns: 16px 50px 1fr 60px 90px 14px;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border-soft);
  text-decoration: none; color: var(--text);
  transition: background .12s;
}
.compact-run-row:last-child { border-bottom: none; }
.compact-run-row:hover { background: var(--active-row); }
.compact-run-row__dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.compact-run-row__id {
  font-size: 11px; font-family: var(--font-mono); color: var(--text-dim);
}
.compact-run-row__main { min-width: 0; }
.compact-run-row__title {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.compact-run-row__meta {
  font-size: 10.5px; color: var(--text-dim);
  font-family: var(--font-mono); margin-top: 2px;
}
.compact-run-row__phase, .compact-run-row__time {
  font-size: 11px; color: var(--text-dim); font-family: var(--font-mono);
  text-align: right; white-space: nowrap;
}
.compact-run-row__chev { color: var(--text-faint); font-size: 12px; }

/* Push-gate chip — hard/soft variants. */
.gate-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  background: var(--chip-bg); color: var(--text);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  font-size: 11px; font-family: var(--font-mono);
}
.gate-chip__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--completed);
}
.gate-chip--soft .gate-chip__dot { background: var(--queued); }

/* Quick-action link list inside the right-rail card. */
.quick-link {
  display: block;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--panel-border-soft);
  transition: color .12s;
}
.quick-link:hover { color: var(--accent); }
.quick-link--last { border-bottom: none; }

/* ─── Run Detail · progress-log disclosure (terminal runs) ──────── */
.progress-log-disclosure {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  overflow: hidden;
}
.progress-log-disclosure__summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft);
  user-select: none;
}
.progress-log-disclosure__summary::-webkit-details-marker { display: none; }
.progress-log-disclosure__chevron {
  font-size: 11px; color: var(--text-faint);
  font-family: var(--font-mono);
  width: 10px; display: inline-block;
  transition: transform .15s ease;
}
.progress-log-disclosure[open] .progress-log-disclosure__chevron {
  transform: rotate(90deg);
}
.progress-log-disclosure[open] .progress-log-disclosure__summary {
  border-bottom: 1px solid var(--panel-border-soft);
}

/* ─── Run Detail · split layout (Sentinel design) ─────────────── */

.run-detail-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 1100px) {
  .run-detail-grid { grid-template-columns: 1fr; }
}

.run-detail-grid__main { min-width: 0; }
.run-detail-grid__log { min-width: 0; }

.phase-panel { display: none; }
.phase-panel.is-active { display: block; }

.phase-panel__head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.phase-panel__name { font-size: 14px; font-weight: 600; color: var(--text); }
.phase-panel__count {
  font-size: 11px; color: var(--text-dim);
  font-family: var(--font-mono);
}
.phase-panel__phase-log {
  margin-left: auto; font-size: 11px; font-family: var(--font-mono);
}
.phase-panel__phase-log summary {
  cursor: pointer; color: var(--text-muted); user-select: none;
}
.phase-panel__phase-log summary:hover { color: var(--text); }
.phase-panel__phase-log[open] summary { color: var(--text); }
.phase-log-content {
  margin-top: 8px;
  font-size: 11px; font-family: var(--font-mono);
  background: #0f0e0c; color: #e8e2d3;
  padding: 12px; border-radius: 4px;
  max-height: 384px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}

.phase-panel__steps { display: flex; flex-direction: column; gap: 8px; }

.step-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--skipped);
  border-radius: 4px;
  transition: transform .12s, box-shadow .12s;
}
.step-card:hover { transform: translateX(2px); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.step-card[open] { box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.step-card--completed { border-left-color: var(--completed); }
.step-card--running { border-left-color: var(--running); }
.step-card--failed { border-left-color: var(--failed); border-color: var(--failed-border); }
.step-card--skipped { border-left-color: var(--skipped); opacity: 0.65; }
.step-card--short_circuited { border-left-color: var(--sc); }

.step-card > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 12px 14px;
}
.step-card > summary::-webkit-details-marker { display: none; }
.step-card__main { min-width: 0; }
.step-card__id {
  display: inline-block;
  font-size: 12.5px; font-family: var(--font-mono);
  font-weight: 600; color: var(--text);
}
.step-card__model {
  font-size: 9.5px; font-family: var(--font-mono);
  padding: 1px 6px; border-radius: 2px;
  background: var(--chip-bg); color: var(--text-muted);
  letter-spacing: 0.04em; text-transform: uppercase;
}
.step-card__preview {
  font-size: 12.5px; color: var(--text-muted);
  line-height: 1.55;
  margin: 4px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.step-card__rt {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.step-card__calls {
  font-size: 10px; color: var(--text-faint);
}
.step-card__body {
  padding: 0 14px 14px;
  border-top: 1px dashed var(--panel-border-soft);
  display: flex; flex-direction: column; gap: 10px;
}
.step-card__body > *:first-child { margin-top: 12px; }

/* Tail event log (left, driver). Phase badge per group + connector. */
.event-log-tail {
  background: var(--bg-soft);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  list-style: none; margin: 0; padding: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  max-height: 560px; overflow-y: auto;
  position: sticky; top: 64px;
}
.event-log-tail__empty {
  padding: 24px 16px; text-align: center;
  color: var(--text-faint);
}
.event-log-row {
  padding: 4px 12px 10px 10px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background .12s;
  display: grid; grid-template-columns: 34px 1fr;
  gap: 10px; align-items: flex-start;
}
.event-log-row--first { padding-top: 12px; }
.event-log-row:hover { background: var(--active-row); }
.event-log-row.is-active {
  background: var(--active-row);
  border-left-color: var(--accent);
}

.event-log-row__phasecol {
  display: flex; flex-direction: column; align-items: center;
  align-self: stretch; position: relative;
}
.event-log-row__badge {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding-top: 1px;
}
.event-log-row__badge-num {
  width: 28px; height: 28px;
  background: var(--skipped); color: #fff;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.event-log-row--completed       .event-log-row__badge-num { background: var(--completed); }
.event-log-row--running         .event-log-row__badge-num { background: var(--running); }
.event-log-row--failed          .event-log-row__badge-num { background: var(--failed); }
.event-log-row--skipped         .event-log-row__badge-num { background: var(--skipped); }
.event-log-row--short_circuited .event-log-row__badge-num { background: var(--sc); }
.event-log-row.is-active .event-log-row__badge-num {
  background: var(--accent); color: var(--accent-text, #fff);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--accent);
}
.event-log-row__badge-name {
  font-size: 8.5px; color: var(--text-faint);
  letter-spacing: 0.05em; text-transform: uppercase;
  white-space: nowrap; max-width: 34px;
  overflow: hidden; text-overflow: ellipsis;
}
.event-log-row__connector {
  width: 2px; flex: 1; margin-top: 2px;
  background: var(--skipped);
  opacity: 0.4;
  border-radius: 1px;
}
.event-log-row--completed       .event-log-row__connector { background: var(--completed); }
.event-log-row--running         .event-log-row__connector { background: var(--running); }
.event-log-row--failed          .event-log-row__connector { background: var(--failed); }
.event-log-row--skipped         .event-log-row__connector { background: var(--skipped); }
.event-log-row--short_circuited .event-log-row__connector { background: var(--sc); }
.event-log-row.is-active .event-log-row__connector {
  background: var(--accent); opacity: 1;
}

.event-log-row__content { min-width: 0; }
.event-log-row__head {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.event-log-row__num {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.event-log-row__time { color: var(--text-dim); }
.event-log-row__id {
  color: var(--text-muted); font-size: 10px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.event-log-row__dur {
  margin-left: auto; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.event-log-row__preview {
  margin: 4px 0 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 11.5px;
  line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-log-tail__terminator {
  padding: 10px 12px 10px 10px;
  display: grid; grid-template-columns: 34px 1fr;
  gap: 10px; align-items: flex-start;
  border-left: 3px solid var(--failed);
  color: var(--failed-text);
}
.event-log-tail__terminator-badge {
  width: 28px; height: 28px;
  background: var(--failed); color: #fff;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  font-family: var(--font-mono);
}

/* ─── Scrollbar (subtle) ──────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--panel-border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--panel-border-strong); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
