/* SecurityBox BYOA — Instrument conversation surface.
   Warm-graphite, mobile-first SOC product surface. Dark is the default (SOC context);
   a full light theme overrides the same custom properties under
   prefers-color-scheme: light. System font stack + inline SVG only — no CDN,
   no web fonts, no remote assets (air-gap friendly).

   Layout: single stacked column below 900px (list, then detail+chat once a
   conclusion is opened via the .has-selection collapse); a two-pane split at
   >=900px (fixed list left, detail+chat right). */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0c0c0b;
  --bg-1: #141311;
  --bg-2: #1c1a17;
  --bg-3: #090908;
  --bg-input: #0a0a09;
  --surface-shell: #0a0a09;
  --surface-panel: #141311;
  --surface-elevated: #1c1a17;
  --surface-interactive: #232019;
  --surface-hover: #2a261e;
  --surface-selected: #211d15;
  --border: rgba(232, 224, 208, 0.10);
  --border-structural: rgba(232, 224, 208, 0.15);
  --border-strong: rgba(232, 224, 208, 0.24);

  /* Text */
  --text: #ece6d8;
  --text-dim: #a49d8c;
  --text-muted: #6f695b;

  /* Accent = warm-bone luminance, not a hue. */
  --accent: #efe8d6;
  --accent-hover: #fbf6ea;
  --accent-contrast: #17150f;
  --accent-soft: rgba(239, 232, 214, 0.12);
  --focus-ring: rgba(239, 232, 214, 0.55);
  --success: #5fb488;
  --danger: #ff5d5d;
  --danger-soft: rgba(255, 93, 93, 0.14);

  /* Severity — the only chromatic axis. */
  --sev-critical: #ff5d5d;
  --sev-high: #ff9a4d;
  --sev-medium: #f0c34a;
  --sev-low: #57ceb0;
  --sev-info: #74b6ff;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow: 0 5px 16px rgba(0, 0, 0, 0.24);
  --shadow-card: 0 1px 0 rgba(232, 224, 208, 0.02), 0 4px 12px rgba(0, 0, 0, 0.24);
  --shadow-elevated: 0 1px 0 rgba(232, 224, 208, 0.025) inset, 0 6px 18px rgba(0, 0, 0, 0.18);

  /* Geometry */
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --tap: 44px;
  --topbar-h: 60px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --list-row-padding: var(--sp-3);

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

  /* Inline-SVG icons used as mask images (color comes from background). */
  --icon-shield: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2 20 5v6c0 5-3.5 8.5-8 10-4.5-1.5-8-5-8-10V5l8-3Z'/%3E%3C/svg%3E");
  --icon-shield-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M12 2 20 5v6c0 5-3.5 8.5-8 10-4.5-1.5-8-5-8-10V5l8-3Zm4 6.6-1.4-1.4-4 4-1.6-1.6L7.6 11l3 3 5.4-5.4Z'/%3E%3C/svg%3E");
  --icon-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M12 2a5 5 0 0 0-5 5v3H6a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7a2 2 0 0 0-2-2h-1V7a5 5 0 0 0-5-5Zm3 8H9V7a3 3 0 0 1 6 0v3Z'/%3E%3C/svg%3E");
  --icon-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M11 4a7 7 0 1 0 4.2 12.6l4.1 4.1 1.4-1.4-4.1-4.1A7 7 0 0 0 11 4Zm0 2a5 5 0 1 1 0 10 5 5 0 0 1 0-10Z'/%3E%3C/svg%3E");
  --icon-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M12 2 22 20H2L12 2Zm0 6a1 1 0 0 0-1 1v5a1 1 0 0 0 2 0V9a1 1 0 0 0-1-1Zm0 9a1.3 1.3 0 1 0 0 2.6 1.3 1.3 0 0 0 0-2.6Z'/%3E%3C/svg%3E");
  --icon-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' fill-rule='evenodd' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm0 4.4a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8ZM13.2 17h-2.4v-6h2.4v6Z'/%3E%3C/svg%3E");
  --icon-spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2c.5 3.2 1.8 4.5 5 5-3.2.5-4.5 1.8-5 5-.5-3.2-1.8-4.5-5-5 3.2-.5 4.5-1.8 5-5Zm7 9c.3 1.6.9 2.2 2.5 2.5-1.6.3-2.2.9-2.5 2.5-.3-1.6-.9-2.2-2.5-2.5 1.6-.3 2.2-.9 2.5-2.5Z'/%3E%3C/svg%3E");
  --icon-sev-critical: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='m12 2 10 10-10 10L2 12 12 2Z'/%3E%3C/svg%3E");
  --icon-sev-high: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2 23 22H1L12 2Z'/%3E%3C/svg%3E");
  --icon-sev-medium: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M3 3h18v18H3V3Z'/%3E%3C/svg%3E");
  --icon-sev-low: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='10' fill='%23000'/%3E%3C/svg%3E");
  --icon-sev-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='4' fill='%23000'/%3E%3C/svg%3E");
}

/* Per-severity token: any element carrying data-severity exposes --sev to its
   subtree, so glyphs, accents and marks share one consistent color source. */
[data-severity="critical"] { --sev: var(--sev-critical); --sev-shape: var(--icon-sev-critical); }
[data-severity="high"] { --sev: var(--sev-high); --sev-shape: var(--icon-sev-high); }
[data-severity="medium"] { --sev: var(--sev-medium); --sev-shape: var(--icon-sev-medium); }
[data-severity="low"] { --sev: var(--sev-low); --sev-shape: var(--icon-sev-low); }
[data-severity="info"] { --sev: var(--sev-info); --sev-shape: var(--icon-sev-info); }

/* Lifecycle state token: while severity is uniform, the left accent bar is
   colored by where the finding is in its lifecycle (new -> developing -> persistent). */
[data-state="new"] { --state: var(--sev-info); }
[data-state="developing"] { --state: var(--sev-medium); }
[data-state="persistent"] { --state: var(--sev-high); }
[data-state="resolved"] { --state: var(--sev-low); }
[data-state="dismissed"] { --state: var(--text-muted); }

/* -------------------------------------------------------------- light theme */

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --bg: #efeade;
    --bg-1: #fbf8f0;
    --bg-2: #ffffff;
    --bg-3: #f4efe3;
    --bg-input: #ffffff;
    --surface-shell: #f4efe3;
    --surface-panel: #fbf8f0;
    --surface-elevated: #ffffff;
    --surface-interactive: #efe9db;
    --surface-hover: #e8e1d0;
    --surface-selected: #eae2cf;
    --border: rgba(41, 37, 28, 0.14);
    --border-structural: rgba(41, 37, 28, 0.20);
    --border-strong: rgba(41, 37, 28, 0.30);

    --text: #1f1c15;
    --text-dim: #4a4638;
    --text-muted: #6f695b;

    --accent: #23201a;
    --accent-hover: #100f0b;
    --accent-contrast: #fbf8f0;
    --accent-soft: rgba(35, 32, 26, 0.08);
    --focus-ring: rgba(35, 32, 26, 0.45);
    --success: #2f855a;
    --danger: #c0392b;
    --danger-soft: rgba(192, 57, 43, 0.12);

    /* Severity — darkened for contrast on warm paper. */
    --sev-critical: #be2f2f;
    --sev-high: #a85814;
    --sev-medium: #8a6d10;
    --sev-low: #1d7d68;
    --sev-info: #2f6fc0;

    --shadow-sm: 0 1px 2px rgba(41, 37, 28, 0.08);
    --shadow: 0 5px 16px rgba(41, 37, 28, 0.10);
    --shadow-card: 0 1px 2px rgba(41, 37, 28, 0.06), 0 4px 12px rgba(41, 37, 28, 0.06);
    --shadow-elevated: 0 1px 0 rgba(255, 255, 255, 0.72) inset, 0 6px 18px rgba(41, 37, 28, 0.08);

    /* Geometry tokens are theme-invariant but mirrored for complete parity. */
    --sp-1: 4px;
    --sp-2: 8px;
    --sp-3: 12px;
    --sp-4: 16px;
    --sp-5: 20px;
    --sp-6: 24px;
    --sp-7: 32px;
    --sp-8: 40px;
  }
}

/* ------------------------------------------------------------------- reset */

* {
  box-sizing: border-box;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: inherit;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

#root {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.muted {
  color: var(--text-muted);
}
.small {
  font-size: 12.5px;
}
.mono {
  font-family: var(--mono);
}

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

.btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 550;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  color: var(--text);
  background: transparent;
  border-color: var(--border);
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.06s ease,
    box-shadow 0.16s ease;
}
.btn:hover {
  background: var(--surface-hover);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn.ghost:hover {
  background: var(--bg-2);
  color: var(--text);
}
.btn.back {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
  padding: 0 4px;
  min-height: 34px;
  font-size: 13.5px;
  align-self: flex-start;
}
.btn.back:hover {
  color: var(--text);
  background: transparent;
}

/* --------------------------------------------------------- centered screens */

.center-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 26px;
  box-shadow: var(--shadow-card);
}
.card.notice {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.card.notice p {
  margin: 0;
  color: var(--text-dim);
}
.notice-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
}

.spinner-block {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

/* spinners */
.spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.spinner-small {
  width: 15px;
  height: 15px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Decorative status icons (error / not-found) */
.state-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
}
.state-icon::after {
  content: "";
  width: 26px;
  height: 26px;
  background: var(--accent);
  -webkit-mask: var(--icon-info) center / contain no-repeat;
  mask: var(--icon-info) center / contain no-repeat;
}
.state-icon-error {
  background: var(--danger-soft);
}
.state-icon-error::after {
  background: var(--danger);
  -webkit-mask-image: var(--icon-alert);
  mask-image: var(--icon-alert);
}
.state-icon-search::after {
  -webkit-mask-image: var(--icon-search);
  mask-image: var(--icon-search);
}

/* ------------------------------------------------------------------- login */

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.login-mark {
  width: 30px;
  height: 30px;
}
.login-wordmark {
  font-size: 22px;
}
.login-title {
  margin: 6px 0 0;
  text-align: center;
  font-size: 19px;
  font-weight: 650;
}
.login-sub {
  margin: -4px 0 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-dim);
}
.login-form input {
  font-family: inherit;
  font-size: 15px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0 13px;
  min-height: var(--tap);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.login-form input:focus {
  outline: none;
  border-color: var(--border-strong);
}
.login-form input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--border-strong);
  box-shadow: none;
}
.login-form .btn {
  margin-top: 6px;
}
.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

/* ------------------------------------------------------------------ topbar */

.wordmark {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text);
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  color: var(--accent);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 var(--sp-4);
  min-height: var(--topbar-h);
  background:
    radial-gradient(circle at 18% -90%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 42%),
    color-mix(in srgb, var(--surface-shell) 96%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border-structural);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  min-width: 0;
}
.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}
.topbar .wordmark {
  font-size: 15.5px;
}
.product-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}
.tenant {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  font-size: 13px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: 999px;
  min-width: 0;
}
.tenant-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent);
}
.tenant-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 30vw;
}
.topbar .btn.ghost {
  min-height: 38px;
  padding: 0 12px;
}

/* pills */
.live-pill,
.private-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  font-family: var(--mono);
  white-space: nowrap;
}
.live-pill span[aria-hidden],
.private-pill span[aria-hidden] {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
}
.live-pill {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
}
.live-pill span[aria-hidden] {
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  animation: pulse 2s ease-out infinite;
}
.live-pill.stale,
.live-pill.degraded,
.live-pill.offline,
.live-pill[data-state="stale"],
.live-pill[data-state="degraded"],
.live-pill[data-state="offline"] {
  color: var(--accent);
  background: transparent;
  border-color: var(--accent);
}
.live-pill.stale span[aria-hidden],
.live-pill.degraded span[aria-hidden],
.live-pill.offline span[aria-hidden],
.live-pill[data-state="stale"] span[aria-hidden],
.live-pill[data-state="degraded"] span[aria-hidden],
.live-pill[data-state="offline"] span[aria-hidden] {
  border-radius: 0;
  background: currentColor;
  box-shadow: none;
  animation: none;
  -webkit-mask: var(--icon-info) center / contain no-repeat;
  mask: var(--icon-info) center / contain no-repeat;
}
.private-pill span[aria-hidden] {
  background: var(--accent);
  -webkit-mask: var(--icon-lock) center / contain no-repeat;
  mask: var(--icon-lock) center / contain no-repeat;
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent);
  }
  70% {
    box-shadow: 0 0 0 7px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* ------------------------------------------------------------------ layout */

.layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.list-pane {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-structural);
  min-height: 0;
  flex: 1;
  background: var(--surface-shell);
}
.detail-pane {
  display: none;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  background: var(--bg);
}

/* Mobile: once a conclusion is open, hand the whole screen to the conversation. */
.layout.has-selection .list-pane {
  display: none;
}
.layout.has-selection .detail-pane {
  display: flex;
}

/* pane header (list) */
.pane-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border-structural);
  background: var(--surface-shell);
}
.list-pane-header {
  flex: 0 0 auto;
}
.eyebrow {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
}
.pane-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* --------------------------------------------------------------------- list */

.list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  scrollbar-color: var(--border-strong) transparent;
}
.list-status {
  padding: 26px 18px;
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}
.list-status.empty,
.list-status.list-error {
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 40px 22px;
}
.list-loading {
  flex-direction: row;
  align-items: center;
}

/* skeleton shimmer while loading */
.list-skeleton {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
}
.list-skeleton span {
  height: 62px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    100deg,
    transparent 20%,
    color-mix(in srgb, var(--text-muted) 12%, transparent) 40%,
    transparent 60%
  );
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

/* empty-state illustration */
.empty-illustration {
  width: 172px;
  max-width: 66%;
  height: auto;
  margin-bottom: 4px;
}
.empty-orbit {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.5;
  stroke-dasharray: 3 7;
  opacity: 0.7;
}
.empty-card-shape {
  fill: var(--bg-1);
  stroke: var(--border-strong);
  stroke-width: 1.5;
}
.empty-card-back {
  fill: var(--bg-2);
  opacity: 0.7;
}
.empty-shield {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.empty-check {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.empty-dot {
  fill: var(--accent);
}
.empty-dot-small {
  fill: var(--text-muted);
}
.empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}
.empty-copy {
  margin: 0;
  max-width: 34ch;
  color: var(--text-muted);
  font-size: 13.5px;
}
.empty-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}
.empty-status span[aria-hidden] {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  animation: pulse 2s ease-out infinite;
}

/* conclusion rows */
.list-filters {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.queue-search {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-interactive);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.queue-customer {
  flex: 0 0 auto;
  max-width: 45%;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-interactive);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.queue-search:focus-visible,
.queue-customer:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.queue-correlate {
  flex: 0 0 auto;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}
.queue-correlate:hover {
  color: var(--text);
}
.queue-correlate.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.row-similar {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-family: var(--mono);
  white-space: nowrap;
}
.row-item {
  position: relative;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
}
.row-resolve {
  position: absolute;
  top: var(--sp-3);
  right: var(--sp-4);
  z-index: 2;
  padding: 4px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
}
.row-item:hover .row-resolve,
.row-item:focus-within .row-resolve,
.row-resolve:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.row-resolve:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.row-resolve:disabled {
  cursor: default;
  opacity: 0.4;
}
.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  padding: var(--sp-3) var(--sp-4) var(--sp-3) var(--sp-5);
  min-height: 72px;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.row:hover {
  background: var(--surface-hover);
}
.row:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
  background: var(--surface-hover);
}
.row.active,
.row[aria-current="true"] {
  background: var(--surface-selected);
}
.row.active::after,
.row[aria-current="true"]::after {
  content: "";
  position: absolute;
  top: var(--sp-3);
  bottom: var(--sp-3);
  left: 5px;
  width: 2px;
  border-radius: var(--radius-xs);
  background: var(--accent);
}
.row-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--state, var(--sev, var(--sev-info)));
  opacity: 0.7;
  transition: opacity 0.14s ease;
}
.row.active .row-accent,
.row[aria-current="true"] .row-accent,
.row:hover .row-accent {
  opacity: 1;
}
.severity-glyph {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  background: var(--sev, var(--sev-info));
  -webkit-mask: var(--icon-shield) center / contain no-repeat;
  mask: var(--icon-shield) center / contain no-repeat;
}
.row-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.row-customer {
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-type {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-signals {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  min-width: 0;
}
.row-time {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}
.row-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-width: 0;
  margin-top: var(--sp-1);
  padding: 6px var(--sp-2);
  border-radius: var(--radius-xs);
  background: color-mix(in srgb, var(--surface-panel) 72%, transparent);
}
.row-asset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-dim);
  font-size: 11.5px;
}
.row-asset .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-state {
  flex: 0 0 auto;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-arrow {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  opacity: 0.5;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
.row:hover .row-arrow,
.row.active .row-arrow {
  opacity: 0.9;
  transform: translateX(2px) rotate(-45deg);
}

/* signal-led card: headline = what happened -> to whom; type demoted to a tag */
.row-headline-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}
.row-headline {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  margin-top: 3px;
}
.row-meta-text {
  flex: 1;
  min-width: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-tag {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* summary tiles: posture at a glance, sticky above the queue */
.queue-tiles {
  position: sticky;
  top: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-app);
  border-bottom: 1px solid var(--border);
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-panel) 60%, transparent);
  border-left: 3px solid var(--state, var(--border-strong));
}
.tile-value {
  color: var(--text);
  font-size: 17px;
  font-weight: 680;
  font-family: var(--mono);
  line-height: 1.1;
}
.tile-label {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ detail */

.detail {
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-4) var(--sp-6);
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-color: var(--border-strong) transparent;
}

/* detail status screens (empty / loading / not-found) */
.detail-status {
  padding: 28px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.detail-empty {
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 8vh 16px;
}
.detail-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}
.detail-empty-mark {
  width: 34px;
  height: 34px;
  color: var(--accent);
}
.detail-loading {
  flex-direction: row;
  align-items: center;
  color: var(--text-muted);
}
.detail-not-found {
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-top: 6vh;
}
.detail-status-title {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
}
.detail-status-copy {
  margin: 0;
  max-width: 42ch;
  color: var(--text-muted);
  font-size: 14px;
}

/* detail header */
.detail-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border: 1px solid var(--border-structural);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 92% -20%, color-mix(in srgb, var(--sev, var(--sev-info)) 7%, transparent), transparent 44%),
    var(--surface-panel);
}
.detail-head-top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.detail-head-top .eyebrow {
  margin: 0;
}
.detail-title-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.detail-shield {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--sev, var(--sev-info));
  background: color-mix(in srgb, var(--sev, var(--sev-info)) 12%, var(--surface-interactive));
}
.detail-shield-mark {
  width: 28px;
  height: 28px;
}
.detail-identity {
  min-width: 0;
}
.detail-title {
  font-size: clamp(21px, 2vw, 28px);
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
  min-width: 0;
  word-break: break-word;
}
.detail-kind {
  margin: var(--sp-1) 0 0;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.4;
}
.detail-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}
.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  min-height: 32px;
  padding: 6px var(--sp-2);
  border-radius: var(--radius-xs);
  color: var(--text-dim);
  background: var(--surface-interactive);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.25;
}
.detail-meta-time,
.detail-meta-source,
.detail-meta-id,
.detail-meta-host,
.detail-meta-user {
  max-width: 100%;
}
.detail-meta-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-report-action {
  color: var(--accent);
  font-family: var(--font);
  text-decoration: none;
  transition: background 0.14s ease, color 0.14s ease;
}
.detail-report-action:hover {
  color: var(--accent-hover);
  background: var(--surface-hover);
}
.detail-report-action:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* shared inline icons */
.ui-icon {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  color: inherit;
  overflow: visible;
}
.icon-clock,
.icon-host,
.icon-user-key,
.icon-source-target,
.icon-report,
.icon-repeat,
.icon-error,
.icon-search {
  stroke-width: 1.7;
}
.icon-error {
  color: var(--danger);
}
.icon-search {
  color: var(--text-muted);
}
.detail-meta-item .ui-icon,
.row-time .ui-icon,
.row-asset .ui-icon {
  color: var(--text-muted);
}

/* badges and neutral state vocabulary */
.sev-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: max-content;
  border-radius: 999px;
  color: var(--sev, var(--sev-info));
  background: color-mix(in srgb, var(--sev, var(--sev-info)) 14%, transparent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.sev-badge::before {
  content: "";
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--sev-shape, var(--icon-sev-info)) center / contain no-repeat;
  mask: var(--sev-shape, var(--icon-sev-info)) center / contain no-repeat;
}
.sev-badge-compact {
  min-height: 22px;
  padding: 0 var(--sp-2);
}
.sev-badge-prominent {
  min-height: 28px;
  padding: 0 var(--sp-3);
  font-size: 11px;
}
.state-chip,
.taxonomy-chip,
.confidence-chip {
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  padding: 3px var(--sp-2);
  border-radius: 999px;
  color: var(--text-dim);
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.025em;
  line-height: 1.2;
  text-transform: capitalize;
  white-space: nowrap;
}
.detail-state {
  min-height: 28px;
  padding-inline: var(--sp-3);
}
.taxonomy-chip {
  min-height: 28px;
  padding-inline: var(--sp-3);
  text-transform: none;
}
.confidence-chip {
  color: var(--accent);
  background: var(--accent-soft);
  font-variant-numeric: tabular-nums;
  text-transform: none;
}
.taxonomy-chip:focus-visible,
.confidence-chip:focus-visible,
.state-chip:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* detail sections / cards */
.detail-section {
  margin-top: 16px;
}
.detail-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
}
.section-title {
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin: 0 0 9px;
}
.prose {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* recommended action — accent-framed card */
.action-card {
  background: linear-gradient(
    180deg,
    var(--accent-soft),
    transparent 60%
  ),
  var(--bg-1);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.action-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}
.action-title-row .section-title {
  margin: 0;
}
.action-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  background: var(--accent);
  -webkit-mask: var(--icon-shield-check) center / contain no-repeat;
  mask: var(--icon-shield-check) center / contain no-repeat;
}

/* evidence */
.evidence {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(84px, auto) 1fr;
  gap: 6px 14px;
  font-size: 13px;
}
.evidence dt {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-word;
}
.evidence dd {
  margin: 0;
  word-break: break-word;
  white-space: pre-wrap;
  color: var(--text);
}

/* --------------------------------------------------------------- storyline */

.storyline .timeline {
  margin-top: 4px;
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.tl-item {
  display: flex;
  gap: 12px;
  padding: 9px 8px 9px 4px;
  position: relative;
  border-radius: var(--radius-sm);
}
.tl-item::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 26px;
  bottom: -9px;
  width: 1.5px;
  background: var(--border-strong);
}
.tl-item:last-child::before {
  display: none;
}
.tl-glyph {
  width: 15px;
  height: 15px;
  margin-top: 3px;
  z-index: 1;
}
.tl-body {
  min-width: 0;
  flex: 1;
}
.tl-title {
  font-size: 13.5px;
  font-weight: 550;
  word-break: break-word;
}
.tl-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}
.tl-severity {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--sev, var(--sev-info));
}
.tl-arrow {
  align-self: center;
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.14s ease;
}
.tl-clickable {
  cursor: pointer;
  transition: background 0.14s ease;
}
.tl-clickable:hover {
  background: var(--bg-2);
}
.tl-clickable:hover .tl-arrow {
  opacity: 0.7;
}
.tl-item.current {
  background: var(--bg-2);
}
.tl-item.current .tl-title {
  font-weight: 680;
  color: var(--text);
}

/* -------------------------------------------------------------------- chat */

.chat {
  border-top: 1px solid var(--border-structural);
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 0 0 auto;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.chat-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  position: relative;
}
.chat-avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  background: var(--accent);
  -webkit-mask: var(--icon-spark) center / contain no-repeat;
  mask: var(--icon-spark) center / contain no-repeat;
}
.chat-head-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
  margin-right: auto;
}
.chat-title {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}
.chat-subtitle {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-muted);
}
.chat-empty {
  margin: 0;
  padding: 16px;
  color: var(--text-muted);
  font-size: 13.5px;
}
.messages {
  padding: 12px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 42vh;
}

/* intro hint */
.chat-hint {
  display: flex;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  border-radius: var(--radius-sm);
}
.chat-hint-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 1px;
  background: var(--accent);
  -webkit-mask: var(--icon-info) center / contain no-repeat;
  mask: var(--icon-info) center / contain no-repeat;
}
.chat-hint strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 2px;
}
.chat-hint p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* bubbles */
.bubble {
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bubble-author {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0 2px;
}
.bubble-content {
  padding: 10px 13px;
  border-radius: var(--radius);
  font-size: 14px;
  word-break: break-word;
  white-space: pre-wrap;
}
.bubble.user {
  align-self: flex-end;
  align-items: flex-end;
}
.bubble.user .bubble-content {
  background: var(--accent);
  color: var(--accent-contrast);
  border-bottom-right-radius: var(--radius-xs);
}
.bubble.assistant {
  align-self: flex-start;
}
.bubble.assistant .bubble-content {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: var(--radius-xs);
  white-space: normal;
}
.bubble.assistant.error .bubble-content {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}
.bubble.streaming .bubble-content::after {
  content: "▍";
  color: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  to {
    visibility: hidden;
  }
}

/* rendered-markdown formatting inside assistant bubbles */
.bubble-content p {
  margin: 0 0 8px;
}
.bubble-content p:last-child,
.bubble-content ul:last-child,
.bubble-content ol:last-child {
  margin-bottom: 0;
}
.bubble-content ul,
.bubble-content ol {
  margin: 4px 0 8px;
  padding-left: 20px;
}
.bubble-content li {
  margin: 2px 0;
}
.bubble-content strong {
  font-weight: 680;
}
.bubble-content code {
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  font-family: var(--mono);
}
.bubble-content pre {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 9px 11px;
  border-radius: var(--radius-xs);
  overflow-x: auto;
  margin: 6px 0;
}
.bubble-content pre code {
  background: none;
  padding: 0;
}
.bubble-content h3,
.bubble-content h4,
.bubble-content h5,
.bubble-content h6 {
  margin: 8px 0 4px;
  font-size: 13.5px;
  font-weight: 680;
}
.bubble-content .table-wrap {
  overflow-x: auto;
  margin: 6px 0;
  max-width: 100%;
}
.bubble-content table {
  border-collapse: collapse;
  font-size: 13px;
  width: max-content;
  min-width: 100%;
}
.bubble-content th,
.bubble-content td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
  vertical-align: top;
}
.bubble-content th {
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  font-weight: 680;
  white-space: nowrap;
}

/* chat status ("investigating…") */
.chat-status {
  padding: 2px 16px 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-style: italic;
}

/* composer */
.composer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--bg-1);
}
.composer-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 15px;
  resize: none;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 13px;
  line-height: 1.4;
  max-height: 160px;
  min-height: var(--tap);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.chat-input:focus {
  outline: none;
  border-color: var(--border-strong);
}
.chat-input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--border-strong);
  box-shadow: none;
}
.composer .send {
  align-self: flex-end;
  min-width: 68px;
  min-height: var(--tap);
}
.composer-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
  font-size: 11px;
  color: var(--text-muted);
}
.composer-note span[aria-hidden] {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  background: var(--text-muted);
  -webkit-mask: var(--icon-lock) center / contain no-repeat;
  mask: var(--icon-lock) center / contain no-repeat;
}

/* --------------------------------------------------------------- desktop */

@media (min-width: 900px) {
  .layout {
    flex-direction: row;
    height: calc(100vh - var(--topbar-h));
  }
  .list-pane {
    flex: 0 0 360px;
    width: 360px;
    border-bottom: none;
    border-right: 1px solid var(--border-structural);
    min-height: 0;
  }
  /* Desktop always shows both panes regardless of selection. */
  .layout.has-selection .list-pane {
    display: flex;
  }
  .detail-pane {
    display: flex;
    flex: 1;
    min-width: 0;
    height: 100%;
  }
  .btn.back {
    display: none;
  }
  .detail {
    flex: 1;
  }
  .messages {
    max-height: none;
    flex: 1;
  }
  .chat {
    flex: 0 0 auto;
    max-height: 52vh;
  }
  .detail-empty,
  .detail-not-found {
    padding-top: 12vh;
  }
}

@media (min-width: 1200px) {
  .detail {
    padding: 22px 28px 26px;
  }
}

/* --------------------------------------------- findings / peers tables */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.4;
}
.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10.5px;
  padding: 4px 12px 8px 0;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-dim);
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table .mono { font-family: var(--mono); color: var(--text); font-size: 12px; }
.data-table .cell-signal { color: var(--text); font-weight: 600; white-space: nowrap; }
.data-table .cell-flow { line-height: 1.7; }
.data-table .flow-arrow { color: var(--text-muted); padding: 0 2px; }
.data-table .cell-num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .cell-status { color: var(--text-muted); font-family: var(--mono); text-transform: lowercase; font-size: 12px; }
.data-table .endpoint-fqdn { display: block; color: var(--text-muted); font-family: var(--mono); font-size: 11px; margin-top: 1px; }

.sev-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--sev, var(--text-dim));
  background: color-mix(in srgb, var(--sev, var(--text-muted)) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--sev, var(--text-muted)) 40%, transparent);
}

/* Operational summary — elevated executive overview */
.summary-hero {
  position: relative;
  overflow: hidden;
  padding: var(--sp-6);
  border: 1px solid var(--border-structural);
  border-left: 3px solid var(--sev, var(--sev-info));
  border-radius: var(--radius);
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--sev, var(--sev-info)) 7%, transparent), transparent 48%),
    var(--surface-elevated);
  box-shadow: var(--shadow-elevated);
}
.summary-eyebrow {
  margin: 0 0 var(--sp-2);
  color: color-mix(in srgb, var(--sev, var(--sev-info)) 72%, var(--text-muted));
}
.summary-headline {
  max-width: 54ch;
  margin: 0;
  color: var(--text);
  font-size: clamp(19px, 2vw, 22px);
  font-weight: 640;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.summary-supporting {
  max-width: 72ch;
  margin: var(--sp-2) 0 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.55;
}
.summary-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}
.summary-fact {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-1);
  min-width: 0;
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-interactive) 76%, transparent);
}
.summary-fact-findings {
  flex-grow: 0;
  min-width: 150px;
}
.summary-fact-signal {
  flex-grow: 2;
}
.summary-fact-value {
  order: 1;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.summary-fact-signal .summary-fact-value {
  font-family: var(--mono);
}
.summary-fact-findings .summary-fact-value {
  color: var(--sev, var(--text));
  font-family: var(--mono);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.summary-fact-label {
  order: 2;
  color: var(--text-muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* Findings and external endpoints — operational table language */
.findings-table,
.peers-table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-color: var(--border-strong) transparent;
}
.findings-table th,
.findings-table td,
.peers-table th,
.peers-table td {
  padding-inline: var(--sp-3);
}
.findings-table th:first-child,
.findings-table td:first-child,
.peers-table th:first-child,
.peers-table td:first-child {
  padding-left: var(--sp-3);
}
.findings-table th:last-child,
.findings-table td:last-child,
.peers-table th:last-child,
.peers-table td:last-child {
  padding-right: var(--sp-3);
}
.table-heading,
.peers-table th {
  height: var(--sp-7);
  padding-top: 0;
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.table-heading.cell-num {
  text-align: right;
}
.finding-row,
.peers-table tbody tr {
  height: 52px;
}
.finding-row > td,
.peers-table tbody td {
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.finding-row > td:first-child {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--sev, var(--sev-info)) 62%, transparent) 0 3px,
    transparent 3px
  );
}
.finding-primary {
  min-width: 180px;
  color: var(--text);
}
.finding-signal {
  display: block;
  color: var(--text);
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}
.finding-flow {
  min-width: 250px;
  white-space: nowrap;
}
.st-source,
.st-target {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  max-width: 18ch;
  vertical-align: middle;
}
.st-source .ui-icon,
.st-target .ui-icon {
  color: var(--text-muted);
}
.st-source .mono,
.st-target .mono {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-inline: var(--sp-1);
  color: var(--text-muted);
  vertical-align: middle;
}
.cell-severity {
  white-space: nowrap;
}
.cell-severity .sev-badge {
  min-height: 24px;
  padding-inline: var(--sp-2);
}
.cell-cycles {
  min-width: 112px;
  text-align: right;
  white-space: nowrap;
}
.cycles-value {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-1);
  color: var(--text-dim);
}
.cycles-value .ui-icon {
  color: var(--text-muted);
}
.cycle-count {
  color: var(--text);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.persistent-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: var(--sp-1);
  padding-inline: var(--sp-1);
  border-radius: var(--radius-xs);
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}
.finding-state {
  justify-content: center;
}
.cell-endpoint {
  min-width: 170px;
  white-space: nowrap;
}
.cell-endpoint > .mono {
  display: block;
  line-height: 1.35;
}

/* ------------------------------------------------ chat starter chips */

.chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0;
}
.starter-chip {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 15px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.starter-chip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

/* Persistent one-tap actions above the composer (Short Story, Simplify). */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 8px;
}
.quick-action {
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.quick-action:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

/* --------------------------------------------------- reduced motion */

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

/* Version footer — deploy-verification badge, unobtrusive at bottom-left. */
#app-version-footer {
  position: fixed;
  left: 10px;
  bottom: 6px;
  margin: 0;
  font: 400 10px/1.4 var(--mono);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  opacity: 0.55;
  pointer-events: none;
  user-select: text;
  z-index: 40;
}

/* ------------------------------------------------- BYOA connect dialog
   Each operator connects their own AI subscription. Modal because the flow is
   a hand-carried code paste — leaving the queue interactive behind it invites
   the operator to wander off mid-exchange and lose the code. */
.ai-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 9, 8, 0.72);
}
.ai-dialog {
  width: 100%;
  max-width: 460px;
  background: var(--surface-panel);
  border: 1px solid var(--border-structural);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ai-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ai-dialog-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.ai-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ai-dialog-copy,
.ai-provider-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-dim);
}
.ai-provider {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.ai-dialog-input {
  font-family: var(--mono);
  font-size: 13px;
  width: 100%;
  padding: 10px 12px;
  min-height: var(--tap);
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border-structural);
  border-radius: var(--radius-sm);
}
.ai-dialog-input:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}
.ai-dialog-status {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-dim);
}
.ai-dialog-status.error {
  color: #f0a58c;
}
/* Connected vs not is a state worth reading at a glance from the topbar. */
.topbar .btn.ai-off {
  border-color: var(--border-strong);
  color: var(--text-dim);
}
.topbar .btn.ai-on {
  border-color: var(--accent-soft);
  color: var(--text);
}
.ai-dialog-select {
  font-family: var(--font);
  font-size: 13px;
  width: 100%;
  padding: 9px 12px;
  min-height: var(--tap);
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border-structural);
  border-radius: var(--radius-sm);
}
.ai-provider-hint {
  margin: -2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
