/* ============================================================
   DevOps Platform — design system tokens
   ============================================================
   The token surface is the contract the redesigned screens use.
   Legacy aliases below (--bg-primary, --accent-primary, etc) stay
   as fallbacks so unconverted views keep rendering until they're
   migrated.
   ============================================================ */

:root {
  /* Surfaces — 5-level scale (0 = page bg, 4 = floating chrome) */
  --bg-0: #0a0d12;
  --bg-1: #11151c;
  --bg-2: #161b22;
  --bg-3: #1c2128;
  --bg-4: #21262d;

  /* Borders */
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --border-faint: rgba(255,255,255,0.04);

  /* Text scale */
  --text-0: #f4f6fb;
  --text-1: #c9d1d9;
  --text-2: #8b949e;
  --text-3: #5e6772;

  /* Accent ramp — driven by JS via setAccentPalette() to match the
   * fleet bot (violet default; cyan/amber/emerald/rose alternates). */
  --accent: #a78bfa;          /* lighter hover/link */
  --accent-strong: #8b5cf6;   /* primary button, brand */
  --accent-deep: #6d28d9;     /* pressed, gradient end */
  --accent-glow: rgba(139,92,246,0.20);
  --accent-soft: rgba(139,92,246,0.10);
  --accent-line: rgba(139,92,246,0.32);

  /* Severity */
  --sev-p1: #ef4444;
  --sev-p2: #f97316;
  --sev-p3: #f5c542;

  /* Incident state */
  --state-open: #ef4444;
  --state-ack: #f59e0b;
  --state-resolved: #34d399;
  --state-bot: var(--accent);
  --state-closed: #6b7280;

  /* Semantic */
  --ok: #34d399;
  --warn: #f59e0b;
  --bad: #ef4444;

  /* Density (balanced default; data-density overrides) */
  --pad-card-y: 16px;
  --pad-card-x: 18px;
  --gap-stack: 16px;
  --gap-grid: 14px;
  --row-height: 36px;
  --font-body: 13.5px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Type */
  --mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* ── Legacy aliases (kept for unmigrated views) ───────────── */
  --bg-primary: var(--bg-0);
  --bg-secondary: var(--bg-2);
  --bg-tertiary: var(--bg-4);
  --bg-card: var(--bg-3);
  --border-color: #30363d;
  --text-primary: var(--text-0);
  --text-secondary: var(--text-2);
  --text-muted: var(--text-3);
  --accent-primary: var(--accent-strong);
  --accent-primary-hover: var(--accent-deep);
  --severity-p1: var(--sev-p1);
  --severity-p2: var(--sev-p2);
  --severity-p3: var(--sev-p3);
  --status-open: var(--state-open);
  --status-ack: var(--state-ack);
  --status-resolved: var(--state-resolved);
  --status-resolved-by-bot: var(--state-bot);
  --status-closed: var(--state-closed);
  --danger: var(--bad);
  --vh: 100vh;
  --chat-dock-left-offset: 0px;
  --chat-dock-top-offset: 0px;
  --chat-dock-gutter: 16px;
}

[data-density="compact"] {
  --pad-card-y: 11px;
  --pad-card-x: 13px;
  --gap-stack: 11px;
  --gap-grid: 9px;
  --row-height: 30px;
  --font-body: 12.5px;
}

[data-density="spacious"] {
  --pad-card-y: 22px;
  --pad-card-x: 26px;
  --gap-stack: 22px;
  --gap-grid: 18px;
  --row-height: 42px;
  --font-body: 14.5px;
}

[data-theme="light"] {
  --bg-0: #f7f8fb;
  --bg-1: #ffffff;
  --bg-2: #f1f3f7;
  --bg-3: #e6e9ef;
  --bg-4: #d8dce5;
  --border: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.18);
  --border-faint: rgba(0,0,0,0.05);
  --text-0: #0f1419;
  --text-1: #2c3340;
  --text-2: #5b6472;
  --text-3: #8a93a3;
  --accent-soft: rgba(139,92,246,0.08);
  --accent-glow: rgba(139,92,246,0.14);
  --accent-line: rgba(139,92,246,0.28);
}

/* Honour the user's OS-level reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--sans);
  font-size: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }

/* The legacy header is rendered hidden; the new sidebar takes over.
 * Kept in markup so old code that toggles its display via JS doesn't
 * throw — the rules below win because the legacy code only sets the
 * style attribute, which has lower specificity than this declaration. */
.header { display: none !important; }

/* On the login route the sidebar and mobile bar are hidden so the
 * login card centres inside the main area. The shell itself stays in
 * the DOM (no blank-screen flash); the grid collapses to a single
 * column. Same treatment for unauthenticated state on any route. */
body[data-route="login"] .app-shell,
body[data-authed="no"]   .app-shell { grid-template-columns: 1fr; }
body[data-route="login"] .sidebar,
body[data-route="login"] .sidebar-scrim,
body[data-route="login"] .main-mobile-bar,
body[data-authed="no"]   .sidebar,
body[data-authed="no"]   .sidebar-scrim,
body[data-authed="no"]   .main-mobile-bar { display: none !important; }
body[data-route="login"] .main,
body[data-authed="no"]   .main { padding: 0; }

.muted { color: var(--text-2); }
.grow { flex: 1; }

/* ── App shell ───────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: var(--bg-0);
}
.app-shell[data-nav="compact"] { grid-template-columns: 64px 1fr; }
.app-shell[data-nav="top"]     { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }

.sidebar {
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border-right: 1px solid var(--border);
  padding: 18px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}
.app-shell[data-nav="top"] .sidebar {
  position: sticky;
  top: 0;
  height: auto;
  width: 100%;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  overflow-x: auto;
  overflow-y: hidden;
  border-right: 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 14px;
  border-bottom: 1px solid var(--border-faint);
  margin-bottom: 8px;
}
.sidebar-brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-glow);
  flex-shrink: 0;
}
.sidebar-brand .name {
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.sidebar-brand .name small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 6px 12px 4px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none !important;
  position: relative;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
}
.nav-link:hover {
  background: var(--bg-2);
  color: var(--text-0);
}
.nav-link.active {
  background: linear-gradient(90deg, var(--accent-glow) 0%, var(--accent-soft) 35%, transparent 100%);
  color: var(--text-0);
  box-shadow: inset 3px 0 0 var(--accent-strong),
              0 0 0 1px var(--accent-line);
}
.nav-link.active .nav-icon { color: var(--accent); }
.nav-link.active span { color: var(--text-0); }
.nav-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.nav-link.has-attention {
  /* Subtle pulse on attention items; reduced-motion media query above mutes it. */
  animation: nav-attention 2.4s ease-in-out infinite;
}
@keyframes nav-attention {
  0%, 100% { background-color: transparent; }
  50%      { background-color: var(--accent-soft); }
}
.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--state-open);
  margin-left: auto;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.18);
}
.nav-pip {
  margin-left: auto;
  background: var(--accent-strong);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  line-height: 1.4;
  min-width: 20px;
  text-align: center;
}
.sidebar-spacer { flex: 1; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-top: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.sidebar-user .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12.5px;
  flex-shrink: 0;
}
.sidebar-user .who { flex: 1; min-width: 0; line-height: 1.25; }
.sidebar-user .who .name {
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .who .status {
  font-size: 11px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.sidebar-user .who .status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.sidebar-user .who .status .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.18);
}
.sidebar-settings-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  background: transparent;
  border: 0;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}
.sidebar-settings-btn + .sidebar-settings-btn { margin-left: 2px; }
.sidebar-settings-btn:hover { background: var(--bg-3); color: var(--text-0); }
.sidebar-settings-btn .ico { width: 14px; height: 14px; }

/* Compact icon-rail variant — hide labels, hide group headers,
 * hide pip text but keep the dot. */
.app-shell[data-nav="compact"] .sidebar { padding: 14px 6px; align-items: center; }
.app-shell[data-nav="compact"] .sidebar-brand .name { display: none; }
.app-shell[data-nav="compact"] .nav-group-label { display: none; }
.app-shell[data-nav="compact"] .nav-link { justify-content: center; padding: 10px 8px; }
.app-shell[data-nav="compact"] .nav-link > span:not(.nav-icon) { display: none; }
.app-shell[data-nav="compact"] .nav-link .nav-pip { position: absolute; top: 2px; right: 2px; font-size: 10px; padding: 0 5px; min-width: 16px; }
.app-shell[data-nav="compact"] .nav-link .nav-dot { position: absolute; top: 6px; right: 6px; margin: 0; }
.app-shell[data-nav="compact"] .sidebar-user { padding: 6px; }
.app-shell[data-nav="compact"] .sidebar-user .who,
.app-shell[data-nav="compact"] .sidebar-user .sidebar-settings-btn { display: none; }

/* Top bar variant — flatten the brand + groups into a row. */
.app-shell[data-nav="top"] .sidebar-brand { border: 0; padding: 4px 8px 4px 0; margin: 0 4px 0 0; flex-shrink: 0; }
.app-shell[data-nav="top"] .nav-group { flex-direction: row; align-items: center; margin: 0; gap: 1px; }
.app-shell[data-nav="top"] .nav-group-label { display: none; }
.app-shell[data-nav="top"] .nav-link { padding: 6px 10px; font-size: 13px; }
.app-shell[data-nav="top"] .nav-link.active { box-shadow: inset 0 -2px 0 var(--accent-strong); background: transparent; }
.app-shell[data-nav="top"] .sidebar-spacer { flex: 1; }
.app-shell[data-nav="top"] .sidebar-user { margin: 0; padding: 6px 10px; background: transparent; border: 0; }

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 29;
}
.sidebar-scrim.open { display: block; }

.main {
  padding: 28px 32px 60px;
  min-width: 0;
  background: var(--bg-0);
}
.main-mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-faint);
  margin-bottom: 12px;
}
.mobile-menu-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-1);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}

/* Mobile drawer */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 40;
  }
  .sidebar.open { transform: translateX(0); }
  .main-mobile-bar { display: flex; }
  .main { padding: 16px; }
}

/* ── Page head / cards / common ───────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: var(--gap-stack);
}
.page-head .titles { flex: 1; min-width: 0; }
.page-head h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-0);
}
.page-head .subtitle {
  display: block;
  color: var(--text-2);
  font-size: 13.5px;
  margin-top: 4px;
}
.page-head .actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.crumb {
  font-size: 12.5px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.crumb:hover { color: var(--text-0); }

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--pad-card-y) var(--pad-card-x);
  margin-bottom: var(--gap-stack);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-0);
  letter-spacing: -0.005em;
}
.card-ai {
  border-color: var(--accent-line);
  background: linear-gradient(160deg, var(--accent-soft) 0%, var(--bg-2) 30%);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap-grid);
  margin-bottom: var(--gap-stack);
}
.stat {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  overflow: hidden;
}
.stat .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}
.stat .value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 4px;
  color: var(--text-0);
}
.stat .sub {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 4px;
}
.stat.has-attention {
  border-color: rgba(239,68,68,0.35);
  background: linear-gradient(160deg, rgba(239,68,68,0.08), var(--bg-2) 60%);
}
.stat.has-attention .value { color: var(--bad); }
.stat.good .value { color: var(--ok); }
.stat .stripe {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
}

/* ── Buttons (additive — keep legacy variants working) ───────── */
.btn {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-family: inherit;
}
.btn:hover { background: var(--bg-4); border-color: var(--border-strong); color: var(--text-0); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-strong) 0%, var(--accent-deep) 100%);
  border-color: var(--accent-deep);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 2px 6px rgba(109,40,217,0.35);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--accent-deep) 0%, var(--accent-deep) 100%);
  border-color: var(--accent-deep);
  color: #fff;
  box-shadow: 0 2px 10px rgba(109,40,217,0.5);
}
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-ai {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.btn-ai:hover { background: var(--accent-glow); color: var(--text-0); }

/* ── Badges (new variants alongside legacy) ───────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge .b-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  display: inline-block;
}
.badge-ai {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}
/* Severity — bright text on tinted bg, visible filled dot to the
 * left. The dot has a small dark ring to keep contrast on any bg. */
.badge-sev-p1, .badge-sev-p2, .badge-sev-p3 { padding-left: 8px; gap: 6px; font-weight: 600; }
.badge-sev-p1::before, .badge-sev-p2::before, .badge-sev-p3::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 999px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}
.badge-sev-p1 { background: rgba(239,68,68,0.14); color: #fca5a5; border-color: transparent; }
.badge-sev-p1::before { background: #ef4444; box-shadow: 0 0 0 1px rgba(0,0,0,0.20); }
.badge-sev-p2 { background: rgba(249,115,22,0.14); color: #fdba74; border-color: transparent; }
.badge-sev-p2::before { background: #f97316; box-shadow: 0 0 0 1px rgba(0,0,0,0.20); }
.badge-sev-p3 { background: rgba(245,197,66,0.14); color: #fcd34d; border-color: transparent; }
.badge-sev-p3::before { background: #f5c542; box-shadow: 0 0 0 1px rgba(0,0,0,0.20); }

/* State — same brightness step-up; padding tweak for breathing room. */
.badge-state-open,
.badge-state-acknowledged, .badge-state-ack,
.badge-state-resolved,
.badge-state-resolved_by_bot, .badge-state-bot,
.badge-state-closed,
.badge-state-suppressed,
.badge-state-unrouted    { font-weight: 600; padding: 3px 11px; }
.badge-state-open        { background: rgba(239,68,68,0.14);  color: #fca5a5; border-color: transparent; }
.badge-state-acknowledged,
.badge-state-ack         { background: rgba(245,158,11,0.14); color: #fcd34d; border-color: transparent; }
.badge-state-resolved    { background: rgba(52,211,153,0.14); color: #6ee7b7; border-color: transparent; }
.badge-state-resolved_by_bot,
.badge-state-bot         { background: var(--accent-soft);    color: var(--accent); border-color: transparent; }
.badge-state-closed      { background: rgba(107,114,128,0.18);color: #d1d5db; border-color: transparent; }
.badge-state-suppressed  { background: rgba(107,114,128,0.10);color: var(--text-2); border-style: dashed; }
.badge-state-unrouted    { background: rgba(168,85,247,0.14); color: #d8b4fe; border-color: transparent; }

.badge-tier {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px dashed rgba(255,255,255,0.25);
  font-weight: 600;
  padding: 3px 9px;
  letter-spacing: 0.02em;
}
.badge-role { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

/* ── Tables (additive `.table` for the new design) ───────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-faint);
  vertical-align: middle;
}
.table tbody tr { cursor: pointer; transition: background 0.12s; }
.table tbody tr:hover { background: var(--bg-3); }
.table tbody tr:hover .ai-snippet { color: var(--text-1); }
.table tbody tr.row-clean { cursor: default; }
.table tbody tr.row-clean:hover { background: transparent; }
.table tbody tr.is-attention td:first-child {
  box-shadow: inset 3px 0 0 var(--state-open);
}
.sev-gutter { display: inline-block; width: 4px; height: 32px; border-radius: 2px; vertical-align: middle; margin: 0 6px 0 0; }
.cell-stack { display: flex; flex-direction: column; gap: 5px; }
.cell-stack > span:first-child { font-weight: 600; color: var(--text-0); font-size: 13.5px; }
.ai-snippet.ai-snippet-muted { color: var(--text-3); }
.ai-snippet.ai-snippet-muted .ico { color: var(--text-3); }
.ai-snippet.ai-snippet-muted .mono { color: var(--text-2); }
.ai-snippet {
  font-size: 12px;
  color: var(--text-2);
  display: inline-flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.5;
  font-style: italic;
}
.ai-snippet .ico { color: var(--accent); flex-shrink: 0; margin-top: 3px; font-style: normal; }

/* Mini sparkline in Insights' Top problem services table. */
.mini-trend {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  width: 110px;
}
.mini-trend .mtb {
  flex: 1;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-radius: 2px;
  opacity: 0.85;
  min-height: 2px;
}

.mono { font-family: var(--mono); font-size: 12.5px; }
.ico { vertical-align: -2px; }

/* Filter pill bar — pills are free on the page (no enclosing card).
 * Each active pill has its own rounded border + tinted bg; counts
 * sit in a contrasting chip glued to the right of the label. */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 0;
  background: transparent;
  border: 0;
}
.filter-pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.filter-pill:hover { color: var(--text-0); border-color: var(--border-strong); }
.filter-pill.is-active {
  background: var(--accent-soft);
  color: var(--text-0);
  border-color: var(--accent-line);
  box-shadow: 0 0 0 1px var(--accent-line);
}
.filter-pill .pill-count {
  background: var(--bg-3);
  color: var(--text-2);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}
.filter-pill.is-active .pill-count { background: var(--accent-strong); color: #fff; }
.filter-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 6px;
}
.filter-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 4px;
}
.search-row { margin-bottom: var(--gap-stack); }
.search-input {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input .ico { position: absolute; left: 12px; color: var(--text-3); pointer-events: none; }
.search-input input {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px 8px 36px;
  color: var(--text-0);
  font-size: 13px;
  outline: none;
  width: 100%;
  max-width: 420px;
  font-family: inherit;
}
.search-input input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.sidebar-global-search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 10px 16px;
  color: var(--text-3);
}
.sidebar-global-search svg { position: absolute; left: 10px; pointer-events: none; }
.sidebar-global-search input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px 8px 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-2);
  color: var(--text-0);
  font: inherit;
  font-size: 12px;
  outline: none;
}
.sidebar-global-search input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.global-search-loading { display: flex; align-items: center; gap: 10px; }
.loading-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: globalSearchSpin .75s linear infinite;
}
@keyframes globalSearchSpin { to { transform: rotate(360deg); } }
.btn.is-loading { cursor: wait; opacity: .8; }
.service-map-toolbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.service-map-toolbar form { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.service-map-toolbar input, .service-map-toolbar select {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--text-0);
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
}
.service-map-toolbar input { flex: 1 1 240px; }
.service-map-view-toggle { display: flex; gap: 4px; }
.service-map-visual { display: grid; gap: 14px; margin-top: 12px; }
.service-map-graph-viewport { overflow: hidden; min-height: 540px; border: 1px solid var(--border); border-radius: 8px; background: #0b1020; cursor: grab; touch-action: none; }
.service-map-graph-viewport:active { cursor: grabbing; }
.service-map-graph { display: block; width: 100%; min-width: 900px; height: 540px; }
.service-map-edge { fill: none; stroke-width: 2; stroke-opacity: .75; }
.service-map-graph-node { cursor: pointer; }
.service-map-graph-node:hover rect { stroke-width: 2.5; filter: brightness(1.25); }
.service-map-zoom-controls { display: flex; gap: 4px; }
.service-map-project-node { border: 1px solid var(--border); border-radius: 8px; background: var(--bg-1); padding: 16px; }
.service-map-project-head { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; color: var(--text-0); padding: 0; text-align: left; cursor: pointer; font: inherit; }
.service-map-project-head strong { font-size: 16px; }
.service-map-project-meta { color: var(--text-2); font-size: 12px; margin: 8px 0 14px; }
.service-map-branches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.service-map-branch-label { display: block; color: var(--text-3); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 7px; }
.service-map-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 24px; }
.service-map-list { margin-top: 12px; }
.service-map-detail-card { margin-top: 16px; }
.service-map-detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 14px 0 20px; }
.service-map-detail-grid > div { display: flex; flex-direction: column; gap: 5px; }
.link-button { border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-weight: 600; }
@media (max-width: 760px) {
  .service-map-toolbar { align-items: stretch; flex-direction: column; }
  .service-map-toolbar form { flex-direction: column; }
  .service-map-toolbar input, .service-map-toolbar select { width: 100%; }
  .service-map-branches, .service-map-detail-grid { grid-template-columns: 1fr; }
}

/* AI suggest strip (used on Pulse, Approvals, etc.) */
.ai-suggest-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, var(--accent-soft), var(--bg-2) 60%);
  margin-bottom: var(--gap-stack);
}
.ai-suggest-strip > .ico { color: var(--accent); flex-shrink: 0; }
.ai-suggest-strip strong { color: var(--text-0); font-weight: 600; }

/* Sev gutter (left rail for table rows / cards) */
.sev-gutter {
  display: inline-block;
  width: 4px;
  height: 28px;
  border-radius: 2px;
  vertical-align: middle;
}
.sev-gutter.p1 { background: var(--sev-p1); }
.sev-gutter.p2 { background: var(--sev-p2); }
.sev-gutter.p3 { background: var(--sev-p3); }

/* Empty state */
.empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
}

/* Tabs (Insights, Routing) */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap-stack);
}
.tab {
  background: transparent;
  border: 0;
  color: var(--text-2);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
}
.tab:hover { color: var(--text-0); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent-strong); }

/* Toast (additive — uses new tokens) */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  color: var(--text-0);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  font-size: 13px;
  max-width: 360px;
}
.toast.ok      { border-color: rgba(52,211,153,0.4); }
.toast.error,
.toast.bad     { border-color: rgba(239,68,68,0.4); }
.toast.warn    { border-color: rgba(245,158,11,0.4); }

/* Page not found (killed routes) */
.page-not-found {
  margin: 80px auto 0;
  max-width: 480px;
  text-align: center;
  padding: 40px 28px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.page-not-found-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
}
.page-not-found h1 { margin: 0 0 8px; font-size: 24px; font-weight: 700; }
.page-not-found p { margin: 0 0 22px; font-size: 13.5px; }
.page-not-found-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* ── Pulse-specific bits ──────────────────────────────────────── */
.pulse-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--gap-stack);
}
@media (max-width: 1100px) {
  .pulse-grid { grid-template-columns: 1fr; }
}
.live-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.live-counter .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.18);
  animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(52,211,153,0.18); }
  50%      { box-shadow: 0 0 0 5px rgba(52,211,153,0.30); }
}
.live-counter .t { color: var(--text-1); font-weight: 500; }

/* Detail/dashboard live-polling pill — mirrors `.live-counter` but
 * also surfaces the polling interval + last-updated time so the
 * operator can see freshness. Sits in `.page-head .actions`. */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  font-size: 11.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.live-pill-dot {
  width: 7px; height: 7px; border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.18);
  animation: live-pulse 1.6s ease-in-out infinite;
}
.live-pill-label { color: var(--text-1); font-weight: 500; }
.live-pill-int   { color: var(--accent); font-weight: 600; }
.live-pill .muted { color: var(--text-3); }
.live-pill-t { color: var(--text-1); font-weight: 500; font-size: 11px; }

.bot-activity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bot-activity-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 8px;
  border-radius: 8px;
  font-size: 13px;
}
.bot-activity-row:hover { background: var(--bg-3); }
.ba-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}
.ba-icon.ok   { background: rgba(52,211,153,0.12); color: var(--ok); border-color: rgba(52,211,153,0.32); }
.ba-icon.warn { background: rgba(245,158,11,0.14); color: var(--warn); border-color: rgba(245,158,11,0.32); }
.ba-text strong { color: var(--text-0); font-weight: 500; }
.ba-time {
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}
.health-tile {
  display: block;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-1);
  text-decoration: none;
  transition: border-color 0.12s, transform 0.12s;
}
.health-tile:hover { border-color: var(--border-strong); transform: translateY(-1px); text-decoration: none; }
.health-tile.warn { border-color: rgba(245,158,11,0.30); }
.health-tile.bad  { border-color: rgba(239,68,68,0.32); }
.health-tile .ht-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.health-tile .ht-state {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--ok);
}
.health-tile.warn .ht-state { background: var(--warn); }
.health-tile.bad  .ht-state { background: var(--bad); }
.health-tile .ht-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-2);
  padding: 2px 0;
}
.health-tile .ht-row .num { color: var(--text-0); font-weight: 500; font-family: var(--mono); }
.health-tile .ht-strip {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 2px;
  margin-top: 10px;
  height: 12px;
}
.health-tile .ht-strip .seg {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--bg-4);
}
.health-tile .ht-strip .seg.lvl-1 { background: rgba(245,158,11,0.45); }
.health-tile .ht-strip .seg.lvl-2 { background: rgba(249,115,22,0.75); }
.health-tile .ht-strip .seg.lvl-3 { background: rgba(239,68,68,0.85); }

.me-meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.me-meta-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-faint);
  font-size: 13px;
  color: var(--text-1);
}
.me-meta-list li:last-child { border-bottom: 0; }
.me-meta-list .k { color: var(--text-2); }

/* Approval card */
.approval-card {
  background: var(--bg-3);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.approval-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.approval-pb { font-weight: 500; color: var(--text-0); margin-bottom: 4px; }
.approval-meta { font-size: 11.5px; color: var(--text-2); margin-bottom: 8px; }
.approval-reasoning {
  font-size: 12.5px;
  color: var(--text-1);
  background: var(--bg-2);
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-style: italic;
  border-left: 2px solid var(--accent-line);
}
.approval-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 6px;
}
.approval-incident {
  font-size: 11px;
  color: var(--text-3);
  text-align: right;
}

/* ── Incident detail (THE STAR) ──────────────────────────────── */
.incident-hero {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: var(--gap-stack);
  overflow: hidden;
}
.incident-hero .left-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--sev-p3);
}
.incident-hero.state-open .left-bar,
.incident-hero.state-acknowledged .left-bar { background: var(--sev-p1); }
.incident-hero.is-bot-resolved .left-bar    { background: var(--accent-strong); }
.incident-hero.is-resolved .left-bar        { background: var(--ok); }
.incident-hero .meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.incident-hero h1 {
  margin: 10px 0 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-0);
}
.incident-hero .ext-id { color: var(--text-2); }
.service-link {
  color: var(--text-2);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.service-link strong { color: var(--text-0); }
.hero-action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.hero-action-row .timer {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-2);
}

/* AI panel */
.ai-panel {
  position: relative;
  background: linear-gradient(160deg, var(--accent-soft), var(--bg-2) 60%);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  padding: 24px 26px 20px;
  margin-bottom: var(--gap-stack);
}
.ai-bot {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  color: #fff;
  display: grid;
  place-items: center;
}
.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-left: 50px;
  margin-bottom: 8px;
}
.ai-head .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.ai-head .conf {
  font-size: 11.5px;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ai-head .conf strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.conf-meter { display: inline-flex; gap: 2px; }
.conf-seg {
  display: inline-block;
  width: 12px;
  height: 6px;
  border-radius: 2px;
  background: var(--bg-4);
}
.conf-seg.on { background: var(--accent); }
/* Quick-synopsis path: no investigation_result populated yet, so we
 * skip the confidence meter and show a "preliminary" chip instead.
 * Marks the summary as a lightweight first-pass, not a bot-stamped
 * diagnosis. */
.conf.conf-preliminary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.conf.conf-preliminary .ico { width: 11px; height: 11px; }

.ai-session-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: fit-content;
}
.ai-session-link .ico { width: 12px; height: 12px; color: var(--accent); }
.ai-session-link a { color: var(--accent); text-decoration: none; }
.ai-session-link a:hover { color: var(--accent-strong); text-decoration: underline; }

/* Cross-stitch chips on Application detail "Packages consumed" +
 * Package detail "Consumers". Same shape on both sides so operators
 * read them with one mental model. */
.pkg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pkg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-1);
  text-decoration: none;
  font-size: 12.5px;
  transition: border-color 0.12s, background 0.12s;
}
.pkg-chip:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text-0); }
.pkg-chip .ico { color: var(--text-3); width: 11px; height: 11px; }
.pkg-chip:hover .ico { color: var(--accent); }
.pkg-chip-version {
  background: var(--bg-4);
  color: var(--text-2);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

/* Package card: latest-version line + recent-releases mini-list */
.pkg-version {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pkg-recent {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-faint);
}
.pkg-recent-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
}
.pkg-recent-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  flex-shrink: 0;
}

.diagnosis {
  font-size: 15px;
  color: var(--text-0);
  line-height: 1.6;
  margin: 0 0 14px 50px;
}
/* When the diagnosis text is full markdown (agent's session summary)
 * preserve paragraph breaks, lists, code spans. The base .diagnosis
 * rule wins on font + colour; .markdown-body extras add spacing. */
.diagnosis.markdown-body p { margin: 0 0 10px; }
.diagnosis.markdown-body p:last-child { margin-bottom: 0; }
.diagnosis.markdown-body ul,
.diagnosis.markdown-body ol { margin: 6px 0 10px; padding-left: 22px; }
.diagnosis.markdown-body li { margin-bottom: 4px; }
.diagnosis.markdown-body li:last-child { margin-bottom: 0; }
.diagnosis.markdown-body code {
  background: var(--bg-4);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 13.5px;
  font-family: var(--mono);
}
.diagnosis.markdown-body pre {
  background: var(--bg-4);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 13px;
}
.diagnosis.markdown-body pre code { background: transparent; padding: 0; }
.diagnosis.markdown-body strong { color: var(--text-0); font-weight: 600; }
.diagnosis.markdown-body a { color: var(--accent); }
.diagnosis.markdown-body a:hover { color: var(--accent-strong); }
.diagnosis.markdown-body h1,
.diagnosis.markdown-body h2,
.diagnosis.markdown-body h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--text-0);
  text-transform: none;
  letter-spacing: 0;
}

.evidence-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  margin-left: 50px;
}
.evidence-chip {
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  min-width: 140px;
}
.evidence-chip .ec-label { font-size: 11px; color: var(--text-2); margin-bottom: 2px; }
.evidence-chip .ec-value { color: var(--text-0); font-weight: 500; font-family: var(--mono); }
.evidence-chip .ec-detail { font-size: 11px; color: var(--text-2); margin-top: 2px; }

.ai-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-left: 50px;
}
@media (max-width: 800px) { .ai-actions { grid-template-columns: 1fr; } }
.ai-act {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.ai-act:has(.ai-act-icon.suggest) { border-color: var(--accent-line); background: var(--accent-soft); }
.ai-act-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ai-act-icon.done { background: rgba(52,211,153,0.12); color: var(--ok); border: 1px solid rgba(52,211,153,0.3); }
.ai-act-icon.deferred { background: rgba(245,158,11,0.14); color: var(--warn); border: 1px solid rgba(245,158,11,0.3); }
.ai-act-icon.suggest { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.ai-act-title { font-weight: 500; color: var(--text-0); font-size: 13px; }
.ai-act-sub   { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* Resolution summary card */
.card.resolution { border-color: var(--ok); background: linear-gradient(160deg, rgba(52,211,153,0.06), var(--bg-2)); }
.card.resolution.bot-resolved { border-color: var(--accent-line); background: linear-gradient(160deg, var(--accent-soft), var(--bg-2)); }
.resolution-text { color: var(--text-0); font-size: 14px; line-height: 1.6; }

/* Tag chips */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-1);
  font-size: 12.5px;
  font-family: var(--mono);
}
.tag-chip.untagged { background: transparent; border-style: dashed; color: var(--text-3); }
.tag-chip.suggested {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-family: inherit;
  cursor: pointer;
}
.tag-chip.suggested:hover { background: var(--accent-glow); color: var(--text-0); }
.tag-chip .x {
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}
.tag-chip .x:hover { color: var(--bad); }
.tag-chip-input {
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--text-2);
  font-size: 12.5px;
  outline: none;
  font-family: inherit;
  min-width: 100px;
}

/* Action items */
.action-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.action-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-3);
}
.action-item.is-done { opacity: 0.55; }
.action-item.is-done .text { text-decoration: line-through; }
.action-item .check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  margin-top: 2px;
  color: var(--accent);
  flex-shrink: 0;
}
.action-item.is-done .check { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.action-item .text { color: var(--text-0); font-size: 13px; line-height: 1.5; }
.action-item .item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}
.action-item .delete-btn {
  background: transparent;
  border: 0;
  color: var(--text-3);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.action-item .delete-btn:hover { color: var(--bad); background: var(--bg-2); }

/* Audit timeline — bigger dots, more breathing room. */
.timeline {
  list-style: none;
  margin: 0;
  padding: 4px 0 0 22px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.timeline-item { position: relative; padding-left: 14px; }
.timeline-dot {
  position: absolute;
  left: -29px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--text-3);
  border: 3px solid var(--bg-2);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.timeline-dot.act-ingest    { background: var(--text-2); }
.timeline-dot.act-page,
.timeline-dot.act-acknowledge,
.timeline-dot.act-ack       { background: var(--state-ack); }
.timeline-dot.act-escalate,
.timeline-dot.act-escalated { background: var(--bad); }
.timeline-dot.act-resolve,
.timeline-dot.act-resolved  { background: var(--ok); }
.timeline-dot.act-remediate,
.timeline-dot.act-playbook,
.timeline-dot.act-bot       { background: var(--accent-strong); }
.timeline-dot.act-investigate,
.timeline-dot.act-investigation_completed,
.timeline-dot.act-investigation_requested { background: var(--accent); }
.timeline-dot.act-suppress,
.timeline-dot.act-mute      { background: var(--warn); }

.ti-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.ti-actor { color: var(--text-1); font-weight: 500; }
.ti-actor.bot { color: var(--accent); }
.ti-action { color: var(--text-2); font-size: 12px; }
.ti-time { color: var(--text-3); font-size: 11.5px; margin-left: auto; }
.ti-detail {
  color: var(--text-2);
  font-size: 12.5px;
  margin-top: 6px;
  line-height: 1.55;
  word-break: break-word;
}
.ti-detail h1,
.ti-detail h2,
.ti-detail h3 {
  margin: 8px 0 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-0);
  letter-spacing: -0.005em;
}
.ti-detail p { margin: 4px 0; }
.ti-detail ul, .ti-detail ol { margin: 4px 0; padding-left: 18px; }
.ti-detail code { font-size: 11.5px; padding: 1px 5px; }
.ti-detail strong { color: var(--text-1); }
.ti-kv {
  list-style: none;
  margin: 4px 0 0;
  padding: 8px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border-faint);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  font-size: 12px;
}
.ti-kv li { display: contents; }
.ti-kv-key { color: var(--text-3); font-size: 11.5px; }
.ti-kv-val { color: var(--text-1); word-break: break-word; }

/* Full approval card (used on /approvals page) */
.approval-full { padding: 16px 18px; }
.approval-full-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.approval-full-pb { font-size: 14px; font-weight: 500; color: var(--text-0); margin-bottom: 4px; }
.approval-full-meta { font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; }
.approval-params { margin-bottom: 12px; }
.approval-params summary { font-size: 12px; color: var(--text-2); cursor: pointer; }
.approval-params-pre {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-1);
  margin-top: 6px;
}
.approval-reasoning-full {
  font-size: 13.5px;
  color: var(--text-1);
  background: var(--bg-2);
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--accent-line);
  margin-bottom: 14px;
  font-style: italic;
}
.approval-full-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Login page wrapper (override legacy centering with new tokens) */
.login-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 30% 20%, var(--accent-soft), transparent 60%), var(--bg-0);
}
.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}
.login-card .login-logo { width: 60px; height: 60px; margin-bottom: 12px; }
.login-card h2 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.login-card p { color: var(--text-2); font-size: 13.5px; margin: 0 0 18px; }
.btn-google { display: inline-block; padding: 10px 24px; }
.login-error { color: var(--bad); }

code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', Menlo, monospace;
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}

pre {
  padding: 12px;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

/* ── Header / nav ────────────────────────────────────────────── */

.header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Hamburger button. Hidden on desktop, shown via the mobile media
 * query below. Three-bar SVG-free icon so we don't need an extra
 * asset request. */
.header-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  flex-direction: column;
  gap: 4px;
  width: 36px;
  height: 36px;
  justify-content: center;
  align-items: center;
}
.header-menu-btn:hover { background: var(--accent-soft); }
.hamburger-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.15s, opacity 0.15s;
}
.header-menu-btn[aria-expanded="true"] .hamburger-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.header-menu-btn[aria-expanded="true"] .hamburger-bar:nth-child(2) {
  opacity: 0;
}
.header-menu-btn[aria-expanded="true"] .hamburger-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.header-logo { width: 28px; height: 28px; }

.header-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 7px 14px;
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--accent-soft);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent-primary);
}

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

.user-menu { position: relative; }
.user-menu-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-menu-btn:hover { border-color: var(--accent-primary); }

.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 110%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  min-width: 180px;
  padding: 6px;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.user-menu.open .user-menu-dropdown { display: block; }
.user-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.user-menu-item:hover { background: var(--accent-soft); }

/* ── Layout ─────────────────────────────────────────────────── */

#app-body { display: flex; min-height: calc(100vh - 60px); }
#app-content { flex: 1; min-width: 0; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.view-header h1 { margin: 0; font-size: 22px; font-weight: 600; flex: 1; }
.view-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}
.back-link:hover { color: var(--accent-primary); }

/* ── Login ─────────────────────────────────────────────────── */

.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 60px);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 36px 28px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 12px 60px rgba(139,92,246,0.15);
  text-align: center;
}

.login-card .login-logo { width: 64px; height: 64px; margin-bottom: 16px; }
.login-card h2 { margin: 0 0 8px; font-size: 22px; }
.login-card p { color: var(--text-secondary); margin: 0 0 24px; font-size: 14px; }

.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  font-weight: 600;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-top: 12px;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
  margin: 0;
}

.muted { color: var(--text-muted); }

/* Stat tiles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-primary);
  border-radius: 10px;
  padding: 16px 18px;
}
.stat-tile-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.stat-tile-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-top: 4px;
}
.stat-tile-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--bg-secondary); }
.btn-primary {
  background: var(--accent-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-primary-hover); }
.btn-secondary {
  background: transparent;
  border-color: var(--border-color);
}
.btn-secondary:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }
.btn-link {
  background: none;
  color: var(--accent-primary);
  padding: 4px 6px;
}
.btn-link:hover { background: var(--accent-soft); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.is-busy {
  position: relative;
  pointer-events: none;
}
.btn.is-busy::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btnSpin 0.7s linear infinite;
}
@keyframes btnSpin {
  to { transform: rotate(360deg); }
}

.btn-sm { padding: 4px 10px; font-size: 12px; }

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  transform: translateX(-100%);
  opacity: 0;
}
body.route-loading::before {
  opacity: 1;
  animation: routeLoadingBar 1.1s ease-in-out infinite;
}
@keyframes routeLoadingBar {
  0% { transform: translateX(-100%); }
  55% { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}

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

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

table.simple-table,
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.simple-table th,
.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.simple-table td,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: top;
}
.simple-table tr:last-child td,
.data-table tr:last-child td { border-bottom: 0; }
.simple-table tr:hover,
.data-table tr:hover { background: var(--accent-soft); }

.row-clickable { cursor: pointer; }

/* ── Badges ─────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Legacy badge variants kept only for `.badge-safety-*` (used on the
 * Playbooks table). The redesign's sev / state / tier / role rules
 * live near the top of this file. */
.badge-safety-safe { background: rgba(52,211,153,0.18); color: #6ee7b7; border-color: rgba(52,211,153,0.5); }
.badge-safety-requires_approval { background: rgba(245,158,11,0.20); color: #fcd34d; border-color: rgba(245,158,11,0.5); }
.badge-safety-destructive { background: rgba(239,68,68,0.20); color: #fca5a5; border-color: rgba(239,68,68,0.5); }

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

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.form-row label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Style text-like inputs inside form-row. Checkboxes / radios keep
   their native rendering — without these :not() exclusions the
   100%-wide wide-input style stretches the checkbox into a giant
   pill that looks like an empty text field. */
.form-row input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-row select,
.form-row textarea,
.input-text,
input.input-text,
input.list-search-input,
input.search-input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  font: inherit;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-row input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):hover,
.form-row select:hover,
.form-row textarea:hover {
  border-color: var(--text-muted);
}
.form-row input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
.form-row textarea:focus,
.form-row select:focus,
.input-text:focus,
input.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-row input::placeholder,
.form-row textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}
.form-row input[readonly] {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: not-allowed;
}
.form-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--accent-primary);
  cursor: pointer;
}
/* Native select chevron — replaces the platform default with our own
   so the dropdown looks consistent across Mac / Linux. */
.form-row select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%238b949e' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-row textarea { min-height: 80px; resize: vertical; font-family: inherit; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.form-grid .form-row { margin-bottom: 0; }
.form-row.full { grid-column: 1 / -1; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
  align-items: center;
}
.form-status { color: var(--text-muted); font-size: 12px; flex: 1; }
.form-save-msg { font-size: 12px; margin-left: 8px; }
.form-help { font-size: 11px; margin-top: 4px; display: block; }
.text-success { color: var(--status-resolved); }
.text-warning { color: var(--status-ack); }
.text-error { color: var(--danger); }

.chip-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; min-height: 38px; background: var(--bg-tertiary); border-radius: 6px; border: 1px solid var(--border-color); }
.chip-input:focus-within { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-glow); }
.chip-input input {
  flex: 1; min-width: 100px; background: transparent; border: 0; outline: 0; color: var(--text-primary); font: inherit; padding: 4px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent-primary);
  padding: 3px 8px; border-radius: 999px; font-size: 12px;
}
.chip-x { cursor: pointer; opacity: 0.7; }
.chip-x:hover { opacity: 1; }

/* Agentic AWS MCP playbook builder on the Service form. */
.agent-playbooks-builder {
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 12px;
}
.agent-playbooks-head,
.agent-env-head,
.agent-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.agent-playbooks-head { margin-bottom: 12px; }
.agent-empty-state {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
}
.agent-env-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-primary);
  padding: 12px;
  margin-top: 10px;
}
.agent-env-head strong,
.agent-actions-title {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
}
.agent-env-head .muted {
  display: block;
  font-size: 12px;
  margin-top: 2px;
}
.agent-env-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.agent-credential-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
}
.agent-credential-panel .form-row {
  margin-bottom: 0;
}
.agent-tool-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 38px;
}
.agent-tool-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 12px;
}
.agent-command-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  padding: 7px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-tertiary);
}
.agent-command-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-family: var(--mono);
  font-size: 11.5px;
}
.agent-command-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  font: inherit;
  opacity: 0.72;
}
.agent-command-chip button:hover { opacity: 1; }
.agent-command-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}
.agent-actions {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}
.agent-action-row {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.agent-action-toggle {
  margin: 0;
  justify-content: flex-start;
}
.agent-action-toggle span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.agent-action-toggle small {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
}
.agent-action-row textarea {
  min-height: 74px;
}
.agent-action-row textarea:disabled,
.agent-action-row input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.agent-action-foot {
  display: grid;
  grid-template-columns: 82px 110px;
  align-items: center;
  gap: 8px;
}
.agent-action-foot label {
  color: var(--text-secondary);
  font-size: 12px;
}
.agent-summary-list {
  display: grid;
  gap: 10px;
}
.agent-summary-env {
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-tertiary);
}
.agent-summary-head .mono {
  color: var(--text-secondary);
  font-size: 11.5px;
}

/* ── Search-driven autocomplete picker ─────────────────────── */
.picker { position: relative; }
.picker-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  min-height: 38px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}
.picker-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent-primary);
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  max-width: 100%;
}
.picker-tag-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.picker-tag-x {
  cursor: pointer;
  opacity: 0.7;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.picker-tag-x:hover { opacity: 1; }

.picker-search {
  width: 100%;
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  font: inherit;
  outline: none;
}
.picker-search:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.picker-dropdown {
  display: none;
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  margin-top: 4px;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.picker-dropdown.open { display: block; }
.picker-option {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.picker-option:last-child { border-bottom: 0; }
.picker-option:hover, .picker-option.active {
  background: var(--accent-soft);
}
.picker-option-name { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.picker-option-desc { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; word-break: break-all; }
.picker-empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

/* ── On-call calendar ──────────────────────────────────────── */
.oc-calendar-wrap { margin-top: 16px; }
.oc-calendar-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 8px;
}
.oc-calendar-header h4 { margin: 0; }
.oc-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary);
  user-select: none;
}
.oc-ruler {
  position: relative;
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border-color);
}
.oc-ruler-cell {
  font-size: 10.5px;
  color: var(--text-muted);
  padding: 2px 6px 0;
  border-bottom: 1px solid var(--border-color);
  box-sizing: border-box;
}
.oc-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-color);
}
.oc-col:last-child { border-right: 0; }
.oc-col-head {
  text-align: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 6px 0;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}
.oc-col-body {
  position: relative;
  cursor: crosshair;
}
.oc-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-color);
  pointer-events: none;
  opacity: 0.6;
}
.oc-block {
  position: absolute;
  left: 4px;
  right: 4px;
  border-radius: 6px;
  color: #fff;
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.25;
  padding: 4px 6px;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.18);
}
.oc-block.dragging { cursor: grabbing; opacity: 0.85; box-shadow: 0 4px 12px rgba(0,0,0,0.6); }
.oc-block-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.oc-block-handle {
  position: absolute;
  left: 0; right: 0;
  height: 6px;
  cursor: ns-resize;
  background: rgba(255,255,255,0.18);
  opacity: 0;
  transition: opacity 0.12s;
}
.oc-block:hover .oc-block-handle { opacity: 1; }
.oc-handle-top { top: 0; }
.oc-handle-bot { bottom: 0; }

.oc-edit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 24, 0.6);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.oc-edit-panel {
  width: min(440px, 90vw);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.oc-day-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.oc-day-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.oc-day-chip input { display: none; }
.oc-day-chip.on {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.investigation-panel { display: flex; flex-direction: column; gap: 10px; }
.investigation-panel .investigation-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.investigation-panel .investigation-header h4 { margin: 0; font-size: 14px; }
.investigation-panel h5 { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; color: var(--text-secondary); letter-spacing: 0.04em; }
.investigation-panel .detail-grid { gap: 6px 14px; }
.investigation-panel .investigation-summary,
.resolution-summary {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}
.investigation-evidence {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.investigation-evidence li {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
}

.notify-step-row {
  display: grid;
  grid-template-columns: 24px 1fr 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 6px;
}
.notify-step-num {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  padding-bottom: 8px;
}
.notify-step-row .form-row { margin-bottom: 0; }

.team-owned-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.team-owned-row {
  display: block;
  padding: 6px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.team-owned-row:hover {
  border-color: var(--accent-primary);
  background: rgba(124, 58, 237, 0.10);
}
.team-owned-row .muted { font-size: 11.5px; margin-left: 4px; }

.oc-legacy-row {
  padding: 6px 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  font-size: 12.5px;
  margin-bottom: 4px;
}

/* Single-pick variant — input with an inline clear-X button. */
.picker-single { position: relative; }
.picker-single .picker-search { padding-right: 32px; }
.picker-single-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.picker-single-clear:hover { color: var(--text-primary); background: var(--bg-tertiary); }

/* ── Modals ─────────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 800;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.modal-wide { max-width: 880px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
}
.modal-close:hover { background: var(--accent-soft); color: var(--accent-primary); }

/* ── Toast ──────────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-primary);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  pointer-events: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--status-resolved); }

/* ── Audit trail ─────────────────────────────────────────────── */

.audit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.audit-list li {
  display: grid;
  grid-template-columns: 200px 160px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 12.5px;
}
.audit-list li:last-child { border-bottom: 0; }
.audit-when { color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.audit-actor { color: var(--accent-primary); }
.audit-action { color: var(--text-primary); font-weight: 500; }

/* ── Root-cause tag chips ─────────────────────────────────────── */
.tags-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  min-height: 24px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 3px 4px 3px 10px;
  font-size: 12px;
  color: var(--text-primary);
}
.tag-chip-label { user-select: text; }
.tag-chip-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tag-chip-remove:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.tags-add {
  display: flex;
  gap: 8px;
}
.tags-add input[type="text"] {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}

/* ── Bot conversation transcripts (Wave 4.6) ─────────────────── */
.conversation-transcript {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 4px;
}
.transcript-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  font-size: 13px;
}
.transcript-user { border-left: 3px solid var(--accent-primary); }
.transcript-assistant { border-left: 3px solid var(--text-success, #22c55e); }
.transcript-system {
  border-left: 3px solid var(--text-muted);
  background: var(--bg-secondary);
  opacity: 0.9;
}
.transcript-header {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 11.5px;
}
.transcript-role {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.transcript-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.transcript-text p:last-child { margin-bottom: 0; }
.transcript-tool-use, .transcript-tool-result {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px;
}
.transcript-tool-use pre, .transcript-tool-result pre {
  margin: 4px 0 0 0;
  max-height: 240px;
  overflow: auto;
  background: var(--bg-primary);
  padding: 6px 8px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
}

/* ── Voice sessions on incident detail (Wave 7.4) ────────────── */
.voice-session-row {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-tertiary);
  margin-bottom: 8px;
  font-size: 13px;
}
.voice-session-row:last-child { margin-bottom: 0; }
.voice-session-header {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.voice-session-meta {
  font-size: 12px;
  margin-bottom: 8px;
}
.voice-session-transcript details summary {
  cursor: pointer;
  color: var(--accent-primary);
  font-size: 12.5px;
  padding: 4px 0;
}
.voice-session-transcript details[open] summary {
  margin-bottom: 6px;
}
.voice-session-transcript .transcript-row {
  margin-bottom: 6px;
  background: var(--bg-secondary);
  padding: 6px 10px;
}

/* ── Trends view ──────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 280px;
  margin-top: 8px;
}
select.select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  margin-right: 8px;
}

/* ── Action items ─────────────────────────────────────────────── */
.action-items-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
}
.action-items-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.action-items-list li:last-child { border-bottom: 0; }
.action-item-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.action-item-text { color: var(--text-primary); }
.action-item-done .action-item-text {
  text-decoration: line-through;
  color: var(--text-muted);
}
.action-item-wontfix .action-item-text {
  text-decoration: line-through;
  color: var(--text-muted);
  font-style: italic;
}
.action-item-meta {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
}
.action-item-buttons {
  display: inline-flex;
  gap: 6px;
}
.action-item-buttons .btn { padding: 3px 8px; font-size: 11.5px; }
.action-items-add {
  display: grid;
  grid-template-columns: 1fr 220px auto;
  gap: 8px;
  margin-top: 8px;
}
.action-items-add input[type="text"] {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
@media (max-width: 720px) {
  .action-items-list li { grid-template-columns: 1fr; gap: 4px; }
  .action-items-add { grid-template-columns: 1fr; }
}

/* ── Filters bar ─────────────────────────────────────────────── */

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.filters select,
.filters input {
  padding: 5px 9px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  font: inherit;
}

/* ── Chat FAB + Panel ─────────────────────────────────────── */

.chat-fab {
  position: fixed;
  /* default placement (overridden by JS once positioned); restoreFabPos
     swaps right/bottom for left/top so dragging works against absolute
     coordinates. */
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent-primary);
  color: #fff;
  cursor: grab;
  z-index: 600;
  box-shadow: 0 4px 18px rgba(139,92,246,0.45);
  transition: transform 0.2s ease, box-shadow 0.2s, left 0.32s cubic-bezier(.2,.8,.2,1), top 0.32s cubic-bezier(.2,.8,.2,1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.chat-fab img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
}
.chat-fab:not(.dragging):not(.snapping):hover { transform: scale(1.06); box-shadow: 0 8px 24px rgba(139,92,246,0.6); }
.chat-fab.dragging {
  cursor: grabbing;
  transition: none;
  transform: scale(1.08);
  box-shadow: 0 10px 28px rgba(139,92,246,0.7);
}
.chat-fab.snapping { cursor: grab; }
.chat-fab.long-pressed {
  animation: chatFabLongPress 0.25s ease-out;
}
@keyframes chatFabLongPress {
  0%   { transform: scale(1); }
  50%  { transform: scale(0.88); }
  100% { transform: scale(1); }
}
.chat-fab[hidden] { display: none; }
.chat-fab.hidden {
  pointer-events: none;
  opacity: 0;
  transform: scale(0.5);
}

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: 420px;
  height: 600px;
  max-height: calc(var(--vh, 100vh) - 120px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 700;
}
.chat-panel.open { display: flex; }
.chat-panel.dragging {
  cursor: grabbing;
  transition: none;
  box-shadow: 0 30px 70px rgba(0,0,0,0.65);
}
.chat-panel.docked {
  position: fixed;
  top: var(--chat-dock-top-offset, 0px);
  bottom: 0;
  /* --chat-dock-width is the single source of truth for the docked
   * width; the body padding rules below reference the same variable
   * so the page content and panel always agree. JS clamps + persists
   * it via setDockWidth / restoreDockWidth. */
  width: var(--chat-dock-width, 460px);
  height: auto;
  max-height: none;
  border-radius: 0;
  border-top: 0;
  border-bottom: 0;
  box-shadow: none;
}
.chat-panel.docked.docked-right {
  right: 0;
  left: auto;
  border-right: 0;
}
.chat-panel.docked.docked-left {
  left: var(--chat-dock-left-offset, 0px);
  right: auto;
  border-left: 0;
}
/* Push the page content over so the docked panel doesn't overlap.
 * Target both the legacy `main` selector AND the redesign's
 * `.main` so the padding actually lands on the right element. */
body.chat-docked-right main,
body.chat-docked-right .main { padding-right: calc(var(--chat-dock-width, 460px) + var(--chat-dock-gutter, 16px)) !important; }
body.chat-docked-left  main,
body.chat-docked-left  .main { padding-left:  calc(var(--chat-dock-width, 460px) + var(--chat-dock-gutter, 16px)) !important; }

/* Resize handle — sits on the inboard edge of the docked panel and
 * grabs a horizontal drag. Hidden in floating / expanded modes. */
.chat-dock-resize-handle {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  z-index: 10;
  cursor: ew-resize;
  background: transparent;
  transition: background 120ms ease;
}
.chat-panel.docked .chat-dock-resize-handle { display: block; }
.chat-panel.docked.docked-right .chat-dock-resize-handle { left: -3px; }
.chat-panel.docked.docked-left .chat-dock-resize-handle { right: -3px; }
.chat-dock-resize-handle:hover,
.chat-dock-resize-handle.dragging {
  background: var(--accent-primary);
  opacity: 0.55;
}
.chat-panel.resizing { transition: none; user-select: none; }
body.chat-resizing { cursor: ew-resize; user-select: none; }
/* Maximized chat — consistent size, regardless of where the panel was
 * floating beforehand. `!important` overrides any inline styles set
 * by the floating drag handler that get left behind on the element. */
.chat-panel.expanded {
  position: fixed !important;
  top: 60px !important;
  right: 16px !important;
  bottom: 16px !important;
  left: 16px !important;
  width: auto !important;
  height: auto !important;
  max-width: 1280px !important;
  max-height: none !important;
  margin: 0 auto !important;
  z-index: 800;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
.chat-header-info { display: flex; align-items: center; gap: 10px; }
.chat-header-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.chat-header-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-header-text { display: flex; flex-direction: column; }
.chat-header-title { font-size: 13px; font-weight: 600; color: #fff; }
.chat-header-status { font-size: 11px; color: var(--status-resolved); }

.chat-header-actions { display: flex; gap: 4px; }
.chat-icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-icon-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-welcome {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-secondary);
}
.chat-welcome strong { color: var(--text-primary); }
.chat-quick-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.chat-quick-action {
  background: var(--accent-soft);
  color: var(--accent-primary);
  border: 1px solid transparent;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}
.chat-quick-action:hover { border-color: var(--accent-primary); }

.chat-disabled-banner {
  background: rgba(245,158,11,0.10);
  border: 1px solid rgba(245,158,11,0.5);
  color: var(--status-ack);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin: 14px;
  text-align: center;
}

.chat-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.chat-msg-bot .chat-msg-body { background: var(--bg-tertiary); }
.chat-msg-user { flex-direction: row-reverse; }
.chat-msg-user .chat-msg-body {
  background: var(--accent-primary);
  color: #fff;
}

.chat-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.chat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }

.chat-msg-body {
  padding: 10px 12px;
  border-radius: 10px;
  max-width: 84%;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.chat-msg-body p { margin: 0 0 8px; }
.chat-msg-body p:last-child { margin: 0; }
.chat-msg-body ul, .chat-msg-body ol { padding-left: 20px; margin: 0 0 8px; }
.chat-msg-body li { margin: 2px 0; }
.chat-msg-body code {
  background: rgba(0,0,0,0.3);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.chat-msg-body pre {
  background: rgba(0,0,0,0.4);
  padding: 8px 10px;
  border-radius: 6px;
  margin: 6px 0 8px;
  overflow-x: auto;
  font-size: 0.92em;
  line-height: 1.45;
}
.chat-msg-body pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.chat-msg-body h1,
.chat-msg-body h2,
.chat-msg-body h3,
.chat-msg-body h4,
.chat-msg-body h5,
.chat-msg-body h6 {
  margin: 10px 0 6px;
  line-height: 1.25;
  font-weight: 600;
}
.chat-msg-body h1 { font-size: 1.25em; }
.chat-msg-body h2 { font-size: 1.18em; }
.chat-msg-body h3 { font-size: 1.10em; }
.chat-msg-body h4, .chat-msg-body h5, .chat-msg-body h6 { font-size: 1em; }
.chat-msg-body blockquote {
  margin: 6px 0;
  padding: 4px 10px;
  border-left: 3px solid var(--accent-primary, #7c3aed);
  background: rgba(124, 58, 237, 0.08);
  color: inherit;
}
.chat-msg-body a {
  color: var(--accent-primary, #a78bfa);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-msg-body a:hover { text-decoration-color: currentColor; }
.chat-msg-body hr {
  border: none;
  border-top: 1px solid var(--border-color, rgba(255,255,255,0.15));
  margin: 10px 0;
}
.chat-msg-body table {
  border-collapse: collapse;
  margin: 6px 0 8px;
  font-size: 0.95em;
}
.chat-msg-body th,
.chat-msg-body td {
  border: 1px solid var(--border-color, rgba(255,255,255,0.18));
  padding: 4px 8px;
  text-align: left;
}
.chat-msg-body th { background: rgba(255,255,255,0.04); font-weight: 600; }
.chat-msg-body kbd {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
}

.chat-tool-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent-primary);
  margin-top: 6px;
}

/* Chat input row — editor on the left, action column on the right.
 * Matches the sibling-repo pattern (security-scanner / quality-
 * scanner / agent-bridge): textarea / EasyMDE in a flex-grow
 * column, voice-mode + mic + attach + send stacked vertically on
 * the right edge. */
.chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.chat-editor-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
#chat-input {
  width: 100%;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  line-height: 1.45;
  outline: none;
  resize: none;
  max-height: 160px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#chat-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
#chat-input::placeholder { color: var(--text-muted); }

.chat-action-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Shared round-button base for voice-mode / mic / attach.
 * `.chat-send-btn` keeps its own filled-accent treatment below. */
.chat-voice-mode-btn,
.chat-mic-btn,
.chat-attach-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.chat-voice-mode-btn:hover,
.chat-mic-btn:hover,
.chat-attach-btn:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.12);
}

/* Voice mode equalizer bars — animate on .active to show the bot
 * is in hands-free mode (mic auto-arms, TTS reads replies). */
.chat-voice-mode-btn .voice-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 14px;
}
.chat-voice-mode-btn .voice-bars .vbar {
  width: 3px;
  border-radius: 1.5px;
  background: currentColor;
  opacity: 0.6;
  transform-origin: bottom;
}
.chat-voice-mode-btn .voice-bars .vbar:nth-child(1) { height: 5px; }
.chat-voice-mode-btn .voice-bars .vbar:nth-child(2) { height: 10px; }
.chat-voice-mode-btn .voice-bars .vbar:nth-child(3) { height: 7px; }
.chat-voice-mode-btn.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.18);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.35);
}
.chat-voice-mode-btn.active .voice-bars .vbar {
  opacity: 1;
  animation: voiceModeBars 1.2s ease-in-out infinite;
}
.chat-voice-mode-btn.active .voice-bars .vbar:nth-child(1) { animation-delay: 0s; }
.chat-voice-mode-btn.active .voice-bars .vbar:nth-child(2) { animation-delay: 0.15s; }
.chat-voice-mode-btn.active .voice-bars .vbar:nth-child(3) { animation-delay: 0.3s; }
@keyframes voiceModeBars {
  0%, 100% { transform: scaleY(0.5); }
  50%      { transform: scaleY(1.3); }
}

/* Mic recording pulse. */
.chat-mic-btn.listening {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  animation: chatMicPulse 1.2s ease-in-out infinite;
}
@keyframes chatMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.chat-mic-btn[disabled], .chat-attach-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Live interim transcript shown above the editor while the mic is
 * picking up speech. Cleared between final flushes. */
.voice-interim {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 4px 14px 0;
  font-style: italic;
  word-wrap: break-word;
}

/* Small purple dot on the chat FAB when hands-free voice mode is on
 * AND the chat panel is closed — gives the user a visual hint that
 * the bot is still listening / speaking in the background. */
.chat-fab-voice {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--bg-primary);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.5);
  transition: opacity 0.2s, transform 0.2s;
}
.chat-fab-voice.active {
  opacity: 1;
  transform: scale(1);
  animation: chatFabVoicePulse 1.4s ease-in-out infinite;
}
@keyframes chatFabVoicePulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 0 rgba(139, 92, 246, 0.55); }
  50%      { box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 6px rgba(139, 92, 246, 0); }
}

/* Voice-settings card on the Settings view. Pattern lifted from the
 * agent-bridge profile drawer so the layout matches across the fleet. */
.voice-prefs { display: flex; flex-direction: column; gap: 14px; }
.voice-pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.voice-pref-col { flex-direction: column; align-items: stretch; }
.voice-pref-info { flex: 1; min-width: 0; }
.voice-pref-label { font-weight: 600; color: var(--text-primary); }
.voice-pref-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.pref-select {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9rem;
  min-width: 200px;
}
.voice-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.voice-picker .pref-select { flex: 1 1 220px; min-width: 0; }
.voice-preview-status { font-size: 0.8rem; }
.btn-sm { padding: 4px 10px; font-size: 0.85rem; }

/* Generic accessible toggle switch (matches bridge styling). */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--accent-primary);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: var(--accent-primary);
}
.chat-attachments {
  display: flex;
  gap: 6px;
  padding: 8px 12px 0;
  flex-wrap: wrap;
}
.chat-attachment {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.chat-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.65);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-msg-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.chat-msg-attachments img {
  max-width: 140px;
  max-height: 140px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
/* EasyMDE theming — wrap fills the editor column, recolour toolbar
 * + CodeMirror to match the dashboard palette. The fontawesome
 * toolbar icons inherit from the panel's text colour. */
.chat-input-area .EasyMDEContainer {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chat-input-area .EasyMDEContainer .editor-toolbar {
  border: 1px solid var(--border-color);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: var(--bg-tertiary);
  padding: 4px 6px;
  opacity: 1;
}
.chat-input-area .EasyMDEContainer .editor-toolbar button {
  color: var(--text-secondary);
  border: 0;
  padding: 0 6px;
  height: 24px;
  line-height: 24px;
}
.chat-input-area .EasyMDEContainer .editor-toolbar button:hover,
.chat-input-area .EasyMDEContainer .editor-toolbar button.active {
  background: rgba(139, 92, 246, 0.18);
  color: var(--accent-primary);
  border: 0;
}
.chat-input-area .EasyMDEContainer .editor-toolbar i.separator {
  border-left-color: var(--border-color);
  border-right: 0;
  margin: 0 4px;
}
.chat-input-area .EasyMDEContainer .CodeMirror {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0 0 10px 10px;
  padding: 4px 6px;
  font: inherit;
  line-height: 1.45;
  min-height: 40px;
  height: auto;
}
.chat-input-area .EasyMDEContainer .CodeMirror-cursor {
  border-left-color: var(--text-primary);
}
.chat-input-area .EasyMDEContainer .CodeMirror-placeholder {
  color: var(--text-muted) !important;
}
.chat-input-area .EasyMDEContainer .CodeMirror-focused {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Drag-drop affordance: when an image is being dragged over the
 * input area, highlight the editor to show it'll be accepted. */
.chat-drop-active,
.chat-drop-active .CodeMirror {
  outline: 2px dashed var(--accent-primary);
  outline-offset: 2px;
  background: rgba(139, 92, 246, 0.08);
}
/* Hide the EasyMDE status bar — we don't surface word counts in chat. */
.chat-input-area .EasyMDEContainer .editor-statusbar { display: none; }

.chat-send-btn {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.4);
}
.chat-send-btn:disabled {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  cursor: not-allowed;
  box-shadow: none;
}
.chat-send-btn:not(:disabled):hover {
  background: var(--accent-primary-hover);
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.55);
}

/* A2UI rendering inside chat messages */
.a2ui-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 8px 0;
  background: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
}
.a2ui-table th, .a2ui-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.a2ui-table th { background: var(--bg-tertiary); color: var(--text-secondary); font-weight: 600; font-size: 11px; }
.a2ui-table-title { font-size: 11.5px; color: var(--text-secondary); margin: 6px 0 4px; font-weight: 600; }

.a2ui-chart {
  margin: 8px 0;
  padding: 10px;
  background: var(--bg-card);
  border-radius: 8px;
  height: 220px;
  position: relative;
}
.a2ui-chart-title { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 600; }

.a2ui-card {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--bg-card);
  border-left: 3px solid var(--accent-primary);
  border-radius: 6px;
}
.a2ui-card-title { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; font-size: 13px; }
.a2ui-card-content { white-space: pre-line; font-size: 12.5px; color: var(--text-secondary); }
.a2ui-card.color-red { border-left-color: var(--danger); }
.a2ui-card.color-orange { border-left-color: var(--severity-p2); }

.a2ui-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  margin: 6px 4px 6px 0;
  font-weight: 600;
}
.a2ui-status.severity-low { background: rgba(52,211,153,0.2); color: var(--status-resolved); }
.a2ui-status.severity-medium { background: rgba(245,158,11,0.2); color: var(--status-ack); }
.a2ui-status.severity-high { background: rgba(253,126,20,0.2); color: var(--severity-p2); }
.a2ui-status.severity-critical { background: rgba(220,53,69,0.2); color: var(--severity-p1); }

.a2ui-incident-card {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--severity-p1);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
}
.a2ui-incident-card .ic-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.a2ui-incident-card .ic-id { font-weight: 600; color: var(--text-primary); }
.a2ui-incident-card .ic-svc { color: var(--text-secondary); }

.a2ui-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 4px 6px 0;
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--accent-primary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid transparent;
}
.a2ui-nav:hover { border-color: var(--accent-primary); }

.a2ui-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 4px 6px 0;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  border: none;
}
.a2ui-action-btn.style-primary { background: var(--accent-primary); color: #fff; }
.a2ui-action-btn.style-danger { background: var(--danger); color: #fff; }

/* ── Chat visuals (table / chart / diagram) — wrappers + toolbar ─── */

.a2ui-visual {
  position: relative;
  margin: 8px 0;
}
.a2ui-table-wrapper, .a2ui-chart-wrapper, .a2ui-diagram-wrapper {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid var(--border-color);
}
.a2ui-table-wrapper .a2ui-table { margin: 0; background: transparent; }
.a2ui-table-scroll { overflow-x: auto; max-width: 100%; }
.a2ui-chart-wrapper .a2ui-chart {
  padding: 0;
  background: transparent;
  border: 0;
}

.a2ui-diagram {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60px;
  padding: 6px;
  overflow: auto;
}
.a2ui-diagram svg { max-width: 100%; height: auto; }
.a2ui-diagram-title { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 600; }
.a2ui-diagram-caption { font-size: 11px; color: var(--text-secondary); margin-top: 4px; font-style: italic; text-align: center; }
.a2ui-diagram-fallback {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 8px;
  border-radius: 4px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.chat-visual-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}
.chat-visual-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}
.chat-visual-btn:hover { color: var(--text-primary); border-color: var(--accent-primary); }
.chat-visual-btn.copied { color: var(--status-resolved); border-color: var(--status-resolved); }
.chat-visual-btn.failed { color: var(--severity-p1); border-color: var(--severity-p1); }

.a2ui-visual.chat-visual-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  margin: 0;
  padding: 24px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  border: 0;
}
.a2ui-visual.chat-visual-fullscreen .a2ui-diagram,
.a2ui-visual.chat-visual-fullscreen .a2ui-chart {
  flex: 1;
  height: auto;
}
.a2ui-visual.chat-visual-fullscreen .chat-visual-toolbar {
  border-top: 0;
  padding-top: 0;
}
body.chat-visual-fs-open { overflow: hidden; }

/* ── Audit list / detail ─────────────────────────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}
.detail-label { color: var(--text-secondary); font-weight: 500; }
.detail-value { color: var(--text-primary); word-break: break-all; }

.action-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ── Responsive breakpoints ─────────────────────────────────────
 * Two breakpoints: tablet (≤900px) drops the full nav into a
 * hamburger so the chat-FAB still has room; phone (≤480px) tightens
 * paddings, stacks the view-header actions, and lets tables scroll
 * horizontally inside their wrapper.
 *
 * Body gets `overflow-x: hidden` so a too-wide descendant can never
 * push the whole page past the viewport (the no-scroll horizontal
 * is enforced at the body, then each `.table-wrap` reintroduces
 * x-scroll only where it makes sense for the table column to slide).
 */
@media (max-width: 900px) {
  body { overflow-x: hidden; }

  .header {
    gap: 12px;
    padding: 10px 14px;
  }
  .header-menu-btn { display: flex; }
  .header-brand { font-size: 14px; gap: 8px; }

  /* The nav becomes a drop-down that slides under the header. Tap
   * a link → handleRoute closes the drawer (wired in app.js). */
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px;
    gap: 2px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
    z-index: 99;
  }
  .header-nav.open { display: flex; }
  .nav-link {
    padding: 10px 14px;
    font-size: 14px;
  }

  .header-actions { margin-left: auto; }

  .container { padding: 16px 14px; }
  .view-header { gap: 8px; }
  .view-header h1 { font-size: 19px; }
}

@media (max-width: 480px) {
  .header-brand-text { display: none; }
  .user-menu-btn { padding: 5px 8px; font-size: 12px; }
  #user-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
  }

  .container { padding: 12px 10px; }
  .view-header { flex-direction: column; align-items: flex-start; }
  .view-header h1 { font-size: 18px; }
  .view-actions { width: 100%; justify-content: flex-start; }

  /* Stat tiles stack one per row on the smallest screens. */
  .stats-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-tile { padding: 14px; }
  .stat-tile-value { font-size: 22px; }

  /* Cards lose their generous padding. */
  .card { padding: 14px; margin-bottom: 12px; }

  .form-grid { grid-template-columns: 1fr; }
  .audit-list li { grid-template-columns: 1fr; gap: 2px; }

  /* Tables — let .table-wrap scroll horizontally so columns don't
   * collapse into illegible 30px slivers. The wrapper already has
   * overflow-x:auto; this just prevents flex/grid parents from
   * stretching past the viewport. */
  .table-wrap { max-width: 100%; }
  .simple-table th,
  .simple-table td,
  .data-table th,
  .data-table td { padding: 8px 10px; }

  /* Chat panel takes the full mobile viewport bar a comfy gutter. */
  .chat-panel {
    right: 8px;
    left: 8px;
    width: auto;
    bottom: 76px;
    height: 70vh;
  }

  /* Modal on mobile fills the viewport rather than floating in the
   * middle of empty whitespace. */
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal {
    border-radius: 0;
    max-width: none;
    min-height: 100vh;
    padding: 18px 14px;
  }
}

/* Small tweak that applies above the phone breakpoint too — the chat
 * dock pattern eats horizontal space, so on narrow tablets we
 * suppress the side-dock UI and force the panel to float instead. */
@media (max-width: 900px) {
  body.chat-docked-left,
  body.chat-docked-right { padding-left: 0; padding-right: 0; }
}

/* ── Nexus integration ──────────────────────────────────────
 * Reused panel container for the Nexus attribution block on the
 * incident-detail view (sits adjacent to .investigation-panel).
 * .notice-warning is a generic warning callout — used for stuck
 * Nexus holds; reuse for any future "operator action required"
 * messages.
 */
.nexus-panel {
  margin-bottom: 16px;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  margin: 8px 0;
  font-size: 14px;
}
.notice-warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--status-ack);
  color: var(--status-ack);
}

/* ============================================================
   REDESIGN OVERRIDES — wins the cascade.
   The legacy `.card`, `.btn`, `.stat-tile` etc. above were
   pre-existing styles. The redesign at the top of the file
   shares those selectors but loses to the legacy ones because
   they come later. This block re-asserts the redesign values
   for every selector that matters so the new visuals actually
   render. Don't add new things here — fix them in the
   redesign section near the top and re-add the override here
   only when there's a known legacy collision.
   ============================================================ */

/* Cards clip child content to the rounded corner, so tables /
 * health strips don't poke past the radius (Services list). */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--pad-card-y) var(--pad-card-x);
  margin-bottom: var(--gap-stack);
  overflow: hidden;
}
.card .card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-0);
  letter-spacing: -0.005em;
  text-transform: none;
}
.card-ai {
  border-color: var(--accent-line);
  background: linear-gradient(160deg, var(--accent-soft) 0%, var(--bg-2) 30%);
}
.empty-state {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
  margin: 0;
}
.muted { color: var(--text-2); }

/* Buttons — restore the redesign defaults. */
.btn {
  background: var(--bg-3);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover { background: var(--bg-4); border-color: var(--border-strong); color: var(--text-0); }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-strong) 0%, var(--accent-deep) 100%);
  border-color: var(--accent-deep);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset, 0 2px 6px rgba(109,40,217,0.35);
}
.btn-primary:hover {
  background: linear-gradient(180deg, var(--accent-deep) 0%, var(--accent-deep) 100%);
  border-color: var(--accent-deep);
  color: #fff;
  box-shadow: 0 2px 10px rgba(109,40,217,0.5);
}
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-ai {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.btn-ai:hover { background: var(--accent-glow); color: var(--text-0); }

/* Table — clear thead/tbody distinction, stronger row hover. */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-1);
}
.table tbody td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border-faint);
  vertical-align: middle;
  color: var(--text-1);
}
.table tbody tr { cursor: pointer; transition: background 0.12s, box-shadow 0.12s; }
.table tbody tr:hover {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.table tbody tr:hover td { color: var(--text-0); }
.table tbody tr.row-clean { cursor: default; }
.table tbody tr.row-clean:hover { background: transparent; box-shadow: none; }
.table tbody tr.row-clean:hover td { color: var(--text-1); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.is-attention td:first-child {
  box-shadow: inset 3px 0 0 var(--state-open);
}
.table tbody tr.is-attention:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--state-open), inset 0 0 0 1px var(--accent-line);
}

/* Sidebar active item — strong purple wash, brighter on the left
 * fading into transparency on the right. Matches the design where
 * the selected route is unmistakably highlighted. */
.nav-link.active {
  background: linear-gradient(180deg, rgba(139,92,246,0.40) 0%, rgba(139,92,246,0.18) 100%);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent-strong),
              0 0 0 1px rgba(139,92,246,0.30);
  border: 1px solid transparent;
  font-weight: 600;
}
.nav-link.active .nav-icon { color: #ddd6fe; }
.nav-link.active span { color: #fff; }
.nav-link.active .nav-dot {
  width: 8px;
  height: 8px;
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,0.22), 0 0 8px rgba(239,68,68,0.45);
}

/* Stat tile — kill the legacy left stripe; use the redesign's
 * optional .stripe element. */
.stat {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  overflow: hidden;
}
.stat .label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}
.stat .value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 4px;
  color: var(--text-0);
}
.stat .sub { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }

/* Light theme — additional surface fixes for elements still
 * pulling from hardcoded dark token aliases. */
body[data-theme="light"] {
  color: var(--text-0);

  /* Re-anchor the legacy `--bg-tertiary` / `--text-primary` / etc.
   * aliases for the light theme. They're declared on `:root` as
   * `var(--bg-0)` / `var(--text-0)`, but CSS resolves a custom-
   * property's *value* at the declaring element (`:root`), so the
   * body-level light override of `--bg-0` / `--text-0` never reaches
   * any rule still using the legacy alias. Result: pre-modernisation
   * surfaces (badge bg, .card h3 colour, etc.) keep their dark values
   * in light theme — dark-on-dark PR-number pills, near-white card
   * headers. Redeclaring the aliases here pins them to body's cascade
   * so the modern light values flow through. */
  --bg-primary: var(--bg-0);
  --bg-secondary: var(--bg-2);
  --bg-tertiary: var(--bg-3);
  --bg-card: var(--bg-1);
  --border-color: var(--border);
  --text-primary: var(--text-0);
  --text-secondary: var(--text-2);
  --text-muted: var(--text-3);
  --accent-primary: var(--accent-strong);
  --accent-primary-hover: var(--accent-deep);
  --danger: var(--bad);
}
body[data-theme="light"] .app-shell { background: var(--bg-0); }
body[data-theme="light"] .sidebar {
  background: var(--bg-1);
  border-right-color: var(--border-strong);
}
body[data-theme="light"] .sidebar-brand .name { color: var(--text-0); font-weight: 700; }
body[data-theme="light"] .sidebar-brand small { color: var(--text-2); }
body[data-theme="light"] .nav-link { color: var(--text-1); }
body[data-theme="light"] .nav-group-label { color: var(--text-2); }
body[data-theme="light"] .nav-link:hover { background: var(--bg-2); color: var(--text-0); }
body[data-theme="light"] .nav-link.active,
body[data-theme="light"] .nav-link.active span { color: var(--text-0); }
body[data-theme="light"] .sidebar-user { background: var(--bg-2); border-color: var(--border); }
body[data-theme="light"] .sidebar-user .who .name { color: var(--text-0); }
body[data-theme="light"] .sidebar-user .who .status { color: var(--text-2); }
body[data-theme="light"] .sidebar-settings-btn { color: var(--text-2); }
body[data-theme="light"] .sidebar-settings-btn:hover { background: var(--bg-3); color: var(--text-0); }
body[data-theme="light"] .ai-suggest-strip { background: linear-gradient(120deg, var(--accent-soft), var(--bg-1) 60%); border-color: var(--accent-line); }
body[data-theme="light"] .ai-suggest-strip strong { color: var(--text-0); }
body[data-theme="light"] .card-ai { background: linear-gradient(160deg, var(--accent-soft) 0%, var(--bg-1) 30%); }
body[data-theme="light"] .table thead th { background: var(--bg-2); color: var(--text-2); border-bottom-color: var(--border); }
body[data-theme="light"] .table tbody tr:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
body[data-theme="light"] .table tbody td { color: var(--text-1); }
body[data-theme="light"] .card { background: var(--bg-1); border-color: var(--border); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
body[data-theme="light"] .card-ai { background: linear-gradient(160deg, #f5f3ff 0%, var(--bg-1) 35%); border-color: var(--accent-line); }
body[data-theme="light"] .table tbody tr.is-attention { background: linear-gradient(90deg, rgba(239,68,68,0.10) 0%, rgba(239,68,68,0.04) 50%, transparent 100%); }
body[data-theme="light"] .table tbody tr.is-attention:hover { background: linear-gradient(90deg, rgba(239,68,68,0.16) 0%, rgba(239,68,68,0.06) 50%, transparent 100%); }
body[data-theme="light"] .health-tile { background: var(--bg-1); border-color: var(--border); }
body[data-theme="light"] .health-tile:hover { background: var(--bg-2); border-color: var(--accent-line); }

/* Sev gutter — hidden everywhere; the design uses a row-tint gradient
 * (below) to mark severity instead of a left edge bar. The empty <td>
 * stays in markup to keep table column widths stable. */
.sev-gutter { display: none; }
.table tbody tr td:first-child:has(.sev-gutter) { width: 0; padding: 0; }
.table tbody tr.is-attention {
  background: linear-gradient(90deg, rgba(239,68,68,0.08) 0%, rgba(239,68,68,0.025) 35%, transparent 70%);
}
.table tbody tr.is-attention:hover {
  background: linear-gradient(90deg, rgba(239,68,68,0.14) 0%, rgba(239,68,68,0.05) 35%, transparent 70%);
}
.table tbody tr.is-attention td:first-child { box-shadow: none; }
body[data-theme="light"] .filter-pill { color: var(--text-2); border-color: var(--border); }
body[data-theme="light"] .filter-pill:hover { color: var(--text-0); border-color: var(--border-strong); }
body[data-theme="light"] .filter-pill.is-active { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--accent-line); }
body[data-theme="light"] .filter-pill .pill-count { background: var(--bg-3); color: var(--text-2); }
body[data-theme="light"] .filter-pill.is-active .pill-count { background: var(--accent-strong); color: #fff; }
body[data-theme="light"] .search-input input { background: var(--bg-1); color: var(--text-0); border-color: var(--border); }
body[data-theme="light"] .btn { background: var(--bg-2); color: var(--text-1); border-color: var(--border); }
body[data-theme="light"] .btn:hover { background: var(--bg-3); color: var(--text-0); }
body[data-theme="light"] .me-meta-list li { border-bottom-color: var(--border-faint); color: var(--text-1); }
body[data-theme="light"] .me-meta-list .k { color: var(--text-2); }
body[data-theme="light"] .tag-chip { background: var(--bg-2); color: var(--text-1); border-color: var(--border); }
body[data-theme="light"] .timeline { border-left-color: var(--border); }
body[data-theme="light"] .ti-detail { color: var(--text-2); }
body[data-theme="light"] .ti-kv { background: var(--bg-2); border-color: var(--border); }
body[data-theme="light"] .ti-kv-key { color: var(--text-2); }
body[data-theme="light"] .ti-kv-val { color: var(--text-1); }
body[data-theme="light"] .ai-panel { background: linear-gradient(160deg, var(--accent-soft), var(--bg-1) 60%); border-color: var(--accent-line); }
body[data-theme="light"] .diagnosis { color: var(--text-0); }
body[data-theme="light"] .evidence-chip { background: var(--bg-2); border-color: var(--border); }
body[data-theme="light"] .evidence-chip .ec-value { color: var(--text-0); }
body[data-theme="light"] .ai-act { background: var(--bg-2); border-color: var(--border); }
body[data-theme="light"] .ai-act-title { color: var(--text-0); }
body[data-theme="light"] .ai-act-sub { color: var(--text-2); }
body[data-theme="light"] .incident-hero { background: var(--bg-2); }
body[data-theme="light"] .incident-hero h1 { color: var(--text-0); }
body[data-theme="light"] .ext-id { color: var(--text-2); }
body[data-theme="light"] .service-link { color: var(--text-2); }
body[data-theme="light"] .service-link strong { color: var(--text-0); }
body[data-theme="light"] .conv-bubble { background: var(--bg-2); color: var(--text-0); border-color: var(--border); }
body[data-theme="light"] .conv-turn.user .conv-bubble { background: var(--accent-soft); border-color: var(--accent-line); }
body[data-theme="light"] .conv-tool { background: var(--bg-2); border-color: var(--border); }
body[data-theme="light"] .conv-tool-head { background: var(--bg-3); color: var(--text-2); }
body[data-theme="light"] .stat .value { color: var(--text-0); }
body[data-theme="light"] .stat.has-attention .value { color: var(--bad); }
body[data-theme="light"] .stat.good .value { color: var(--ok); }
/* Light-mode badges — light bg + dark text (opposite of dark mode). */
body[data-theme="light"] .badge-sev-p1 { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
body[data-theme="light"] .badge-sev-p2 { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
body[data-theme="light"] .badge-sev-p3 { background: #fef3c7; color: #b45309; border-color: #fde68a; }
body[data-theme="light"] .badge-state-open        { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
body[data-theme="light"] .badge-state-acknowledged,
body[data-theme="light"] .badge-state-ack         { background: #fef3c7; color: #b45309; border-color: #fde68a; }
body[data-theme="light"] .badge-state-resolved    { background: #d1fae5; color: #047857; border-color: #a7f3d0; }
body[data-theme="light"] .badge-state-resolved_by_bot,
body[data-theme="light"] .badge-state-bot         { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
body[data-theme="light"] .badge-state-closed      { background: #e5e7eb; color: #4b5563; border-color: #d1d5db; }
body[data-theme="light"] .badge-state-unrouted    { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
body[data-theme="light"] .badge-tier              { background: var(--bg-2); color: var(--text-1); border-color: rgba(0,0,0,0.18); }
body[data-theme="light"] .badge                   { color: var(--text-1); }
body[data-theme="light"] .badge-ai                { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
body[data-theme="light"] .nav-link.active        { background: linear-gradient(180deg, rgba(139,92,246,0.28), rgba(139,92,246,0.12) 100%); }
body[data-theme="light"] .chat-panel             { background: var(--bg-1); color: var(--text-0); border-color: var(--border-strong); }
body[data-theme="light"] .chat-header            { background: var(--bg-2); border-bottom-color: var(--border); }
body[data-theme="light"] .chat-header-title,
body[data-theme="light"] .chat-header-status,
body[data-theme="light"] .chat-header *          { color: var(--text-0); }
body[data-theme="light"] .chat-header-status     { color: var(--text-2); }
body[data-theme="light"] .chat-close-btn,
body[data-theme="light"] .chat-newconv-btn,
body[data-theme="light"] .chat-dock-btn,
body[data-theme="light"] .chat-expand-btn        { color: var(--text-2); }
body[data-theme="light"] .chat-close-btn:hover,
body[data-theme="light"] .chat-newconv-btn:hover,
body[data-theme="light"] .chat-dock-btn:hover,
body[data-theme="light"] .chat-expand-btn:hover  { color: var(--text-0); background: var(--bg-3); }
body[data-theme="light"] .chat-body              { background: var(--bg-1); }
body[data-theme="light"] .chat-body *            { color: var(--text-0); }
body[data-theme="light"] .chat-empty             { color: var(--text-2); }
body[data-theme="light"] .chat-empty h2,
body[data-theme="light"] .chat-empty h3          { color: var(--text-0); }
body[data-theme="light"] .chat-quick-actions { background: transparent; }
body[data-theme="light"] .chat-quick-action      { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-line); }
body[data-theme="light"] .chat-quick-action:hover { background: var(--accent-glow); }
body[data-theme="light"] .chat-input-area        { background: var(--bg-2); border-top-color: var(--border); }
body[data-theme="light"] .chat-editor-wrap       { background: var(--bg-1); border-color: var(--border); }
body[data-theme="light"] .chat-input-area input,
body[data-theme="light"] .chat-input-area textarea { background: var(--bg-1); color: var(--text-0); border-color: var(--border); }
body[data-theme="light"] .chat-input-area textarea::placeholder { color: var(--text-3); }
body[data-theme="light"] .chat-action-col        { background: transparent; }
body[data-theme="light"] .chat-voice-mode-btn,
body[data-theme="light"] .chat-mic-btn,
body[data-theme="light"] .chat-attach-btn { background: var(--bg-3); color: var(--text-1); border-color: var(--border); }
body[data-theme="light"] .chat-voice-mode-btn:hover,
body[data-theme="light"] .chat-mic-btn:hover,
body[data-theme="light"] .chat-attach-btn:hover { background: var(--bg-4); color: var(--text-0); }
body[data-theme="light"] .chat-send-btn          { background: var(--accent-strong); color: #fff; border-color: var(--accent-strong); }
body[data-theme="light"] .chat-send-btn:hover    { background: var(--accent-deep); border-color: var(--accent-deep); }
body[data-theme="light"] .chat-send-btn:disabled { opacity: 0.4; }
body[data-theme="light"] .chat-msg.from-bot .chat-bubble { background: var(--bg-2); color: var(--text-0); }
body[data-theme="light"] .chat-msg.from-user .chat-bubble { background: var(--accent-strong); color: #fff; }
body[data-theme="light"] .chat-attachments      { background: var(--bg-2); border-color: var(--border); }
body[data-theme="light"] .timeline-dot           { border-color: var(--bg-2); }

/* Service detail page — "used in <App>" inline reverse-link in the
 * service-hero meta row. Inherits the row's text colour; only the
 * accent on hover hints at clickability so it sits quietly next to
 * the owner/team text. */
.svc-app-inline-link {
  color: var(--text-0);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted var(--border-strong);
}
.svc-app-inline-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.svc-app-inline-more {
  color: var(--text-3);
  text-decoration: none;
  font-size: inherit;
}
.svc-app-inline-more:hover { color: var(--accent); }

/* Service detail page — Health card (NerdGraph-fed line charts) */
.svc-health-tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 10px;
  flex-wrap: wrap;
}
.svc-health-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 12px;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.svc-health-tab:hover { color: var(--text-0); border-color: var(--accent); }
.svc-health-tab.active { color: var(--text-0); border-color: var(--accent); background: rgba(139,92,246,0.10); }
.svc-health-tab-name { font-weight: 500; }
.svc-health-tab-sub  { color: var(--text-3); font-size: 10.5px; font-family: var(--mono); }
.svc-health-windows {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.svc-health-window {
  padding: 3px 10px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 11.5px;
  border-radius: 4px;
  transition: background 120ms ease, color 120ms ease;
}
.svc-health-window:hover { color: var(--text-0); }
.svc-health-window.active { color: var(--text-0); background: var(--accent); }
.svc-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.svc-health-metric {
  display: flex;
  flex-direction: column;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.svc-health-metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.svc-health-metric-title { font-size: 12.5px; color: var(--text-1); font-weight: 500; }
.svc-health-metric-actions { display: inline-flex; align-items: center; gap: 8px; }
.svc-health-metric-unit { font-size: 11px; color: var(--text-3); }
.svc-health-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.svc-health-expand-btn:hover {
  color: var(--text-0);
  border-color: var(--accent);
  background: rgba(139,92,246,0.10);
}
.svc-health-metric-canvas { position: relative; height: 140px; }

/* Service detail page — Logs card */
.svc-logs-tabs {
  display: flex;
  gap: 6px;
  padding: 0 16px 8px;
  flex-wrap: wrap;
}
.svc-logs-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 12px;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.svc-logs-tab:hover  { color: var(--text-0); border-color: var(--accent); }
.svc-logs-tab.active { color: var(--text-0); border-color: var(--accent); background: rgba(139,92,246,0.10); }
.svc-logs-tab-name   { font-weight: 500; }
.svc-logs-tab-sub    { color: var(--text-3); font-size: 10.5px; font-family: var(--mono); }
.svc-logs-windows {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.svc-logs-window {
  padding: 3px 10px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 11.5px;
  border-radius: 4px;
  transition: background 120ms ease, color 120ms ease;
}
.svc-logs-window:hover  { color: var(--text-0); }
.svc-logs-window.active { color: var(--text-0); background: var(--accent); }
.svc-logs-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
}
.svc-logs-level {
  padding: 5px 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 12px;
}
.svc-logs-search {
  flex: 1;
  min-width: 180px;
  padding: 5px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-0);
  font-size: 12px;
}
.svc-logs-search::placeholder { color: var(--text-3); }
.svc-logs-tail-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.svc-logs-tail-label input { accent-color: var(--accent); }
.svc-logs-fullscreen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.svc-logs-fullscreen-btn:hover {
  color: var(--text-0);
  border-color: var(--accent);
  background: rgba(139,92,246,0.10);
}
.svc-logs-body { padding: 0 0 14px; }
.svc-logs-histogram-wrap {
  position: relative;
  height: 110px;
  padding: 6px 16px 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}
#svc-logs-card.is-fullscreen .svc-logs-histogram-wrap {
  height: 140px;
}

/* Fullscreen mode for the Logs card — pinned over the viewport so the
 * whole panel (tabs, filters, list) becomes the focus. CSS-only flip;
 * no DOM moves so handlers + live-tail interval keep working. */
#svc-logs-card.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 900;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  box-shadow: 0 0 60px rgba(0,0,0,0.45);
}
#svc-logs-card.is-fullscreen .svc-logs-body {
  flex: 1;
  min-height: 0;
  padding: 0 0 14px;
  display: flex;
  flex-direction: column;
}
#svc-logs-card.is-fullscreen .svc-logs-list {
  max-height: none;
  flex: 1;
  min-height: 0;
}
.svc-logs-list {
  max-height: 480px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-1);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
}
.svc-log-row {
  display: grid;
  grid-template-columns: 110px 64px 1fr;
  gap: 10px;
  padding: 4px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.025);
  align-items: baseline;
  cursor: pointer;
  transition: background 120ms ease;
}
.svc-log-row:hover { background: var(--bg-3); }
.svc-log-row .svc-log-msg {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.svc-log-row:hover .svc-log-msg { color: var(--text-0); }
.svc-log-ts        { color: var(--text-3); white-space: nowrap; }
.svc-log-level     { color: var(--text-2); font-weight: 600; font-size: 10.5px; letter-spacing: 0.04em; }
.svc-log-msg       { color: var(--text-1); word-break: break-word; white-space: pre-wrap; }
.svc-log-lvl-error .svc-log-level { color: var(--bad); }
.svc-log-lvl-warn  .svc-log-level { color: var(--warn); }
.svc-log-lvl-info  .svc-log-level { color: var(--accent); }
.svc-log-lvl-debug .svc-log-level { color: var(--text-3); }
.svc-log-lvl-error { background: linear-gradient(90deg, rgba(239,68,68,0.06), transparent 50%); }
.svc-log-lvl-warn  { background: linear-gradient(90deg, rgba(245,158,11,0.05), transparent 50%); }

/* Log-line side drawer */
.svc-log-detail-msg {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-0);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60vh;
  overflow-y: auto;
}
.drawer-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.svc-log-drawer-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--bg-3);
  display: inline-block;
}
.svc-log-drawer-badge.svc-log-lvl-error { color: var(--bad); border-color: rgba(239,68,68,0.3); }
.svc-log-drawer-badge.svc-log-lvl-warn  { color: var(--warn); border-color: rgba(245,158,11,0.3); }
.svc-log-drawer-badge.svc-log-lvl-info  { color: var(--accent); border-color: rgba(139,92,246,0.3); }
.svc-log-drawer-badge.svc-log-lvl-debug { color: var(--text-3); }

/* Log-line attributes section (key/value pairs from `SELECT *`) */
.svc-log-attrs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}
.svc-log-attr {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  padding: 6px 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  align-items: baseline;
}
.svc-log-attr-key { color: var(--text-3); word-break: break-word; }
.svc-log-attr-val { color: var(--text-1); word-break: break-word; }
.svc-log-attr-long {
  grid-template-columns: 1fr;
  gap: 4px;
}
.svc-log-attr-long .svc-log-attr-key { color: var(--text-2); font-weight: 500; }
.svc-log-attr-long .svc-log-attr-val {
  margin: 0;
  padding: 8px 10px;
  background: var(--bg-2);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

/* Health chart full-screen lightbox */
.svc-health-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.svc-health-lightbox-inner {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: min(1200px, 100%);
  height: min(80vh, 800px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.svc-health-lightbox-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.svc-health-lightbox-title { font-size: 16px; font-weight: 600; color: var(--text-0); }
.svc-health-lightbox-sub   { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.svc-health-lightbox-close {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.svc-health-lightbox-close:hover {
  color: var(--text-0);
  border-color: var(--accent);
  background: rgba(139,92,246,0.10);
}
.svc-health-lightbox-canvas-wrap {
  flex: 1;
  padding: 16px 18px 18px;
  position: relative;
  min-height: 0;
}
.svc-health-lightbox-canvas-wrap canvas { width: 100% !important; height: 100% !important; }

/* Service health strip cells — driven by real per-day pressure. */
.health-tile .ht-strip {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 2px;
  margin-top: 10px;
  height: 12px;
}
.health-tile .ht-strip .seg {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--bg-4);
}
.health-tile .ht-strip .seg.lvl-1 { background: rgba(245,197,66,0.55); }
.health-tile .ht-strip .seg.lvl-2 { background: rgba(249,115,22,0.80); }
.health-tile .ht-strip .seg.lvl-3 { background: rgba(239,68,68,0.90); }

/* Conversation transcript — bot / user avatars + bubbles. */
.conv-wrap { display: flex; flex-direction: column; gap: 18px; }
.conv-turn { display: flex; gap: 12px; align-items: flex-start; }
.conv-turn.user { flex-direction: row-reverse; }
.conv-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep));
  color: #fff;
}
.conv-avatar.bot { background: linear-gradient(135deg, var(--accent-strong), var(--accent-deep)); }
.conv-avatar.user { background: linear-gradient(135deg, #475569, #1e293b); }
.conv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.conv-body { flex: 1; min-width: 0; }
.conv-meta {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-3);
  margin-bottom: 4px;
  align-items: center;
}
.conv-turn.user .conv-meta { justify-content: flex-end; }
.conv-meta strong { color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-size: 10.5px; }
.conv-bubble {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  color: var(--text-0);
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 720px;
  word-wrap: break-word;
}
.conv-turn.user .conv-bubble {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.conv-bubble p { margin: 4px 0; }
.conv-bubble code { font-size: 12px; padding: 1px 5px; background: var(--bg-3); border-radius: 4px; }
.conv-bubble pre { background: var(--bg-3); padding: 10px 12px; border-radius: 8px; overflow-x: auto; }
.conv-tool {
  margin-top: 8px;
  background: var(--bg-3);
  border: 1px solid var(--border-faint);
  border-radius: 10px;
  overflow: hidden;
}
.conv-tool-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-4);
  color: var(--text-2);
  font-size: 11.5px;
}
.conv-tool-head .ico { color: var(--accent); }
.conv-tool pre {
  margin: 0;
  padding: 8px 12px;
  font-size: 11.5px;
  color: var(--text-1);
  background: transparent;
  overflow-x: auto;
}
.conv-actions { display: flex; gap: 6px; margin-top: 8px; }

/* ── Applications: redesign (DevOps Platform v2) ──────────
 * Ported from the Claude Design handoff prototype. Scope: the
 * #/applications list (card grid with mini live pipelines) and
 * #/applications/:id detail (flow board + drawer for attempt
 * details). Tokens reuse the existing palette at the top of this
 * file; only new component classes are added below.
 */

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 currentColor; }
  50%      { box-shadow: 0 0 0 6px transparent; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* List grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: var(--gap-grid);
}
.app-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.12s, transform 0.06s;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.app-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.app-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.app-card-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-0);
}
.app-card-slug {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
  font-family: var(--mono);
}
.app-card-pipe {
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.app-card-arrow {
  display: grid; place-items: center;
  color: var(--text-3);
}
.app-card-foot {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border-faint);
  font-size: 12px;
  color: var(--text-2);
}
.app-card-foot-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.app-card-foot-row .ico { color: var(--text-3); }
.app-card-foot-row .app-card-foot-strong { color: var(--text-0); font-weight: 500; text-transform: capitalize; }

/* Mini-stage (inside app-card-pipe) */
.mini-stage {
  flex: 1;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-width: 0;
}
.mini-stage.is-bad  { border-color: rgba(239,68,68,0.40); background: rgba(239,68,68,0.06); }
.mini-stage.is-soak { border-color: var(--accent-line); background: var(--accent-soft); }
.mini-stage-head { display: flex; align-items: center; gap: 6px; }
.mini-stage-name {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-1);
}
.mini-stage-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--text-3);
  flex: 0 0 8px;
}
.mini-stage-dot.good { background: var(--ok);     box-shadow: 0 0 0 3px rgba(52,211,153,0.18); }
.mini-stage-dot.soak { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulseDot 1.8s ease-in-out infinite; color: var(--accent-soft); }
.mini-stage-dot.building { background: #388bfd; box-shadow: 0 0 0 3px rgba(56,139,253,0.18); animation: pulseDot 1.8s ease-in-out infinite; }
.mini-stage-dot.warn { background: var(--warn);   box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.mini-stage-dot.bad  { background: var(--bad);    box-shadow: 0 0 0 3px rgba(239,68,68,0.20); animation: pulseDot 1.4s ease-in-out infinite; color: rgba(239,68,68,0.20); }
.mini-stage-pip {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-strong);
  color: #fff;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.mini-stage-sub {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 4px;
}

/* App-state pill (top-right of list card) */
.app-state-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.app-state-pill .b-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.app-state-pill.ok        { background: rgba(52,211,153,0.14); color: var(--ok); }
.app-state-pill.in-flight { background: var(--accent-soft);    color: var(--accent); }
.app-state-pill.waiting,
.app-state-pill.attention { background: rgba(245,158,11,0.14); color: var(--warn); }
.app-state-pill.failing   { background: rgba(239,68,68,0.14);  color: var(--bad); }
.app-state-pill.idle      { background: var(--bg-3);           color: var(--text-2); }

/* ── Detail: autopilot strip ──────────────────────────────── */
.autopilot-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background:
    linear-gradient(90deg, var(--accent-soft), transparent 70%),
    var(--bg-2);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg);
  margin-bottom: var(--gap-stack);
}
.autopilot-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  display: grid; place-items: center;
  color: #fff;
  flex: 0 0 32px;
}
.autopilot-icon .ico { color: #fff; }
.autopilot-meta { flex: 1; min-width: 0; }
.autopilot-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}
.autopilot-desc {
  font-size: 13px;
  color: var(--text-1);
  margin-top: 2px;
}
.autopilot-radio {
  display: flex;
  gap: 4px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  flex-shrink: 0;
}
.autopilot-pill {
  border: 0;
  background: transparent;
  font-family: inherit;
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.autopilot-pill:hover { color: var(--text-0); }
.autopilot-pill.active {
  background: var(--accent-strong);
  color: #fff;
}

/* ── Detail: flow board ───────────────────────────────────── */
.flow-board {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: var(--gap-stack);
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}
.flow-inflow {
  flex: 0 0 220px;
  background: var(--bg-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.flow-inflow-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.flow-inflow-head-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.flow-inflow-head-repo {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-1);
}
.flow-inflow-empty {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  padding: 12px 0;
}
.flow-inflow-arrow {
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  display: grid;
  place-items: center;
  background: var(--bg-0);
  border-radius: 999px;
  color: var(--text-2);
  z-index: 2;
}

.cs-teaser {
  background: var(--bg-3);
  border: 1px solid var(--border-faint);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cs-teaser-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cs-teaser-title {
  font-size: 12px;
  color: var(--text-1);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.flow-stage {
  flex: 1;
  min-width: 290px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: border-color 0.12s;
}
.flow-stage.is-good     { border-top: 3px solid var(--ok);     padding-top: 13px; }
.flow-stage.is-soaking  { border-top: 3px solid var(--accent); padding-top: 13px; box-shadow: 0 0 24px var(--accent-soft); }
.flow-stage.is-building { border-top: 3px solid #388bfd; padding-top: 13px; }
.flow-stage.is-failing  { border-top: 3px solid var(--bad);    padding-top: 13px; }
.flow-arrow {
  position: absolute;
  left: -18px;
  top: 28px;
  width: 28px; height: 28px;
  display: grid;
  place-items: center;
  background: var(--bg-0);
  color: var(--text-2);
  border-radius: 999px;
  z-index: 2;
}
.flow-stage:first-of-type .flow-arrow { display: none; }

.flow-stage-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-faint);
}
.flow-stage-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.flow-stage-title h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-0);
}
.flow-stage-dot {
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--text-3);
  flex: 0 0 10px;
}
.flow-stage-dot.good     { background: var(--ok);     box-shadow: 0 0 0 3px rgba(52,211,153,0.18); }
.flow-stage-dot.degraded { background: var(--warn);   box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.flow-stage-dot.failing  { background: var(--bad);    box-shadow: 0 0 0 3px rgba(239,68,68,0.20); animation: pulseDot 1.4s ease-in-out infinite; color: rgba(239,68,68,0.20); }
.flow-stage-dot.soaking  { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: pulseDot 1.8s ease-in-out infinite; color: var(--accent-soft); }
.flow-stage-dot.building { background: #388bfd; box-shadow: 0 0 0 3px rgba(56,139,253,0.18); animation: pulseDot 1.8s ease-in-out infinite; }
.flow-stage-meta {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--text-1);
}
.flow-stage-meta-label {
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-3);
}

/* Stage deploy banner */
.flow-deploy {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-3);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.12s;
}
.flow-deploy:hover { border-color: var(--border-strong); }
.flow-deploy-icon {
  width: 24px; height: 24px;
  border-radius: 7px;
  display: grid; place-items: center;
  flex: 0 0 24px;
  background: var(--bg-4);
}
.flow-deploy-icon .ico { color: var(--text-1); width: 13px; height: 13px; }
.flow-deploy.is-soaking   { background: var(--accent-soft);          border-color: var(--accent-line); }
.flow-deploy.is-soaking   .flow-deploy-icon { background: var(--accent-strong); }
.flow-deploy.is-soaking   .flow-deploy-icon .ico { color: #fff; }
.flow-deploy.is-succeeded { background: rgba(52,211,153,0.08);       border-color: rgba(52,211,153,0.24); }
.flow-deploy.is-succeeded .flow-deploy-icon { background: var(--ok); }
.flow-deploy.is-succeeded .flow-deploy-icon .ico { color: #fff; }
.flow-deploy.is-failed    { background: rgba(239,68,68,0.08);        border-color: rgba(239,68,68,0.30); }
.flow-deploy.is-failed    .flow-deploy-icon { background: var(--bad); }
.flow-deploy.is-failed    .flow-deploy-icon .ico { color: #fff; }
/* CI building — distinct blue so it doesn't read as the purple soak. */
.flow-deploy.is-building  { background: rgba(56,139,253,0.08);       border-color: rgba(56,139,253,0.30); }
.flow-deploy.is-building  .flow-deploy-icon { background: #388bfd; }
.flow-deploy.is-building  .flow-deploy-icon .ico { color: #fff; animation: spin 1.4s linear infinite; }
/* CI paused — amber, awaiting a manual run click in Bitbucket. */
.flow-deploy.is-paused    { background: rgba(245,158,11,0.10);       border-color: rgba(245,158,11,0.32); }
.flow-deploy.is-paused    .flow-deploy-icon { background: var(--warn); }
.flow-deploy.is-paused    .flow-deploy-icon .ico { color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.flow-deploy-body { flex: 1; min-width: 0; }
.flow-deploy-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
  display: flex;
  align-items: center;
  gap: 4px;
}
.flow-deploy-sub {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-deploy-sub-bad { color: var(--bad); }

.probe-strip {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.probe-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.probe-chip-dot { width: 5px; height: 5px; border-radius: 999px; }
.probe-chip.ok       { color: var(--ok);   background: rgba(52,211,153,0.14); }
.probe-chip.ok       .probe-chip-dot { background: var(--ok); }
.probe-chip.pending  { color: var(--text-2); background: var(--bg-3); }
.probe-chip.pending  .probe-chip-dot { background: var(--text-3); }
.probe-chip.degraded { color: var(--warn); background: rgba(245,158,11,0.14); }
.probe-chip.degraded .probe-chip-dot { background: var(--warn); }
.probe-chip.fail,
.probe-chip.failed   { color: var(--bad);  background: rgba(239,68,68,0.14); }
.probe-chip.fail     .probe-chip-dot,
.probe-chip.failed   .probe-chip-dot { background: var(--bad); }

/* Queue */
.flow-queue-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-top: 4px;
}
.flow-queue-label-right {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--text-2);
}
.flow-queue {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
/* Entry-stage queues can have an unbounded number of open PRs;
 * cap visual height + scroll internally so the whole flow board
 * doesn't grow taller than the viewport for one busy app. */
.flow-queue.is-scrollable {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;  /* room for the scrollbar so it doesn't crowd the cards */
}
.flow-queue.is-scrollable::-webkit-scrollbar { width: 6px; }
.flow-queue.is-scrollable::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.cs-card-pr-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.12s;
}
.cs-card-pr-link:hover { color: var(--accent); }
.cs-merge-btn {
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  background: var(--bg-4);
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cs-merge-btn:hover {
  background: var(--accent-strong);
  color: #fff;
  border-color: var(--accent-strong);
}
.cs-merge-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Stale-PR signals — quietly flag PRs that have been waiting to
 * land for >=14d (warn), >=30d (stale), >=60d (very-stale). Created
 * date drives the age; updated would tick on every CI run. */
.cs-card-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.cs-stale-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(245,158,11,0.16);
  color: var(--warn);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.cs-stale-pill.is-very-stale {
  background: rgba(239,68,68,0.16);
  color: var(--bad);
}
.cs-stale-pill .ico { width: 10px; height: 10px; }
.cs-card.is-stale       { border-left: 3px solid var(--warn); }
.cs-card.is-very-stale  { border-left: 3px solid var(--bad); background: rgba(239,68,68,0.04); }
.cs-card-meta-age              { color: var(--text-3); }
.cs-card-meta-age.is-warn      { color: var(--warn); font-weight: 500; }
.cs-card-meta-age.is-stale     { color: var(--warn); font-weight: 500; }
.cs-card-meta-age.is-very-stale{ color: var(--bad);  font-weight: 600; }

/* Risk-override pill on PR cards — operator can click to cycle
 * through high → low → unset. Hotfix is a Bridge-stamped value
 * (read-only here); it's still rendered with the same colour scheme. */
.cs-risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  background: transparent;
  color: var(--text-3);
  border: 1px dashed var(--border-strong);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.cs-risk-pill:hover { color: var(--text-1); border-color: var(--text-3); }
.cs-risk-pill.cs-risk-high   { background: rgba(239,68,68,0.14);  color: var(--bad);     border: 1px solid transparent; }
.cs-risk-pill.cs-risk-low    { background: rgba(52,211,153,0.14); color: var(--ok);      border: 1px solid transparent; }
.cs-risk-pill.cs-risk-hotfix { background: rgba(245,158,11,0.16); color: var(--warn);    border: 1px solid transparent; cursor: default; }
.cs-risk-pill.cs-risk-normal,
.cs-risk-pill.cs-risk-unset  { background: transparent; color: var(--text-3); }
.cs-risk-pill:disabled { opacity: 0.55; cursor: not-allowed; }
.cs-risk-pill-icon { font-weight: 700; }

/* Hotfix gets its own card-level treatment too (matches design
 * intent: amber border, urgent feel without the alarm of high). */
.cs-card.is-hotfix { border-left: 3px solid var(--warn); }
.flow-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 12px;
  border: 1px dashed var(--border-faint);
  border-radius: var(--radius-md);
  color: var(--text-3);
  font-size: 12.5px;
}

/* Change-set card (queued or inflow) */
.cs-card {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.cs-card.is-blocked          { border-color: rgba(239,68,68,0.40); background: rgba(239,68,68,0.04); }
.cs-card.risk-high           { border-left: 3px solid var(--warn); }
.cs-card.is-blocked.risk-high{ border-left-color: var(--bad); }
.cs-card-clickable           { cursor: pointer; transition: border-color 120ms ease, background 120ms ease; }
.cs-card-clickable:hover     { border-color: var(--accent); background: var(--bg-2); }
.cs-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  row-gap: 6px;
}
.cs-card-pr { display: flex; align-items: center; gap: 6px; }
.cs-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-0);
  line-height: 1.35;
}
.cs-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-3);
}
.cs-card-meta-author { color: var(--text-2); font-size: 11.5px; }
.cs-block-note, .cs-risk-note {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  line-height: 1.4;
  margin-top: 2px;
  align-items: flex-start;
}
.cs-block-note { background: rgba(239,68,68,0.10); color: #fda4a4; }
.cs-block-note .ico { color: var(--bad); flex: 0 0 12px; margin-top: 2px; }
.cs-risk-note  { background: var(--accent-soft);   color: var(--text-1); }
.cs-risk-note .ico  { color: var(--accent); flex: 0 0 12px; margin-top: 2px; }

.cs-risk { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; padding: 0 6px; height: 18px; border-radius: var(--radius-sm); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.cs-risk.cs-risk-high   { background: rgba(245,158,11,0.16); color: var(--warn); }
.cs-risk.cs-risk-low    { background: rgba(52,211,153,0.14); color: var(--ok); }
.cs-risk.cs-risk-normal { background: var(--bg-4);            color: var(--text-2); }

/* Stage footer CTA */
.flow-stage-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-faint);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flow-stage-gate-note {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--accent);
  justify-content: center;
}

/* Right-slide drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  /* Above the Logs card's fullscreen mode (z=900) and the chart
   * lightbox (z=1000). Drawer must always sit on top. */
  z-index: 1200;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.18s ease-out;
}
.drawer {
  width: 560px;
  max-width: 92vw;
  height: 100vh;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: slideInRight 0.22s ease-out;
  box-shadow: -16px 0 60px rgba(0,0,0,0.45);
}
.drawer-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-faint);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.drawer-head-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: 600;
}
.drawer-head-title {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-0);
}
.drawer-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--text-2);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
}
.drawer-close:hover { background: var(--bg-3); color: var(--text-0); }
.drawer-body { padding: 22px; flex: 1; }

.kv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
}
.kv-k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 4px;
}
.kv-v {
  font-size: 13px;
  color: var(--text-0);
  word-break: break-word;
}

.drawer-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-faint);
}
.drawer-section h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-2);
}
.drawer-probe-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.drawer-probe-row .muted { font-size: 12.5px; }

.attempt-risk-select {
  background: var(--bg-3);
  color: var(--text-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.attempt-risk-select:hover { border-color: var(--border-strong); }
.attempt-risk-select:focus { outline: none; border-color: var(--accent); }
.attempt-risk-select:disabled { opacity: 0.55; cursor: not-allowed; }

/* Crumb link in detail page head */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  text-decoration: none;
}
.crumb:hover { color: var(--text-0); }
.crumb .ico { width: 12px; height: 12px; transform: rotate(180deg); }

/* Mobile reflow for flow-board + drawer */
@media (max-width: 900px) {
  .flow-board { flex-direction: column; }
  .flow-inflow, .flow-stage { flex: 1 1 auto; min-width: 0; }
  .flow-inflow-arrow {
    top: auto;
    right: 50%;
    bottom: -18px;
    transform: translateX(50%) rotate(90deg);
  }
  .flow-arrow {
    left: 50%;
    top: -18px;
    transform: translateX(-50%) rotate(90deg);
  }
  .flow-stage { padding-top: 24px; }
  .autopilot-strip { flex-direction: column; align-items: flex-start; }
  .autopilot-radio { width: 100%; overflow-x: auto; }
}
@media (max-width: 760px) {
  .drawer { width: 100vw; max-width: 100vw; }
  .kv-grid { grid-template-columns: 1fr; }
}

/* ── Pulse v3 additions ──────────────────────────────────────
 * In-flight deploy rows + "Applications I touch" compact rows.
 */
.inflight-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inflight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.12s;
}
.inflight-row:hover { border-color: var(--border-strong); }
.inflight-row.is-failing  { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.30); }
.inflight-row.is-soaking  { background: var(--accent-soft);   border-color: var(--accent-line); }
.inflight-icon {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  flex: 0 0 26px;
  background: var(--bg-4);
}
.inflight-row.is-failing  .inflight-icon { background: var(--bad);    color: #fff; }
.inflight-row.is-soaking  .inflight-icon { background: var(--accent-strong); color: #fff; }
.inflight-row.is-soaking  .inflight-icon .ico { animation: pulseDot 1.6s ease-in-out infinite; color: var(--accent-soft); }
.inflight-body { flex: 1; min-width: 0; }
.inflight-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-0);
  display: flex;
  align-items: center;
}
.inflight-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}
.inflight-row > .ico { color: var(--text-3); flex: 0 0 14px; }

.my-apps-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.my-app-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s;
}
.my-app-row:hover { background: var(--bg-3); }
.my-app-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-0);
  min-width: 0;
  flex: 1;
  overflow: hidden;
}
/* Ellipsize the name so it never paints over the state badge/meta
 * when the card is narrow (Pulse right column compresses to ~300px). */
.my-app-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.my-app-dot {
  width: 8px; height: 8px;
  border-radius: 999px;
  flex: 0 0 8px;
}
.my-app-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
 * Mobile / narrow-viewport pass (≤640px)
 * Appended last so these rules win on source order. The recurring
 * culprit is wide content (data tables, flex toolbars) forcing the
 * page wider than the viewport. We let that content scroll inside its
 * own container instead of pushing the whole page sideways.
 * ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Hard stop on page-level horizontal scroll. */
  html, body { max-width: 100%; overflow-x: hidden; }

  /* Data tables: scroll horizontally inside their card instead of
   * stretching it. `display:block` turns the <table> into a scroll
   * box; the card (and page) stay at viewport width. */
  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  /* The Pulse/Service incident tables carry an AI-summary line that
   * should still wrap rather than blow the row out to one line. */
  .table .cell-stack,
  .table .ai-snippet { white-space: normal; }

  /* Cards: never exceed viewport; tighten padding a touch. */
  .card { max-width: 100%; }

  /* Page-head: stack title over actions; let action buttons wrap. */
  .page-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-head .actions { flex-wrap: wrap; }

  /* Card-head with a right-aligned button: allow wrap so the button
   * drops below the title instead of overflowing. */
  .card-head { flex-wrap: wrap; row-gap: 6px; }

  /* Stat grid → single column below 640 (auto-fit minmax(220) can
   * still squeeze two columns into ~440, which is too tight). */
  .stat-grid { grid-template-columns: 1fr; }

  /* Form fields must shrink with their container — without min-width:0
   * an <input>'s intrinsic size keeps it wide and overflows the grid
   * cell it lives in (e.g. the action-items add row). */
  input, select, textarea, .search-input, .search-input input {
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* Add-action-item row: stack to one column so the owner field +
   * Add button don't run off-screen. */
  .action-items-add { grid-template-columns: 1fr; }

  /* Tab bars (Insights, etc.): scroll horizontally instead of letting
   * tabs spill past the viewport edge where they get clipped. */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; flex-shrink: 0; }

  /* Filter bars wrap rather than overflow. */
  .filters { flex-wrap: wrap; }
}
