/* ==========================================================================
   Quality Agent — Operations Monitoring Console Stylesheet
   Reference-inspired airy dashboard + Login page + Worker/Claude Agent Cards
   ========================================================================== */

:root {
  --bg: #f5f7fb;
  --sidebar-bg: #ffffff;
  --topbar-bg: #ffffff;
  --panel: #ffffff;
  --panel-alt: #f4f6fa;
  --text: #101828;
  --muted: #5d6b82;
  --border: #e6eaf2;
  --border-subtle: #eff2f7;

  --accent: #316bff;
  --accent-strong: #2358eb;
  --accent-soft: #eef3ff;

  --ok: #0b8a4b;
  --ok-bg: #e3f7ec;
  --bad: #c42b1c;
  --bad-bg: #fdeaea;
  --warn: #b36600;
  --warn-bg: #fff4db;
  --info: #2d5bd1;
  --info-bg: #e9efff;
  --idle: #475467;
  --idle-bg: #eef1f6;

  --bar-muted: #ebeff5;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.03), 0 6px 20px rgba(16, 24, 40, 0.025);
  --shadow-pop: 0 10px 30px rgba(16, 24, 40, 0.12), 0 2px 6px rgba(16, 24, 40, 0.06);
  --shadow-primary: 0 4px 14px rgba(49, 107, 255, 0.28);
  --row-hover: #f8faff;
  --shimmer-base: #edf1f7;
  --shimmer-highlight: #f7f9fd;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --sidebar-w: 244px;
  --sidebar-w-collapsed: 74px;
  --topbar-h: 64px;
  --radius-card: 16px;
  --radius-btn: 12px;
  --radius-pill: 999px;
  --gap: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1118;
    --sidebar-bg: #111822;
    --topbar-bg: #111822;
    --panel: #141b25;
    --panel-alt: #1a2230;
    --text: #e8edf6;
    --muted: #93a1b8;
    --border: #243041;
    --border-subtle: #1d2736;

    --accent: #6b93ff;
    --accent-strong: #4d78f7;
    --accent-soft: #1b294a;

    --ok: #52d48f;
    --ok-bg: #12301f;
    --bad: #ff8a80;
    --bad-bg: #3a1a1a;
    --warn: #f5b742;
    --warn-bg: #33270b;
    --info: #8fb0ff;
    --info-bg: #1c2a4d;
    --idle: #a4b0c4;
    --idle-bg: #212b3a;

    --bar-muted: #202a39;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.22);
    --shadow-pop: 0 14px 36px rgba(0, 0, 0, 0.45);
    --shadow-primary: 0 4px 16px rgba(77, 120, 247, 0.35);
    --row-hover: #192231;
    --shimmer-base: #192230;
    --shimmer-highlight: #233043;
  }
}

:root[data-theme="dark"] {
  --bg: #0c1118;
  --sidebar-bg: #111822;
  --topbar-bg: #111822;
  --panel: #141b25;
  --panel-alt: #1a2230;
  --text: #e8edf6;
  --muted: #93a1b8;
  --border: #243041;
  --border-subtle: #1d2736;

  --accent: #6b93ff;
  --accent-strong: #4d78f7;
  --accent-soft: #1b294a;

  --ok: #52d48f;
  --ok-bg: #12301f;
  --bad: #ff8a80;
  --bad-bg: #3a1a1a;
  --warn: #f5b742;
  --warn-bg: #33270b;
  --info: #8fb0ff;
  --info-bg: #1c2a4d;
  --idle: #a4b0c4;
  --idle-bg: #212b3a;

  --bar-muted: #202a39;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.22);
  --shadow-pop: 0 14px 36px rgba(0, 0, 0, 0.45);
  --shadow-primary: 0 4px 16px rgba(77, 120, 247, 0.35);
  --row-hover: #192231;
  --shimmer-base: #192230;
  --shimmer-highlight: #233043;
}

/* ==========================================================================
   Base & Utilities
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol {
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
}

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted-small {
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   Login Page
   ========================================================================== */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--accent) 11%, transparent) 0%, transparent 40%),
    radial-gradient(circle at 88% 82%, color-mix(in srgb, var(--ok) 8%, transparent) 0%, transparent 38%),
    var(--bg);
}

.login-shell {
  width: 100%;
  max-width: 980px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}

.login-showcase {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 36px;
  color: #ffffff;
  background:
    radial-gradient(circle at 88% 12%, rgba(114, 168, 255, 0.36) 0%, transparent 50%),
    linear-gradient(155deg, #2d66ff 0%, #153ca8 52%, #0c1733 100%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-lg {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

.login-brand-name {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.login-brand-tag {
  font-size: 12.5px;
  color: rgba(226, 236, 255, 0.8);
}

.login-headline {
  font-size: 26px;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.login-lead {
  margin-top: -10px;
  font-size: 14px;
  line-height: 1.6;
  color: rgba(226, 236, 255, 0.85);
}

.login-agents-preview {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-agent-card {
  padding: 13px 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
}

.login-agent-top {
  display: flex;
  align-items: center;
  gap: 11px;
}

.login-agent-name {
  font-size: 13.5px;
  font-weight: 650;
  color: #ffffff;
}

.login-agent-role {
  font-size: 12px;
  color: rgba(226, 236, 255, 0.8);
}

.login-pill-ok {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 650;
  background: rgba(82, 212, 143, 0.2);
  color: #82f0b5;
}

.login-foot-note {
  font-size: 12px;
  color: rgba(215, 228, 255, 0.72);
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.login-card-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px;
  background: var(--panel);
}

.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.login-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.login-title {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.login-subtitle {
  margin-top: 4px;
  font-size: 13.5px;
  color: var(--muted);
}

.login-error {
  padding: 10px 13px;
  border-radius: 11px;
  background: var(--bad-bg);
  color: var(--bad);
  font-size: 13px;
  font-weight: 550;
  border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease;
}

.form-input:focus {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
  outline: none;
}

.form-input.is-invalid {
  border-color: var(--bad);
}

.password-wrap {
  position: relative;
}

.password-wrap .form-input {
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 4px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--text);
  background: var(--border-subtle);
}

.field-error {
  font-size: 12px;
  color: var(--bad);
  min-height: 16px;
}

.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.login-submit {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 650;
}

.login-demo-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--muted);
}

/* ==========================================================================
   App Shell: Sidebar + Workspace
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 17, 24, 0.45);
  z-index: 45;
  backdrop-filter: blur(2px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 16px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #427bff 0%, #2457ea 100%);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(49, 107, 255, 0.28);
}

.brand-name {
  font-size: 16.5px;
  font-weight: 750;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--panel-alt);
  color: var(--text);
}

.nav-item[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-item[aria-selected="true"]::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 7px;
  bottom: 7px;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
}

.nav-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
}

.nav-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.nav-badge[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.nav-badge[data-tone="bad"] { background: var(--bad-bg); color: var(--bad); }
.nav-badge[data-tone="info"] { background: var(--accent-soft); color: var(--accent); }

.nav-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 8px 6px;
}

.nav-chevron {
  transition: transform 0.18s ease;
  opacity: 0.7;
}

.nav-group-toggle[aria-expanded="false"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 21px;
  padding-left: 16px;
  border-left: 1.5px solid var(--border);
  margin-top: 2px;
  margin-bottom: 4px;
}

.nav-subitem {
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.nav-subitem:hover {
  background: var(--panel-alt);
  color: var(--text);
}

.sidebar-footer {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-meta-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.blueprint-hero-card {
  position: relative;
  padding: 16px;
  border-radius: 16px;
  color: #ffffff;
  background:
    radial-gradient(circle at 85% 15%, rgba(114, 166, 255, 0.35) 0%, transparent 55%),
    linear-gradient(155deg, #2d66ff 0%, #12369c 55%, #0c1733 100%);
  box-shadow: 0 10px 24px rgba(17, 45, 130, 0.25);
  overflow: hidden;
}

.blueprint-hero-badge {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.94);
  color: #2358eb;
  margin-bottom: 12px;
}

.blueprint-hero-title {
  font-size: 14.5px;
  font-weight: 700;
}

.blueprint-hero-sub {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(226, 236, 255, 0.85);
  font-family: var(--font-mono);
}

.blueprint-hero-switches {
  margin-top: 8px;
  font-size: 11.5px;
  color: rgba(226, 236, 255, 0.78);
}

.blueprint-hero-btn {
  margin-top: 13px;
  width: 100%;
  height: 34px;
  border: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #437eff 0%, #2660f5 100%);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.blueprint-hero-btn:hover {
  filter: brightness(1.08);
}

.app-shell.sidebar-collapsed .brand-name,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-badge,
.app-shell.sidebar-collapsed .nav-chevron,
.app-shell.sidebar-collapsed .nav-submenu,
.app-shell.sidebar-collapsed .blueprint-hero-card {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-head {
  flex-direction: column;
  gap: 10px;
}

.app-shell.sidebar-collapsed .nav-item,
.app-shell.sidebar-collapsed .sidebar-meta-row {
  justify-content: center;
  padding: 10px;
}

/* ==========================================================================
   Top Bar & Popovers
   ========================================================================== */

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 24px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.mobile-only {
  display: none;
}

.global-search-wrap {
  position: relative;
  width: 100%;
  max-width: 340px;
}

.global-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.global-search-input {
  width: 100%;
  height: 38px;
  padding: 0 46px 0 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13.5px;
}

.global-search-input:focus {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
  outline: none;
}

.kbd-hint {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  pointer-events: none;
}

.search-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 60;
  max-height: 320px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result-item:hover {
  background: var(--panel-alt);
}

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

.search-result-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-sub {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--border-subtle);
}

.icon-btn-subtle {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.alert-indicator {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 2px var(--panel);
}

.popover-anchor {
  position: relative;
}

.alerts-popover,
.account-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  z-index: 60;
  overflow: hidden;
}

.alerts-popover {
  width: 320px;
}

.account-popover {
  width: 230px;
  padding: 6px;
}

.account-info {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 6px;
}

.account-name {
  font-size: 14px;
  font-weight: 700;
}

.account-role {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.account-logout-btn {
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--bad);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.account-logout-btn:hover {
  background: var(--bad-bg);
}

.alerts-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13.5px;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  max-height: 300px;
  overflow-y: auto;
}

.alert-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.alert-row:last-child { border-bottom: 0; }
.alert-row:hover { background: var(--row-hover); }
.alert-row-title { font-size: 13px; font-weight: 600; }
.alert-row-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dce6ff 0%, #c5d6ff 100%);
  color: #1f48b8;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid var(--border);
  cursor: pointer;
}

:root[data-theme="dark"] .user-avatar {
  background: linear-gradient(135deg, #21345c 0%, #172440 100%);
  color: #9bb8ff;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 600;
  user-select: none;
}

.status-pill[data-tone="ok"] { color: var(--ok); background: var(--ok-bg); }
.status-pill[data-tone="warn"] { color: var(--warn); background: var(--warn-bg); }
.status-pill[data-tone="bad"] { color: var(--bad); background: var(--bad-bg); }
.status-pill[data-tone="idle"] { color: var(--idle); background: var(--idle-bg); }

.status-dot {
  width: 7.5px;
  height: 7.5px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
}

.status-pill[data-tone="ok"] .status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.35;
  animation: live-pulse 2s ease-out infinite;
}

@keyframes live-pulse {
  0% { transform: scale(0.85); opacity: 0.5; }
  70% { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* ==========================================================================
   Main Canvas & Page Head
   ========================================================================== */

.canvas {
  flex: 1 0 auto;
  padding: 22px 26px 32px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.canvas:focus { outline: none; }

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-subtitle {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill-control-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 13px;
}

.control-icon { color: var(--muted); }
.control-date { font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.control-divider { width: 1px; height: 16px; background: var(--border); }
.control-select { border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.control-select:focus { outline: none; color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover { background: var(--panel-alt); }
.btn:active { transform: translateY(1px); }

.btn-surface[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.btn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #3c76ff 0%, #2458ee 100%);
  color: #ffffff;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #4b82ff 0%, #2b60f5 100%);
}

.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }

.btn-outline-pill {
  height: 32px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-outline-pill:hover { background: var(--panel-alt); }

.btn-danger-ghost {
  background: transparent;
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
}

.is-spinning { animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent);
  flex-wrap: wrap;
}

.error-banner-body { display: flex; align-items: center; gap: 12px; }
.error-banner-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: color-mix(in srgb, var(--bad) 16%, transparent); }
.error-banner-copy { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13.5px; }

/* ==========================================================================
   Cards, Pills, Agent Runtime Cards & Bento Grid
   ========================================================================== */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-action-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}

.card-action-link:hover { text-decoration: underline; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13.5px; font-weight: 600; }
.kpi-icon-badge { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kpi-value { font-size: 26px; font-weight: 750; line-height: 1.15; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.switch-inline-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.pill[data-tone="ok"] { color: var(--ok); background: var(--ok-bg); }
.pill[data-tone="bad"] { color: var(--bad); background: var(--bad-bg); }
.pill[data-tone="warn"] { color: var(--warn); background: var(--warn-bg); }
.pill[data-tone="info"] { color: var(--info); background: var(--info-bg); }
.pill[data-tone="idle"] { color: var(--idle); background: var(--idle-bg); }

/* Worker Agent & Claude Reviewer Runtime Grid */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.agent-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.agent-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.agent-badge-dot {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
}

.agent-dot-worker {
  background: linear-gradient(145deg, #3c76ff 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px rgba(49, 107, 255, 0.25);
}

.agent-dot-claude {
  background: linear-gradient(145deg, #d97745 0%, #b45326 100%);
  box-shadow: 0 4px 12px rgba(209, 106, 56, 0.24);
}

.agent-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.agent-role {
  font-size: 12.5px;
  color: var(--muted);
}

.agent-summary {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.agent-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.agent-metric-box {
  padding: 9px 11px;
  border-radius: 11px;
  background: var(--panel-alt);
}

.agent-metric-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.agent-metric-val {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Row-aligned Bento Grid (every left/right pair shares exact top & bottom edges) */
.bento-rows {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.bento-row {
  display: grid;
  grid-template-columns: minmax(0, 1.58fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: stretch;
}

.bento-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}

.bento-card-grow {
  flex: 1 1 auto;
}

.table-card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--panel);
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.hero-top-split {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.25fr);
  gap: 20px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.hero-big-metric { font-size: 34px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.hero-metric-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.sprint-bars-stack { display: flex; flex-direction: column; gap: 14px; }
.sprint-bar-item { display: flex; flex-direction: column; gap: 6px; }
.sprint-bar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.sprint-bar-name { font-weight: 650; }
.sprint-bar-stat { color: var(--muted); font-variant-numeric: tabular-nums; }

.progress-track { display: flex; height: 10px; width: 100%; border-radius: var(--radius-pill); overflow: hidden; background: var(--bar-muted); gap: 1.5px; }
.progress-seg { height: 100%; transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.progress-seg[data-tone="ok"] { background: var(--ok); }
.progress-seg[data-tone="warn"] { background: #e89b19; }
.progress-seg[data-tone="bad"] { background: #e0493c; }
.progress-seg[data-tone="idle"] { background: #8c98ab; }

.breakdown-strip { margin-top: 16px; }
.breakdown-strip-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.breakdown-strip-title { font-size: 13px; font-weight: 650; }
.breakdown-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.breakdown-cell { display: flex; flex-direction: column; gap: 4px; padding-left: 10px; border-left: 1px solid var(--border); }
.breakdown-cell:first-child { padding-left: 0; border-left: 0; }
.breakdown-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.breakdown-lbl { font-size: 12px; color: var(--muted); }
.breakdown-bar { margin-top: 6px; height: 4px; border-radius: 4px; background: var(--bar-muted); overflow: hidden; }
.breakdown-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.breakdown-bar-fill[data-tone="ok"] { background: var(--ok); }
.breakdown-bar-fill[data-tone="warn"] { background: #f09d1f; }
.breakdown-bar-fill[data-tone="bad"] { background: #e24b3d; }
.breakdown-bar-fill[data-tone="idle"] { background: #7f8ca0; }

.bar-chart-wrap { flex: 1 1 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 14px; min-height: 158px; padding: 22px 6px 8px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 8px; cursor: pointer; }
.bar-val-top { font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--muted); }
.bar-col.is-peak .bar-val-top, .bar-col:hover .bar-val-top { color: var(--text); }
.bar-pillar { width: 100%; max-width: 42px; min-height: 12px; border-radius: 10px 10px 6px 6px; background: var(--bar-muted); transition: height 0.5s ease, transform 0.15s ease; }
.bar-col.is-peak .bar-pillar { background: linear-gradient(180deg, #4f88ff 0%, #2459ee 100%); box-shadow: 0 6px 16px rgba(49, 107, 255, 0.25); }
.bar-col:hover .bar-pillar { transform: translateY(-2px); }
.bar-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.bar-col.is-peak .bar-label { color: var(--accent); font-weight: 650; }
.bar-chart-footnote { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border-subtle); font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }

.gauge-wrap { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6px 0 2px; }
.gauge-svg-box { position: relative; width: 100%; max-width: 240px; display: flex; flex-direction: column; align-items: center; }
.gauge-svg { width: 100%; height: auto; overflow: visible; }
.gauge-center { margin-top: -54px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.gauge-pct { font-size: 32px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gauge-caption { font-size: 12px; color: var(--muted); }
.gauge-action { margin-top: 14px; }

.triage-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.triage-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 11px; background: var(--panel-alt); border: 1px solid var(--border-subtle); }
.triage-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.triage-label { font-size: 13px; font-weight: 550; }
.triage-links { display: flex; flex-wrap: wrap; gap: 5px; }
.task-chip-link { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 6px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; background: var(--panel); border: 1px solid var(--border); color: var(--accent); }
.task-chip-link:hover { background: var(--accent-soft); text-decoration: none; }

.reason-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.reason-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--panel-alt); font-size: 12.5px; line-height: 1.4; }
.reason-dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; background: var(--warn); }
.reason-more { margin-top: 8px; font-size: 12px; color: var(--muted); font-weight: 550; }
.reason-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.reason-page-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.reason-page-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}
.page-btn:hover:not(:disabled) {
  background: var(--panel-alt);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.page-btn[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.clear-gate { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); font-size: 13.5px; font-weight: 600; }

/* ==========================================================================
   Enriched Tasks Filter Card & Facets
   ========================================================================== */

.tasks-filter-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: var(--gap);
  padding: 16px 18px;
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-toolbar-tight {
  margin-bottom: 0;
}

.facet-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.facet-control {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.facet-label {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.facet-select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.facet-select:focus {
  border-color: var(--accent);
  background: var(--panel);
  outline: none;
}

.active-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.active-tags-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.active-filter-remove {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.active-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.search-field { position: relative; flex: 1 1 280px; max-width: 440px; }
.search-field-wide { max-width: 520px; }
.search-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input { width: 100%; height: 38px; padding: 0 34px 0 36px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-alt); color: var(--text); font-size: 13.5px; }
.search-input:focus { background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); outline: none; }
.search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--border-subtle); color: var(--muted); cursor: pointer; display: grid; place-items: center; font-size: 15px; }

.chip-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 550; cursor: pointer; }
.chip:hover { background: var(--panel-alt); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 34%, var(--border)); font-weight: 650; }
.chip-count { font-size: 11.5px; opacity: 0.8; font-variant-numeric: tabular-nums; }
.toolbar-meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Tables, Queue & Activity Timeline
   ========================================================================== */

.table-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; }
.table-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px 12px; flex-wrap: wrap; }
.table-scroll { overflow: auto; width: 100%; }
.table-scroll-tall { max-height: 64vh; }

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; font-size: 13.5px; }
.data-table thead th { position: sticky; top: 0; z-index: 2; background: var(--panel); color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 16px; border-top: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.data-table thead th.sortable { cursor: pointer; }
.data-table thead th.sortable:hover { color: var(--text); background: var(--panel-alt); }
.data-table thead th[aria-sort="ascending"], .data-table thead th[aria-sort="descending"] { color: var(--accent); }
.th-inner { display: inline-flex; align-items: center; gap: 5px; }
.sort-arrow { font-size: 10px; opacity: 0.45; }
.data-table thead th[aria-sort="ascending"] .sort-arrow, .data-table thead th[aria-sort="descending"] .sort-arrow { opacity: 1; }
.data-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--row-hover); }
.cell-wrap { white-space: normal !important; word-break: break-word; max-width: 560px; }
.task-link { font-family: var(--font-mono); font-size: 13px; font-weight: 650; color: var(--accent); }
.muted-cell { color: var(--muted); }

.reviewer-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 550;
}

.reviewer-mini {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  color: #ffffff;
}

.queue-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.queue-card { display: flex; flex-direction: column; gap: 12px; }
.queue-kind-header { display: flex; align-items: center; justify-content: space-between; }
.queue-kind-title { font-size: 14.5px; font-weight: 650; text-transform: capitalize; }
.queue-kind-total { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.queue-states { display: flex; flex-direction: column; gap: 7px; }
.queue-state-row { display: flex; align-items: center; justify-content: space-between; }
.queue-state-count { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.queue-state-count-zero { color: var(--muted); font-weight: 400; }
.queue-section { margin-top: var(--gap); }

.timeline-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; }
.timeline-list { list-style: none; padding: 0; }
.timeline-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; gap: 13px; padding: 14px 18px; border-bottom: 1px solid var(--border-subtle); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-row:hover { background: var(--row-hover); }
.timeline-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 15px; font-weight: 700; }
.timeline-icon[data-tone="ok"] { color: var(--ok); background: var(--ok-bg); }
.timeline-icon[data-tone="bad"] { color: var(--bad); background: var(--bad-bg); }
.timeline-icon[data-tone="warn"] { color: var(--warn); background: var(--warn-bg); }
.timeline-icon[data-tone="info"] { color: var(--info); background: var(--info-bg); }
.timeline-icon[data-tone="idle"] { color: var(--idle); background: var(--idle-bg); }
.timeline-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.timeline-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline-action { font-family: var(--font-mono); font-size: 13px; font-weight: 650; }
.timeline-sub { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.timeline-target { font-weight: 600; color: var(--text); }
.timeline-ids { font-family: var(--font-mono); font-size: 12px; word-break: break-all; }
.timeline-time { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.empty-state { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 44px 24px; text-align: center; box-shadow: var(--shadow-card); }
.empty-state-title { font-size: 15.5px; font-weight: 650; margin-bottom: 4px; }
.empty-state-desc { font-size: 13.5px; color: var(--muted); }

.skeleton-card { height: 118px; border-radius: var(--radius-card); border: 1px solid var(--border); background: linear-gradient(90deg, var(--shimmer-base) 25%, var(--shimmer-highlight) 50%, var(--shimmer-base) 75%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.canvas-footer { margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }

/* ==========================================================================
   End-to-End Quality Gate Workflow Page
   ========================================================================== */

.workflow-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: var(--gap);
}

.workflow-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 720px;
}

.workflow-hero-desc {
  font-size: 13.5px;
  color: var(--muted);
}

.workflow-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--panel-alt);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
}

/* Connected 6-Stage Horizontal Pipeline with Stage-by-Stage Flow Animation */
.pipeline-card {
  margin-bottom: var(--gap);
  padding: 20px;
}

.pipeline-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.flow-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.flow-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: live-pulse 1.5s ease-out infinite;
}

.pipeline-track {
  display: flex;
  align-items: stretch;
  gap: 0;
  position: relative;
}

.stage-node {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 13px 13px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--panel-alt);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.16s ease, box-shadow 0.22s ease;
}

.stage-node::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: transparent;
}

.stage-node.is-completed {
  background: var(--panel);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
}

.stage-node.is-completed::before {
  background: linear-gradient(90deg, var(--accent) 0%, #5b8fff 100%);
}

.stage-node:hover {
  background: var(--panel);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  transform: translateY(-2px);
}

.stage-node[aria-selected="true"] {
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), 0 8px 22px color-mix(in srgb, var(--accent) 16%, transparent);
  transform: translateY(-2px);
}

.stage-node[aria-selected="true"].is-playing::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #4a83ff 0%, var(--accent) 60%, #7aa5ff 100%);
  animation: stage-progress-fill 2.6s linear forwards;
}

.stage-node[aria-selected="true"]:not(.is-playing)::before {
  background: var(--accent);
}

@keyframes stage-progress-fill {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* Stage-to-stage animated flow connectors */
.stage-connector {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.stage-connector-rail {
  position: relative;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.stage-connector-head {
  position: absolute;
  right: 1px;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  transform: rotate(45deg);
  opacity: 0.6;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.stage-connector.is-passed .stage-connector-rail {
  background: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.stage-connector.is-passed .stage-connector-head {
  border-color: var(--accent);
  opacity: 0.9;
}

.stage-connector.is-ambient .stage-connector-rail::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 55%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--accent) 55%, transparent) 55%, transparent 100%);
  animation: flow-packet 2.1s linear infinite;
}

.stage-connector.is-flowing .stage-connector-rail {
  background: color-mix(in srgb, var(--accent) 28%, var(--border));
}

.stage-connector.is-flowing .stage-connector-rail::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 70%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 55%, #8bb0ff 100%);
  box-shadow: 0 0 10px var(--accent);
  animation: flow-packet 0.95s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.stage-connector.is-flowing .stage-connector-head {
  border-color: var(--accent);
  opacity: 1;
  animation: arrow-pulse 0.95s ease-in-out infinite;
}

/* Closed-Loop Return Track (06 -> 01 continuous cycle) */
.pipeline-loop-return {
  position: relative;
  margin-top: 2px;
  padding: 0 7%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loop-svg {
  width: 100%;
  height: 46px;
  display: block;
  overflow: visible;
}

.loop-path-base {
  fill: none;
  stroke: var(--border);
  stroke-width: 2.5;
  stroke-linecap: round;
}

.loop-path-flow {
  fill: none;
  stroke: color-mix(in srgb, var(--accent) 60%, transparent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 10 14;
  animation: loop-dash-march 1.35s linear infinite;
}

.pipeline-loop-return.is-loop-active .loop-path-base {
  stroke: color-mix(in srgb, var(--accent) 34%, var(--border));
}

.pipeline-loop-return.is-loop-active .loop-path-flow {
  stroke: var(--accent);
  stroke-width: 3.2;
  stroke-dasharray: 14 10;
  animation: loop-dash-march 0.65s linear infinite;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 60%, transparent));
}

.loop-arrow-head {
  fill: var(--accent);
  opacity: 0.78;
}

.pipeline-loop-return.is-loop-active .loop-arrow-head {
  opacity: 1;
}

@keyframes loop-dash-march {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -48; }
}

.loop-label-pill {
  margin-top: -19px;
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 13px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.05);
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.pipeline-loop-return.is-loop-active .loop-label-pill {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
  color: var(--accent);
}

.loop-spin-icon {
  display: inline-block;
  font-size: 13px;
  line-height: 1;
  animation: spin-ccw 3.4s linear infinite;
}

.pipeline-loop-return.is-paused .loop-path-flow,
.pipeline-loop-return.is-paused .loop-spin-icon {
  animation-play-state: paused;
}

@keyframes spin-ccw {
  to { transform: rotate(-360deg); }
}

@keyframes flow-packet {
  0% { left: -65%; }
  100% { left: 110%; }
}

@keyframes arrow-pulse {
  0%, 100% { transform: rotate(45deg) scale(1); }
  50% { transform: rotate(45deg) scale(1.22); }
}

.inspector-animate {
  animation: stage-enter 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes stage-enter {
  from {
    opacity: 0.55;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.trace-step.is-trace-active .trace-dot {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 24%, transparent);
  transform: scale(1.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.trace-step.is-trace-active .trace-step-title {
  color: var(--accent);
}

.trace-step.is-trace-active .trace-step-body {
  background: color-mix(in srgb, var(--accent-soft) 60%, transparent);
  border-radius: 10px;
  padding: 5px 9px;
  margin: -5px -9px;
}

.arch-arrow {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 700;
  flex: 0 0 auto;
  animation: arch-nudge 1.8s ease-in-out infinite;
}

@keyframes arch-nudge {
  0%, 100% { transform: translateX(0); opacity: 0.65; }
  50% { transform: translateX(3px); opacity: 1; }
}

.stage-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.stage-step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.stage-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.stage-metric {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.stage-owner-text {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Stage Inspector + Interactive Task Trace Bento */
.workflow-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
  margin-bottom: var(--gap);
}

.inspector-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.inspector-kicker {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.inspector-title {
  margin-top: 3px;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.inspector-summary {
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.55;
}

.io-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.io-box {
  padding: 12px;
  border-radius: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border-subtle);
}

.io-box-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

.io-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text);
}

.inspector-live-box {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.inspector-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.inspector-live-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
}

/* Task Lifecycle Tracer */
.trace-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.trace-select {
  flex: 1 1 200px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.trace-steps {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.trace-step {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 14px;
}

.trace-step:last-child {
  padding-bottom: 0;
}

.trace-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 26px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.trace-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.trace-dot[data-tone="ok"] { background: var(--ok-bg); color: var(--ok); }
.trace-dot[data-tone="warn"] { background: var(--warn-bg); color: var(--warn); }
.trace-dot[data-tone="bad"] { background: var(--bad-bg); color: var(--bad); }
.trace-dot[data-tone="info"] { background: var(--info-bg); color: var(--info); }
.trace-dot[data-tone="idle"] { background: var(--idle-bg); color: var(--idle); }

.trace-step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.trace-step-title {
  font-size: 13px;
  font-weight: 650;
}

.trace-step-detail {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

/* Verdict Routing Matrix + System Architecture Strip */
.verdict-matrix-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--gap);
}

.verdict-rule-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px 16px;
}

.verdict-rule-desc {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.verdict-rule-gate {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.arch-flow {
  display: flex;
  align-items: stretch;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.arch-node {
  flex: 1 1 170px;
  min-width: 155px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.arch-node-title {
  font-size: 13px;
  font-weight: 700;
}

.arch-node-sub {
  font-size: 11.5px;
  color: var(--muted);
}

/* ==========================================================================
   Wiki Blueprint Updates Page (#wiki)
   ========================================================================== */

.wiki-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiki-facet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.2fr);
  gap: 10px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.wiki-filter-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 34px;
  flex-wrap: wrap;
}

.wiki-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}

.wiki-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wiki-item-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 16px;
  border-radius: var(--radius-card);
  border: 1.5px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.1s ease;
}

.wiki-item-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
}

.wiki-item-card[aria-selected="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent), var(--shadow-card);
}

.wiki-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.wiki-item-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.wiki-item-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.wiki-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.wiki-item-summary {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.wiki-item-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.wiki-preview-card {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wiki-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.wiki-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.wiki-mode-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  gap: 2px;
}

.wiki-mode-btn {
  padding: 4px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.wiki-mode-btn[aria-pressed="true"] {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.wiki-export-btns {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.md-preview {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border-subtle);
  max-height: 52vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.md-h1 {
  font-size: 16px;
  font-weight: 750;
  color: var(--text);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.md-h2 {
  margin-top: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.md-p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
}

.md-ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: var(--text);
}

.md-raw {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 52vh;
  overflow: auto;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agents-grid { grid-template-columns: minmax(0, 1fr); }
  .bento-row { grid-template-columns: minmax(0, 1fr); }
  .facet-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pipeline-track { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .stage-connector { display: none; }
  .pipeline-loop-return { padding: 10px 0 0; }
  .loop-svg { display: none; }
  .loop-label-pill { margin-top: 0; }
  .workflow-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .wiki-grid { grid-template-columns: minmax(0, 1fr); }
  .wiki-preview-card { position: static; }
  .verdict-matrix-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .login-shell { grid-template-columns: minmax(0, 1fr); }
  .login-showcase { padding: 28px; }
  .login-card-wrap { padding: 28px; }

  .app-shell,
  .app-shell.sidebar-collapsed { grid-template-columns: minmax(0, 1fr); }
  .mobile-only { display: grid; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 264px; transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-pop); }
  .app-shell.drawer-open .sidebar { transform: translateX(0); }
  .app-shell.drawer-open .brand-name,
  .app-shell.drawer-open .nav-label,
  .app-shell.drawer-open .nav-badge,
  .app-shell.drawer-open .nav-chevron,
  .app-shell.drawer-open .nav-submenu,
  .app-shell.drawer-open .blueprint-hero-card { display: revert; }
  .hero-top-split { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .login-page { padding: 12px; }
  .login-showcase { display: none; }
  .topbar { padding: 0 14px; }
  .canvas { padding: 16px 14px 28px; }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .facet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wiki-facet-grid { grid-template-columns: minmax(0, 1fr); }
  .wiki-filter-meta { justify-content: flex-start; }
  .pipeline-track { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .io-grid { grid-template-columns: minmax(0, 1fr); }
  .verdict-matrix-grid { grid-template-columns: minmax(0, 1fr); }
  .agent-metrics-row { grid-template-columns: minmax(0, 1fr); }
  .breakdown-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdown-cell:nth-child(3) { padding-left: 0; border-left: 0; }
  .kbd-hint, .control-date, .control-divider { display: none; }
  .timeline-row { grid-template-columns: 34px minmax(0, 1fr); }
  .timeline-time { grid-column: 2; }
  .search-field, .search-field-wide { max-width: none; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Markdown preview tables (wiki page) */
.md-table-wrap{overflow:auto;margin:8px 0 12px;border:1px solid var(--border);border-radius:12px}
.md-table{width:100%;border-collapse:collapse;font-size:12.5px;min-width:560px}
.md-table th,.md-table td{text-align:left;padding:7px 10px;border-bottom:1px solid var(--border);vertical-align:top}
.md-table th{background:var(--panel-alt);font-size:11.5px;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}
.md-table tr:last-child td{border-bottom:0}
.md-table code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}
