/* Stable Genius SI console. Apple HIG spirit: clarity, deference, depth. No build step. */

:root {
  color-scheme: light dark;
  --font: -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Cascadia Code", Consolas, Menlo, monospace;

  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #fafafc;
  --surface-sunken: #f0f0f3;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.08);
  --fill-hover: rgba(120, 120, 128, 0.16);
  --sep: rgba(60, 60, 67, 0.13);
  --sep-strong: rgba(60, 60, 67, 0.22);
  --text: #1d1d1f;
  --text-2: #5c5c62;
  --text-3: #808087;
  --accent: #0066cc;
  --accent-hover: #0058b0;
  --accent-fill: rgba(0, 113, 227, 0.1);
  --on-accent: #ffffff;
  --green: #1e7f35;
  --green-dot: #34c759;
  --green-fill: rgba(52, 199, 89, 0.13);
  --red: #c4141e;
  --red-dot: #ff3b30;
  --red-fill: rgba(255, 59, 48, 0.1);
  --orange: #b04a00;
  --orange-dot: #ff9500;
  --orange-fill: rgba(255, 149, 0, 0.13);
  --purple: #7a3ea8;
  --purple-fill: rgba(175, 82, 222, 0.12);
  --gray-dot: #aeaeb2;
  --material: rgba(246, 246, 248, 0.78);
  --shadow-card: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow-pop: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 0 12px 40px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
  --focus: 0 0 0 3px rgba(0, 113, 227, 0.45);
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 7px;
  --sidebar-w: 236px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --surface-sunken: #141415;
    --fill: rgba(120, 120, 128, 0.24);
    --fill-2: rgba(120, 120, 128, 0.16);
    --fill-hover: rgba(120, 120, 128, 0.32);
    --sep: rgba(84, 84, 88, 0.55);
    --sep-strong: rgba(110, 110, 115, 0.7);
    --text: #f5f5f7;
    --text-2: #aeaeb2;
    --text-3: #8d8d93;
    --accent: #2f8fff;
    --accent-hover: #4a9eff;
    --accent-fill: rgba(10, 132, 255, 0.18);
    --green: #32d74b;
    --green-dot: #30d158;
    --green-fill: rgba(48, 209, 88, 0.16);
    --red: #ff6961;
    --red-dot: #ff453a;
    --red-fill: rgba(255, 69, 58, 0.16);
    --orange: #ffb340;
    --orange-dot: #ff9f0a;
    --orange-fill: rgba(255, 159, 10, 0.16);
    --purple: #da8fff;
    --purple-fill: rgba(191, 90, 242, 0.18);
    --gray-dot: #636366;
    --material: rgba(28, 28, 30, 0.72);
    --shadow-card: 0 0 0 0.5px rgba(255, 255, 255, 0.07);
    --shadow-pop: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 16px 48px rgba(0, 0, 0, 0.6);
    --focus: 0 0 0 3px rgba(47, 143, 255, 0.6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern";
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--r-sm); }
.num, .tnum, td, .stat-value { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -40px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--r-sm); box-shadow: var(--shadow-pop); }
.skip-link:focus { top: 12px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 18px 12px 14px; border-right: 0.5px solid var(--sep);
  background: var(--material); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #3a8bff, #1d5fd6 55%, #5b3fd1);
  box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.4), 0 1px 3px rgba(0, 40, 120, 0.3);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-weight: 650; font-size: 14px; letter-spacing: -0.01em; line-height: 1.15; }
.brand-sub { font-size: 11.5px; color: var(--text-2); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 14px 10px 5px; letter-spacing: 0.02em; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r-sm);
  color: var(--text); font-size: 13.5px; font-weight: 450; text-decoration: none;
}
.nav a svg { width: 17px; height: 17px; color: var(--accent); flex: none; }
.nav a:hover { background: var(--fill-2); }
.nav a[aria-current="page"] { background: var(--fill); font-weight: 600; }
.nav .count {
  margin-left: auto; min-width: 20px; padding: 0 6px; height: 18px; border-radius: 9px; font-size: 11px; font-weight: 650;
  display: grid; place-items: center; background: var(--red-dot); color: #fff; font-variant-numeric: tabular-nums;
}
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; border-top: 0.5px solid var(--sep); display: flex; flex-direction: column; gap: 10px; }
.client { display: flex; flex-direction: column; }
.client-name { font-weight: 600; font-size: 13px; }
.me { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 11px; font-weight: 650; color: #fff; background: linear-gradient(160deg, #8e8e93, #636366);
}
.avatar.agent { background: linear-gradient(160deg, #7d5cff, #4b32c8); }
.avatar.service { background: linear-gradient(160deg, #40a6c9, #237a99); }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.avatar svg { width: 15px; height: 15px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-dot); }
.live.on .dot { background: var(--green-dot); box-shadow: 0 0 0 3px var(--green-fill); }

.main { min-width: 0; padding: 30px 40px 64px; }
.page { max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.022em; margin: 0; line-height: 1.15; }
.page-sub { margin: 4px 0 0; color: var(--text-2); font-size: 14.5px; max-width: 720px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 4px 10px; }
.section-title { font-family: var(--font-display); font-size: 17px; font-weight: 650; letter-spacing: -0.012em; margin: 0; }
.section-note { color: var(--text-2); font-size: 13px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px 12px; border-bottom: 0.5px solid var(--sep); }
.card-title { font-weight: 650; font-size: 14px; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }

/* inset grouped list */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; position: relative; min-height: 48px; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; border-top: 0.5px solid var(--sep); }
.row.indent + .row.indent::before { left: 56px; }
.list > li + li > .row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; border-top: 0.5px solid var(--sep); }
.list > li + li > .row.indent::before { left: 56px; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-trail { display: flex; align-items: center; gap: 10px; color: var(--text-2); flex: none; }
button.row, a.row { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; text-decoration: none; }
button.row:hover, a.row:hover { background: var(--fill-2); }
.list > li:first-child > .row:hover, .list > .row:first-child:hover { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.chev { width: 14px; height: 14px; color: var(--text-3); }

/* ---------- stats ---------- */
.stat { padding: 16px 18px 15px; }
.stat-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.1; }
.stat-value .unit { font-size: 15px; font-weight: 500; color: var(--text-2); margin-left: 2px; letter-spacing: 0; }
.stat-foot { font-size: 12px; color: var(--text-2); margin-top: 6px; }

/* trust cards */
.trust { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; }
.trust-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.trust-icon svg { width: 22px; height: 22px; }
.trust-icon.good { background: var(--green-fill); color: var(--green); }
.trust-icon.bad { background: var(--red-fill); color: var(--red); }
.trust-icon.warn { background: var(--orange-fill); color: var(--orange); }
.trust-icon.info { background: var(--accent-fill); color: var(--accent); }
.trust-kicker { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.01em; }
.trust-title { font-family: var(--font-display); font-size: 17px; font-weight: 650; letter-spacing: -0.012em; margin-top: 1px; }
.trust-detail { font-size: 12.5px; color: var(--text-2); margin-top: 3px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--fill-2); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gray-dot); flex: none; }
.badge.plain::before { display: none; }
.badge.plain { padding: 0 9px; }
.badge.good { background: var(--green-fill); color: var(--green); }
.badge.good::before { background: var(--green-dot); }
.badge.bad { background: var(--red-fill); color: var(--red); }
.badge.bad::before { background: var(--red-dot); }
.badge.warn { background: var(--orange-fill); color: var(--orange); }
.badge.warn::before { background: var(--orange-dot); }
.badge.info { background: var(--accent-fill); color: var(--accent); }
.badge.info::before { background: var(--accent); }
.badge.purple { background: var(--purple-fill); color: var(--purple); }
.badge.purple::before { background: var(--purple); }
.badge.pulse::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px;
  font-family: var(--mono); background: var(--fill-2); color: var(--text-2); white-space: nowrap;
}
.tag.sensitive { background: var(--orange-fill); color: var(--orange); }
.tag.sensitive svg, .tag.hidden svg { width: 11px; height: 11px; }
.tag.hidden { background: var(--red-fill); color: var(--red); text-decoration: line-through; text-decoration-thickness: 1px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: 8px; border: 0; cursor: pointer; font-size: 13.5px; font-weight: 550; white-space: nowrap;
  background: var(--fill); color: var(--text); transition: background 0.12s, transform 0.08s;
}
.btn:hover { background: var(--fill-hover); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--red); }
.btn.danger-fill { background: var(--red-dot); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-fill); }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn.lg { height: 40px; padding: 0 20px; font-size: 15px; border-radius: 10px; }
.btn[disabled] { opacity: 0.45; cursor: default; transform: none; }
.icon-btn { width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* segmented control */
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill-2); gap: 2px; }
.seg button {
  border: 0; background: transparent; height: 26px; padding: 0 13px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text);
  white-space: nowrap;
}
.seg button:hover { background: var(--fill-2); }
.seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: var(--surface); box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.06), 0 2px 5px rgba(0, 0, 0, 0.1); font-weight: 600; }
@media (prefers-color-scheme: dark) { .seg button[aria-checked="true"], .seg button[aria-selected="true"] { background: #636366; } }
.seg.lg button { height: 30px; padding: 0 18px; font-size: 13.5px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  height: 34px; padding: 0 11px; border-radius: 8px; border: 0.5px solid var(--sep-strong); background: var(--surface);
  font-size: 14px; width: 100%; transition: box-shadow 0.12s, border-color 0.12s;
}
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.45; }
textarea.code { font-family: var(--mono); font-size: 12.5px; }
.input:focus, .input:focus-visible { border-color: var(--accent); box-shadow: var(--focus); border-radius: 8px; }
.input[aria-invalid="true"] { border-color: var(--red-dot); }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 31px; background: var(--fill-2); border-color: transparent; }
.search .input:focus { background: var(--surface); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px 6px 9px; border-radius: 8px; background: var(--fill-2); cursor: pointer; font-size: 13px;
  user-select: none;
}
.check input { accent-color: var(--accent); margin: 0; }
.check:has(input:checked) { background: var(--accent-fill); color: var(--accent); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { width: 280px; }
.spacer { flex: 1; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 10px 14px 8px; border-bottom: 0.5px solid var(--sep);
  position: sticky; top: 0; background: var(--surface); z-index: 1; white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 0.5px solid var(--sep); vertical-align: middle; }
.table tr:last-child > td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 18px; }
.table th:last-child, .table td:last-child { padding-right: 18px; }
.table td.r, .table th.r { text-align: right; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover > td { background: var(--fill-2); }
.table tr.fresh > td { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: var(--accent-fill); } to { background: transparent; } }
.table tr.detail > td { background: var(--surface-2); padding: 14px 18px 18px; }
.expander { width: 20px; height: 20px; border: 0; background: none; padding: 0; color: var(--text-3); cursor: pointer; display: inline-grid; place-items: center; border-radius: 5px; }
.expander svg { width: 12px; height: 12px; transition: transform 0.15s; }
.expander[aria-expanded="true"] svg { transform: rotate(90deg); }

pre.code, .json {
  margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-sunken); font-family: var(--mono); font-size: 12.5px;
  line-height: 1.55; overflow: auto; white-space: pre-wrap; word-break: break-word; max-height: 420px; border: 0.5px solid var(--sep);
}
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; margin: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- pipeline stepper ---------- */
.stepper { display: grid; grid-template-columns: repeat(6, 1fr); align-items: center; position: relative; min-width: 300px; }
.step { display: flex; align-items: center; position: relative; height: 22px; }
.step::after { content: ""; position: absolute; left: 50%; right: -50%; top: 50%; height: 2px; translate: 0 -50%; background: var(--fill); }
.step:last-child::after { display: none; }
.step.done::after { background: var(--green-dot); opacity: 0.55; }
.step .node { position: relative; z-index: 1; margin: 0 auto; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--fill-hover); }
.step.done .node { background: var(--green-dot); border-color: var(--green-dot); color: #fff; }
.step.done .node svg { width: 10px; height: 10px; }
.step.current .node { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-fill); }
.step.current .node::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.step.current.failed .node { border-color: var(--red-dot); box-shadow: 0 0 0 4px var(--red-fill); }
.step.current.failed .node::after { background: var(--red-dot); }
.step.current.live .node { background: var(--green-dot); border-color: var(--green-dot); box-shadow: 0 0 0 4px var(--green-fill); }
.step.current.live .node::after { background: #fff; }
.stepper-labels { display: grid; grid-template-columns: repeat(6, 1fr); font-size: 11.5px; color: var(--text-3); text-align: center; margin-top: 4px; }

/* ---------- chain chips (counterexample path) ---------- */
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px 0 8px; border-radius: 14px; font-size: 12.5px; font-weight: 550;
  background: var(--surface); box-shadow: 0 0 0 0.5px var(--sep-strong); white-space: nowrap;
}
.chip svg { width: 14px; height: 14px; }
.chip .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 650; }
.chip.person svg { color: var(--accent); }
.chip.group svg { color: var(--purple); }
.chip.grant svg { color: var(--orange); }
.chip.tool svg { color: var(--green); }
.chip.field { background: var(--red-fill); box-shadow: 0 0 0 0.5px rgba(255, 59, 48, 0.4); color: var(--red); }
.chain .arrow { color: var(--text-3); width: 14px; height: 14px; flex: none; }

/* ---------- callouts ---------- */
.callout { display: flex; gap: 12px; padding: 13px 16px; border-radius: var(--r-md); align-items: flex-start; font-size: 13.5px; }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.callout.good { background: var(--green-fill); }
.callout.good > svg { color: var(--green); }
.callout.bad { background: var(--red-fill); }
.callout.bad > svg { color: var(--red); }
.callout.warn { background: var(--orange-fill); }
.callout.warn > svg { color: var(--orange); }
.callout.info { background: var(--accent-fill); }
.callout.info > svg { color: var(--accent); }
.callout-title { font-weight: 650; }

/* ---------- empty / skeleton ---------- */
.empty { text-align: center; padding: 44px 24px; color: var(--text-2); }
.empty svg { width: 34px; height: 34px; color: var(--text-3); margin-bottom: 8px; }
.empty-title { font-weight: 650; color: var(--text); font-size: 15px; }
.empty p { margin: 4px auto 0; max-width: 380px; font-size: 13px; }
.sk { border-radius: 6px; background: linear-gradient(90deg, var(--fill-2) 0%, var(--fill) 50%, var(--fill-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.sk-line { height: 12px; margin: 8px 0; }

/* ---------- feed ---------- */
.feed { max-height: 460px; overflow-y: auto; }
.feed-item { display: flex; gap: 11px; padding: 10px 18px; align-items: flex-start; position: relative; }
.feed-item + .feed-item::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: 0.5px solid var(--sep); }
.feed-item.fresh { animation: fresh 2.4s ease-out; }
.feed-icon { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--fill-2); color: var(--text-2); }
.feed-icon svg { width: 13px; height: 13px; }
.feed-icon.ok { background: var(--green-fill); color: var(--green); }
.feed-icon.denied, .feed-icon.blocked { background: var(--red-fill); color: var(--red); }
.feed-icon.error { background: var(--orange-fill); color: var(--orange); }
.feed-text { flex: 1; min-width: 0; font-size: 13px; }
.feed-text b { font-weight: 600; }
.feed-meta { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.feed-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* ---------- progress ---------- */
.progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; display: flex; gap: 2px; }
.progress span { display: block; height: 100%; }
.progress .done { background: var(--green-dot); }
.progress .failed { background: var(--red-dot); }
.progress .waiting { background: var(--orange-dot); }

/* ---------- MCP url ---------- */
.copyfield { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 12px; border-radius: 9px; background: var(--surface-sunken); border: 0.5px solid var(--sep); }
.copyfield code { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 9px; }
.steps li { counter-increment: s; display: flex; gap: 10px; font-size: 13px; color: var(--text-2); }
.steps li::before { content: counter(s); flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-fill); color: var(--accent); font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.steps b { color: var(--text); font-weight: 600; }

/* ---------- mail preview ---------- */
.mail { border-radius: var(--r-md); background: var(--surface-2); border: 0.5px solid var(--sep); overflow: hidden; }
.mail-head { padding: 12px 16px; border-bottom: 0.5px solid var(--sep); display: grid; grid-template-columns: 64px 1fr; gap: 3px 10px; font-size: 13px; }
.mail-head dt { color: var(--text-3); }
.mail-head dd { margin: 0; overflow-wrap: anywhere; }
.mail-body { padding: 14px 16px 16px; white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; max-height: 360px; overflow-y: auto; }

/* ---------- dialogs: modal + sheet ---------- */
dialog { border: 0; padding: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(0, 0, 0, 0.28); backdrop-filter: blur(2px); }
@media (prefers-color-scheme: dark) { dialog::backdrop { background: rgba(0, 0, 0, 0.55); } }
.modal { width: min(560px, calc(100vw - 32px)); margin: auto; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-pop); }
.modal.wide { width: min(760px, calc(100vw - 32px)); }
.modal-body { padding: 22px 24px 8px; max-height: calc(100vh - 180px); overflow-y: auto; }
.modal-title { font-family: var(--font-display); font-size: 19px; font-weight: 650; letter-spacing: -0.015em; margin: 0 0 4px; }
.modal-sub { color: var(--text-2); margin: 0 0 16px; font-size: 13.5px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; }
.modal[open] { animation: pop 0.18s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
.sheet { margin: 0 0 0 auto; height: 100vh; width: min(560px, 100vw); background: var(--surface); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; }
.sheet[open] { animation: slide 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 14px; border-bottom: 0.5px solid var(--sep); }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px 22px 28px; }
.sheet-section + .sheet-section { margin-top: 22px; }
.sheet-section h3 { font-size: 12px; font-weight: 650; color: var(--text-2); margin: 0 0 8px 2px; letter-spacing: 0.01em; }
.sheet .card { box-shadow: 0 0 0 0.5px var(--sep); background: var(--surface-2); }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; translate: -50% 0; display: flex; flex-direction: column; gap: 8px; z-index: 1000; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: 12px; font-size: 13.5px; max-width: 520px;
  background: var(--material); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: var(--shadow-pop);
  animation: toast-in 0.2s ease-out;
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.good svg { color: var(--green); }
.toast.bad svg { color: var(--red); }
.toast.info svg { color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- misc page bits ---------- */
.agent-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; text-align: left; border: 0; cursor: pointer; color: inherit; font: inherit; }
.agent-card:hover { box-shadow: var(--shadow-card), 0 0 0 1px var(--sep-strong); }
.agent-card[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.agent-top { display: flex; align-items: center; gap: 11px; }
.agent-glyph { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--purple-fill); color: var(--purple); flex: none; }
.agent-glyph svg { width: 20px; height: 20px; }
.agent-name { font-weight: 650; font-size: 14.5px; }
.agent-role { font-size: 12.5px; color: var(--text-2); }
.agent-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 36px; }
.agent-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); }
.agent-meta b { color: var(--text); font-weight: 600; }

.decision { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.decision-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.decision-icon svg { width: 24px; height: 24px; }
.decision-icon.allow { background: var(--green-fill); color: var(--green); }
.decision-icon.deny { background: var(--red-fill); color: var(--red); }
.decision-title { font-family: var(--font-display); font-size: 18px; font-weight: 650; letter-spacing: -0.012em; }

.inv { display: flex; gap: 12px; padding: 13px 18px; align-items: flex-start; position: relative; }
.inv + .inv::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: 0.5px solid var(--sep); }
.inv-status { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.inv-status svg { width: 12px; height: 12px; }
.inv-status.pass { background: var(--green-dot); color: #fff; }
.inv-status.fail { background: var(--red-dot); color: #fff; }
.inv-title { font-weight: 600; }
.inv-id { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }

.hero { display: flex; align-items: center; gap: 22px; padding: 26px 28px; }
.hero-badge { width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center; flex: none; }
.hero-badge svg { width: 38px; height: 38px; }
.hero-badge.good { background: linear-gradient(160deg, #34c759, #1f9a43); color: #fff; box-shadow: 0 6px 18px rgba(52, 199, 89, 0.3); }
.hero-badge.bad { background: linear-gradient(160deg, #ff5a4f, #d70015); color: #fff; box-shadow: 0 6px 18px rgba(255, 59, 48, 0.3); }
.hero-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.hero-sub { color: var(--text-2); margin-top: 3px; font-size: 14px; max-width: 640px; }
.hero-stats { display: flex; gap: 28px; margin-left: auto; }
.hero-stat .v { font-family: var(--font-display); font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.015em; }
.hero-stat .l { font-size: 12px; color: var(--text-2); }

.token-box { font-family: var(--mono); font-size: 13px; padding: 12px 14px; border-radius: 10px; background: var(--surface-sunken); border: 0.5px dashed var(--sep-strong); word-break: break-all; user-select: all; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-top: 0.5px solid var(--sep); font-size: 12.5px; color: var(--text-2); }
.result-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
  .hero { flex-wrap: wrap; }
  .hero-stats { margin-left: 0; }
}
@media (max-width: 960px) {
  :root { --sidebar-w: 64px; }
  .brand-text, .nav a span, .nav-label, .sidebar-foot .client, .sidebar-foot .me-text, .live .live-text { display: none; }
  .nav a { justify-content: center; padding: 9px; }
  .nav .count { position: absolute; margin: -16px 0 0 18px; }
  .nav a { position: relative; }
  .brand { justify-content: center; padding-left: 0; padding-right: 0; }
  .main { padding: 24px 22px 48px; }
  .cols-3 { grid-template-columns: 1fr; }
  .cols-2 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .sk { animation: none; }
}
@media (forced-colors: active) {
  .badge::before, .live .dot { forced-color-adjust: none; }
  .btn, .seg button, .chip { border: 1px solid ButtonText; }
}

/* ---------- login page ---------- */
body.login-page { display: grid; place-items: center; min-height: 100vh; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-fill), transparent 70%), var(--bg); }
.login { width: min(400px, 100%); padding: 36px 34px 30px; text-align: center; }
.login .brand-mark { width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 18px; }
.login .brand-mark svg { width: 28px; height: 28px; }
.login h1 { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.login p.lead { color: var(--text-2); margin: 6px 0 24px; font-size: 14.5px; }
.login form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login .input { height: 42px; font-size: 15px; border-radius: 10px; }
.login .btn.lg { width: 100%; }
.sent { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sent .ok { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--green-fill); color: var(--green); margin-bottom: 6px; }
.sent .ok svg { width: 28px; height: 28px; }
.sent h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.sent p { margin: 0; color: var(--text-2); }
.sent .btn { margin-top: 10px; }
.foot { margin-top: 22px; font-size: 12px; color: var(--text-3); display: flex; align-items: center; justify-content: center; gap: 6px; }
.foot svg { width: 13px; height: 13px; }
.err { color: var(--red); font-size: 13px; min-height: 18px; }
[hidden] { display: none !important; }
