/* ════════════════════════════════════════════════════════════════════════
   ThoughtSpot Embed Playground — tool UI
   Visual language: ThoughtSpot Security Compendium (navy · cyan · violet)
════════════════════════════════════════════════════════════════════════ */
:root {
  /* Surfaces */
  --bg:            #f5fafd;
  --surface:       #ffffff;
  --surface-2:     #f5fafd;
  --surface-3:     #eaf1f7;
  /* Borders */
  --border:        #e1ecf0;
  --border-light:  #c2d4dc;
  /* Brand palette */
  --navy:          #1a1f4a;
  --accent:        #00c9de;
  --accent-2:      #6366f1;
  --accent-soft:   #ecf7f9;
  --accent-border: #b8e0dd;
  /* Ink variants of the accent pair — #00c9de is 2.02:1 on white, so it must never
     carry text. These are the AA-safe text/fill twins (5.07:1 and 6.29:1 on white);
     the bright originals stay for dots, borders, glows and decorative fills. */
  --accent-ink:    #067a87;
  --accent-2-ink:  #4f46e5;
  --violet-soft:   #eef0fe;
  --violet-border: #c7cbf5;
  /* Text */
  --text-primary:  #1a1f4a;
  --text-secondary:#4a5573;
  --text-muted:    #5d698c; /* ≥4.5:1 on white — was #7a85a3 (~3.4:1, failed WCAG AA) */
  /* Status */
  --success:       #2d8b65;
  --success-soft:  #e6f4ed;
  --warn:          #c08930;
  --warn-soft:     #faf3e0;
  --danger:        #b85450;
  --danger-soft:   #fae9e8;
  /* Status borders — the literals these replace were repeated 16x across the sheet. */
  --success-border:#c0dccf;
  --warn-border:   #ead9a8;
  --danger-border: #ebcccc;
  /* Ink twins of the status colors: the ONLY status values allowed to carry text.
     As text the originals fail AA (on their *-soft fills: success 3.72, warn 2.76,
     danger 4.04). These clear 4.5:1 on white AND on their own *-soft fill. */
  --success-ink:   #1f6e4f;
  --warn-ink:      #8f5f17;
  --danger-ink:    #9c3f3b;
  /* Code */
  --code-bg:       #0a0f24;
  /* Layout */
  --topbar-h:      52px;
  --rail-w:        212px;
  --insp-w:        340px;
  --bp-collapsed:  40px;
  --bp-open:       300px;
  --radius:        9px;
  /* Fonts */
  --mono:          'JetBrains Mono', ui-monospace, monospace;
}

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

/* One keyboard-focus indicator for everything that doesn't paint its own.
   --accent is only 2.02:1 on white (below the 3:1 non-text floor of WCAG 1.4.11),
   so the outline uses --accent-ink (5.07:1) and the theme's signature soft halo
   sits outside it.

   The rule itself lives at the END of this file — see "Keyboard focus ring". At equal
   specificity the last declaration wins, and ~8 later rules set `outline: none`, which
   would otherwise cancel it. */

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Compendium-style left accent stripe */
body::before {
  content: '';
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  z-index: 1000;
  pointer-events: none;
}

[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ── App grid ────────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#workspace { flex: 1; display: grid; grid-template-columns: var(--rail-w) 1fr var(--insp-w); min-height: 0; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px; padding: 0 16px 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(26,31,74,.06);
}

.tb-brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14px; letter-spacing: -.2px; white-space: nowrap;
}
.tb-mark {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center; font-size: 12px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 2px 8px rgba(0,201,222,.3);
}
/* This is the document's <h1> (O11) — pin the UA heading size/weight back to the
   .tb-brand scale so the wordmark renders exactly as it did as a <span>. */
.tb-name { color: var(--navy); font-size: inherit; font-weight: inherit; line-height: inherit; }
.tb-beta {
  font-size: 10px; font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
  color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: 999px; padding: 1px 7px; line-height: 1.4;
}

/* Host + auth + Connect are fused into one segmented control — they submit together,
   so they should read as one thing. Status pill and Token-claims sit apart from it. */
.tb-connect { display: flex; align-items: center; gap: 0; flex: 1; max-width: 760px; }
/* min-width was 220px; the host input must be the cluster that shrinks, or the
   utilities on the right get squeezed until their labels wrap (O5). */
.tb-host { flex: 1 1 auto; min-width: 130px; border-radius: 8px 0 0 8px; }
#connect-btn { border-radius: 0 8px 8px 0; }
#auth-config-btn { margin-left: 8px; }
/* Now a direct topbar child (outside the 760px .tb-connect cap) so the connected
   "user · org" gets the free middle space; flex:0 0 auto keeps it from being
   squeezed to "…" by the host input beside it.
   Now flex:0 1 auto with a min-width floor: it must NOT be the first thing to
   shrink (the host input is), but with .tb-right pinned at flex:0 0 auto something
   in the middle has to give or the utilities get pushed off the right edge. */
#conn-status { flex: 0 1 auto; min-width: 104px; margin-left: 2px; }
.tb-host, .tb-auth {
  height: 34px; background: var(--bg); color: var(--text-primary);
  border: 1px solid var(--border-light); border-radius: 8px;
  padding: 0 11px; font-size: 13px;
  transition: border-color .18s;
}
.tb-host:focus { border-color: var(--accent); }
.tb-auth { border-radius: 0; border-left: none; cursor: pointer; appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235d698c'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 10px;
}

.tb-btn {
  height: 34px; padding: 0 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--text-secondary);
  border: 1px solid var(--border-light); white-space: nowrap; transition: border-color .18s, color .18s;
}
.tb-btn:hover { border-color: var(--accent); color: var(--accent-ink); }
.tb-btn-primary {
  background: linear-gradient(135deg, var(--accent-ink), var(--accent-2-ink));
  border: none; color: #fff;
  box-shadow: 0 2px 10px rgba(0,201,222,.3);
}
.tb-btn-primary:hover { opacity: .88; color: #fff; }

/* flex:0 0 auto — never shrink the utilities; .tb-host absorbs the squeeze. */
.tb-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.tb-status {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 20px; white-space: nowrap;
  max-width: 440px; overflow: hidden;
  letter-spacing: .02em;
}
/* Ellipsis lives on the label span — text-overflow doesn't apply to the flex
   container's bare text node, so a long "user · org" was hard-clipped mid-word. */
.tb-status-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Traffic-light dot — the connection state should be readable at a glance,
   before the text is. Matches the Event Log dot language. */
.tb-status::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex: 0 0 auto;
}
.tb-status[data-state="connecting"]::before { animation: status-pulse 1s ease-in-out infinite; }
@keyframes status-pulse { 50% { opacity: .3; } }
.tb-status[data-state="idle"]       { color: var(--text-muted);  background: var(--surface-3); }
.tb-status[data-state="connecting"] { color: var(--warn-ink);        background: var(--warn-soft);    border: 1px solid var(--warn-border); }
.tb-status[data-state="ok"]         { color: var(--success-ink);     background: var(--success-soft); border: 1px solid var(--success-border); }
.tb-status[data-state="error"]      { color: var(--danger-ink);      background: var(--danger-soft);  border: 1px solid var(--danger-border); }

.tb-icon-btn {
  height: 30px; padding: 0 11px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: transparent; color: var(--text-muted); border: 1px solid var(--border-light);
  white-space: nowrap;   /* the 30px fixed height cannot hold a wrapped label (O5) */
  transition: border-color .18s, color .18s;
}
.tb-icon-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
a.tb-icon-btn { display: inline-flex; align-items: center; text-decoration: none; }
.tb-icon-btn.on { color: var(--accent-ink); border-color: var(--accent-border); background: var(--accent-soft); }
.tb-div { width: 1px; height: 18px; background: var(--border-light); flex: 0 0 auto; }

/* "Display ▾" popover — show/hide optional panels (e.g. the beta Webhooks tab). */
.tb-menu { position: relative; }
.tb-menu-pop {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
  min-width: 210px; padding: 6px; border-radius: 9px;
  background: var(--surface); border: 1px solid var(--border-light);
  box-shadow: 0 8px 24px rgba(16,24,48,.14);
}
.tb-menu-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px;
  font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer;
}
.tb-menu-item:hover { background: var(--surface-2); }
.tb-menu-item input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.tb-menu-lbl { display: inline-flex; align-items: center; gap: 6px; }
.tb-reset:hover { color: var(--danger-ink); border-color: var(--danger-border); }
/* Armed state — first click asks, second click resets. */
.tb-reset.confirm,
.tb-reset.confirm:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

/* ── Embed rail ──────────────────────────────────────────────────────────── */
#rail {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 10px; overflow-y: auto;
}
#embed-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
/* Family headers — group the nine surfaces the way the SDK does. */
.rail-group {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em; color: var(--accent-ink);
  padding: 16px 8px 6px;
}
.rail-group:first-child { padding-top: 4px; }
.embed-item {
  padding: 8px 10px 8px 12px; border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  transition: background .15s;
}
.embed-item:hover { background: var(--surface-2); }
.embed-item.active { background: var(--accent-soft); }
.ei-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.ei-cls { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); }
/* Greyed out: the section needs the local Node relay, which isn't there (see
   applyLocalOnlyAvailability). Still hoverable — the tooltip explains why. */
.embed-item.unavailable { cursor: not-allowed; opacity: .45; }
.embed-item.unavailable:hover { background: none; }
.embed-item.active .ei-name { color: var(--navy); }
.embed-item.active .ei-cls { color: var(--accent-ink); }
/* A section that is part of the one above it (Customize Columns under Custom Liveboard). */
.embed-item--sub { margin-left: 12px; padding-left: 10px; border-left: 2px solid var(--border-light); border-radius: 0 8px 8px 0; }
.embed-item--sub.active { border-left-color: var(--accent); }
.rail-spacer { flex: 1; }
.rail-foot { padding: 8px; border-top: 1px solid var(--border); margin-top: 8px; }
.rail-credit { font-size: 10.5px; line-height: 1.45; color: var(--text-muted); }
.rail-credit-name { font-weight: 600; color: var(--text-primary); }

/* Rail hover tooltip — explains what each embed does. Body-anchored + fixed so
   it isn't clipped by #rail's overflow. */
.rail-tip {
  position: fixed; z-index: 200; max-width: 250px;
  padding: 9px 12px; border-radius: 9px;
  background: var(--navy); color: #fff;
  box-shadow: 0 10px 28px rgba(26, 31, 74, .28);
  pointer-events: none; opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity .12s ease, transform .12s ease;
}
.rail-tip[data-show="true"] { opacity: 1; transform: translateY(-50%) translateX(0); }
.rail-tip::before {
  content: ''; position: absolute; top: 50%; left: -4px;
  width: 9px; height: 9px; background: var(--navy);
  transform: translateY(-50%) rotate(45deg); border-radius: 2px;
}
.rail-tip-title { font-size: 12.5px; font-weight: 700; margin-bottom: 4px; }
.rail-tip-cls { font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--accent); }
.rail-tip-body { font-size: 12px; line-height: 1.5; color: rgba(255, 255, 255, .82); }

/* ── Stage ───────────────────────────────────────────────────────────────── */
/* min-height:0 on both the grid item (#stage) and the flex child (#embed-area) is REQUIRED:
   without it their default min-height:auto lets them grow to content height, so when fullHeight
   makes the embed tall they expand instead of letting #embed-area's overflow-y:auto scroll. */
#stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#embed-area { position: relative; flex: 1; min-height: 0; background: #fff; overflow: hidden; }
#ts-embed-container { position: absolute; inset: 0; width: 100%; height: 100%; }
#ts-embed-container iframe { width: 100% !important; border: none; }
/* Default: pin the iframe to fill the fixed-height stage. Scoped to :not(.full-height) so it does
   NOT clobber the inline content-height the SDK sets when fullHeight is on. */
#embed-area:not(.full-height) #ts-embed-container iframe { height: 100% !important; }
/* fullHeight:true — the SDK grows the iframe to the Liveboard's full content height and expects the
   host to scroll. Let #embed-area scroll and the container/iframe flow to that height instead of
   being clipped to the container. app.js toggles .full-height from the active fullHeight flag. */
#embed-area.full-height { overflow-y: auto; }
#embed-area.full-height #ts-embed-container { position: relative; inset: auto; width: 100%; height: auto; min-height: 100%; }

/* State overlay */
#state-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: #f8faff;
}
.st { display: none; flex-direction: column; align-items: center; text-align: center; max-width: 440px; padding: 36px; }
.st.active { display: flex; }
.st-icon { font-size: 40px; margin-bottom: 16px; opacity: .85; }
.st-title { font-size: 19px; font-weight: 700; margin-bottom: 8px; color: var(--navy); }
.st-sub { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; overflow-wrap: anywhere; } /* a long unbroken server error must not overflow the card */
/* What the shared link carries beyond the host (confirm-host overlay). */
.st-extras {
  list-style: none; margin: 12px 0 0; padding: 10px 14px; text-align: left;
  font-size: 12.5px; line-height: 1.7; color: var(--text-secondary);
  background: var(--surface-2, rgba(26,31,74,.04)); border-radius: 8px; width: 100%;
  word-break: break-word;
}
.st-actions { display: flex; gap: 10px; margin-top: 20px; align-items: center; }
.st-btn {
  height: 36px; padding: 0 18px; border-radius: 8px; font-size: 13px; font-weight: 600; border: none;
  background: linear-gradient(135deg, var(--accent-ink), var(--accent-2-ink)); color: #fff;
  box-shadow: 0 2px 10px rgba(0,201,222,.25);
}
.st-btn-ghost {
  background: transparent; border: 1px solid var(--border-light);
  color: var(--text-secondary); height: 36px; padding: 0 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
}
.st-link { font-size: 13px; color: var(--accent-ink); text-decoration: none; font-weight: 600; }
/* 1-2-3 walkthrough shown on the empty canvas (not-connected / needs states). */
.st-steps {
  display: flex; flex-direction: column; gap: 13px;
  margin-top: 26px; width: 100%; max-width: 360px; text-align: left;
}
/* Pending steps recede by COLOR, not opacity: opacity .5 took their text to ~2.4:1.
   --text-muted keeps them visibly secondary at ~5.2:1 on the stage background. */
.st-step { display: flex; gap: 12px; align-items: flex-start; }
.st-step:not(.st-step--current):not(.st-step--done) :is(.st-step-t, .st-step-d) { color: var(--text-muted); }
.st-step:not(.st-step--current):not(.st-step--done) .st-step-t { font-weight: 500; }
.st-step-n {
  width: 23px; height: 23px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; margin-top: 1px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  border: 1.5px solid var(--border-light); background: var(--surface); color: var(--text-muted);
}
.st-step--current .st-step-n {
  border-color: var(--accent-ink); background: var(--accent-ink); color: #fff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.st-step--done .st-step-n { border-color: var(--success-ink); background: var(--success-ink); color: #fff; }
.st-step-t { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.st-step--current .st-step-t { color: var(--navy); }
.st-step-d { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 1px; }

.st-spinner, .st-loading .st-spinner {
  width: 34px; height: 34px; border-radius: 50%; margin-bottom: 16px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading-overlay live progress checklist (renderLoadingProgress) */
.st-progress { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; text-align: left; min-width: 230px; }
.lp-step { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-muted); }
.lp-step.lp-done { color: var(--text-secondary); }
.lp-step.lp-active { color: var(--navy); font-weight: 600; }
.lp-step.lp-failed { color: var(--danger-ink); font-weight: 600; }
.lp-mark {
  width: 16px; height: 16px; flex: 0 0 auto; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 700;
  border: 1.5px solid var(--border-light); color: var(--text-muted); background: var(--surface);
}
.lp-done .lp-mark { border-color: var(--success-ink); background: var(--success-ink); color: #fff; }
.lp-failed .lp-mark { border-color: var(--danger); background: var(--danger); color: #fff; }
/* Active step: a small pulsing spinner in place of the mark glyph. */
.lp-active .lp-mark {
  border: 1.5px solid var(--border); border-top-color: var(--accent);
  background: transparent; animation: spin .8s linear infinite;
}

/* ── Bottom panel ────────────────────────────────────────────────────────── */
#bottom {
  flex: 0 0 auto; background: var(--surface);
  border-top: 1px solid var(--border); display: flex; flex-direction: column;
}
.bp-head {
  height: var(--bp-collapsed); display: flex; align-items: center;
  justify-content: space-between; padding: 0 12px;
}
.bp-tabs { display: flex; gap: 4px; }
.bp-tab {
  height: 27px; padding: 0 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  background: transparent; color: var(--text-muted); border: none;
  display: flex; align-items: center; gap: 7px;
  transition: background .15s, color .15s;
}
.bp-tab.active { background: var(--accent-soft); color: var(--navy); }
.bp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.tab-ico { flex-shrink: 0; display: block; }
/* "beta" pill on the (experimental) Webhooks tab — same language as the topbar brand beta. */
.bp-beta {
  font-size: 8.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: var(--accent-ink); border: 1px solid var(--accent-border);
  border-radius: 999px; padding: 1px 5px; line-height: 1.3;
}
.bp-count {
  font-family: var(--mono); font-size: 10.5px; background: var(--surface-3);
  color: var(--text-muted); border-radius: 10px; padding: 1px 7px;
}
.bp-head-r { display: flex; align-items: center; gap: 8px; }
.bp-mini {
  height: 26px; padding: 0 10px; border-radius: 6px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
  transition: color .15s;
}
.bp-mini:hover { color: var(--text-primary); }
.bp-chevron { background: none; border: none; color: var(--text-muted); font-size: 12px; transition: transform .2s; }
.bp-chevron.open { transform: rotate(180deg); }
.bp-body { height: 0; overflow: hidden; transition: height .2s ease; }
#bottom[data-open="true"] .bp-body { height: var(--bp-open); border-top: 1px solid var(--border); }
/* Full screen: the panel (code, lifecycle, APIs…) covers the whole window. Esc exits.
   z 120: above the rail/topbar/inspector dropdowns (50/60) but BELOW toasts (150) and
   modals (200), so the payload/email dialogs and "copied" toasts still show over it. */
#bottom[data-expanded="true"] {
  /* !important: beats the phone layout's fixed bottom-sheet offsets (top: 34vh). */
  position: fixed; inset: 0 !important; z-index: 120; border-top: none;
}
#bottom[data-expanded="true"] .bp-body { height: calc(100vh - var(--bp-collapsed)) !important; height: calc(100dvh - var(--bp-collapsed)) !important; flex: 1 1 auto; }
#bottom[data-expanded="true"] #bp-toggle { display: none; }
.bp-pane { display: none; height: 100%; overflow: auto; }
.bp-pane.active { display: block; }

/* Event log */
.log-list { padding: 8px 12px; font-family: var(--mono); font-size: 11.5px; }
.log-empty { color: var(--text-muted); padding: 14px; font-family: 'Inter', sans-serif; font-size: 12.5px; }
.log-row {
  display: grid; grid-template-columns: 64px 130px 1fr; gap: 10px;
  padding: 5px 0; border-bottom: 1px solid var(--border);
}
.lr-time { color: var(--text-muted); }
.lr-type { color: var(--accent-ink); font-weight: 700; }
.lr-data { color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }

/* ── Webhook Inbox ───────────────────────────────────────────────────────── */
.wh-list { padding: 14px; display: flex; flex-direction: column; gap: 12px; }

/* Empty / receiver-off states */
.wh-empty { padding: 26px 16px; text-align: center; }
.wh-empty-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.wh-empty-sub { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.wh-hint { padding: 14px 16px; border: 1px dashed var(--border); border-radius: 10px; background: var(--surface-2); }
.wh-hint-title { font-weight: 700; font-size: 13px; color: var(--text-primary); }
.wh-hint-sub { font-size: 12px; color: var(--text-muted); margin: 3px 0 9px; }
.wh-hint-steps { margin: 0; padding-left: 18px; font-family: var(--mono); font-size: 11px; color: var(--text-secondary); line-height: 1.85; }
.wh-hint-steps li { word-break: break-word; }
.wh-hint-foot { margin-top: 9px; font-size: 11px; color: var(--text-muted); }

/* Toolbar */
.wh-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--surface-3); }
.wh-toolbar-hint { font-size: 11.5px; color: var(--text-muted); }

/* Summary strip — stat tiles + one-line caption */
.wh-sum { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.wh-sum-stats { display: flex; flex-wrap: wrap; gap: 24px; }
.wh-sum-tile { display: flex; flex-direction: column; gap: 2px; }
.wh-sum-num { font-family: var(--mono); font-size: 21px; font-weight: 800; line-height: 1; color: var(--accent-ink); }
.wh-sum-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.wh-sum-tile--warn .wh-sum-num { color: var(--warn-ink); }
.wh-sum-tile--warn .wh-sum-label { color: var(--warn-ink); font-weight: 600; }
.wh-sum-caption { margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

/* Card shell + classic head (KPI / generic) */
.wh-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.wh-card-head { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-3); }
.wh-type { font-weight: 700; font-size: 12px; color: var(--accent-ink); flex: 1; word-break: break-word; }
.wh-time { font-family: var(--mono); font-size: 11px; color: var(--text-muted); }
.wh-badge { font-family: var(--mono); font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.wh-badge--ok { color: var(--success-ink); background: color-mix(in srgb, var(--success) 16%, transparent); }
.wh-badge--warn { color: var(--warn-ink); background: color-mix(in srgb, var(--warn) 16%, transparent); }

/* ⓘ button — opens the raw payload in a modal (see .wh-payload-modal) */
.wh-ibtn { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); cursor: pointer; font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.wh-ibtn:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }

/* Scheduled-Liveboard batching card */
.wh-lbc-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-3); }
.wh-pill { flex: none; font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: .05em; padding: 3px 9px; border-radius: 6px; color: #fff; white-space: nowrap; }
.wh-pill--batched { background: var(--success-ink); }
.wh-pill--peruser { background: var(--accent-ink); }
.wh-lbc-who { flex: 1; font-size: 13px; font-weight: 700; color: var(--text-primary); word-break: break-word; }
.wh-lbc-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 12px 0; }
.wh-lbc-lb { font-size: 12px; font-weight: 600; color: var(--accent-ink); text-decoration: none; }
a.wh-lbc-lb:hover { text-decoration: underline; }
.wh-lbc-meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); }
.wh-lbc-tag { font-family: var(--mono); font-size: 9px; font-weight: 700; color: var(--text-muted); border: 1px solid var(--border); border-radius: 8px; padding: 1px 6px; }
.wh-lbc-body { padding: 11px 12px 12px; display: flex; flex-direction: column; gap: 11px; }
.wh-lbc-why { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.wh-lbc-dl { display: flex; flex-wrap: wrap; gap: 8px; }

/* Recipient chips */
.wh-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wh-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface-3); }
.wh-chip--user { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.wh-chip--ext { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.wh-chip-tag { font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .03em; padding: 1px 5px; border-radius: 7px; color: #fff; }
.wh-chip--user .wh-chip-tag { background: var(--accent); }
.wh-chip--ext .wh-chip-tag { background: var(--success); }
.wh-chip-name { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.wh-chip-email { font-family: var(--mono); font-size: 10px; color: var(--text-muted); }
.wh-chip-more { font-size: 11px; color: var(--text-muted); align-self: center; }

/* Download link (also used by KPI cards' report links) */
.wh-file, .wh-link { font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 7px; text-decoration: none; color: var(--navy); background: var(--accent-soft); border: 1px solid var(--border); white-space: nowrap; }
.wh-file:hover, .wh-link:hover { background: var(--accent-ink); color: #fff; }

/* KPI-alert card */
.wh-kpi { padding: 12px; }
.wh-kpi-title { font-weight: 800; font-size: 14px; color: var(--text-primary); margin-bottom: 10px; }
.wh-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px 16px; }
.wh-kpi-field { display: flex; flex-direction: column; gap: 2px; }
.wh-kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.wh-kpi-value { font-size: 13px; color: var(--text-primary); font-weight: 600; word-break: break-word; }
.wh-kpi-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.wh-json { margin: 0; padding: 12px; font-family: var(--mono); font-size: 11px; line-height: 1.55; color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; }

/* Raw-payload viewer (centered modal) — wider than the default dialog for JSON */
.wh-payload-panel { width: 720px; max-width: 94vw; }
.wh-payload-head-actions { display: flex; align-items: flex-start; gap: 10px; }
.wh-payload-modal { margin: 0; font-family: var(--mono); font-size: 11.5px; line-height: 1.6; color: var(--text-secondary); white-space: pre; overflow: auto; max-height: 62vh; padding: 14px 16px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 8px; }

/* ✉ per-recipient email composer (preview only) */
.wh-ibtn--email { font-size: 11px; }
.wh-email-panel { width: 640px; max-width: 94vw; }
.wh-email-body { gap: 14px; }
.wh-email-editor { display: flex; flex-direction: column; gap: 10px; }
.wh-email-lbl { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.wh-email-input, .wh-email-textarea { width: 100%; padding: 8px 10px; font-size: 12.5px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); font-family: inherit; }
.wh-email-textarea { resize: vertical; line-height: 1.55; }
.wh-email-input:focus, .wh-email-textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.wh-email-vars { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.wh-email-vars code { font-family: var(--mono); font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-secondary); }
.wh-email-count { font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.wh-email-previews { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.wh-email-card { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); padding: 11px 12px; display: flex; flex-direction: column; gap: 7px; }
.wh-email-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wh-email-k { flex: none; width: 52px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); font-weight: 700; }
.wh-email-v { font-size: 12.5px; color: var(--text-primary); word-break: break-word; }
.wh-email-subjline { font-weight: 700; }
.wh-email-tag { font-family: var(--mono); font-size: 9px; font-weight: 800; letter-spacing: .03em; padding: 1px 5px; border-radius: 7px; color: #fff; }
.wh-email-tag--user { background: var(--accent); }
.wh-email-tag--ext { background: var(--success); }
.wh-email-preview-body { margin: 4px 0 0; padding: 10px 12px; font-family: inherit; font-size: 12px; line-height: 1.55; color: var(--text-secondary); white-space: pre-wrap; word-break: break-word; background: var(--surface-3); border: 1px solid var(--border); border-radius: 7px; }
.wh-email-attach { display: flex; }
.wh-email-foot { align-items: center; gap: 12px; }
.wh-email-note { flex: 1; font-size: 10.5px; color: var(--text-muted); line-height: 1.5; }
.wh-email-send { font-size: 12.5px; font-weight: 700; padding: 8px 18px; border-radius: 7px; cursor: pointer; color: #fff; background: var(--accent-ink); border: 1px solid var(--accent-ink); white-space: nowrap; }
.wh-email-send:disabled { opacity: .45; cursor: not-allowed; }

/* Inline "APIs used" panel inside the 🔔 Webhooks tab */
.wh-apis { padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.wh-apis-intro { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 10px; }
.wh-apis-intro strong { color: var(--text-secondary); font-weight: 700; }
.wh-apis .api-group { margin: 0; }
.wh-apis-foot { margin-top: 8px; font-size: 11px; color: var(--text-muted); }

/* In-app recipient editor */
.wh-composer { padding: 14px; border-bottom: 1px solid var(--border); background: var(--surface-3); display: flex; flex-direction: column; gap: 14px; }
.wh-comp-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.wh-comp-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.wh-comp-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.wh-comp-close { flex: none; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); cursor: pointer; font-size: 12px; line-height: 1; }
.wh-comp-close:hover { color: var(--text-primary); border-color: var(--accent); }
.wh-comp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 16px; }
.wh-comp-field { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border); }
.wh-comp-field--emails  { border-left-color: var(--success); }
.wh-comp-field--users   { border-left-color: var(--accent); }
.wh-comp-field--groups  { border-left-color: var(--accent-2); }
.wh-comp-field--blocked { border-left-color: var(--warn); }
.wh-comp-label { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wh-comp-label-t { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.wh-comp-label-h { font-size: 10.5px; color: var(--text-muted); }
.wh-comp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wh-comp-input { flex: 1; min-width: 130px; padding: 6px 10px; font-size: 12px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); }
.wh-comp-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.wh-comp-num { width: 56px; padding: 6px; font-size: 12px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary); }
.wh-comp-add { font-size: 11px; font-weight: 700; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--navy); background: var(--accent-soft); border: 1px solid var(--border); }
.wh-comp-add:hover { background: var(--accent-ink); color: #fff; border-color: var(--accent-ink); }
.wh-comp-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.wh-comp-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 9px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: 11.5px; color: var(--text-primary); }
.wh-comp-chip--emails  { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.wh-comp-chip--users   { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.wh-comp-chip--groups  { border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border)); }
.wh-comp-chip--blocked { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--warn) 60%, transparent); }
.wh-comp-chip-t { line-height: 1.3; }
.wh-comp-x { border: none; background: transparent; cursor: pointer; font-size: 15px; line-height: 1; color: var(--text-muted); padding: 0 3px; border-radius: 50%; }
.wh-comp-x:hover { color: var(--warn-ink); }
.wh-comp-empty { font-size: 11px; color: var(--text-muted); font-style: italic; }
.wh-comp-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 9px; background: var(--surface); border: 1px dashed var(--border); }
.wh-comp-preview-arrow { font-family: var(--mono); font-weight: 800; color: var(--accent-ink); }
.wh-comp-preview-lead { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.wh-comp-preview-empty { font-size: 11.5px; color: var(--text-muted); font-style: italic; }
.wh-comp-pill { font-family: var(--mono); font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-secondary); background: var(--surface-2); }
.wh-comp-pill--ext     { color: var(--success-ink); border-color: color-mix(in srgb, var(--success) 40%, var(--border)); background: var(--success-soft); }
.wh-comp-pill--user    { color: var(--accent-ink); border-color: var(--accent-border); background: var(--accent-soft); }
.wh-comp-pill--blocked { color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: var(--warn-soft); }
.wh-comp-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wh-comp-send { font-size: 12.5px; font-weight: 600; padding: 8px 16px; border-radius: 7px; cursor: pointer; color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.wh-comp-send:hover:not(:disabled) { color: var(--text-primary); }
.wh-comp-send:disabled { opacity: .5; cursor: not-allowed; }
.wh-comp-real { font-size: 12.5px; font-weight: 700; padding: 8px 18px; border-radius: 7px; cursor: pointer; color: #fff; background: var(--accent-ink); border: 1px solid var(--accent-ink); white-space: nowrap; }
.wh-comp-real:hover:not(:disabled) { filter: brightness(1.06); }
.wh-comp-real:disabled { opacity: .5; cursor: not-allowed; }
.wh-comp-note { flex: 1 1 100%; min-width: 220px; font-size: 10.5px; color: var(--text-muted); line-height: 1.5; }
.wh-comp-msg { margin: 6px 0 2px; }
.wh-comp-msg-input {
  width: 100%; box-sizing: border-box; margin-top: 6px; padding: 8px 10px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-primary);
  font-family: inherit; font-size: 12.5px; line-height: 1.5; resize: vertical;
}
.wh-comp-msg-input:focus { outline: none; border-color: var(--accent); }
.wh-comp-realhint { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent-soft); }
.wh-comp-realhint--error { border-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, transparent); }
.wh-comp-realhint--error .wh-comp-realhint-t { color: var(--warn-ink); }
.wh-comp-realhint--error .wh-comp-realhint-b { word-break: break-word; }
.wh-comp-realhint-t { font-weight: 700; font-size: 12.5px; color: var(--navy); margin-bottom: 6px; }
.wh-comp-realhint-b { font-size: 12px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 8px; }

/* SDK code view — keep dark like compendium code blocks */
.code-view {
  padding: 16px 18px; font-family: var(--mono); font-size: var(--code-fs, 12px);
  line-height: 1.7; color: #e8eaf2; white-space: pre;
  background: var(--code-bg); min-height: 100%;
  /* grow to the widest line so the dark bg covers the full horizontal scroll */
  box-sizing: border-box; width: max-content; min-width: 100%;
}

/* Syntax colours (the code view is dark in both themes). Comments get their own colour so the
   explanations read apart from the code; section-header comments (// ── …) are bolder. */
.code-view .tk-com { color: #7fb77e; font-style: italic; }
.code-view .tk-hdr { color: #9fd49e; font-style: normal; font-weight: 700; }
.code-view .tk-str { color: #e9a97a; }
.code-view .tk-kw  { color: #c99cf0; }
.code-view .tk-num { color: #b5d8a8; }
.code-view .tk-re  { color: #e8c86b; }

/* ── SDK Lifecycle flow diagram ──────────────────────────────────────────── */
.flow { padding: 16px 18px; }
.flow-lanes {
  display: flex; gap: 8px; margin-bottom: 16px;
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
}
.flow-lane {
  flex: 1; text-align: center; padding: 7px 6px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.flow-lane[data-lane="host"]   { border-color: var(--accent-border); color: var(--accent-ink); background: var(--accent-soft); }
.flow-lane[data-lane="iframe"] { border-color: #c8c9f0; color: var(--accent-2-ink); background: #eeeefb; }
.flow-lane[data-lane="server"] { border-color: var(--warn-border); color: var(--warn-ink); background: var(--warn-soft); }

.flow-steps { display: flex; flex-direction: column; gap: 0; }
.flow-step {
  display: grid; grid-template-columns: 34px 84px 1fr; gap: 12px; align-items: start;
  padding: 11px 0; position: relative;
}
/* connector line down the gutter */
.flow-step:not(:last-child)::before {
  content: ''; position: absolute; left: 16px; top: 34px; bottom: -11px;
  width: 2px; background: var(--border); z-index: 0;
}
.flow-step.done:not(:last-child)::before { background: var(--success); }

.fs-dot {
  width: 34px; height: 34px; border-radius: 50%; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  border: 2px solid var(--border); background: var(--surface); color: var(--text-muted);
  transition: all .25s ease;
}
.flow-step.active .fs-dot {
  border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-soft); animation: fs-pulse 1.2s ease-in-out infinite;
}
.flow-step.done .fs-dot { border-color: var(--success-ink); background: var(--success-ink); color: #fff; }
.flow-step.failed .fs-dot { border-color: var(--err, #c0392b); background: var(--err, #c0392b); color: #fff; }
@keyframes fs-pulse { 0%,100% { box-shadow: 0 0 0 3px var(--accent-soft); } 50% { box-shadow: 0 0 0 7px transparent; } }

.fs-lane {
  font-family: var(--mono); font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; padding: 3px 6px; border-radius: 5px; text-align: center;
  align-self: start; margin-top: 6px; white-space: nowrap;
}
.fs-lane[data-lane="host"]   { color: var(--accent-ink);   background: var(--accent-soft); }
.fs-lane[data-lane="iframe"] { color: var(--accent-2-ink); background: #eeeefb; }
.fs-lane[data-lane="server"] { color: var(--warn-ink);     background: var(--warn-soft); }

.fs-body { padding-top: 3px; }
.fs-title { font-size: 13px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.fs-evt { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); font-weight: 500; }
.flow-step.done .fs-evt { color: var(--success-ink); }
.flow-step.active .fs-evt { color: var(--accent-ink); }
.fs-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.55; margin-top: 3px; }
.fs-pending { opacity: .5; }
.flow-foot {
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-muted); line-height: 1.6;
}

/* ── Inspector ───────────────────────────────────────────────────────────── */
#inspector {
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.insp-head {
  height: var(--topbar-h); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.insp-title { font-size: 13.5px; font-weight: 700; color: var(--navy); }
.insp-badge {
  font-family: var(--mono); font-size: 10.5px; color: var(--accent-ink);
  letter-spacing: .08em; text-transform: uppercase;
}
.insp-reset {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 14px; transition: color .15s, border-color .15s;
}
.insp-reset:hover { color: var(--danger-ink); border-color: var(--danger-border); }
.insp-body { flex: 1; overflow-y: auto; padding: 10px; }

/* Intent headers between accordion clusters: Data · Behavior · Appearance. */
.insp-group-lbl {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em; color: var(--accent-ink);
  padding: 12px 4px 7px;
}
.insp-group-lbl:first-child { padding-top: 2px; }

/* Shown while disconnected — the pickers below are disabled, say why. */
.insp-offline {
  font-size: 11.5px; line-height: 1.55; color: var(--text-secondary);
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--border-light);
  border-radius: 8px; padding: 9px 11px; margin: 2px 0 4px;
}
#inspector[data-connected="false"] .acc { background: var(--surface-2); }

/* Accordion */
.acc {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; overflow: hidden; background: var(--surface);
}
.acc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 13px; background: none; border: none; color: var(--text-primary);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.acc-head:hover { background: var(--surface-2); }
.acc-r { display: flex; align-items: center; gap: 8px; }
.acc-count { font-family: var(--mono); font-size: 10.5px; min-width: 18px; text-align: center; }
.acc-count:not(:empty) {
  background: var(--accent-ink); color: #fff; border-radius: 10px;
  padding: 1px 7px; font-weight: 700;
}
.acc-chev { color: var(--text-muted); font-size: 11px; transition: transform .2s; }
/* Direct-child scoping so a nested accordion's chevron/body isn't driven by an open PARENT. */
.acc.open > .acc-head .acc-chev { transform: rotate(90deg); }
.acc-body { display: none; padding: 4px 13px 14px; border-top: 1px solid var(--border); }
.acc.open > .acc-body { display: block; }
/* Nested sub-accordions (e.g. Custom styles sub-groups) rely on the parent's flex gap for spacing. */
.acc-body .acc { margin-bottom: 0; }
.sec-body { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.sec-note { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.sec-note--warn { color: var(--warn-ink); background: var(--warn-soft); border: 1px solid var(--warn-border); border-radius: 6px; padding: 8px 10px; margin-top: 6px; }
.sub-lbl {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .15em; color: var(--accent-ink);
  margin-top: 8px;
}

/* Fields */
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld-lbl { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.fld-hint { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
/* Compact collapsible guide: brief line + ⓘ toggle revealing the full help text. */
.fld-info { border: none; margin: 0; }
.fld-info-sum {
  list-style: none; cursor: pointer; display: flex; align-items: flex-start; gap: 7px;
  font-size: 11px; color: var(--text-muted); line-height: 1.5; border-radius: 6px;
  padding: 2px 3px; margin: -2px -3px; transition: color .15s, background .15s;
}
.fld-info-sum::-webkit-details-marker { display: none; }
.fld-info-sum:hover { color: var(--text-secondary); background: var(--violet-soft); }
.fld-info-brief { flex: 1 1 auto; }
.fld-info-i {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-top: 1px; border: 1px solid var(--border-light);
  border-radius: 50%; font-family: var(--mono); font-size: 9px; font-weight: 700;
  font-style: italic; line-height: 1; color: var(--text-muted); background: var(--surface);
  transition: color .15s, border-color .15s, background .15s;
}
.fld-info-sum:hover .fld-info-i,
.fld-info[open] .fld-info-i { color: var(--accent-2-ink); border-color: var(--accent-2); background: var(--violet-soft); }
.fld-info-body {
  margin-top: 6px; padding: 8px 11px; font-size: 11px; line-height: 1.55; color: var(--text-muted);
  border-left: 2px solid var(--violet-border); background: var(--violet-soft); border-radius: 0 6px 6px 0;
}
/* Self-updating guard notices in the token-claims panel (groups / auto-create). */
.guard-note { font-size: 11.5px; line-height: 1.55; border-radius: 6px; padding: 8px 10px; }
.guard-note code {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  background: rgba(26,31,74,.06); border-radius: 4px; padding: 1px 5px;
}
.guard-blocked { color: var(--warn-ink); background: var(--warn-soft); border: 1px solid var(--warn-border); }
.guard-ok {
  color: var(--text-secondary); background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--success);
}
.inp {
  height: 32px; background: var(--surface); border: 1px solid var(--border-light);
  border-radius: 7px; color: var(--text-primary); padding: 0 10px;
  font-size: 12.5px; outline: none; width: 100%; transition: border-color .18s;
}
.inp:focus { border-color: var(--accent); }
.inp-sm { height: 30px; font-size: 12px; }
select.inp { cursor: pointer; }

/* Custom dropdown (replaces native <select> so long lists never overflow off-screen) */
.sel { position: relative; }
.sel-btn {
  height: 32px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border-light); border-radius: 7px;
  color: var(--text-primary); font-size: 12.5px; font-family: inherit;
  padding: 0 28px 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='5'%3E%3Cpath d='M0 0l4.5 5L9 0z' fill='%235d698c'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 9px;
  transition: border-color .18s;
}
.sel-btn:hover, .sel-btn:focus { border-color: var(--accent); outline: none; }
.sel-btn--placeholder { color: var(--text-muted); }
.sel-btn:disabled {
  opacity: .55; cursor: not-allowed; background: var(--surface-2);
}
.sel-btn:disabled:hover { border-color: var(--border-light); }
.sel-panel {
  position: fixed; z-index: 1000; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(26,31,74,.16); padding: 5px; overflow: hidden;
}
.sel-search {
  height: 30px; flex: 0 0 auto; margin: 1px 1px 5px; padding: 0 9px;
  border: 1px solid var(--border-light); border-radius: 6px; background: var(--surface-2);
  font-size: 12.5px; font-family: inherit; color: var(--text-primary); outline: none;
}
.sel-search:focus { border-color: var(--accent); }
.sel-list { overflow-y: auto; }
.sel-item {
  padding: 6px 9px; border-radius: 5px; font-size: 12.5px; cursor: pointer;
  color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .12s;
}
.sel-item:hover { background: var(--accent-soft); color: var(--navy); }
.sel-item--active { background: var(--accent-soft); color: var(--navy); font-weight: 600; }
.sel-empty { padding: 8px 10px; font-size: 12px; color: var(--text-muted); font-style: italic; }
/* Manual-GUID entry (allowCustom pickers): the "Use …" commit row, the raw-id button label,
   the dashed "list unavailable, GUID only" button, and the panel's disconnected note. */
.sel-item--custom { color: var(--accent-ink); border-top: 1px solid var(--border); margin-top: 3px; padding-top: 8px; font-size: 12px; }
.sel-item--custom:hover { background: var(--accent-soft); color: var(--accent-ink); }
.sel-item-custom-icon { font-weight: 700; margin-right: 3px; }
.sel-btn--rawid { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.sel-btn--guidonly { border-style: dashed; }
.sel-note { padding: 5px 9px 6px; font-size: 11.5px; color: var(--text-muted); }
textarea.inp { height: auto; padding: 8px 10px; line-height: 1.5; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Toggle */
.tgl {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--text-primary); cursor: pointer;
}
.tgl input { display: none; }
.tgl-slider {
  width: 36px; height: 20px; background: var(--border-light); border-radius: 20px;
  position: relative; transition: background .2s; flex: 0 0 auto;
}
.tgl-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(26,31,74,.2); transition: transform .2s;
}
.tgl input:checked + .tgl-slider { background: var(--accent); }
.tgl input:checked + .tgl-slider::after { transform: translateX(16px); }

/* Action table */
.act-tbl { display: flex; flex-direction: column; }
.act-hdr, .act-row { display: grid; grid-template-columns: 1fr 44px 54px; align-items: center; gap: 4px; padding: 5px 0; }
.act-hdr {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em;
  border-bottom: 1px solid var(--border);
}
.act-hdr span:not(:first-child), .act-row input { justify-self: center; }
.act-name { font-size: 12.5px; color: var(--text-primary); min-width: 0; overflow-wrap: anywhere; }
.act-row { border-bottom: 1px solid var(--border); }
.act-row input { width: 15px; height: 15px; accent-color: var(--accent); }

/* Rows (filters / params / styles) */
.rows { display: flex; flex-direction: column; gap: 7px; }
.frow { display: flex; gap: 6px; align-items: center; }
.frow .inp { flex: 1; }
/* Typed runtime-filter row rendered as a card: column + ✕ (line 1) · type | operator (line 2) · value (line 3). */
.frow--typed {
  flex-direction: column; align-items: stretch; gap: 7px;
  padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); transition: border-color .15s, box-shadow .15s, background .15s;
}
.frow--typed:focus-within { background: var(--surface); border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.frow-head { display: flex; gap: 6px; align-items: center; }
.frow-head .frow-col { flex: 1; min-width: 0; font-weight: 600; }
.frow-controls { display: flex; gap: 6px; }
.frow-controls .frow-type { flex: 0 0 88px; }
.frow-controls .frow-op { flex: 1; min-width: 0; }
.frow--typed .frow-valwrap { display: flex; gap: 6px; }
.frow--typed .frow-valwrap .inp { flex: 1; min-width: 0; }
/* Empty state when no filters are configured yet. */
.frow-empty {
  font-size: 11.5px; color: var(--text-muted); text-align: center; line-height: 1.5;
  padding: 14px 12px; border: 1px dashed var(--border-light); border-radius: 8px;
  background: var(--surface-2);
}
.frow-x {
  width: 28px; height: 30px; flex: 0 0 auto; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; transition: color .15s, border-color .15s;
}
.frow-x:hover { color: var(--danger-ink); border-color: var(--danger-border); background: var(--danger-soft); }
.frow-go {
  width: 34px; height: 30px; flex: 0 0 auto; border-radius: 6px;
  background: var(--accent-ink); border: none; color: #fff; font-size: 14px;
}
.sec-add {
  align-self: flex-start; padding: 7px 12px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px dashed var(--border-light);
  color: var(--text-secondary); transition: color .15s, border-color .15s;
}
.sec-add:hover { color: var(--accent-ink); border-color: var(--accent-border); }
.sec-apply {
  padding: 9px 14px; border-radius: 7px; font-size: 12.5px; font-weight: 600;
  background: linear-gradient(135deg, var(--accent-ink), var(--accent-2-ink));
  border: none; color: #fff;
  box-shadow: 0 2px 8px rgba(0,201,222,.2);
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 14px; background: var(--accent-soft);
  border: 1px solid var(--accent-border); font-size: 11.5px; color: var(--navy);
}
.chip-active { background: var(--accent-ink); color: #fff; border-color: var(--accent-ink); }
.chip-active .chip-x { color: rgba(255,255,255,.8); }
.chip-x { background: none; border: none; color: var(--text-muted); font-size: 10px; }
.chip-x:hover { color: var(--danger-ink); }

/* Secondary/ghost button — used for "Cancel edit" */
.sec-apply.ghost {
  background: none; color: var(--text-muted);
  border: 1px solid var(--accent-border); box-shadow: none; margin-top: 6px;
}

/* ── Modal (trusted auth) ────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; }
.modal-scrim { position: absolute; inset: 0; background: rgba(26,31,74,.25); backdrop-filter: blur(2px); }
.modal-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 460px; max-width: 92vw;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(26,31,74,.12);
  animation: slidein .22s ease;
}
@keyframes slidein { from { transform: translateX(24px); opacity: .6; } }
.modal-head {
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 12px;
  background: var(--surface);
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--navy); }
.modal-sub { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 4px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 16px; transition: color .15s; }
.modal-close:hover { color: var(--text-primary); }
.modal-body {
  flex: 1; overflow-y: auto; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 16px;
}

/* Centered dialog variant (Customize Export) — overrides the right slide-over anchoring */
.modal-panel--center {
  top: 50%; left: 50%; right: auto; bottom: auto;
  transform: translate(-50%, -50%);
  width: 440px; max-height: 88vh;
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(26,31,74,.22);
  animation: popin .18s ease;
}
@keyframes popin { from { transform: translate(-50%, -46%); opacity: .5; } }
.modal-foot {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface);
}
/* "View payload" slide-over — wider panel + raw JSON block */
.modal-panel--wide { width: 640px; }

/* Customize Columns dialog (js/custom-columns.js) — centered panel, two panes */
.cc-panel { width: 640px; max-width: calc(100vw - 32px); }
.cc-tools { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 18px 0; }
.cc-search { flex: 0 1 240px; }
.cc-panel .sec-apply, .cc-actions .sec-apply { margin-top: 0; }
.cc-panel .sec-apply:disabled, .cc-actions .sec-apply:disabled { opacity: .5; cursor: not-allowed; }
.cc-body { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 12px 18px; flex: 1; min-height: 0; overflow: hidden; }
.cc-pane { display: flex; flex-direction: column; min-height: 0; }
.cc-pane-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.cc-pane-head h3 { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.cc-list { list-style: none; margin: 0; padding: 0; overflow: auto; max-height: 52vh; }
.cc-check label { display: flex; gap: 10px; align-items: center; padding: 4px 2px; font-size: 13px; color: var(--text-primary); cursor: pointer; }
.cc-check.locked label { color: var(--text-muted); cursor: default; }
.cc-check input { width: 15px; height: 15px; accent-color: var(--accent-ink); }
.cc-row { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-radius: 6px; font-size: 13px; color: var(--text-primary); }
.cc-row[draggable="true"] { cursor: grab; }
.cc-row:hover { background: var(--surface-2); }
.cc-row.locked { color: var(--text-muted); }
.cc-row.dragging { opacity: .4; }
.cc-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.cc-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cc-group {
  font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted); padding: 10px 4px 4px;
}
.cc-grip, .cc-lock { color: var(--text-muted); width: 14px; display: inline-flex; justify-content: center; flex: 0 0 auto; }
.cc-remove {
  width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; display: inline-grid; place-items: center;
  font-size: 14px; line-height: 1; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border-light); cursor: pointer;
}
.cc-remove:hover { color: var(--danger-ink); border-color: var(--danger-border); }
.cc-tag { margin-left: auto; flex: 0 0 auto; font-size: 11px; color: var(--text-muted); }
.cc-link { background: none; border: 0; padding: 0; font-size: 12px; font-weight: 600; color: var(--accent-ink); cursor: pointer; }
.cc-hint, .cc-empty { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.cc-hint { margin-top: 8px; }
.cc-empty { padding: 6px 2px; }
.cc-err { margin-right: auto; align-self: center; font-size: 12px; color: var(--danger-ink); }
.cc-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
@media (max-width: 700px) { .cc-body { grid-template-columns: 1fr; overflow: auto; } }
.payload-json {
  margin: 0; padding: 12px 14px; flex: 1;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2, var(--bg)); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius);
  user-select: text;
}

/* Auth status card */
.auth-status {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 13px;
  display: flex; flex-direction: column; gap: 5px;
}
.as-row { display: flex; justify-content: space-between; font-size: 12px; }
.as-row > span:first-child { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.as-ok { color: var(--success-ink); font-weight: 600; }
.as-bad { color: var(--danger-ink); font-weight: 600; }
.as-allow { align-items: flex-start; }
.auth-chip {
  font-size: 11px; padding: 2px 9px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  color: var(--navy); margin: 0 0 4px 4px; transition: background .15s;
}
.auth-chip:hover { background: var(--accent-ink); color: #fff; border-color: var(--accent-ink); }

/* Trusted-auth setup guide (rendered under the status card by renderSetupGuide) */
#auth-setup-guide:empty { display: none; } /* don't leave a double flex-gap while loading */
.setup-ready {
  background: var(--success-soft); border: 1px solid #bfe0cf;
  border-radius: var(--radius); padding: 10px 13px;
}
.setup-ready-t { color: var(--success-ink); font-weight: 700; font-size: 12.5px; }
.setup-ready-d { color: var(--text-secondary); font-size: 12px; line-height: 1.5; margin-top: 3px; }
.setup-warn {
  color: var(--warn-ink); background: var(--warn-soft); border: 1px solid var(--warn-border);
  border-radius: 6px; padding: 8px 10px; font-size: 12px; line-height: 1.5; margin-top: 8px;
}
.setup-guide {
  background: var(--warn-soft); border: 1px solid var(--warn-border);
  border-radius: var(--radius); padding: 12px 14px;
}
.setup-guide-t { color: var(--warn-ink); font-weight: 700; font-size: 12.5px; margin-bottom: 9px; }
.setup-steps { margin: 0; padding-left: 19px; display: flex; flex-direction: column; gap: 10px; }
.setup-step { font-size: 12px; }
.setup-step::marker { color: var(--warn-ink); font-weight: 700; }
.setup-step-t { font-weight: 600; color: var(--text-primary); }
.setup-step-d { color: var(--text-secondary); line-height: 1.5; margin-top: 2px; }
.env-block { position: relative; margin-top: 6px; }
.env-block pre {
  font-family: var(--mono); font-size: 11px; line-height: 1.65;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  /* padding-right clears the absolutely-positioned Copy button; wrap instead of
     clipping so a long TS_SECRET_KEY line stays readable (O10). */
  padding: 9px 62px 9px 11px; margin: 0; overflow-x: auto;
  white-space: pre-wrap; word-break: break-all;
}
.env-block .bp-mini { position: absolute; top: 6px; right: 6px; }
.setup-secnote {
  margin-top: 7px; font-size: 11.5px; line-height: 1.5;
  color: var(--text-secondary); background: var(--surface);
  border: 1px solid var(--border); border-left: 3px solid var(--warn);
  border-radius: 6px; padding: 7px 10px;
}
.setup-recheck { margin-top: 10px; height: 30px; }
.auth-group {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.auth-group-t { font-size: 13px; font-weight: 700; color: var(--navy); }
.auth-sub {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; color: var(--accent-ink); margin-top: 4px;
}
.chips-editor { display: flex; flex-direction: column; gap: 7px; }
.auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.auth-actions .tb-btn { height: 38px; }

/* Token inspector */
.tok-inspect { display: flex; flex-direction: column; gap: 10px; }
.tok-block {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 9px 12px; overflow: hidden;
}
.tok-lbl {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--accent-ink); text-transform: uppercase; letter-spacing: .12em;
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
}
.tok-redact {
  background: var(--warn-soft); color: var(--warn-ink);
  border: 1px solid var(--warn-border); border-radius: 4px; padding: 1px 6px;
  font-size: 9.5px; font-weight: 700; text-transform: none; letter-spacing: 0;
}
.tok-exp { margin-left: auto; font-weight: 600; text-transform: none; color: var(--text-secondary); }
.tok-exp.warn { color: var(--warn-ink); }
.tok-block pre {
  font-family: var(--mono); font-size: 11px; line-height: 1.65;
  color: #e8eaf2; white-space: pre-wrap; word-break: break-all;
  background: var(--code-bg); padding: 10px 12px; border-radius: 6px;
  max-height: 160px; overflow: auto;
}
.tok-lbl .bp-mini { margin-left: auto; }
.tok-log { font-family: var(--mono); font-size: 11px; max-height: 120px; overflow: auto; }
.tok-empty { color: var(--text-muted); }
.tok-line { padding: 2px 0; border-bottom: 1px solid var(--border); }
.tl-t { color: var(--text-muted); }
.tl-ok { color: var(--success-ink); font-weight: 600; }
.tl-bad { color: var(--danger-ink); font-weight: 600; }
.tl-warn { color: var(--warn-ink); font-weight: 500; margin-top: 2px; white-space: normal; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
#toast-container {
  /* Sits above the collapsed bottom-panel bar (it used to cover the tab strip) and
     BELOW .modal (z-index 200) so an open dialog's scrim always wins (O7). */
  position: fixed; bottom: calc(var(--bp-collapsed) + 18px); left: 50%; transform: translateX(-50%);
  z-index: 150; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  padding: 10px 18px; border-radius: 9px; font-size: 13px; font-weight: 500;
  background: var(--navy); color: #fff; border-left: 4px solid var(--accent);
  box-shadow: 0 8px 24px rgba(26,31,74,.2);
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left-color: var(--success); }
.toast-warn    { border-left-color: var(--warn); }
.toast-error   { border-left-color: var(--danger); }
.toast-info    { border-left-color: var(--accent); }
.toast-busy    { border-left-color: var(--accent); display: inline-flex; align-items: center; gap: 9px; }
.toast-spinner {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.28); border-top-color: #fff;
  animation: cfb-spin .7s linear infinite;
}

/* ── Custom Liveboard filter bar ─────────────────────────────────────────── */
/* Host-rendered title + tabs ("Host header" layout) */
.cfb-hh { flex-shrink: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px 0; }
.cfb-hh-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.cfb-hh-actions { display: flex; align-items: center; gap: 8px; }
.cfb-hh-actions[hidden] { display: none; }
.cfb-hh-btn, .cfb-hh-ai { font: inherit; font-size: 12.5px; padding: 5px 12px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); }
.cfb-hh-ai { background: var(--accent-2); border-color: var(--accent-2); color: #fff; font-weight: 600; }
.cfb-hh-menuwrap { position: relative; }
.cfb-hh-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; min-width: 170px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.cfb-hh-menu[hidden] { display: none; }
.cfb-hh-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 10px; font: inherit; font-size: 12.5px; color: var(--text-primary); border-radius: 4px; cursor: pointer; }
.cfb-hh-menu button:hover, .cfb-hh-menu button:focus-visible { background: var(--accent-soft); }
.cfb-hh-title { margin: 0; font-size: 18px; font-weight: 600; color: var(--text-primary); }
.cfb-hh-tabs { display: flex; gap: 20px; overflow-x: auto; }
.cfb-hh-tab {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 0; margin-bottom: -1px;
  font: inherit; font-size: 13px; color: var(--text-secondary); cursor: pointer; white-space: nowrap;
}
.cfb-hh-tab.active { font-weight: 700; color: var(--text-primary); border-bottom-color: var(--accent-2); }
.cfb {
  flex-shrink: 0; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  padding: 10px 16px; display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
}
.cfb-heading {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .15em; color: var(--accent-ink);
  padding-bottom: 8px; white-space: nowrap;
}
.cfb-heading svg { opacity: .85; }
.cfb-dropdowns { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; flex: 1; min-width: 0; }
.cfb-loading {
  font-size: 12px; color: var(--text-muted); padding: 7px 2px;
  display: inline-flex; align-items: center; gap: 7px;
}
.cfb-loading::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: cfb-spin .7s linear infinite;
}
@keyframes cfb-spin { to { transform: rotate(360deg); } }

.cfb-col { display: flex; flex-direction: column; gap: 3px; position: relative; }
.cfb-col-label {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted);
}
.cfb-ms { position: relative; }
.cfb-toggle {
  height: 30px; padding: 0 26px 0 10px; border: 1px solid var(--border-light);
  border-radius: 7px; background: var(--surface-2); color: var(--text-primary);
  font-size: 12.5px; font-family: inherit; cursor: pointer; white-space: nowrap;
  min-width: 90px; max-width: 170px; text-align: left;
  overflow: hidden; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='5'%3E%3Cpath d='M0 0l4.5 5L9 0z' fill='%235d698c'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 9px;
  transition: border-color .15s;
}
.cfb-toggle:hover { border-color: var(--accent); }
.cfb-toggle--active { border-color: var(--accent); background: var(--accent-soft); color: var(--navy); }
.cfb-panel {
  position: absolute; top: calc(100% + 5px); left: 0; min-width: 170px;
  max-height: 240px; overflow-y: auto; background: var(--surface);
  border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(26,31,74,.12); z-index: 50; padding: 5px;
}
.cfb-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  border-radius: 5px; font-size: 12.5px; cursor: pointer; color: var(--text-primary);
  transition: background .12s;
}
.cfb-item:hover { background: var(--accent-soft); }
.cfb-item input { accent-color: var(--accent); cursor: pointer; }
.cfb-item--all {
  border-bottom: 1px solid var(--border); margin-bottom: 3px;
  padding-bottom: 7px; font-weight: 600; color: var(--text-secondary);
}
.cfb-empty { padding: 8px 10px; font-size: 12px; color: var(--text-muted); font-style: italic; }
.cfb-sort {
  display: flex; gap: 3px; padding: 2px 2px 6px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.cfb-sort-btn {
  flex: 1; height: 24px; padding: 0 6px; border: 1px solid var(--border-light);
  border-radius: 6px; background: var(--surface-2); color: var(--text-secondary);
  font-size: 11px; font-family: inherit; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s, color .15s;
}
.cfb-sort-btn:hover { border-color: var(--accent); }
.cfb-sort-btn--active { border-color: var(--accent); background: var(--accent-soft); color: var(--navy); font-weight: 600; }
.cfb-metric-cfg {
  display: flex; gap: 4px; align-items: center; padding: 0 2px 6px;
  margin-bottom: 4px; border-bottom: 1px solid var(--border);
}
.cfb-metric-cfg[hidden] { display: none; }
.cfb-metric-sel {
  height: 24px; min-width: 0; flex: 1; padding: 0 4px;
  border: 1px solid var(--border-light); border-radius: 6px;
  background: var(--surface-2); color: var(--text-secondary);
  font-size: 11px; font-family: inherit; cursor: pointer;
}
.cfb-metric-dir {
  height: 24px; padding: 0 7px; border: 1px solid var(--border-light);
  border-radius: 6px; background: var(--surface-2); color: var(--text-secondary);
  font-size: 11px; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.cfb-metric-dir:hover { border-color: var(--accent); }
.cfb-metric-warn {
  margin: 0 2px 6px; padding: 6px 8px; border-radius: 6px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
  font-size: 11px; line-height: 1.35;
}
.cfb-metric-warn[hidden] { display: none; }
.cfb-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfb-metric-val {
  margin-left: auto; padding-left: 8px; font-size: 11px; font-weight: 600;
  color: var(--accent-ink); font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.cfb-item--draggable { cursor: grab; }
.cfb-item--draggable.cfb-dragging { opacity: .45; background: var(--accent-soft); }
.cfb-drag {
  color: var(--text-muted); font-size: 11px; line-height: 1; cursor: grab;
  user-select: none; margin-right: -2px;
}
.cfb-remove {
  position: absolute; top: -5px; right: -5px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--border-light); border: none;
  color: var(--text-muted); font-size: 11px; cursor: pointer;
  display: none; align-items: center; justify-content: center; line-height: 1;
}
.cfb-col:hover .cfb-remove { display: flex; }
.cfb-remove:hover { background: var(--danger-soft); color: var(--danger-ink); }
/* Right-side action cluster — separated from the filter group by a divider. */
.cfb-actions {
  display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0;
  padding-left: 14px; margin-left: auto;
  border-left: 1px solid var(--border);
}
.cfb-clear {
  height: 30px; padding: 0 12px; border-radius: 7px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; font-family: inherit;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.cfb-clear:hover { border-color: var(--accent); color: var(--accent-ink); }

/* Export split-button: format select + primary action, fused into one control. */
.cfb-export-group { display: inline-flex; align-items: stretch; }
.cfb-format {
  height: 30px; padding: 0 6px 0 10px; font-size: 12px; font-family: inherit;
  border: 1px solid var(--accent); border-right: none;
  border-radius: 7px 0 0 7px; cursor: pointer;
  background: var(--accent-soft); color: var(--navy);
  transition: background .15s;
}
.cfb-format:hover { background: var(--accent-soft); filter: brightness(.98); }
.cfb-export {
  height: 30px; padding: 0 14px; font-size: 12px; font-family: inherit; font-weight: 600;
  border: 1px solid var(--accent-ink); border-radius: 0 7px 7px 0;
  background: var(--accent-ink); color: #fff; cursor: pointer; white-space: nowrap;
  transition: filter .15s;
}
.cfb-export:hover { filter: brightness(1.06); }
.cfb-export:disabled { opacity: .6; cursor: default; filter: none; }

/* Drill-down back bar (Q4) — shown above the embed while drilled into a detail board. */
.drill-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-primary);
}
.drill-back {
  height: 28px; padding: 0 12px; border-radius: 7px;
  background: var(--accent-ink); border: none; color: #fff;
  font-size: 12px; font-family: inherit; cursor: pointer; white-space: nowrap;
}
.drill-back:hover { filter: brightness(1.05); }
.drill-label { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drill-label strong { color: var(--accent-ink); }
.drill-filters { margin-left: 8px; color: var(--text-primary); }

/* Personal liveboards — host-side tab strip above the embed (Standard | copies | ＋ Personalize).
   Reads as a real tab bar: a subtle grey rail, inactive tabs recede, the active tab lifts to white
   with an accent top-bar and seats onto the content below. */
.plb-strip {
  display: flex; align-items: flex-end; gap: 4px;
  padding: 6px 10px 0; background: var(--surface-2);
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.plb-strip::-webkit-scrollbar { height: 6px; }
.plb-strip::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.plb-strip--overflow {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 26px), transparent);
}
.plb-tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 8px 0 12px; border-radius: 8px 8px 0 0;
  background: transparent; color: var(--text-secondary);
  border: 1px solid transparent; border-bottom: none;
  font-family: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap;
  transition: color .15s, background .15s;
}
.plb-tab:hover { color: var(--accent-ink); background: var(--surface-3); }
.plb-tab.active {
  background: var(--surface); color: var(--text-primary);
  border-color: var(--border); box-shadow: inset 0 2px 0 var(--accent);
  margin-bottom: -1px; padding-bottom: 1px;   /* cover the strip's bottom border → connected tab */
}
.plb-tab--standard.active { color: var(--accent-ink); }
.plb-tab-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.plb-tab.active .plb-tab-name { font-weight: 600; }
.plb-tab-close { font-size: 11px; line-height: 1; opacity: .45; border-radius: 4px; padding: 2px 4px; }
.plb-tab-close:hover { opacity: 1; background: var(--surface-3); color: var(--accent-2-ink); }
.plb-tab-close.armed { opacity: 1; color: #fff; background: #e5484d; font-size: 10.5px; font-weight: 600; padding: 2px 6px; }
.plb-rename-input {
  width: 128px; height: 22px; font: inherit; font-size: 12px;
  border: 1px solid var(--accent); border-radius: 4px; padding: 0 5px;
}
.plb-skel {
  width: 88px; height: 30px; border-radius: 8px 8px 0 0; align-self: flex-end;
  background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3));
  background-size: 200% 100%; animation: plb-shimmer 1.1s linear infinite;
}
@keyframes plb-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* ＋ Personalize — a quiet dashed button; only the first-run (no copies yet) gets the filled CTA. */
.plb-add {
  height: 26px; padding: 0 12px; margin: 0 2px 4px; border-radius: 7px;
  background: transparent; color: var(--accent-ink); border: 1px dashed var(--accent-border);
  font-family: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.plb-add:hover { background: var(--accent-soft); border-color: var(--accent); }
.plb-add--cta { background: linear-gradient(135deg, var(--accent-ink), var(--accent-2-ink)); color: #fff; border: none; }
/* Keep the filled gradient on hover — otherwise .plb-add:hover repaints it near-white and the
   white label vanishes. Re-declare background/color so this rule wins on source order. */
.plb-add--cta:hover { background: linear-gradient(135deg, var(--accent-ink), var(--accent-2-ink)); color: #fff; filter: brightness(1.05); }
.plb-add.loading { color: var(--text-muted); border-style: solid; }
.plb-add:disabled { opacity: .6; cursor: default; filter: none; }

/* Inline "+ Add filter" button and column picker */
.cfb-add-wrap { position: relative; align-self: flex-end; }
.cfb-add-btn {
  height: 30px; padding: 0 12px 0 10px; border-radius: 7px;
  background: var(--surface); border: 1px dashed var(--border-strong, var(--border));
  color: var(--text-muted); font-size: 12px; font-family: inherit;
  cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 2px;
  transition: border-color .15s, color .15s, background .15s;
}
.cfb-add-btn:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.cfb-picker {
  position: absolute; top: calc(100% + 5px); left: 0;
  width: 220px; max-height: 260px;
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(26,31,74,.14);
  z-index: 60; display: flex; flex-direction: column; overflow: hidden;
}
.cfb-pick-search {
  flex-shrink: 0; width: 100%; border: none; border-bottom: 1px solid var(--border);
  padding: 8px 12px; font-size: 12.5px; font-family: inherit;
  color: var(--text-primary); background: var(--surface);
}
.cfb-pick-list { flex: 1; overflow-y: auto; padding: 4px; }
.cfb-pick-item {
  padding: 6px 10px; border-radius: 6px; font-size: 12.5px;
  color: var(--text-primary); cursor: pointer; transition: background .12s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cfb-pick-item:hover { background: var(--accent-soft); color: var(--navy); }
.cfb-pick-empty { padding: 10px 12px; font-size: 12px; color: var(--text-muted); font-style: italic; }
.cfb-pick-custom {
  color: var(--accent-ink); border-top: 1px solid var(--border); margin-top: 3px; padding-top: 8px;
  font-size: 12px;
}
.cfb-pick-custom:hover { background: var(--accent-soft); }
.cfb-pick-custom-icon { font-weight: 700; margin-right: 2px; }

/* ── Mobile "Options" drawer control ─────────────────────────────────────────
   O1: below 860px the inspector used to be display:none outright, which deletes
   steps 2-3 of the app's own onboarding. It is now a bottom sheet driven purely by
   a checkbox + label (no JS — js/app.js owns no part of this). The checkbox is the
   first element in <body> so it can address #app as a sibling. */
.mobile-opt-cb {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.mobile-opt-btn { display: none; }
/* The hidden checkbox still takes keyboard focus — paint its ring on the label. */
.mobile-opt-cb:focus-visible ~ #app .mobile-opt-btn {
  outline: 2px solid var(--accent-ink); outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--accent-soft);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  :root { --insp-w: 300px; --rail-w: 180px; }
}
@media (max-width: 860px) {
  /* 44px minimum touch height on the bottom bar (O12). */
  :root { --bp-collapsed: 52px; }

  #workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #rail { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .rail-group, .rail-spacer, .rail-foot { display: none; }
  #embed-list { flex-direction: row; }
  .embed-item--sub { margin-left: 0; padding-left: 12px; border-left: 0; border-radius: 8px; }
  .tb-name, .tb-brand { display: none; }

  /* O2 — the topbar was one non-wrapping, non-scrolling row, so #connect-btn landed
     past the right edge of a 390px viewport and could never be tapped. Two rows now:
     host + Connect, then the auth select, then the utility cluster. */
  #topbar {
    height: auto; min-height: var(--topbar-h);
    flex-wrap: wrap; row-gap: 8px; column-gap: 8px;
    padding: 8px 12px 8px 14px;
  }
  .tb-connect { flex: 1 1 100%; max-width: none; flex-wrap: wrap; row-gap: 8px; }
  .tb-host { flex: 1 1 140px; min-width: 0; }
  #connect-btn { flex: 0 0 auto; }
  /* order:2 drops the auth select onto its own full-width row below host+Connect,
     so it needs its own left border and both corners back. */
  .tb-auth { order: 2; flex: 1 1 100%; border-radius: 8px; border-left: 1px solid var(--border-light); }
  #auth-config-btn { order: 2; margin-left: 0; }
  #conn-status { max-width: 100%; }
  .tb-right { flex: 1 1 auto; flex-wrap: wrap; justify-content: flex-end; }

  /* O1 — inspector as a bottom sheet, toggled by the Options label in the topbar. */
  #inspector { display: none; }
  .mobile-opt-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 11px; border-radius: 7px;
    font-size: 12px; font-weight: 600; cursor: pointer; user-select: none;
    background: transparent; color: var(--text-muted);
    border: 1px solid var(--border-light); white-space: nowrap;
  }
  .mobile-opt-cb:checked ~ #app .mobile-opt-btn {
    color: var(--accent-ink); border-color: var(--accent-border); background: var(--accent-soft);
  }
  .mobile-opt-cb:checked ~ #app #inspector {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; top: 34vh; z-index: 190;
    border-left: none; border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -10px 28px rgba(26,31,74,.28);
  }
  /* A grab-handle so the sheet reads as a sheet. */
  .mobile-opt-cb:checked ~ #app #inspector::before {
    content: ''; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 999px; background: var(--border-light);
  }
  .mobile-opt-cb:checked ~ #app .insp-head { padding-top: 8px; }

  /* O12 — bottom-panel controls to a 44px touch target; the tab strip scrolls
     horizontally instead of wrapping its labels into the 41px bar. */
  .bp-head { height: var(--bp-collapsed); padding: 0 8px; gap: 8px; }
  .bp-tabs { flex-wrap: nowrap; overflow-x: auto; min-width: 0; gap: 2px; -webkit-overflow-scrolling: touch; }
  .bp-tab { height: 44px; flex: 0 0 auto; white-space: nowrap; padding: 0 10px; }
  .bp-head-r { flex: 0 0 auto; }
  .bp-mini { height: 44px; padding: 0 12px; }
  .bp-chevron { width: 44px; height: 44px; flex: 0 0 auto; }
  .insp-reset { width: 44px; height: 44px; }
  /* …and the topbar, which held the other under-40px targets in the O12 census. */
  .tb-host, .tb-auth, .tb-btn, .tb-icon-btn, .mobile-opt-btn { height: 44px; }
  .tb-status { padding: 8px 11px; }
}

/* ── APIs Used panel (bottom panel tab) ─────────────────────────────────────── */
#pane-apis { padding: 4px 2px; }
.api-group { margin: 0 0 14px; }
.api-group-t {
  font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .14em; color: var(--accent-ink); margin: 0 0 6px; padding: 0 2px;
}
.api-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); margin-bottom: 6px;
}
.api-method {
  flex: none; min-width: 46px; text-align: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .04em;
  padding: 3px 6px; border-radius: 5px; color: #fff; background: var(--text-muted); margin-top: 1px;
}
/* White 10px text on these chips: each fill is picked to clear 4.5:1 against #fff. */
.api-method--get  { background: #1d6fe0; }   /* 4.77:1 — was #3b82f6 (3.68:1) */
.api-method--post { background: #0a7d5a; }   /* 5.13:1 — was #10b981 (2.54:1) */
.api-method--sdk  { background: var(--accent-2-ink); }
.api-main { flex: 1 1 auto; min-width: 0; }
.api-path { font-family: var(--mono); font-size: 12px; color: var(--text-primary); word-break: break-word; }
.api-desc { font-size: 11.5px; color: var(--text-secondary); line-height: 1.5; margin-top: 2px; }
.api-scope {
  flex: none; align-self: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600; color: var(--text-muted);
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border-light); white-space: nowrap;
}
.api-badge {
  flex: none; align-self: center;
  font-family: var(--mono); font-size: 10px; font-weight: 700; color: #0a7d52;
  background: #e8f9f1; border: 1px solid #b6e8d3; border-radius: 999px; padding: 2px 7px; white-space: nowrap;
}
.api-badge--err { color: #b42318; background: #fdeceb; border-color: #f3c0bb; }

/* ── AI Insights (headless REST panel — rendered into #ts-embed-container) ───── */
#ts-embed-container .aip { position: absolute; inset: 0; overflow: auto; background: var(--bg); padding: 22px 26px; }
.aip-head { margin-bottom: 16px; }
.aip-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.aip-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.aip-ask { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.aip-input { flex: 1 1 320px; height: 38px; }
.aip-go, .aip-suggest { height: 38px; flex: 0 0 auto; white-space: nowrap; }
.aip-status { font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin: 2px 0 14px; max-width: 880px; }
.aip-results { display: flex; flex-direction: column; gap: 12px; max-width: 880px; }
.aip-insight .aip-card-q { font-weight: 600; }
.aip-insight-body { margin-top: 4px; }
.aip-table-wrap { margin-top: 10px; overflow-x: auto; border: 1px solid var(--border); border-radius: 7px; max-height: 280px; }
.aip-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.aip-table th, .aip-table td { text-align: left; padding: 6px 11px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.aip-table th { background: var(--surface-2); color: var(--text-secondary); font-weight: 600; position: sticky; top: 0; }
.aip-table td { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.aip-table tbody tr:last-child td { border-bottom: none; }
.aip-table tbody tr:hover td { background: var(--surface-2); }
.aip-table-foot { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.aip-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.aip-card--err { border-color: #e8b4b4; background: #fdf3f3; }
.aip-card-q { font-size: 14px; font-weight: 600; color: var(--navy); line-height: 1.45; }
.aip-tokens { font-family: var(--mono); font-size: 12px; color: var(--text-secondary); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin-top: 5px; white-space: pre-wrap; word-break: break-word; }
.aip-card-errmsg { font-size: 12.5px; color: #a23b3b; margin-top: 8px; line-height: 1.5; }
.aip-open { margin-top: 12px; }
.aip-loading { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-top: 10px; }
.aip-spin { width: 14px; height: 14px; border-width: 2px; margin: 0; }

/* ── Custom styles section: theme-builder link, lint, selector picker ──────── */
.sty-tb-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-decoration: none; font-size: 12.5px; font-weight: 600; padding: 9px 12px; border: 1px solid var(--violet-border); border-radius: 8px; background: var(--violet-soft); color: var(--accent-2-ink); transition: border-color .15s, background .15s, box-shadow .15s; }
.sty-tb-link:hover { border-color: var(--accent-2); background: #e7eafe; box-shadow: 0 2px 8px rgba(99,102,241,0.14); }
.sty-tb-arrow { flex: 0 0 auto; font-weight: 700; }
.sty-expose { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding: 9px 11px; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface); transition: border-color .15s, background .15s; }
.sty-expose--on { border-style: solid; border-color: var(--accent-2); background: var(--violet-soft); }
.sty-row { display: flex; flex-direction: column; gap: 4px; }
.sty-swatch { flex: 0 0 30px; width: 30px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); cursor: pointer; }
.lint-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 11px; line-height: 1.45; color: var(--warn-ink); background: var(--warn-soft); border: 1px solid var(--warn-border); border-radius: 6px; padding: 5px 8px; }
.lint-fix { font-size: 10.5px; padding: 2px 8px; border: 1px solid var(--warn-border); border-radius: 999px; background: var(--surface); color: var(--warn-ink); cursor: pointer; font-family: var(--mono); white-space: nowrap; }
.lint-fix:hover { border-color: var(--warn); background: #fff; }
.inp--invalid, .inp--invalid:focus { border-color: var(--danger) !important; box-shadow: 0 0 0 3px var(--danger-soft) !important; }
.cand-panel { border: 1px solid var(--accent-border); background: var(--accent-soft); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.cand-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cand-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cand-title { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.cand-sub { font-size: 10.5px; line-height: 1.4; color: var(--text-secondary); }

/* Radio list — each row is a selectable option; the left accent bar encodes the stability tier.
   Capped height with its own scroll so the header + action bar stay in view without page scroll. */
.cand-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; padding-right: 3px; }
.cand-row { display: flex; align-items: flex-start; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-left-width: 3px; border-radius: 6px; padding: 8px 10px; cursor: pointer; transition: border-color .15s, background .15s, box-shadow .15s; }
.cand-row.tier-best { border-left-color: var(--success); }
.cand-row.tier-good { border-left-color: var(--accent); }
.cand-row.tier-ok   { border-left-color: var(--warn); }
.cand-row.tier-weak { border-left-color: var(--border-light); }
.cand-row:hover:not(.is-added) { background: var(--surface-2); }
.cand-row.is-sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.cand-row.is-added { opacity: .6; cursor: default; }

/* Radio dot — fills when selected, becomes a green check once the rule has been added. */
.cand-radio { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--border-light); background: var(--surface); position: relative; transition: border-color .15s; }
.cand-row.is-sel .cand-radio { border-color: var(--accent); }
.cand-row.is-sel .cand-radio::after { content: ''; position: absolute; inset: 2px; border-radius: 50%; background: var(--accent); }
.cand-row.is-added .cand-radio { border-color: var(--success); background: var(--success); }
.cand-row.is-added .cand-radio::after { content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; line-height: 1; color: #fff; }

.cand-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.cand-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cand-badge { flex: 0 0 auto; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.badge-best { color: var(--success-ink); background: var(--success-soft); border: 1px solid var(--success-border); }
.badge-good { color: var(--accent-ink);  background: var(--accent-soft);  border: 1px solid var(--accent-border); }
.badge-ok   { color: var(--warn-ink);    background: var(--warn-soft);    border: 1px solid var(--warn-border); }
.badge-weak { color: var(--text-muted); background: var(--surface-3); border: 1px solid var(--border-light); }
.cand-ctx { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand-done { flex: 0 0 auto; font-size: 10px; font-weight: 700; color: var(--success-ink); white-space: nowrap; }

/* Full selector, always readable — wraps gracefully instead of truncating to "[data-t…". */
.cand-sel { font-family: var(--mono); font-size: 11.5px; line-height: 1.45; color: var(--text-primary); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 4px 7px; overflow-wrap: anywhere; }
.cand-row.is-sel .cand-sel { background: var(--surface); }
.cand-why { font-size: 10.5px; line-height: 1.4; color: var(--text-secondary); }

/* Footer action bar — choose the action once and apply it to the selected target. */
.cand-bar { display: flex; flex-direction: column; gap: 6px; padding-top: 9px; border-top: 1px solid var(--accent-border); }
.cand-bar-lbl { font-size: 10.5px; font-weight: 600; color: var(--text-secondary); }
.cand-bar-row { display: flex; align-items: center; gap: 8px; }
.cand-act { flex: 1 1 auto; min-width: 0; height: 30px; font-size: 11.5px; }
.cand-add { align-self: center; margin: 0; flex: 0 0 auto; white-space: nowrap; }

/* ── Spotter Chat (MCP) panel ────────────────────────────────────────────────
   Custom chat surface for the spotter-chat section — same "panel replaces the
   iframe" pattern as .aip, but laid out as head / scrolling log / composer. */
#ts-embed-container .smcp { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; }

/* Header — identity left, live session facts as chips right. Compact: the log is
   the point of the panel, so the chrome gets one line, not three. */
.smcp-head { flex: 0 0 auto; display: flex; align-items: center; gap: 16px; padding: 12px 26px; border-bottom: 1px solid var(--border); background: var(--surface); }
.smcp-head-main { flex: 1 1 auto; min-width: 0; }
.smcp-title { font-size: 15px; font-weight: 700; color: var(--navy); }
.smcp-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.smcp-chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.smcp-chip { display: inline-flex; align-items: baseline; gap: 5px; max-width: 260px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); font-size: 11px; }
.smcp-chip-k { color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-size: 9.5px; }
.smcp-chip-v { color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smcp-chip-v.mono { font-family: var(--mono); font-weight: 400; }

.smcp-log { flex: 1 1 auto; overflow-y: auto; padding: 20px 26px 24px; display: flex; flex-direction: column; gap: 12px; }

/* Empty state — a blank rectangle gives no clue what the panel wants. */
.smcp-empty { margin: auto; text-align: center; max-width: 460px; }
.smcp-empty-t { font-size: 13.5px; color: var(--text-secondary); font-weight: 600; }
.smcp-empty-hints { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 12px; }
.smcp-hint { padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-secondary); font-size: 12px; cursor: pointer; }
.smcp-hint:hover { border-color: var(--accent-border); background: var(--accent-soft); color: var(--navy); }

.smcp-msg { max-width: 700px; font-size: 13px; line-height: 1.62; color: var(--text-primary); overflow-wrap: anywhere; }
/* The user's question is the only thing that needs a bubble — it marks the turn.
   The agent's prose reads as the document, so it gets no chrome at all: a page of
   bordered cards is what made the transcript look like a stack of receipts. */
.smcp-msg.user { align-self: flex-end; max-width: 560px; padding: 9px 14px; border: 1px solid var(--accent-border); border-radius: 14px; border-bottom-right-radius: 4px; background: var(--accent-soft); white-space: pre-wrap; }
.smcp-msg.agent { padding: 0 2px; }
.smcp-msg.error { padding: 9px 13px; border: 1px solid var(--danger); border-radius: 10px; color: var(--danger-ink); white-space: pre-wrap; }
.smcp-ok { padding: 9px 13px; border: 1px solid var(--accent-border); border-radius: 10px; background: var(--accent-soft); }

/* Markdown inside an agent bubble. Tight margins: these are chat messages, not documents. */
.smcp-msg > :first-child { margin-top: 0; }
.smcp-msg > :last-child { margin-bottom: 0; }
.smcp-msg p { margin: 0 0 8px; }
.smcp-msg h4, .smcp-msg h5, .smcp-msg h6 { margin: 12px 0 6px; font-size: 13px; font-weight: 700; color: var(--navy); }
.smcp-msg ul, .smcp-msg ol { margin: 0 0 8px; padding-left: 20px; }
.smcp-msg li { margin: 2px 0; }
.smcp-msg code { font-family: var(--mono); font-size: 11.5px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }
.smcp-msg hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.smcp-msg table { border-collapse: collapse; margin: 2px 0 10px; font-size: 12.5px; display: block; max-width: 100%; overflow-x: auto; }
.smcp-msg th, .smcp-msg td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; white-space: nowrap; }
.smcp-msg th { background: var(--surface-2); font-weight: 600; color: var(--navy); }
.smcp-ctx { width: 100%; resize: vertical; min-height: 58px; font-size: 12.5px; line-height: 1.5; }

/* Agent reasoning (is_thinking) — folded away so it stops competing with the answer. */
.smcp-think { max-width: 700px; font-size: 12px; }
.smcp-think > summary { cursor: pointer; color: var(--text-muted); font-size: 11.5px; list-style: none; display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px dashed var(--border); border-radius: 999px; }
.smcp-think > summary::-webkit-details-marker { display: none; }
.smcp-think > summary::before { content: '▸'; font-size: 9px; }
.smcp-think[open] > summary::before { content: '▾'; }
.smcp-think > summary:hover { color: var(--text-secondary); border-color: var(--text-muted); }
.smcp-think-body { margin-top: 7px; padding: 9px 13px; border-left: 2px solid var(--border); color: var(--text-secondary); line-height: 1.55; }
.smcp-think-body p { margin: 0 0 6px; }

/* "…" between Ask and the first token. */
.smcp-typing { display: flex; gap: 4px; padding: 4px 2px; }
.smcp-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: smcp-blink 1.2s infinite ease-in-out; }
.smcp-dot:nth-child(2) { animation-delay: .18s; }
.smcp-dot:nth-child(3) { animation-delay: .36s; }
@keyframes smcp-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .smcp-dot { animation: none; opacity: .5; } }

/* Answer card — a titled container for the SDK-rendered embed, with its own pin control.
   The pin control only earns its ink on hover/focus or once unticked, so a transcript
   of five answers isn't five competing checkboxes. */
/* flex: 0 0 auto is load-bearing: the card is a flex item in the .smcp-log column and its
   overflow:hidden zeroes the automatic minimum size, so with default flex-shrink:1 the
   browser squeezes chart cards toward 0px as soon as the transcript overflows the panel —
   text bubbles can't shrink, so ALL the squeeze lands on the charts. */
.smcp-card { flex: 0 0 auto; align-self: stretch; max-width: 880px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.smcp-card-head { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.smcp-card-head h3 { flex: 1 1 auto; margin: 0; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); overflow-wrap: anywhere; }
.smcp-pick { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; font-size: 11.5px; color: var(--text-muted); cursor: pointer; white-space: nowrap; opacity: .35; transition: opacity .12s ease; }
.smcp-card:hover .smcp-pick, .smcp-pick:focus-within, .smcp-pick:hover { opacity: 1; }
.smcp-pick:has(input:not(:checked)) { opacity: 1; color: var(--text-secondary); }
.smcp-pick input { cursor: pointer; }
.smcp-card iframe { display: block; width: 100%; border: 0; background: var(--surface); transition: height .2s ease; }
@media (prefers-reduced-motion: reduce) { .smcp-card iframe { transition: none; } }

/* Liveboard bar — docked above the composer, so the action sits with the other controls. */
.smcp-lb { flex: 0 0 auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 26px; border-top: 1px solid var(--border); background: var(--surface-2); }
.smcp-lb[hidden] { display: none; }
.smcp-lb-count { font-size: 12px; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
.smcp-lb-title { flex: 0 1 210px; height: 32px; font-size: 12.5px; }
.smcp-lb-desc { flex: 1 1 200px; min-width: 140px; height: 32px; font-size: 12.5px; }
.smcp-lb-btn { height: 32px; flex: 0 0 auto; white-space: nowrap; }
.smcp-lb-note { font-size: 12px; color: var(--text-muted); }
.smcp-lb-link { color: var(--accent-ink); font-weight: 600; }

/* Label-map editor in the inspector — from → to pairs. */
.mcp-labels { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.mcp-label-row { display: flex; align-items: center; gap: 6px; }
.mcp-label-row .inp { flex: 1 1 0; min-width: 0; height: 30px; font-size: 12px; }
.mcp-label-arrow { flex: 0 0 auto; color: var(--text-muted); font-size: 12px; }
.mcp-label-x { flex: 0 0 auto; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font-size: 16px; line-height: 1; cursor: pointer; }
.mcp-label-x:hover { background: var(--surface-2); color: var(--danger-ink); }

/* Relay health readout in the inspector — multi-line, machine-ish facts. */
.smcp-relay-out { white-space: pre-line; font-family: var(--mono); font-size: 11px; margin-top: 8px; overflow-wrap: anywhere; }

.smcp-composer { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 26px 18px; border-top: 1px solid var(--border); background: var(--surface); }
.smcp-input { flex: 1 1 320px; height: 38px; }
.smcp-send, .smcp-reset { height: 38px; flex: 0 0 auto; white-space: nowrap; }
.smcp-send { min-width: 64px; }

/* ── Drill-through demo: host-rendered detail panel (below the embed, above #bottom) ── */
.dt-panel {
  flex: 0 0 auto; max-height: 42%; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-top: 1px solid var(--border);
}
.dt-head {
  display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
  padding: 8px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-primary);
}
.dt-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.dt-title strong { color: var(--accent-ink); }
.dt-scope { color: var(--text-primary); }
.dt-badge {
  margin-left: auto; flex: 0 0 auto; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.dt-badge--mismatch { background: var(--warn-soft); border-color: #ead9a8; color: var(--warn-ink); font-weight: 600; }
.dt-close {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 7px;
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 12px; font-family: inherit; cursor: pointer; line-height: 1;
}
.dt-close:hover { background: var(--surface-3); color: var(--text-primary); }
.dt-error { padding: 8px 14px; background: var(--danger-soft); color: var(--danger-ink); font-size: 12.5px; }
.dt-table-wrap { flex: 1; min-height: 0; overflow: auto; }
.dt-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dt-table th, .dt-table td {
  padding: 6px 12px; text-align: left; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.dt-table th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--text-secondary); font-weight: 600;
}
.dt-table tbody tr:hover { background: var(--surface-2); }
.dt-linkcell { text-align: right; }
.dt-link { color: var(--accent-ink); text-decoration: none; }
.dt-link:hover { text-decoration: underline; }
.dt-link-bad { color: var(--text-muted); cursor: help; }
.dt-foot {
  display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
  padding: 7px 14px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted);
}
.dt-more {
  margin-left: auto; height: 26px; padding: 0 12px; border-radius: 7px;
  background: var(--accent-ink); border: none; color: #fff;
  font-size: 12px; font-family: inherit; cursor: pointer;
}
.dt-more:hover:not(:disabled) { filter: brightness(1.05); }
.dt-more:disabled { opacity: .6; cursor: default; }

/* ── Drill-through: the modal record list (Acme-style "View details") ── */
.dt-modal-panel { width: 620px; max-height: 84vh; }
.dt-modal-body { gap: 0; padding: 0; }
.dt-summary {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-secondary); line-height: 1.5;
}
.dt-reclist { display: flex; flex-direction: column; }
.dt-rec {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; transition: background .12s;
}
.dt-rec:hover { background: var(--surface-2); }
.dt-rec--flat { cursor: default; }
.dt-rec--flat:hover { background: transparent; }
.dt-rec-icon {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); position: relative;
}
/* A small calendar/record glyph drawn in CSS — no icon font, no asset request. */
.dt-rec-icon::before {
  content: ''; position: absolute; inset: 9px 8px 8px;
  border: 1.5px solid var(--accent); border-radius: 2px; border-top-width: 4px;
}
.dt-rec-main { flex: 1; min-width: 0; }
.dt-rec-title {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dt-rec-meta {
  font-size: 11.5px; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dt-rec-right { flex: 0 0 auto; text-align: right; }
.dt-rec-date { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.dt-rec-chev { flex: 0 0 auto; color: var(--text-muted); font-size: 17px; line-height: 1; }
.dt-rec--flat .dt-rec-chev { opacity: .35; }
.dt-empty { padding: 26px 18px; text-align: center; font-size: 12.5px; color: var(--text-muted); }
.dt-modal-foot { justify-content: flex-start; align-items: center; gap: 10px; }
.dt-modal-foot .dt-more { margin-left: auto; }
.dt-viewall {
  height: 26px; padding: 0 12px; border-radius: 7px; display: inline-flex; align-items: center;
  background: var(--surface-3); color: var(--text-primary); font-size: 12px; text-decoration: none;
}
.dt-viewall:hover { filter: brightness(.97); }

/* Skeleton — shape before the first page lands */
.dt-skel { padding: 4px 0; }
.dt-skel-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
}
.dt-skel-dot { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto; }
.dt-skel-line { height: 9px; border-radius: 5px; flex: 1; }
.dt-skel-line--short { flex: 0 0 82px; }
.dt-skel-dot, .dt-skel-line {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%; animation: dtshimmer 1.3s ease-in-out infinite;
}
@keyframes dtshimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .dt-skel-dot, .dt-skel-line { animation: none; } }
.dt-summary--mismatch { background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; }
/* ── Demo mode: presenter view — only the embed-type rail and the stage remain ── */
body.demo-mode #topbar,
body.demo-mode #inspector,
body.demo-mode #bottom { display: none; }
body.demo-mode #workspace { grid-template-columns: var(--rail-w) 1fr; }
@media (max-width: 860px) { body.demo-mode #workspace { grid-template-columns: 1fr; } }
.demo-exit {
  position: fixed; right: 14px; bottom: 14px; z-index: 900;
  height: 28px; padding: 0 12px; border-radius: 14px; font-size: 11.5px; font-weight: 600;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border-light);
  box-shadow: 0 2px 8px rgba(16,24,48,.10);
  opacity: .35; transition: opacity .18s, color .18s;
}
.demo-exit:hover, .demo-exit:focus-visible { opacity: 1; color: var(--text-primary); }
.demo-api { right: 104px; }
.demo-api.on { color: var(--accent-ink); border-color: var(--accent-border); background: var(--accent-soft); opacity: .8; }
.demo-api[hidden], .demo-exit[hidden] { display: none; }
/* API hints: hover popover listing the ThoughtSpot APIs in use (reuses the .api-row styles). */
.api-hint-pop {
  position: fixed; z-index: 950; width: min(560px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto;
  padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border-light);
  box-shadow: 0 10px 30px rgba(16,24,48,.18);
}
.api-hint-pop[hidden] { display: none; }

/* ── Keyboard focus ring — MUST STAY LAST ─────────────────────────────────────────────────────
   Equal specificity (0,1,0) with the `outline: none` declarations on .inp, .sel-btn,
   .sel-search and the wh-* inputs, so source order decides. Placed last so the ring reaches
   every control instead of only the ones that never opted out; those rules keep their
   border-color treatment, this only restores the outline and halo. */
:focus-visible,
.wh-email-input:focus-visible, .wh-email-textarea:focus-visible,
.wh-comp-input:focus-visible, .wh-comp-msg-input:focus-visible,
.sel-btn:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--accent-soft);
}

/* ── Drill-through: preset bar + collapsible sub-groups in the inspector ── */
.dpre { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 2px 0 6px; }
.dpre-chip {
  display: inline-flex; align-items: stretch; border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border); background: var(--surface);
}
.dpre-go {
  border: 0; background: none; font-family: inherit; font-size: 12px; color: var(--text-primary);
  padding: 3px 4px 3px 11px; cursor: pointer; max-width: 150px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.dpre-chip:hover { border-color: var(--accent); }
.dpre-go:hover { color: var(--accent-ink); }
.dpre-x {
  border: 0; background: none; font-family: inherit; font-size: 10px; color: var(--text-muted);
  padding: 3px 9px 3px 5px; cursor: pointer; line-height: 1.6;
}
.dpre-x:hover { color: var(--danger-ink); }
.dpre-x--armed { color: #fff; background: var(--danger); font-size: 10.5px; }
.dpre-add {
  height: 24px; padding: 0 11px; border-radius: 999px; cursor: pointer;
  border: 1px dashed var(--text-muted); background: none; color: var(--text-secondary);
  font-family: inherit; font-size: 12px; white-space: nowrap;
}
.dpre-add:hover { border-color: var(--accent); color: var(--accent-ink); }
.dpre-add--cta { border-style: solid; background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.dpre-add--cta:hover { filter: brightness(1.05); color: #fff; }
.dpre-input { flex: 1 1 140px; min-width: 120px; height: 24px; font-size: 12px; padding: 0 9px; }

.insp-sub { border-top: 1px solid var(--border); margin-top: 10px; }
.insp-sub-sum {
  list-style: none; cursor: pointer; padding: 9px 2px; display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
}
.insp-sub-sum::-webkit-details-marker { display: none; }
.insp-sub-sum::before {
  content: ""; width: 0; height: 0; flex: 0 0 auto;
  border-left: 4px solid currentColor; border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
  transition: transform .15s;
}
.insp-sub[open] > .insp-sub-sum::before { transform: rotate(90deg); }
.insp-sub-sum:hover { color: var(--accent-ink); }
.insp-sub-body { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 12px; }

/* ── Reduced motion ──────────────────────────────────────────────────────────
   Honors the OS setting app-wide: transitions become instant, entrance animations
   (modal slide/pop) and decorative loops (status pulse, lifecycle pulse, skeleton
   shimmer) stop. Spinners keep turning: they are the only signal that work is in
   flight, which WCAG 2.3.3 treats as essential motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .tb-status[data-state="connecting"]::before,
  .flow-step.active .fs-dot,
  .modal-panel, .modal-panel--center,
  .plb-skel { animation: none !important; }
}
