/* Test console for the guest assistant. Dark-first, no dependencies — helmet's
   default CSP allows same-origin files but no inline script, so nothing here is
   inlined into the HTML. */

:root {
  color-scheme: dark;
  --bg: #0e1116;
  --bg-panel: #151a21;
  --bg-raised: #1c222b;
  --bg-input: #10151b;
  --border: #262e39;
  --border-strong: #333d4a;
  --text: #e6ebf2;
  --text-dim: #98a4b3;
  --text-faint: #6b7684;
  --accent: #ff8a3d;
  --accent-soft: rgba(255, 138, 61, 0.14);
  --ok: #4ec9a0;
  --warn: #e8c25a;
  --bad: #f0736a;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2 { margin: 0; }
h1 { font-size: 15px; font-weight: 600; letter-spacing: 0.01em; }
h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
code { font-family: var(--mono); font-size: 0.92em; color: var(--accent); }

/* ---- Top bar --------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex: none;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-sub { margin: 0; font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.1em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 50% 78%, #ffd08a 0%, var(--accent) 45%, #d4491f 100%);
  box-shadow: 0 0 18px rgba(255, 138, 61, 0.35);
}

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

.pill {
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  white-space: nowrap;
}
.pill-ok { color: var(--ok); border-color: rgba(78, 201, 160, 0.4); background: rgba(78, 201, 160, 0.08); }
.pill-warn { color: var(--warn); border-color: rgba(232, 194, 90, 0.4); background: rgba(232, 194, 90, 0.08); }
.pill-bad { color: var(--bad); border-color: rgba(240, 115, 106, 0.4); background: rgba(240, 115, 106, 0.08); }

/* ---- Layout ---------------------------------------------------------------- */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr) 340px;
  gap: 1px;
  background: var(--border);
}

.panel { background: var(--bg); min-height: 0; overflow-y: auto; padding: 16px; }
.panel-left { display: flex; flex-direction: column; gap: 22px; }
.panel-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }

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

/* ---- Form controls --------------------------------------------------------- */

.field { margin-top: 10px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field label { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.opt { color: var(--text-faint); font-weight: 400; text-transform: none; }

input, select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--text-dim); }
.check input { width: auto; }

.hint { margin: 4px 0 0; font-size: 12px; color: var(--text-faint); }
.hint.is-missing { color: var(--bad); }

.btn {
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 11px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: none; border-color: transparent; color: var(--text-dim); padding: 4px 6px; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-raised); }
.btn-block { width: 100%; margin-top: 10px; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #241000;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 16px;
}
.btn-primary:hover:not(:disabled) { background: #ffa15e; color: #241000; }

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

.conv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.conv-list li { display: flex; }
.conv-item {
  flex: 1;
  /* Lets the clipped preview shrink instead of stretching the sidebar. */
  min-width: 0;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.conv-item:hover { background: var(--bg-panel); color: var(--text); }
.conv-item.is-active { background: var(--accent-soft); border-color: rgba(255, 138, 61, 0.4); color: var(--text); }
.conv-item .conv-preview {
  display: block;
  /* One line, clipped — a long message must not reflow the sidebar. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}
.conv-item .conv-preview.is-empty { color: var(--text-faint); font-style: italic; }
.conv-item .conv-meta {
  display: block;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.empty { color: var(--text-faint); font-size: 12px; padding: 6px 0; }

/* ---- Chat ------------------------------------------------------------------ */

.chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }

.turn { display: flex; flex-direction: column; gap: 6px; max-width: 78%; }
.turn-user { align-self: flex-end; align-items: flex-end; }
.turn-assistant { align-self: flex-start; }
.turn-system { align-self: center; max-width: 90%; }

.bubble { padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn-user .bubble { background: var(--accent); color: #241000; border-bottom-right-radius: 4px; }
.turn-assistant .bubble { background: var(--bg-panel); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.turn-system .bubble {
  background: rgba(240, 115, 106, 0.08);
  border: 1px solid rgba(240, 115, 106, 0.35);
  color: #ffc9c4;
  font-size: 13px;
  border-radius: 10px;
}
.bubble:empty::after { content: '▍'; color: var(--text-faint); }

/* The "thinking…" row: shown while a turn is in flight, replaced by the reply. */
.bubble.thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
}
.thinking-label::after { content: '…'; }
.thinking-dots { display: inline-flex; gap: 4px; }
.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: thinking-bounce 1.2s ease-in-out infinite;
}
.thinking-dots i:nth-child(2) { animation-delay: 0.18s; }
.thinking-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes thinking-bounce {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-dots i { animation: pulse 1.4s ease-in-out infinite; }
}

.meta { font-size: 11px; color: var(--text-faint); font-family: var(--mono); }

.tools { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text-dim);
}
.tool-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.tool-chip.is-running .dot { animation: pulse 1s ease-in-out infinite; }
.tool-chip.is-ok .dot { background: var(--ok); }
.tool-chip.is-bad .dot { background: var(--bad); }
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.badge {
  align-self: flex-start;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(232, 194, 90, 0.12);
  border: 1px solid rgba(232, 194, 90, 0.4);
  color: var(--warn);
}

.confirm {
  border: 1px dashed rgba(232, 194, 90, 0.55);
  background: rgba(232, 194, 90, 0.07);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
}
.confirm strong { color: var(--warn); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

.suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 4px; flex: none; }
.suggestion {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 5px 11px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.suggestion:hover { border-color: var(--accent); color: var(--text); }

.composer { display: flex; gap: 10px; align-items: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--border); flex: none; }
.composer textarea { resize: none; max-height: 160px; }

/* ---- Voice input ------------------------------------------------------------ */

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

.btn-mic { padding: 7px 11px; line-height: 1; flex: none; }
.mic-glyph { font-size: 15px; filter: grayscale(1) brightness(1.6); }
/* Recording: the button itself is the indicator, so it reads at a glance. */
.btn-mic.is-recording {
  background: var(--bad);
  border-color: var(--bad);
  animation: mic-pulse 1.4s ease-in-out infinite;
}
.btn-mic.is-recording .mic-glyph { filter: none; }
.btn-mic.is-busy { opacity: 0.6; cursor: progress; }
/* Unavailable, but still clickable — the click is what explains why. */
.btn-mic.is-unavailable { opacity: 0.45; }
.btn-mic.is-unavailable:hover { border-color: var(--border-strong); }

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 115, 106, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(240, 115, 106, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .btn-mic.is-recording { animation: none; }
}

/* `display: flex` would otherwise win over the hidden attribute. */
.voice-state[hidden] { display: none; }
.voice-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px 6px;
  font-size: 12px;
  color: var(--text-dim);
  flex: none;
}
.voice-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  animation: pulse 1.2s ease-in-out infinite;
}
.voice-state.is-working .voice-dot { background: var(--accent); }
.voice-timer { font-family: var(--mono); color: var(--text-faint); margin-left: auto; }

/* ---- Inspector ------------------------------------------------------------- */

.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tab {
  background: none;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 5px 9px;
  cursor: pointer;
}
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.events { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.events li {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  overflow-wrap: anywhere;
  color: var(--text-dim);
}
.events .ev-type { color: var(--accent); }
.events li.ev-error { border-color: rgba(240, 115, 106, 0.4); }

.snippet { margin-top: 14px; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.snippet-head h3 { margin: 0; font-size: 12px; font-weight: 600; }
.snippet-head .route { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.snippet pre {
  margin: 6px 0 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

/* ---- Narrow screens -------------------------------------------------------- */

@media (max-width: 1100px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr); }
  .panel-right { display: none; }
}
@media (max-width: 780px) {
  body { height: auto; }
  .layout { grid-template-columns: 1fr; }
  .panel-chat { min-height: 70vh; }
}

/* ---- Failure attribution ---------------------------------------------------- */

.diagnostics {
  margin-top: 8px;
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.diag-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }

.src-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
/* One colour per culprit — the whole point is telling them apart at a glance. */
.src-ai { color: #7fb7ff; background: rgba(127, 183, 255, 0.1); }
.src-backend { color: #d79bff; background: rgba(215, 155, 255, 0.1); }
.src-db { color: #5fd0c0; background: rgba(95, 208, 192, 0.1); }
.src-request { color: var(--warn); background: rgba(232, 194, 90, 0.1); }
.src-server { color: var(--bad); background: rgba(240, 115, 106, 0.12); }
.src-unknown { color: var(--text-faint); }

.diag-meta { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.diag-summary { font-size: 12px; color: var(--text); }
.diag-hint { font-size: 12px; color: var(--text-dim); }

.diag-detail { font-size: 11px; }
.diag-detail summary { cursor: pointer; color: var(--text-faint); font-family: var(--mono); }
.diag-detail pre {
  margin: 6px 0 0;
  padding: 7px 9px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
}

/* ---- Control panel ---------------------------------------------------------- */

.stat-group { margin-bottom: 16px; }
.stat-group h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(38, 46, 57, 0.6);
  font-size: 12px;
}
.stat:last-child { border-bottom: none; }
.stat-key { color: var(--text-dim); white-space: nowrap; }
.stat-value {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}
.stat-ok { color: var(--ok); }
.stat-warn { color: var(--warn); }
.stat-bad { color: var(--bad); }

.control-errors-head { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }

.error-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  margin-top: 8px;
}
.error-card .diagnostics { border-left: none; padding-left: 0; margin-top: 6px; }
.error-when { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.error-request { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-top: 6px; }

/* ---- Tool switches ---------------------------------------------------------- */

.control-tools-head { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }

.tool-group { margin-bottom: 14px; }
.tool-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.tool-group-head h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(38, 46, 57, 0.6);
}
.tool-row:last-child { border-bottom: none; }
/* A tool the model is not being offered reads as inactive, whatever the reason. */
.tool-row.is-off .tool-name { color: var(--text-faint); text-decoration: line-through; }

.tool-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; cursor: pointer; min-width: 0; }
.tool-name { font-family: var(--mono); font-size: 11px; color: var(--text); overflow-wrap: anywhere; }

.tool-tag {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.tag-write { color: var(--warn); }
.tag-locked { color: var(--ok); }
.tag-unconfigured { color: var(--text-faint); }

.tool-toggle { width: auto; flex: none; accent-color: var(--accent); cursor: pointer; }
.tool-toggle:disabled { cursor: not-allowed; opacity: 0.5; }

/* ---- Endpoints behind a tool ------------------------------------------------ */

.tool-endpoints { margin: 0 0 6px 10px; }
.tool-endpoints > summary {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px 0;
  overflow-wrap: anywhere;
}
.tool-endpoints > summary.is-overridden { color: var(--warn); }

.endpoint-line { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }

.endpoint-editor {
  border-left: 2px solid var(--border-strong);
  padding: 6px 0 6px 8px;
  margin-top: 4px;
}
.endpoint-summary { font-size: 11px; color: var(--text-dim); }
.endpoint-url {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  overflow-wrap: anywhere;
  margin: 3px 0;
}
.endpoint-url.is-missing { color: var(--bad); }

.endpoint-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--warn);
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 5px;
}

.endpoint-controls { display: flex; gap: 4px; align-items: center; margin-top: 4px; }
.endpoint-controls select { width: auto; flex: none; font-size: 10px; padding: 3px 4px; }
.endpoint-controls input { font-family: var(--mono); font-size: 10.5px; padding: 3px 6px; }
.endpoint-controls .btn { padding: 3px 8px; font-size: 10.5px; }

/* ---- Tools defined from the console ----------------------------------------- */

.control-custom-head { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }

.custom-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
}
.custom-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.custom-description { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }
.custom-meta { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-top: 4px; }

.new-tool {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 10px;
  background: var(--bg-panel);
}
.new-tool .nt-sub {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.param-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 4px;
  align-items: center;
  margin-top: 5px;
}
.param-row input, .param-row select { font-size: 11px; padding: 4px 6px; }
.param-row select { width: auto; }
.param-row > input:last-child { grid-column: 1 / -1; }
.param-required { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-faint); white-space: nowrap; }
.param-required input { width: auto; }

.nt-actions { display: flex; gap: 6px; margin-top: 12px; }
.nt-error {
  margin-top: 8px;
  font-size: 11.5px;
  color: #ffc9c4;
  background: rgba(240, 115, 106, 0.08);
  border: 1px solid rgba(240, 115, 106, 0.35);
  border-radius: 6px;
  padding: 6px 8px;
}

/* ---- Endpoint probe --------------------------------------------------------- */

.probe-params {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 12px 0;
  background: var(--bg-panel);
}
.probe-params .field { margin-top: 6px; }
.probe-params input { font-family: var(--mono); font-size: 11px; padding: 4px 7px; }

.probe-summary { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }

.probe-row {
  border-bottom: 1px solid rgba(38, 46, 57, 0.6);
  padding: 3px 0;
}
.probe-row:last-child { border-bottom: none; }
.probe-row > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 3px 0;
  list-style: none;
}
.probe-row > summary::-webkit-details-marker { display: none; }

.probe-badge {
  font-family: var(--mono);
  font-size: 10px;
  min-width: 34px;
  text-align: center;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid currentColor;
  flex: none;
}
.probe-badge.is-ok { color: var(--ok); }
.probe-badge.is-bad { color: var(--bad); }
.probe-badge.is-skipped { color: var(--text-faint); }

.probe-key { font-family: var(--mono); font-size: 11px; color: var(--text); flex: none; }
.probe-shape {
  font-size: 10.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.probe-detail { padding: 4px 0 8px 42px; display: flex; flex-direction: column; gap: 4px; }
.probe-detail pre {
  margin: 4px 0 0;
  padding: 8px 9px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 320px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
  white-space: pre-wrap;
}
.probe-detail .btn { align-self: flex-start; }

.check.is-muted { opacity: 0.5; }

/* ---- Sign-in ----------------------------------------------------------------
   An overlay rather than a separate page: the console is one document, and a
   second page would mean a second copy of the shell to keep in step. */

.login {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

/* `display: grid` above outranks the `display: none` the browser gives
   [hidden], so without this the overlay stays on screen after a successful
   sign-in — signed in, and still looking at the login form. */
.login[hidden] {
  display: none;
}

.login-card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.login-card h2 { margin: 0; font-size: 13px; color: var(--text); }
.login-sub { margin: -8px 0 0; font-size: 12px; color: var(--text-faint); }

.login-error {
  margin: 0;
  font-size: 12px;
  color: var(--bad);
}

.pill-operator {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---- API clients ------------------------------------------------------------ */

.new-client {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.new-client .field { flex: 1; }

/* Holds the one and only sighting of a client secret, so it is meant to be
   conspicuous rather than tidy. */
.secret-panel:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

.secret-notice {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.secret-value {
  display: block;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Compact variants, for controls that sit inside a card's own header rather
   than in a panel's toolbar. */
.btn-small {
  padding: 3px 9px;
  font-size: 11px;
}

/* A client that has been revoked: the row stays, because "which client was this,
   and when did we stop trusting it" is asked after an incident. */
.badge-off {
  background: rgba(240, 115, 106, 0.12);
  border-color: rgba(240, 115, 106, 0.4);
  color: var(--bad);
}

/* The live-thread indicator: lit while a stream is open and staff replies can
   arrive without a reload. Small on purpose — it reports a background fact, and
   an operator only looks at it when a reply did not turn up. */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: middle;
  margin-left: 6px;
}
.live-dot[hidden] { display: none; }
