/* TicketIQ — dark mission-control theme. Zero external resources.
   White-label: every accent-derived color flows from the --accent* variables
   below; common.js recomputes and overrides them at runtime via setProperty. */

:root {
  /* Height of the shared top bar. Pages that want to fill the rest of the
     viewport subtract this; it was previously guessed at twice, in two
     different places, with two different numbers. */
  --topnav-h: 59px;
  color-scheme: dark;
  --bg: #0a0e1a;
  --bg-2: #0d1424;
  --panel: #111827;
  --panel-2: #0d1526;
  --border: #1e2a44;
  --border-soft: #17203a;
  --text: #e6edf7;
  --muted: #8494ab;
  --accent: #22d3ee;
  --accent-dim: rgba(34, 211, 238, 0.14);
  --accent-glow: rgba(34, 211, 238, 0.28);
  --accent-border: rgba(34, 211, 238, 0.4);
  --accent-faint: rgba(34, 211, 238, 0.06);
  --accent-hi: #2adbf5;   /* lighter accent — gradient tops */
  --accent-mid: #0fb5d4;  /* darker accent — gradient bottoms */
  --accent-deep: #0e7490; /* deepest accent — bar/gauge tails */
  --accent-ink: #04222b;  /* text on accent-filled surfaces */
  --ok: #34d399;
  --warn: #fbbf24;
  --crit: #f87171;
  --dup: #a78bfa;
  --info: #60a5fa;
  --bg-glow: #101b36;
  --nav-bg: rgba(10, 14, 26, 0.88);
  --scroll-thumb: #223052;
  --hover-bg: rgba(255, 255, 255, 0.04);
  --chip-border: rgba(148, 163, 184, 0.22);
  --badge-bg: rgba(230, 237, 247, 0.10);
  --badge-fg: rgba(230, 237, 247, 0.70);
  --chip-bg: rgba(148, 163, 184, 0.06);
  --chip-text: #cbd5e1;
  --input-bg: #0b1120;
  --input-placeholder: #8494ab;   /* == --muted; keeps the current dark render */
  --input-hover-border: #29395f;
  --track-bg: #141e38;
  --panel-hover-border: #253355;
  --divider: #1c2947;
  --dup-ink: #c4b5fd;
  --grid-line: rgba(148, 163, 184, 0.05);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Light theme: same variable contract, brighter values. The effective theme
   is chosen pre-paint by an inline <head> snippet + common.js (light/dark/system). */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f8;
  --bg-2: #e6ecf5;
  --panel: #ffffff;
  --panel-2: #f4f7fc;
  --border: #d5ddea;
  --border-soft: #e2e8f2;
  --text: #182338;
  --muted: #5a6a84;
  --ok: #059669;
  --warn: #b45309;
  --crit: #dc2626;
  --dup: #7c3aed;
  --info: #2563eb;
  --bg-glow: #dce6f5;
  --nav-bg: rgba(255, 255, 255, 0.86);
  --scroll-thumb: #c2cddf;
  --hover-bg: rgba(15, 23, 42, 0.05);
  --chip-border: rgba(90, 106, 132, 0.28);
  --badge-bg: rgba(15, 23, 42, 0.07);
  --badge-fg: rgba(15, 23, 42, 0.60);
  --chip-bg: rgba(90, 106, 132, 0.07);
  --chip-text: #46566e;
  --input-bg: #fbfcfe;
  --input-placeholder: #5a6a84;   /* == light --muted, readable on near-white */
  --input-hover-border: #b3c0d6;
  --track-bg: #e4eaf4;
  --panel-hover-border: #b9c6db;
  --divider: #e2e8f2;
  --dup-ink: #6d28d9;
  --grid-line: rgba(90, 106, 132, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: radial-gradient(1100px 700px at 18% -8%, var(--bg-glow) 0%, var(--bg) 55%) fixed, var(--bg);
  min-height: 100vh;
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- top nav ---------- */
.topnav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 24px;
  height: 58px; display: flex; align-items: center; gap: 28px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 16px; letter-spacing: 0.04em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
/* The mark is logo.svg painted through a CSS mask rather than an <img>: an
   <img> cannot inherit `currentColor`, and this instance's accent is set at
   runtime for white-labelling. Mask keeps one SVG on disk and lets every
   placement take its own colour and size. */
.brand-mark {
  width: 18px; height: 18px; flex: none;
  background: var(--accent);
  -webkit-mask: url("/logo.svg") center / contain no-repeat;
  mask: url("/logo.svg") center / contain no-repeat;
  transition: background 0.25s;
}
.brand-accent { color: var(--accent); text-shadow: 0 0 14px var(--accent-glow); }
.brand-text { color: var(--text); }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-link {
  color: var(--muted); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  padding: 6px 12px; border-radius: 6px; position: relative;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text); text-decoration: none; background: var(--hover-bg); }
.nav-link.active { color: var(--accent); }
.nav-link.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -14px;
  height: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow);
}
.nav-logout { margin-left: auto; }
.health { display: inline-flex; align-items: center; gap: 8px; }
.health-label { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #3a4a6e; flex: none;
}
.dot-ok { background: var(--ok); box-shadow: 0 0 8px rgba(52, 211, 153, 0.8); animation: pulse 2.4s ease-in-out infinite; }
.dot-warn { background: var(--warn); box-shadow: 0 0 8px rgba(251, 191, 36, 0.7); }
.dot-crit { background: var(--crit); box-shadow: 0 0 8px rgba(248, 113, 113, 0.7); }
@keyframes pulse { 50% { opacity: 0.55; } }

/* ---------- layout ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 26px 24px 64px; }
.page-head { display: flex; align-items: baseline; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.page-title {
  margin: 0; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.22em; color: var(--accent);
  text-shadow: 0 0 16px var(--accent-glow);
}
.grid-main { display: grid; grid-template-columns: minmax(360px, 5fr) 7fr; gap: 18px; align-items: start; }
.grid-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 10px 30px rgba(0, 0, 0, 0.25);
  min-width: 0;
  transition: border-color 0.2s;
}
.panel:hover { border-color: var(--panel-hover-border); }
.panel-title {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted);
}
.panel-title::before {
  content: ""; width: 3px; height: 11px; border-radius: 2px; flex: none;
  background: var(--accent); box-shadow: 0 0 8px var(--accent-glow);
}
.panel-subtitle {
  margin: 18px 0 8px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted);
}
.panel-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.empty { color: var(--muted); font-size: 13px; padding: 10px 2px; }
.empty.pulse { animation: pulse 1.2s ease-in-out infinite; color: var(--accent); }
.error-line { color: var(--crit); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- stats ---------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 18px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.stat-card:hover {
  border-color: var(--accent-border); transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
}
.stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.stat-value { font-family: var(--mono); font-size: 27px; font-weight: 600; line-height: 1; }
.stat-value.accent { color: var(--accent); text-shadow: 0 0 18px var(--accent-glow); }
.stat-value.ok { color: var(--ok); }
.stat-value.dup { color: var(--dup); }
.stat-value.warn { color: var(--warn); }
.status-strip { display: inline-flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.strip-item { display: inline-flex; align-items: center; gap: 6px; }
.strip-count { font-size: 12px; color: var(--text); }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 12px; min-width: 0; }
/* Sentence case, at reading size. Uppercase micro-labels with wide tracking
   read as a dashboard from 2016; ADP and every current console label fields the
   way a form is labelled on paper. */
.field-label {
  display: block; font-size: 13px; font-weight: 500;
  letter-spacing: 0; text-transform: none;
  color: var(--text); margin-bottom: 6px;
}
/* Input metrics match the ADP console: 40px tall, 10px radius, 14px text.
   The height matters more than it looks — a 40px control next to a 36px button
   is the difference between a form that reads as one row and one that reads as
   two. */
.input {
  width: 100%; font: inherit; font-size: 14px; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 0 10px; height: 40px; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input, select[multiple].input { height: auto; padding: 9px 10px; }
.input::placeholder { color: var(--input-placeholder); opacity: 0.8; }
.input:hover:not(:focus) { border-color: var(--input-hover-border); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
textarea.input { resize: vertical; min-height: 64px; }
select.input { cursor: pointer; }

.btn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 8px; padding: 9px 16px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--text);
  transition: filter 0.15s, box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
  letter-spacing: 0.02em;
}
.btn:disabled { opacity: 0.5; cursor: wait; }
/* Flat, not a gradient with a glow. On a light surface the glow reads as a
   focus ring that never turns off, and the vertical gradient is the single
   strongest "old dashboard" tell in the whole console. */
.btn-primary {
  background: var(--accent-mid);
  border-color: transparent; color: var(--accent-ink);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-deep); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.btn-danger { background: transparent; color: var(--crit); border-color: rgba(248, 113, 113, 0.4); }
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.1); border-color: var(--crit); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-wide { width: 100%; }
.btn:focus-visible, .nav-link:focus-visible, .brand:focus-visible,
.theme-toggle:focus-visible, .routing-del:focus-visible, .input:focus-visible,
.ticket-row:focus-visible, .flow-node:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
}
.pill-new { color: var(--info); background: rgba(96, 165, 250, 0.12); border-color: rgba(96, 165, 250, 0.35); }
.pill-open { color: var(--accent); background: var(--accent-dim); border-color: var(--accent-border); }
.pill-in_progress { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.35); }
.pill-resolved { color: var(--ok); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.35); }
.pill-closed { color: var(--muted); background: rgba(132, 148, 171, 0.1); border-color: rgba(132, 148, 171, 0.3); }
.pill-duplicate { color: var(--dup); background: rgba(167, 139, 250, 0.12); border-color: rgba(167, 139, 250, 0.4); }
.pill-p1 { color: var(--crit); background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.45); }
.pill-p2 { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.4); }
.pill-p3 { color: var(--info); background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.35); }
.pill-p4 { color: var(--muted); background: rgba(132, 148, 171, 0.1); border-color: rgba(132, 148, 171, 0.3); }
.pill-type { color: var(--accent); background: transparent; border-color: var(--accent-border); }
.pill-src-connected { color: var(--ok); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.4); }
.pill-src-error { color: var(--crit); background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.45); }
.pill-src-new { color: var(--muted); background: rgba(132, 148, 171, 0.1); border-color: rgba(132, 148, 171, 0.3); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.table td {
  padding: 9px 10px; font-size: 13px;
  border-bottom: 1px solid var(--border-soft); vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
tr.ticket-row { cursor: pointer; transition: background 0.12s; }
tr.ticket-row:hover { background: var(--accent-faint); }
.cell-id { color: var(--accent); font-size: 12px; white-space: nowrap; }
.cell-title, .cell-team, .cell-cat { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- charts ---------- */
.chart { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 118px 1fr 32px; align-items: center; gap: 10px; }
.bar-label { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 8px; background: var(--track-bg); border-radius: 999px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.bar-count { font-size: 12px; color: var(--text); text-align: right; }

/* ---------- pipeline traces ---------- */
.pipe-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.pipe-id { font-size: 16px; font-weight: 700; color: var(--accent); text-shadow: 0 0 14px var(--accent-glow); }
.pipe-run { font-size: 11px; color: var(--muted); margin-left: auto; }
.traces { display: flex; flex-direction: column; gap: 8px; }
.trace-row {
  background: var(--panel-2); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px;
}
.trace-row.trace-failed { border-left-color: var(--crit); }
.trace-head { display: flex; align-items: center; gap: 10px; }
.trace-agent {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.trace-failed .trace-agent { color: var(--crit); }
.trace-action {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px;
}
.trace-ms { margin-left: auto; font-size: 11px; color: var(--muted); }
.trace-summary { margin-top: 6px; font-size: 12.5px; color: var(--text); line-height: 1.45; }
.trace-conf { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.confbar { flex: 1; height: 5px; background: var(--track-bg); border-radius: 999px; overflow: hidden; }
.confbar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 6px var(--accent-glow);
}
.conf-pct { font-size: 11px; color: var(--muted); width: 34px; text-align: right; }

.reveal { opacity: 0; animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }

.dup-banner {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: rgba(167, 139, 250, 0.1); border: 1px solid rgba(167, 139, 250, 0.45);
  color: var(--dup-ink); border-radius: 8px; padding: 10px 13px; margin: 10px 0;
  font-size: 13px;
}
.dup-link { color: var(--dup); font-weight: 700; }

.reco-list { display: flex; flex-direction: column; gap: 8px; }
.reco-item { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.reco-head { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.reco-ref { font-size: 11px; color: var(--dup); flex: none; }
.reco-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reco-score { margin-left: auto; font-size: 11px; color: var(--accent); flex: none; }
.reco-res { margin-top: 5px; font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ---------- filter bar ---------- */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.filter-bar select.input { width: 180px; flex: none; }
.filter-bar .filter-q { flex: 1; }
#result-count { font-size: 11px; flex: none; }

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
  width: min(500px, 94vw); overflow-y: auto;
  background: var(--bg-2); border-left: 1px solid var(--border);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.55);
  padding: 22px 24px 40px;
  animation: slide-in 0.25s cubic-bezier(0.2, 0.7, 0.3, 1);
}
@keyframes slide-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drawer-id { font-size: 16px; font-weight: 700; color: var(--accent); text-shadow: 0 0 14px var(--accent-glow); }
.drawer-close { margin-left: auto; }
.drawer-title { margin: 14px 0 6px; font-size: 17px; line-height: 1.35; }
.drawer-desc { margin: 6px 0 14px; font-size: 13px; color: var(--muted); line-height: 1.55; white-space: pre-wrap; }
.meta-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px;
  margin: 14px 0; padding: 14px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px;
}
.meta-cell dt { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); margin: 0 0 3px; }
.meta-cell dd { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.detail-traces { display: flex; flex-direction: column; gap: 8px; }
.run-head { font-size: 11px; color: var(--muted); margin-top: 6px; }
.update-row {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
}

/* ---------- admin ---------- */
.admin-msg {
  flex: 1; min-height: 20px; font-size: 13px; font-family: var(--mono);
  color: var(--muted); overflow-wrap: anywhere;
}
.admin-msg.ok { color: var(--ok); }
.admin-msg.err { color: var(--crit); }
.sources-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 18px; }
.source-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 13px 15px; }
.source-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.source-name { font-weight: 700; font-size: 14px; margin-right: auto; overflow: hidden; text-overflow: ellipsis; }
.source-meta { font-size: 12px; color: var(--muted); }
.source-meta .mono { color: var(--text); }
.source-error {
  margin-top: 8px; font-size: 11.5px; color: var(--crit); font-family: var(--mono);
  background: rgba(248, 113, 113, 0.07); border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere;
}
.source-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.connect-form { border-top: 1px solid var(--border); padding-top: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.mail-status-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.mail-state { font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.mail-state.on { color: var(--ok); }
.mail-state.off { color: var(--muted); }
.mail-count { color: var(--accent); font-size: 13px; }
.settings-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.settings-row .field { margin-bottom: 0; width: 200px; }
.admin-stack { display: flex; flex-direction: column; gap: 18px; }

/* ---------- toasts ---------- */
#toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; align-items: flex-end; }
.toast {
  background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--ok);
  border-radius: 8px; padding: 10px 15px; margin-top: 8px; font-size: 13px;
  max-width: 380px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: rise 0.3s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.toast-err { border-left-color: var(--crit); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity 0.3s, transform 0.3s; }

/* ---------- branding panel ---------- */
.brand-row {
  display: grid; grid-template-columns: 1.1fr 1.6fr auto auto;
  gap: 14px; align-items: end;
}
.brand-row .field { margin-bottom: 0; min-width: 0; }
.accent-inputs { display: flex; align-items: center; gap: 8px; }
.accent-swatch {
  width: 40px; height: 37px; padding: 3px; flex: none; cursor: pointer;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.accent-swatch:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.accent-hex { width: 104px; }
.brand-hint { margin: 12px 0 0; font-size: 12px; }

/* ---------- background jobs ---------- */
.jobs-list { display: flex; flex-direction: column; gap: 12px; }
.job-row {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
}
.job-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 9px; }
.job-label {
  font-weight: 600; font-size: 13.5px; margin-right: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.job-id { font-size: 11px; }
.pill-job-queued { color: var(--info); background: rgba(96, 165, 250, 0.1); border-color: rgba(96, 165, 250, 0.35); }
.pill-job-running { color: var(--accent); background: var(--accent-dim); border-color: var(--accent-border); animation: pulse 1.8s ease-in-out infinite; }
.pill-job-done { color: var(--ok); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.35); }
.pill-job-failed { color: var(--crit); background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.45); }
.pill-job-cancelled { color: var(--muted); background: rgba(132, 148, 171, 0.1); border-color: rgba(132, 148, 171, 0.3); }
.job-bar { height: 8px; background: var(--track-bg); border-radius: 999px; overflow: hidden; position: relative; }
.job-bar-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.job-bar.indeterminate .job-bar-fill {
  width: 38%; transition: none;
  animation: job-slide 1.4s ease-in-out infinite;
}
@keyframes job-slide {
  from { transform: translateX(-110%); }
  to { transform: translateX(300%); }
}
.job-meta {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  margin-top: 8px; font-size: 11.5px; color: var(--muted);
}
.job-progress { color: var(--text); }
.job-message { margin-top: 6px; font-size: 12px; }
.job-error {
  margin-top: 8px; font-size: 11.5px; color: var(--crit); font-family: var(--mono);
  background: rgba(248, 113, 113, 0.07); border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 6px; padding: 6px 8px; overflow-wrap: anywhere;
}

/* ---------- scale metrics ---------- */
.scale-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.scale-hero { display: flex; flex-direction: column; gap: 6px; margin-right: auto; }
.scale-points {
  font-family: var(--mono); font-size: 30px; font-weight: 600; line-height: 1;
  color: var(--accent); text-shadow: 0 0 18px var(--accent-glow);
}
.bench-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.bench-stat {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
.bench-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.bench-stat-value { font-family: var(--mono); font-size: 18px; color: var(--accent); }
.bench-meta { margin-top: 10px; font-size: 11.5px; }

/* ---------- SLA chips ---------- */
.cell-status { white-space: nowrap; }
.sla-chip {
  display: inline-flex; align-items: center; margin-left: 8px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 999px; border: 1px solid transparent;
  white-space: nowrap; vertical-align: middle;
}
.sla-ok { color: var(--muted); background: rgba(132, 148, 171, 0.08); border-color: rgba(132, 148, 171, 0.3); }
.sla-warn { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.4); }
.sla-crit { color: var(--crit); background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.45); }

/* ---------- platform strip ---------- */
.platform-strip {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 18px; margin-bottom: 18px;
  transition: border-color 0.2s;
}
.platform-strip:hover { border-color: var(--panel-hover-border); }
.plat-item { display: inline-flex; align-items: baseline; gap: 9px; }
.plat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.plat-value { font-family: var(--mono); font-size: 14px; color: var(--text); }
.plat-value.accent { color: var(--accent); text-shadow: 0 0 12px var(--accent-glow); }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .grid-main, .grid-duo { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .nav-inner { gap: 14px; }
  .brand-row { grid-template-columns: 1fr; align-items: stretch; }
  .bench-grid { grid-template-columns: 1fr; }
}

/* ---- insights page ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.page-actions { display: flex; align-items: center; gap: 12px; }
.stats-row-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .stats-row-5 { grid-template-columns: repeat(2, 1fr); } }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.trend { padding-top: 6px; }
.trend-row { display: flex; align-items: flex-end; gap: 4px; min-height: 88px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.trend-bar { width: 100%; max-width: 26px; background: var(--accent); opacity: 0.75; border-radius: 3px 3px 0 0; }
.trend-col:hover .trend-bar { opacity: 1; }
.trend-label { font-size: 9.5px; color: var(--muted); font-family: var(--mono); transform: rotate(-45deg); transform-origin: top left; white-space: nowrap; margin-top: 8px; height: 26px; }
.sla-overdue { color: var(--crit); }
.sla-soon { color: var(--warn); }

/* ---- continuous learning controls ---- */
.input-sm { padding: 4px 8px; font-size: 12px; width: auto; }
.field-inline { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; cursor: pointer; font-size: 12px; }
.field-inline input[type="checkbox"] { accent-color: var(--accent); }
.source-auto { align-items: center; gap: 8px; border-top: 1px solid var(--divider); padding-top: 10px; margin-top: 10px; }
.source-auto .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }

/* ---- table containment: never overflow the panel ---- */
.table { table-layout: fixed; }
.table th, .table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-testid="tickets-table"] th:nth-child(1) { width: 96px; }
[data-testid="tickets-table"] th:nth-child(3) { width: 138px; }
[data-testid="tickets-table"] th:nth-child(4) { width: 186px; }
[data-testid="tickets-table"] th:nth-child(5) { width: 56px; }
[data-testid="tickets-table"] th:nth-child(6) { width: 170px; }
[data-testid="recurring-list"] th:nth-child(1) { width: 58%; }
[data-testid="recurring-list"] th:nth-child(3) { width: 72px; }
[data-testid="sla-risk-list"] th:nth-child(1) { width: 92px; }
[data-testid="sla-risk-list"] th:nth-child(4) { width: 48px; }
[data-testid="sla-risk-list"] th:nth-child(5) { width: 96px; }
.panel { min-width: 0; }
.grid-2 > .panel { overflow: hidden; }


/* ---- theme toggle ---- */
.theme-toggle {
  width: 30px; height: 30px; flex: none;
  background: transparent; border: 1px solid var(--border); border-radius: 7px;
  color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent-border); background: var(--hover-bg); }

/* ---- incident flow graph (category -> team) ---- */
.flow-graph { position: relative; overflow-x: auto; }
.flow-svg { display: block; width: 100%; height: auto; font-family: var(--sans); }
.flow-edge { fill: none; transition: opacity 0.2s, stroke-width 0.2s; }
.flow-svg.has-focus .flow-edge:not(.focus) { opacity: 0.06 !important; }
.flow-svg.has-focus .flow-pulse:not(.focus) { opacity: 0; }
.flow-node { cursor: pointer; }
.flow-node circle {
  stroke-width: 1.5;
  filter: drop-shadow(0 0 6px var(--accent-glow));
}
.flow-svg.has-focus .flow-node:not(.focus) { opacity: 0.25; }
.flow-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.flow-count { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); }
.flow-col-head {
  fill: var(--muted); font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.flow-legend { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.flow-legend .muted { font-size: 11px; }
.legend-swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }

/* ---- routing rules editor ---- */
.routing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.routing-rows { display: flex; flex-direction: column; gap: 8px; }
.routing-row { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) 30px; gap: 8px; align-items: center; }
.routing-row .cat-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routing-row .pill-custom { justify-self: start; }
.routing-del {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1;
}
.routing-del:hover { color: var(--crit); border-color: var(--crit); }
.sla-grid { display: grid; grid-template-columns: repeat(4, minmax(80px, 1fr)); gap: 10px; }
.routing-hint { font-size: 12px; }
@media (max-width: 900px) { .routing-grid { grid-template-columns: 1fr; } }

/* ---- production formatting sweep ---- */
/* Neutral pill for absent priority ("—") */
.pill-none { color: var(--muted); border-color: var(--border); background: transparent; }

/* Numeric table cells right-align + tabular figures for clean columns */
td.num, .num { text-align: right; font-variant-numeric: tabular-nums; }
#collections-table th:nth-child(2), #recurring-list th:nth-child(3) { text-align: right; }

/* Long unbroken tokens (URLs, IDs, stack traces) must wrap, never scroll */
.drawer-title, .drawer-desc, .cell-title, .reco-res, .job-message, .job-error,
.source-error, .admin-msg { overflow-wrap: anywhere; word-break: break-word; }

/* Source card name can ellipsis only with a width bound */
.source-name { max-width: 100%; white-space: nowrap; }

/* Toasts: cap width, wrap long errors */
.toast { max-width: min(90vw, 420px); overflow-wrap: anywhere; }

/* Load-more control */
.load-more-row { display: flex; justify-content: center; margin-top: 14px; }
.load-more-row button[hidden] { display: none; }

/* SLA chip must not force the status column to overflow */
.cell-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sla-chip { white-space: nowrap; }

/* ---- responsive: tablet & phone ---- */
@media (max-width: 760px) {
  .nav-inner { gap: 12px; padding: 0 14px; height: auto; min-height: 52px;
    flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; gap: 2px;
    -webkit-overflow-scrolling: touch; }
  .nav-link { padding: 6px 8px; letter-spacing: 0.06em; white-space: nowrap; }
  .nav-link.active::after { bottom: -8px; }
  .health { order: 2; }
  .wrap { padding: 16px 12px 48px; }
  .grid-main, .grid-duo { grid-template-columns: 1fr; }
  .stats-row, .stats-row-5 { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar select.input, .filter-bar .input { width: 100%; flex: 1 1 100%; }
  .sla-grid { grid-template-columns: repeat(2, 1fr); }
  .routing-row { grid-template-columns: 1fr 1fr 28px; }
  /* Detail drawer becomes full-width on phones instead of a cramped side panel */
  .drawer { position: fixed; inset: 0; width: 100%; max-width: 100%; }
}
@media (max-width: 420px) {
  .stats-row, .stats-row-5 { grid-template-columns: 1fr; }
}

/* ---- integrations panel ---- */
.integrations-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.integration-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: var(--panel-2); display: flex; flex-direction: column; gap: 6px; }
.integration-head { display: flex; align-items: center; gap: 8px; }
.integration-name { font-weight: 700; font-size: 14px; margin-right: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.integration-meta { font-size: 11.5px; overflow-wrap: anywhere; }
.integration-actions { display: flex; gap: 8px; margin-top: 4px; }
.integ-events { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.integ-events .check { display: flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--text); cursor: pointer; }
.integ-events .check input { accent-color: var(--accent); }
.api-token-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 4px; }
.api-token-row .input { font-size: 12px; }
.api-endpoints { margin-top: 10px; font-size: 12px; display: flex; flex-direction: column; gap: 4px;
  color: var(--text); }
.api-endpoints .muted { color: var(--muted); }
.deflect-kpi { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel-2); display: flex; align-items: baseline;
  gap: 14px; flex-wrap: wrap; }
.deflect-rate { font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1; }
.deflect-rate-label { font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-left: 4px; }
.deflect-detail { font-size: 12px; }

/* ---- Agent operations + tuning + audit (enterprise console) ---- */
.agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px; margin-bottom: 6px; }
.agent-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  background: var(--panel-2); display: flex; flex-direction: column; gap: 10px; }
.agent-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agent-name { font-weight: 700; font-size: 14px; }
.pill-ok { color: var(--ok); background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.4); }
.pill-err { color: var(--crit); background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.45); }
.pill-audit { color: var(--accent); background: var(--accent-dim); border-color: var(--accent-border); }
.agent-stats { display: flex; gap: 14px; flex-wrap: wrap; }
.agent-stat b { font-size: 15px; } .agent-stat { font-size: 12px; }
.agent-actions { display: flex; flex-direction: column; gap: 5px; }
.agent-action-row { display: grid; grid-template-columns: 1fr 70px 34px; align-items: center;
  gap: 8px; font-size: 11px; }
.agent-action-name { color: var(--muted); text-transform: capitalize; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.agent-action-bar { height: 6px; background: var(--accent-faint); border-radius: 4px; overflow: hidden; }
.agent-action-fill { display: block; height: 100%; background: var(--accent);
  border-radius: 4px; }
.agent-action-n { text-align: right; color: var(--muted); }

.tune-group { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.tune-group:first-of-type { margin-top: 4px; border-top: none; padding-top: 0; }
.tune-agent { color: var(--accent); margin-bottom: 10px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px; }

.bench-controls { margin: 8px 0 12px; }
.bench-slider-field { max-width: 420px; }
.bench-slider { width: 100%; accent-color: var(--accent); }
.dedup-bench-result { border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  background: var(--panel-2); display: flex; flex-direction: column; gap: 8px; }
.bench-summary { font-size: 12px; }
.bench-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.bench-line-cand { font-weight: 600; }
.bench-line-label { min-width: 150px; color: var(--muted); }
.bench-chip { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); }
.bench-merge { color: var(--dup); border-color: rgba(167,139,250,.4); background: rgba(167,139,250,.1); }
.bench-review { color: var(--warn); border-color: rgba(251,191,36,.4); background: rgba(251,191,36,.1); }
.bench-unique { color: var(--ok); border-color: rgba(52,211,153,.4); background: rgba(52,211,153,.1); }
.bench-delta { font-size: 13px; font-weight: 700; color: var(--accent); margin-top: 2px; }

#audit-table td.audit-detail { max-width: 380px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--muted); font-size: 12px; }

/* ---- Enterprise analytics (per-agent) ---- */
.exec-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(160px,1fr)); gap:12px; }
.exec-tile { border:1px solid var(--border); border-radius:12px; padding:14px 16px; background:var(--panel-2);
  display:flex; flex-direction:column; gap:3px; }
.exec-val { font-family:var(--mono); font-size:26px; font-weight:750; line-height:1; color:var(--accent); }
.exec-tile.tone-ok .exec-val { color:var(--ok); } .exec-tile.tone-warn .exec-val { color:var(--warn); }
.exec-tile.tone-dup .exec-val { color:var(--dup); }
.exec-label { font-size:12px; font-weight:600; margin-top:6px; }
.exec-sub { font-size:11px; }
.agent-intel { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px,1fr)); gap:14px; }
.intel-card { border:1px solid var(--border); border-radius:14px; padding:16px 18px; background:var(--panel-2);
  display:flex; flex-direction:column; gap:9px; }
.intel-head { display:flex; align-items:center; gap:9px; }
.intel-icon { font-size:18px; } .intel-name { font-weight:750; font-size:15px; }
.intel-tagline { font-size:12px; line-height:1.4; min-height:32px; }
.intel-headline { display:flex; align-items:baseline; gap:8px; padding:6px 0; border-top:1px solid var(--border-soft);
  border-bottom:1px solid var(--border-soft); }
.intel-headline-val { font-family:var(--mono); font-size:22px; font-weight:750; color:var(--accent); }
.intel-headline-lbl { font-size:11.5px; }
.intel-detail { display:flex; flex-direction:column; gap:6px; }
.intel-line { display:flex; justify-content:space-between; align-items:center; font-size:12.5px; gap:10px; }
.intel-bar-row { display:grid; grid-template-columns:1fr 80px 42px; align-items:center; gap:8px; font-size:11.5px; }
.intel-bar-label { color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-transform:capitalize; }
.intel-bar { height:6px; background:var(--accent-faint); border-radius:4px; overflow:hidden; }
.intel-bar-fill { display:block; height:100%; border-radius:4px; background:var(--accent); }
.intel-bar-fill.tone-ok { background:var(--ok); } .intel-bar-fill.tone-warn { background:var(--warn); }
.intel-bar-n { text-align:right; color:var(--muted); }
@media (max-width:640px){ .exec-grid,.agent-intel { grid-template-columns:1fr 1fr; } }

/* ---- Case Co-pilot panel (ticket drawer) ---- */
.copilot-panel { border: 1px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface)); padding: 12px 14px; margin: 14px 0; }
.copilot-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.copilot-head .panel-subtitle { margin: 0; }
.copilot-body { margin-top: 4px; }
.copilot-meta { display: flex; gap: 10px; align-items: center; margin: 8px 0 4px; }
.copilot-summary { font-size: 13.5px; line-height: 1.55; margin: 6px 0 4px; }
.copilot-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); margin: 12px 0 5px; }
.copilot-label-row { display: flex; align-items: center; justify-content: space-between; }
.copilot-case { border-left: 2px solid var(--accent); padding: 4px 0 4px 10px; margin: 6px 0; font-size: 12.5px; }
.copilot-case-head { display: flex; gap: 8px; justify-content: space-between; font-weight: 600; }
.copilot-case .muted { font-weight: 400; margin-top: 2px; line-height: 1.45; }
.copilot-reply { white-space: pre-wrap; font-family: inherit; font-size: 13px; line-height: 1.5;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0; }
.copilot-actions { margin: 4px 0 2px; padding-left: 18px; font-size: 13px; line-height: 1.6; }
/* Quality-audit panel in the ticket drawer */
.audit-panel { margin-top: 4px; }
.audit-score { font-variant-numeric: tabular-nums; }
.audit-check { display: flex; gap: 7px; align-items: baseline; font-size: 12.5px; margin-top: 3px; }
.audit-ok { color: var(--ok, #22c55e); font-weight: 700; }
.audit-fail { color: var(--crit, #ef4444); font-weight: 700; }

/* Sentiment tones — scoped to the co-pilot header: files.js already renders
   unstyled `pill pill-muted` badges, which a global rule would repaint. */
.copilot-meta .pill-muted { background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); }
.copilot-meta .pill-warn  { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.copilot-meta .pill-danger{ background: color-mix(in srgb, var(--crit, #ef4444) 22%, transparent); color: var(--crit, #ef4444); }

/* ==========================================================================
   CONSOLE SHELL — sidebar + breadcrumb layout for the admin/governance plane.

   Conventions borrowed from enterprise consoles generally: a grouped left rail,
   a breadcrumb bar, list pages built from search + filter chips + table +
   pagination, and detail pages built from labelled sections. Everything below
   is driven by the SAME theme tokens the rest of the app uses, so light/dark
   and white-labelling keep working — no second palette to maintain.
   ========================================================================== */

body.console {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.18s ease;
}
/* margin 0, not the legacy .wrap's `0 auto`: auto margins stop a grid item
   stretching to its column and size it to its CONTENT instead — so any wide
   row (nine catalogue tabs) dragged the whole page past the window edge. */
body.console > main.wrap { max-width: none; margin: 0; padding: 0 32px 64px; min-width: 0; }

/* Desktop, collapsed: the rail slides away entirely (ADP's "offcanvas") and
   the page takes the full width; a menu button appears in the top bar. */
body.console.side-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
body.console.side-collapsed > .sidebar { transform: translateX(-100%); visibility: hidden; }

/* The show-sidebar button lives in the top bar and exists only when the rail
   is out of view — collapsed on desktop, or always on a narrow screen. */
/* Two classes, so it outranks .icon-btn's display, which is declared later. */
.topbar .side-trigger { display: none; }
body.console.side-collapsed .topbar .side-trigger { display: inline-flex; }
.side-scrim { display: none; }

/* Narrow screens: the rail becomes a slide-over drawer instead of vanishing.
   It used to be `display: none` here with no way to bring it back, so a
   smaller window simply lost the navigation. */
@media (max-width: 900px) {
  body.console, body.console.side-collapsed { grid-template-columns: minmax(0, 1fr); }
  body.console > main.wrap { padding: 0 16px 48px; }
  body.console > .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 60;
    width: min(284px, 86vw);
    transform: translateX(-100%); visibility: hidden;
    transition: transform 0.2s ease, visibility 0.2s;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.25);
  }
  body.console.side-drawer-open > .sidebar { transform: none; visibility: visible; }
  body.console .topbar .side-trigger { display: inline-flex; }
  body.console .side-toggle { display: none; }
  body.console.side-drawer-open > .side-scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(2, 6, 16, 0.45);
  }
}

/* ---- sidebar ---- */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 8px;
  background: var(--panel-2);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.18s ease, visibility 0.18s;
}
.side-head { display: flex; align-items: center; gap: 6px; padding: 2px 2px 8px 6px; }
.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.side-brand .brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The scrollable middle: the head and the user button stay put. */
.side-nav { flex: 1; min-height: 0; overflow-y: auto; margin: 4px -4px 0; padding: 0 4px 8px; }
.side-search {
  display: flex; align-items: center; gap: 8px;
  margin: 2px 2px 6px; padding: 7px 9px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
.side-search:hover { color: var(--text); border-color: var(--accent-border); }
.side-search span { flex: 1; }
kbd {
  font-family: var(--sans); font-size: 11px; line-height: 1;
  padding: 3px 5px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--muted);
}
.side-brand .brand-mark {
  width: 24px; height: 24px; flex: none;
  border-radius: 6px;
  background: linear-gradient(160deg, var(--accent-hi), var(--accent-deep));
}
/* Section heading, and the fold control for it. Sentence case like ADP's
   ("AI Gateway", "Tools & Access"), not the shouty uppercase eyebrow. */
.side-group {
  display: flex; align-items: center; gap: 4px;
  width: 100%;
  margin-top: 12px;
  padding: 4px 10px;
  border: 0; background: transparent;
  font: inherit; font-size: 12px; font-weight: 500;
  color: var(--muted); cursor: pointer; text-align: left;
}
.side-group:disabled { cursor: default; }
.side-group:not(:disabled):hover { color: var(--text); }
.side-group svg { transition: transform 0.15s; }
.side-group:disabled svg { display: none; }
.side-block.folded .side-group svg { transform: rotate(-90deg); }
.side-block.folded .side-links { display: none; }
.side-block:first-child .side-group { margin-top: 0; }
.side-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  line-height: 1.3;
}
.side-link:hover { background: var(--hover-bg); color: var(--text); }
.side-link.active { background: var(--accent-faint); color: var(--text); font-weight: 550; }
.side-link .ico { width: 15px; flex: none; text-align: center; opacity: 0.8; }
/* Maturity badge in the rail (Preview / Admin), as ADP marks its own.
   Deliberately quiet: it labels a capability, it is not a call to action.
   Sits hard right so a column of them scans as one list. */
.side-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  flex: none;
  letter-spacing: 0;
  text-transform: none;
}
/* Nested entry (Agent Fleet under Agents). Indents to the parent's label,
   not its icon, so the hierarchy reads without a connector line. */
.side-link.sub {
  padding-left: 32px;
  font-size: 12.5px;
}
.side-link.sub .ico { width: 13px; font-size: 11px; }

/* Tag chips (agent labels, ADP-style). Inline, quiet, with a +N overflow so a
   heavily-tagged row cannot push the table into a horizontal scroll. */
.tag-row { display: inline-flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.tag-chip {
  font-size: 11px; font-family: var(--mono, ui-monospace, monospace);
  padding: 2px 6px; border-radius: 6px;
  background: var(--badge-bg); color: var(--badge-fg);
  white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.tag-chip.more { cursor: help; font-family: inherit; }

.side-tag {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  text-transform: none;
  letter-spacing: 0;
}
.side-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}
.side-foot .pop-wrap { display: block; }
.side-user {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 6px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font: inherit; cursor: pointer; text-align: left;
}
.side-user:hover { background: var(--hover-bg); }
.side-avatar {
  width: 28px; height: 28px; flex: none;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 650;
  color: var(--accent-ink);
  background: linear-gradient(160deg, var(--accent-hi), var(--accent-mid));
}
.side-who { min-width: 0; flex: 1; font-size: 12.5px; line-height: 1.25; }
.side-who b { display: block; color: var(--text); font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-role { display: block; color: var(--muted); font-size: 11.5px; text-transform: capitalize; }

/* ---- icon buttons, menus ---- */
.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex: none;
  border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--hover-bg); color: var(--text); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.unread-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--bg);
}
.pop-wrap { position: relative; display: inline-flex; }
.pop-menu {
  position: absolute; top: calc(100% + 6px); z-index: 80;
  min-width: 240px; padding: 5px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}
.pop-menu.left { left: 0; }
.pop-menu.right { right: 0; }
.pop-menu.up { top: auto; bottom: calc(100% + 6px); width: 100%; }
.menu-title { display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; font-size: 12.5px; color: var(--muted); }
.menu-title b { color: var(--text); font-size: 13px; }
.menu-sep { height: 1px; margin: 4px 2px; background: var(--border-soft); }
.menu-item {
  display: block; width: 100%; padding: 7px 9px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text); font: inherit; font-size: 13px;
  text-decoration: none; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--hover-bg); }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 9px; font-size: 13px; color: var(--text); }
.menu-row kbd + kbd { margin-left: 3px; }

/* Health, only when something is wrong (see startHealthPoll). */
.health-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 550;
  color: var(--crit); background: color-mix(in srgb, var(--crit) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--crit) 35%, transparent);
}

/* ---- drawer (What's new) ---- */
.drawer-scrim { position: fixed; inset: 0; z-index: 150; background: rgba(2, 6, 16, 0.35); }
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(520px, 100vw);
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.2);
  animation: drawer-in 0.18s ease;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 14px; border-bottom: 1px solid var(--border-soft); }
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 650; color: var(--text); }
.drawer-head p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 22px 28px; }
.note-release { padding: 16px 0 6px; border-bottom: 1px solid var(--border-soft); }
.note-release:last-child { border-bottom: 0; }
.note-head { display: flex; align-items: baseline; gap: 10px; }
.note-version { font-weight: 650; color: var(--text); font-size: 15px; }
.note-date { font-size: 12.5px; color: var(--muted); }
.note-kind { margin: 14px 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.note-item { padding: 6px 0; }
.note-area { display: inline-block; font-size: 11px; padding: 2px 6px; border-radius: 6px;
  background: var(--badge-bg); color: var(--badge-fg); margin-bottom: 4px; }
.note-item p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text); }

/* ---- breadcrumb bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  margin: 0 -32px 4px;
  padding: 0 32px;
  background: var(--nav-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { opacity: 0.5; }
.crumbs .here { color: var(--text); }
.topbar .spacer { margin-left: auto; }
.topbar { gap: 4px; }
.topbar .crumbs { margin-left: 4px; min-width: 0; overflow: hidden; white-space: nowrap; }
.topbar .theme-toggle { border: 0; }
@media (max-width: 900px) { .topbar { margin: 0 -16px 4px; padding: 0 12px; } }

/* ---- page header ---- */
.console .page-head { display: block; padding: 26px 0 18px; border: 0; }
/* The legacy page title is a small uppercase accent eyebrow, which reads as a
   section marker rather than a page name. A console page needs a real heading,
   so the console layer resets all four of those properties explicitly — a
   partial override would leave the glow or the letter-spacing behind. */
.console .page-title {
  margin: 0;
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
  text-shadow: none;
}
/* Same reasoning for pills: uppercase micro-caps suit a dense status strip,
   not a table cell that has to be read as a word. */
.console .pill { text-transform: none; letter-spacing: 0; }
.page-sub { margin: 7px 0 0; color: var(--muted); font-size: 13.5px; max-width: 88ch; line-height: 1.55; }

/* ---- toolbar: search + filter chips + action ---- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 16px; }
.search-box { position: relative; flex: 0 1 260px; }
.search-box input { width: 100%; padding-left: 30px; }
.search-box .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 12px; pointer-events: none; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font-size: 13px; cursor: pointer;
}
.filter-chip:hover { border-color: var(--panel-hover-border); }
.filter-chip.on { border-color: var(--accent-border); background: var(--accent-faint); }
.filter-chip .ico { color: var(--muted); font-size: 11px; }
.toolbar .spacer { margin-left: auto; }

/* ---- data table ---- */
.tbl-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--panel); }
.tbl-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--muted);
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  background: var(--panel-2); white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--hover-bg); }
.cell-main { color: var(--text); font-weight: 550; }
.cell-sub { display: block; color: var(--muted); font-size: 12px; font-family: var(--mono); margin-top: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* ---- status pills ---- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 550;
  border: 1px solid var(--chip-border); background: var(--chip-bg); color: var(--chip-text);
}
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent); }
.pill.off { color: var(--muted); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, transparent); }
.pill.crit { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, transparent);
  background: color-mix(in srgb, var(--crit) 10%, transparent); }

/* ---- pagination footer ---- */
.tbl-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; color: var(--muted); font-size: 12.5px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.tbl-foot .spacer { margin-left: auto; }

/* ---- empty state ---- */
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 15px; font-weight: 600; }
.empty p { margin: 0 auto; max-width: 54ch; font-size: 13.5px; line-height: 1.6; }

/* ---- section form: label column + field column ---- */
.form-section {
  display: grid; grid-template-columns: 210px minmax(0, 1fr);
  gap: 28px; padding: 22px 0; border-bottom: 1px solid var(--border-soft);
}
.form-section:last-of-type { border-bottom: 0; }
.form-section > .lbl h3 { margin: 0 0 5px; font-size: 14px; font-weight: 600; }
.form-section > .lbl p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.form-section > .fields { display: flex; flex-direction: column; gap: 14px; }
.field label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 550; }
.field .hint { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.field .req { color: var(--crit); margin-left: 3px; }
@media (max-width: 760px) { .form-section { grid-template-columns: 1fr; gap: 12px; } }

/* ---- option cards (radio-style choice, e.g. transport / auth mode) ---- */
.opt-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.opt {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--panel); cursor: pointer; text-align: left; color: var(--text); font: inherit;
}
.opt:hover { border-color: var(--panel-hover-border); }
.opt.on { border-color: var(--accent-border); background: var(--accent-faint); }
.opt b { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.opt span { color: var(--muted); font-size: 12px; line-height: 1.5; display: block; }

/* ---- sticky form footer ---- */
.form-foot {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px;
  margin: 0 -32px; padding: 12px 32px;
  background: var(--nav-bg); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
}
.form-foot .spacer { margin-left: auto; }

/* ---- stat strip (cost totals row) ---- */
.totals { display: flex; flex-wrap: wrap; gap: 26px; padding: 14px 16px;
  border-top: 1px solid var(--border); background: var(--panel-2); }
.totals .t { display: flex; align-items: baseline; gap: 7px; }
.totals .t span { font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.totals .t b { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---- mini bar chart (spend/tokens over time, no chart library) ---- */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 130px; padding: 12px 16px; }
.spark .bar { flex: 1 1 0; min-width: 2px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent-deep)); opacity: 0.85; }
.spark .bar:hover { opacity: 1; }
.spark .bar.zero { background: var(--track-bg); }

/* ---- tenant switcher ---- */
.tenant-switch { position: relative; margin: 2px 0 6px; }
.tenant-current {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel);
  color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
  text-align: left;
}
.tenant-current:hover { border-color: var(--panel-hover-border); }
.tenant-dot { width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.tenant-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-current .chev { margin-left: auto; color: var(--muted); font-size: 11px; }
.tenant-menu {
  position: absolute; z-index: 20; left: 0; right: -60px; top: calc(100% + 5px);
  padding: 5px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  max-height: 60vh; overflow-y: auto;
}
.tenant-item {
  display: flex; align-items: flex-start; gap: 8px; width: 100%;
  padding: 8px 9px; border: 0; border-radius: 7px; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.tenant-item:hover { background: var(--hover-bg); }
.tenant-item b { display: block; font-size: 13px; font-weight: 600; }
.tenant-item .tenant-meta { display: block; color: var(--muted); font-size: 11.5px; }
.tenant-item .tenant-id {
  display: block; color: var(--muted); font-family: var(--mono); font-size: 11px;
  opacity: 0.75;
}
.tenant-item .tick { margin-left: auto; color: var(--ok); }

/* ---- home: greeting, health banner, quick actions ---- */
.greet { font-size: 27px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
.greet-sub { display: flex; align-items: center; gap: 9px; margin: 8px 0 0;
  color: var(--muted); font-size: 13.5px; }
.greet-sub .tenant-dot { box-shadow: none; }
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 10px; margin: 20px 0 4px;
  border: 1px solid color-mix(in srgb, var(--ok) 32%, transparent);
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}
.banner.warn { border-color: color-mix(in srgb, var(--warn) 34%, transparent);
  background: color-mix(in srgb, var(--warn) 8%, transparent); }
.banner.crit { border-color: color-mix(in srgb, var(--crit) 40%, transparent);
  background: color-mix(in srgb, var(--crit) 8%, transparent); align-items: center; }
.banner.crit b { color: var(--crit); }
.banner .ico { font-size: 15px; line-height: 1.4; }
.banner b { display: block; font-size: 14px; margin-bottom: 2px; }
.banner p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.home-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  align-items: start; margin-top: 16px; }
.home-duo { display: grid; gap: 16px; grid-template-columns: 1fr 1fr;
  align-items: start; margin-top: 16px; }
@media (max-width: 980px) {
  .home-grid, .home-duo { grid-template-columns: 1fr; }
}
.card { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); }
.card-head { display: flex; align-items: baseline; gap: 9px; padding: 14px 16px 0; }
.card-head b { font-size: 14px; font-weight: 600; }
.card-head .muted { color: var(--muted); font-size: 12.5px; }
.card-head .spacer { margin-left: auto; }
.kpi { display: flex; align-items: center; gap: 12px; padding: 15px 16px;
  border-bottom: 1px solid var(--border-soft); }
.kpi:last-child { border-bottom: 0; }
.kpi .lbl { color: var(--muted); font-size: 13px; }
.kpi .val { margin-left: auto; text-align: right; }
.kpi .val b { display: block; font-size: 19px; font-weight: 650;
  font-variant-numeric: tabular-nums; }
.kpi .val span { color: var(--muted); font-size: 11.5px; }
.rank { display: flex; align-items: center; gap: 11px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft); }
.rank:last-child { border-bottom: 0; }
.rank .n { color: var(--muted); font-size: 12px; width: 12px; }
.rank .who { min-width: 0; flex: 1; }
.rank .who code { font-size: 12.5px; }
.rank .track { height: 3px; margin-top: 6px; border-radius: 2px; background: var(--track-bg); }
.rank .fill { height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-mid), var(--accent-hi)); }
.rank .amt { text-align: right; font-variant-numeric: tabular-nums; }
.rank .amt b { display: block; font-size: 13.5px; }
.rank .amt span { color: var(--muted); font-size: 11.5px; }
.quick { display: grid; gap: 12px; margin-top: 20px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); }
.quick a {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  color: var(--text); text-decoration: none; font-size: 13.5px; font-weight: 550;
}
.quick a:hover { border-color: var(--accent-border); }
.quick a .arrow { margin-left: auto; color: var(--muted); }
.cfg { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px;
  padding: 14px 16px; font-size: 13px; }
.cfg dt { color: var(--muted); white-space: nowrap; }
.cfg dd { margin: 0; }


/* ---------- sign-in ----------
   One centred card. The page a customer's staff see every morning should get
   them in, not sell them the product they already bought — and the landing
   hero it replaces was reading live ticket and vector counts out to anyone who
   loaded the URL, signed in or not. */
.signin {
  /* The shared top bar sits above this; 100vh would push the footer line off
     screen and give the page a scrollbar it does not need. */
  min-height: calc(100vh - var(--topnav-h));
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  padding: 40px 20px;
  /* A single soft wash rather than the animated orbs: on a projector the orbs
     banded badly, and this reads as calm on both themes. */
  background:
    radial-gradient(1100px 520px at 50% -10%, var(--accent-faint), transparent 70%),
    var(--bg);
}
.signin-card {
  width: 100%; max-width: 384px;
  padding: 34px 32px 26px;
  display: flex; flex-direction: column;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 18px 48px rgba(15, 23, 42, 0.10);
}
:root[data-theme="dark"] .signin-card {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.signin-mark {
  width: 40px; height: 40px; align-self: center;
  background: var(--accent);
  -webkit-mask: url("/logo.svg") center / contain no-repeat;
  mask: url("/logo.svg") center / contain no-repeat;
}
.signin-title {
  margin: 14px 0 0; text-align: center;
  font-size: 23px; font-weight: 700; letter-spacing: -0.02em; color: var(--text);
}
.signin-sub {
  margin: 5px 0 24px; text-align: center;
  color: var(--muted); font-size: 13px;
}
.signin-foot {
  margin: 0; text-align: center; color: var(--muted); font-size: 12px;
  max-width: 384px;
}

.sso-list { display: flex; flex-direction: column; gap: 8px; }
.sso-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  /* "Continue with Microsoft Entra ID" wraps on a narrow card. Balanced
     wrapping keeps the two lines even instead of orphaning the last word. */
  font-size: 13.5px; font-weight: 600; line-height: 1.35; text-wrap: balance;
  text-decoration: none;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); border-radius: 9px;
}
.sso-btn:hover { border-color: var(--panel-hover-border); background: var(--hover-bg); }
.sso-btn svg { flex: none; }

/* Rule with the word sitting in the gap, rather than a word floating over a
   line — the latter needs a background colour to punch through and breaks the
   moment the card is not opaque. */
.signin-or {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0 16px; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
}
.signin-or::before, .signin-or::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}

@media (max-width: 480px) {
  .signin { padding: 24px 16px; }
  .signin-card { padding: 28px 22px 22px; }
}


/* ---- agent-suite panel primitives ----
   Lived in an inline <style> on agents.html, which meant any OTHER page using
   these classes rendered them unstyled — the Agent Fleet gallery and the MCP
   page both do. Shared stylesheet, one definition. */
.ag-grid { display:grid; grid-template-columns:1fr 1fr; gap:18px; align-items:start; }
@media (max-width: 980px) { .ag-grid { grid-template-columns:1fr; } }
.ag-head-row { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.ag-item { padding:11px 13px; border:1px solid var(--border); border-radius:11px;
  margin-bottom:9px; background:var(--surface); }
.ag-item-head { display:flex; gap:8px; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.ag-item-title { font-weight:600; font-size:13.5px; }
.ag-item-body { margin-top:6px; font-size:12.5px; color:var(--muted); line-height:1.5;
  white-space:pre-wrap; max-height:7.5em; overflow:auto; }
.ag-actions { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.ag-empty { color:var(--muted); padding:22px 0; text-align:center; font-size:13px; }
.ag-score { font-variant-numeric:tabular-nums; font-weight:700; }
.ag-check { display:flex; gap:7px; align-items:baseline; font-size:12.5px; margin-top:3px; }
.ag-stats { display:flex; gap:18px; margin:2px 0 12px; }
.ag-stats b { font-size:20px; font-variant-numeric:tabular-nums; }
.ag-form { display:grid; gap:8px; margin-top:10px; }
.ag-form input { font-size:13px; }
.sev-critical { color:var(--crit,#ef4444); font-weight:700; }
.sev-high { color:var(--warn); font-weight:700; }
.sev-warning { color:var(--muted); font-weight:600; }


/* ---- command palette (Cmd/Ctrl-K) ----
   Fixed overlay so it is reachable from wherever the operator already is,
   which is the entire point of it. */
.palette {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(2, 6, 16, 0.45); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.palette-box {
  width: min(560px, 92vw); background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35); overflow: hidden;
}
.palette-search { display: flex; align-items: center; gap: 8px; padding: 0 14px;
  border-bottom: 1px solid var(--border-soft); color: var(--muted); }
.palette-box .input {
  border: 0; border-radius: 0; height: 50px; font-size: 15px; padding-left: 0;
  background: transparent; flex: 1;
}
.palette-group { padding: 10px 11px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.palette-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { font-family: var(--mono); font-size: 11.5px; color: var(--muted); flex: none; }
.palette-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border-soft);
  font-size: 11.5px; color: var(--muted); }
.palette-foot kbd { margin-right: 2px; }
.palette-box .input:focus { box-shadow: none; }
.palette-list { max-height: 56vh; overflow: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 9px 11px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit;
  font-size: 13.5px; cursor: pointer; text-align: left;
}
.palette-item:hover, .palette-item.on { background: var(--hover-bg); }
.palette-hint {
  font-size: 11px; color: var(--badge-fg); background: var(--badge-bg);
  padding: 2px 6px; border-radius: 6px; flex: none;
}
.palette-empty { padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---- table paging + page tabs (console.js) ---- */
.tbl-foot { display: flex; align-items: center; gap: 10px; }
.tbl-foot .spacer { flex: 1; }
.tbl-pos { color: var(--muted); font-size: 12px; }
.page-tabs { display: flex; gap: 2px; margin: 0 0 16px; border-bottom: 1px solid var(--border-soft); }
.page-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 12px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer;
}
.page-tab:hover { color: var(--text); }
.page-tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 550; }
.page-tab-count { font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--badge-bg); color: var(--badge-fg); }
.summary-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.summary-tile { flex: 1 1 150px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--panel); }
.summary-tile span { display: block; font-size: 12px; color: var(--muted); }
.summary-tile b { display: block; margin-top: 4px; font-size: 22px; font-weight: 650; color: var(--text); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.check input { accent-color: var(--accent); }
.check-row { display: flex; flex-wrap: wrap; gap: 14px; }
.row-actions { display: inline-flex; gap: 4px; justify-content: flex-end; }
.token-once {
  position: absolute; top: 18vh; left: 50%; transform: translateX(-50%);
  width: min(560px, 92vw); padding: 20px 22px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}
.token-once h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
.showing-for { display: flex; align-items: center; gap: 8px; margin: -6px 0 16px; font-size: 13px; color: var(--muted); }
.showing-for .side-avatar { width: 22px; height: 22px; font-size: 11px; border-radius: 6px; }
.showing-for b { color: var(--text); font-weight: 550; }
/* ---- MCP catalogue ---- */
.cat-kind { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: var(--badge-bg); color: var(--badge-fg); font-weight: 500; }
.back-link { display: inline-block; margin: 20px 0 0; font-size: 13px; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--text); }
.palette-box .input, .palette-box .input:focus, .palette-box .input:focus-visible {
  border: 0; outline: none; box-shadow: none;
}
/* Tabs scroll inside their own row: ten catalogue categories must not push
   the whole page sideways on a laptop-width window. */
.page-tabs { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; min-width: 0; max-width: 100%; }
.page-tab { white-space: nowrap; flex: none; }
.console main.wrap { overflow-x: clip; }

/* ---- MCP server catalog, as ADP's ----
   Search on top, a row of quiet toggle chips, then an even grid of cards
   whose whole surface is the target. No counts, no "All": no chip = all. */
.cat-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 0 16px; }
.cat-head .page-sub { margin: 4px 0 0; }
.cat-back { margin-top: 4px; color: var(--muted); text-decoration: none; font-size: 18px; line-height: 1; }
.cat-back:hover { color: var(--text); }
.cat-search {
  width: 100%; height: 38px; padding: 0 12px; font: inherit; font-size: 13.5px;
  color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
}
.cat-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 16px; }
.cat-chip {
  padding: 4px 11px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--panel); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.cat-chip:hover { background: var(--hover-bg); }
.cat-chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cat-card {
  display: flex; flex-direction: column; gap: 10px; min-height: 150px;
  padding: 14px 16px; text-align: left; font: inherit; color: inherit;
  background: var(--panel); border: 1px solid var(--border); border-radius: 11px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.cat-card:hover:not(:disabled), .cat-card:focus-visible {
  border-color: var(--panel-hover-border); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06); outline: none;
}
.cat-card:disabled { cursor: default; }
.cat-card.manual { grid-column: span 2; border-style: dashed; background: var(--panel-2); }
@media (max-width: 640px) { .cat-card.manual { grid-column: auto; } }
.cat-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cat-card-name { font-size: 14px; font-weight: 600; color: var(--text); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-tag { flex: none; font-size: 11px; font-weight: 500; padding: 2px 7px; border-radius: 6px;
  background: var(--badge-bg); color: var(--badge-fg); }
.cat-tag.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.cat-card-about {
  color: var(--muted); font-size: 12.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.cat-card-foot { display: flex; gap: 10px; margin-top: auto; font-size: 11.5px; color: var(--muted); }
.cat-card-foot span + span::before { content: "\00B7"; margin-right: 10px; }
.cat-none { grid-column: 1 / -1; color: var(--muted); font-size: 13px; }
.brand-tile {
  display: inline-grid; place-items: center; flex: none;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text);
}
.brand-tile.mono { border: 0; font-weight: 700; letter-spacing: -0.02em; font-family: var(--sans); }
.server-cell { display: inline-flex; align-items: center; gap: 10px; }

/* Bare inputs inside a console form section get the app's input look. The
   section forms (Integrations setup, LLM providers, ...) build plain <input>s
   with no class, so they fell back to the browser's narrow default box. */
.form-section .fields :is(input:not([type=checkbox]):not([type=radio]), select, textarea):not(.input) {
  width: 100%; max-width: 560px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 9px;
  padding: 0 11px; height: 38px; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-section .fields textarea:not(.input) { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; }
.form-section .fields :is(input, select, textarea):not(.input)::placeholder { color: var(--input-placeholder); opacity: 0.8; }
.form-section .fields :is(input, select, textarea):not(.input):hover:not(:focus) { border-color: var(--input-hover-border); }
.form-section .fields :is(input, select, textarea):not(.input):focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ---- search, as ADP's: blurred page, a compact dialog, icon + label rows ---- */
.palette {
  background: rgba(15, 18, 25, 0.18); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  padding-top: 20vh;
}
.palette-box { width: min(620px, 92vw); border-radius: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22); }
.palette-search { gap: 9px; padding: 0 8px 0 14px; }
.palette-box .input { height: 46px; font-size: 14px; }
.palette-close { width: 26px; height: 26px; }
/* Hide the native clear "x" — the dialog has its own close button. */
.palette-box input[type=search]::-webkit-search-cancel-button { display: none; }
.palette-list { max-height: 320px; padding: 4px 6px 6px; }
.palette-group { padding: 10px 8px 4px; font-size: 11.5px; font-weight: 500; }
.palette-item { gap: 10px; padding: 8px 8px; font-size: 13.5px; border-radius: 7px; justify-content: flex-start; }
.palette-ico { display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; color: var(--muted); }
.palette-item.on .palette-ico { color: var(--text); }
.palette-ico.mono { width: 18px; height: 18px; border-radius: 4px; color: #fff; font-size: 8.5px; font-weight: 700; letter-spacing: -0.02em; }
.palette-sub { margin-left: auto; font-family: var(--sans); font-size: 11.5px; color: var(--muted); }
.palette-foot { display: none; }

/* Rail icons are now line icons (SVG), sized with the label. */
.side-link .ico { width: 18px; display: inline-grid; place-items: center; opacity: 0.85; }
.side-link.active .ico { opacity: 1; }
.side-link.sub .ico { width: 16px; }

/* ---- Audit log: query bar, verdict timeline, facet rail ---- */
.audit-bar select.audit-window { height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); padding: 0 10px; font: inherit; font-size: 13px; }
.audit-bar .search-box input.audit-q { width: 100%; }
.audit-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0 4px; min-height: 26px; }
.audit-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2);
  color: var(--text); font: 12.5px var(--mono, ui-monospace, monospace); cursor: pointer; }
.audit-chip .x { color: var(--muted); font-size: 14px; line-height: 1; }
.audit-chip:hover .x { color: var(--crit); }
.audit-timeline { border: 1px solid var(--border); border-radius: 10px; background: var(--panel);
  padding: 12px 14px 8px; margin: 8px 0 14px; }
.audit-tl-head { display: flex; gap: 18px; align-items: baseline; font-size: 13px; color: var(--muted); }
.audit-tl-head b { color: var(--text); font-size: 15px; margin-right: 2px; }
.audit-tl-head b.crit { color: var(--crit); }
.audit-tl-head .spacer { flex: 1; }
.audit-tl-head .legend { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }
.audit-tl-head .legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-left: 8px; }
.audit-tl-head .legend i.ok { background: color-mix(in srgb, var(--accent) 70%, transparent); }
.audit-tl-head .legend i.crit { background: var(--crit); }
.audit-tl-bars { display: flex; align-items: flex-end; gap: 2px; height: 70px; margin-top: 10px; }
.audit-tl-bar { flex: 1 1 0; min-width: 2px; max-width: 28px; height: 100%; padding: 0; border: 0;
  background: transparent; display: flex; flex-direction: column; justify-content: flex-end; cursor: zoom-in; }
.audit-tl-bar .a { background: color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 2px 2px 0 0; }
.audit-tl-bar .d { background: var(--crit); }
.audit-tl-bar:hover .a { background: var(--accent); }
.audit-tl-axis { display: flex; justify-content: space-between; font: 11px var(--mono, ui-monospace, monospace);
  color: var(--muted); margin-top: 4px; }
.audit-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .audit-grid { grid-template-columns: 1fr; } }
.audit-facets { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); padding: 10px 12px; }
.audit-facets-title { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.audit-facet { padding: 8px 0; border-top: 1px solid var(--border-soft); }
.audit-facet:first-of-type { border-top: 0; }
.audit-facet-name { font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.audit-facet-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.audit-facet-val { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 2px 0;
  color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: inherit; }
.audit-facet-val:hover { color: var(--accent); }
.audit-facet-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.audit-facet-ex { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 2px;
  visibility: hidden; font-size: 14px; }
.audit-facet-row:hover .audit-facet-ex { visibility: visible; }
.audit-facet-ex:hover { color: var(--crit); }
.audit-row { cursor: pointer; }
.audit-row:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.audit-cell { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; }
.audit-cell:hover { text-decoration: underline dotted; }
.audit-sec { font-size: 13px; margin: 18px 0 6px; }
.audit-kv td { padding: 6px 8px; vertical-align: top; word-break: break-word; }
.audit-diff td { vertical-align: top; word-break: break-word; }
.audit-diff .del { color: var(--crit); text-decoration: line-through; opacity: .85; }
.audit-diff .ins { color: var(--ok); }
.audit-related { display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 7px 10px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); cursor: pointer; }

/* ---- Guardrail form: entity checkboxes and the pattern editor ---- */
.chip-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px;
  border: 1px solid var(--border); border-radius: 999px; font-size: 13px; cursor: pointer;
  background: var(--panel); }
.chip-check:has(input:checked) { border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); }
.chip-check input { margin: 0; }
.pattern-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) 100px auto;
  gap: 8px; align-items: center; margin-bottom: 8px; }
.pattern-row input, .pattern-row select { width: 100%; box-sizing: border-box; }
@media (max-width: 760px) { .pattern-row { grid-template-columns: 1fr; } }

/* ---- MCP data policies editor ---- */
.dp-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .dp-grid { grid-template-columns: 1fr; } }
.dp-tools { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); padding: 8px; }
.dp-tools-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 4px 6px 8px; }
.dp-tool { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%;
  padding: 8px 10px; border: 1px solid transparent; border-radius: 8px; background: none;
  color: var(--text); cursor: pointer; text-align: left; font-size: 13px; }
.dp-tool:hover { background: var(--panel-2); }
.dp-tool.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dp-editor { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.dp-editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.dp-editor-head h2 { margin: 0; font-size: 17px; }
.dp-section { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); padding: 12px 14px; }
.dp-section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.dp-subhead { font-size: 12.5px; font-weight: 600; margin: 14px 0 6px; }
.dp-section select, .dp-section input[type=text], .dp-section textarea { width: 100%; box-sizing: border-box; }
.dp-clamp { min-width: 140px; }
.dp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; }
.dp-preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 760px) { .dp-preview-grid, .dp-row { grid-template-columns: 1fr; } }
.dp-out { white-space: pre-wrap; background: var(--panel-2); border-radius: 8px; padding: 10px 12px;
  margin-top: 10px; font-size: 12.5px; max-height: 360px; overflow: auto; }
