/*
 * Dashboard styling, modelled on the FastBots layout the product competes with.
 *
 * The shape that matters: a dark page frame with a white shell floating on it,
 * a narrow rail of workspaces on the far left, a grouped sidebar, and a light
 * content column. Almost every setting is a row — title, description beneath,
 * pill toggle on the right — which is what makes a long settings page scannable
 * instead of a wall of form fields.
 */

@import url('https://fonts.googleapis.com/css2?family=Mulish:wght@400;600;700;800&display=swap');

:root {
  --frame: #0e1a3c;          /* the dark page behind everything */
  --rail: #0e1a3c;
  --shell: #ffffff;          /* sidebar */
  --content: #f1f3f7;        /* the working area */
  --card: #ffffff;
  --fg: #1b2559;
  --fg-muted: #7f8ba6;
  --line: #e8ebf2;
  --primary: #2196f3;
  --primary-ink: #ffffff;
  --dark: #14204a;
  --green: #22b573;
  --danger: #e5484d;
  --ok: #d1fae5;
  --ok-ink: #065f46;
  --warn: #fef3c7;
  --warn-ink: #92400e;
  --bad: #fee2e2;
  --bad-ink: #991b1b;
  --r-shell: 30px;
  --r-card: 20px;
  --r-input: 14px;
  --r-btn: 10px;
  --font: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

/*
 * The `hidden` attribute is only `display: none` in the user-agent
 * stylesheet, so any author rule that sets `display` beats it — and every
 * flex row in here does. Hiding something then watching it stay on screen has
 * cost time in this codebase more than once; this makes the attribute mean
 * what it says.
 */
[hidden] { display: none !important; }

body {
  margin: 0; background: var(--frame); color: var(--fg);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 700; }
h2 { font-size: 24px; font-weight: 600; }
h3 { font-size: 17px; }
.muted { color: var(--fg-muted); margin: 0; font-size: 14px; }
.hint { color: var(--fg-muted); font-size: 13px; margin: 6px 0 0; }
.empty { color: var(--fg-muted); padding: 22px 0; margin: 0; font-size: 14px; }
.loading { padding: 80px; text-align: center; color: var(--fg-muted); }

/* ------------------------------------------------------------- app frame */
.app { display: flex; min-height: 100vh; gap: 0; }

/* The far-left rail: workspace and bots, on the dark frame itself. */
.rail {
  width: 100px; flex: 0 0 100px; padding: 22px 0;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.rail-logo {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 22px;
}
.rail-bot {
  width: 58px; height: 58px; border-radius: 16px; border: 2px solid transparent;
  background: #1b2a55; color: #cbd5f5; cursor: pointer;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  position: relative;
}
.rail-bot.active { border-color: #4d7cff; background: #24356a; }
.rail-bot::after {
  content: ''; position: absolute; right: 4px; bottom: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); border: 2px solid #1b2a55;
}
.rail-add {
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer;
  background: #24356a; color: #9fb3ff; font-size: 24px;
  display: grid; place-items: center;
}
.rail-add:hover { background: #2e4180; }

/* The white shell everything else sits inside. */
.shell {
  flex: 1; display: flex; min-width: 0; margin: 14px 14px 14px 0;
  border-radius: var(--r-shell); overflow: hidden; background: var(--content);
}

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  width: 210px; flex: 0 0 210px; background: var(--shell);
  padding: 22px 0 20px; display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px 18px; font-weight: 700; font-size: 18px;
}
.side-group {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  color: var(--fg-muted); padding: 18px 20px 8px; text-transform: uppercase;
}
.side-link {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 20px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 15px; color: var(--fg); text-align: left;
  position: relative;
}
.side-link:hover { background: var(--content); }
/*
 * Nothing to point these at until there is a chatbot. Faded rather than
 * hidden: seeing what arrives with one is part of the reason to make one.
 */
.side-link:disabled { color: var(--fg-muted); cursor: not-allowed; }
.side-link:disabled:hover { background: none; }
.side-link:disabled .side-icon { opacity: .4; }
.side-link.active { color: var(--primary); font-weight: 700; }
.side-link.active::after {
  content: ''; position: absolute; right: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 3px 0 0 3px; background: var(--primary);
}
.side-icon { width: 18px; text-align: center; opacity: .85; }

.upsell {
  margin: auto 14px 0; padding: 18px 14px; text-align: center;
  background: #eef2ff; border-radius: var(--r-card);
}
.upsell h3 { font-size: 15px; margin-bottom: 6px; }
.upsell p { font-size: 12px; color: var(--fg-muted); margin: 0 0 12px; }
.btn-green {
  background: var(--green); color: #fff; border: 0; border-radius: var(--r-btn);
  padding: 9px 14px; font: inherit; font-weight: 800; font-size: 12px;
  cursor: pointer; width: 100%;
}

/* ---------------------------------------------------------------- topbar */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 26px 0; flex: 0 0 auto;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title p { margin: 2px 0 0; }
.credits-pill {
  font-size: 13px; font-weight: 700; padding: 6px 12px;
  background: var(--card); border-radius: 999px; white-space: nowrap;
}
.whoami {
  display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px;
  background: var(--card); border-radius: 999px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: #ff7a3d;
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.whoami-text { font-size: 12px; line-height: 1.3; }
.whoami-text b { display: block; font-size: 13px; }

.content { flex: 1; overflow-y: auto; padding: 20px 26px 26px; }

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--card); border-radius: var(--r-card);
  padding: 20px 22px; margin-bottom: 14px;
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/*
 * The signature row: a title, a description under it, and a control on the
 * right. Nearly every setting in the product is one of these.
 */
.setting { display: flex; align-items: flex-start; gap: 18px; }
.setting-text { flex: 1; min-width: 0; }
.setting-text h3 { font-size: 17px; }
.setting-text p { margin: 2px 0 0; font-size: 13.5px; color: var(--fg-muted); }

.switch { position: relative; width: 52px; height: 30px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: #d7dced;
  transition: background .18s ease; pointer-events: none;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  transition: transform .18s ease;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------------------------------------------------------------- forms */
label { display: block; font-size: 13.5px; font-weight: 700; margin: 16px 0 7px; }
label:first-child { margin-top: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="number"], textarea, select {
  width: 100%; padding: 13px 16px; font: inherit; font-size: 15px;
  border: 1px solid transparent; border-radius: var(--r-input);
  background: var(--content); color: inherit;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.55; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); background: #fff;
}
select { cursor: pointer; }

.btn {
  border: 0; border-radius: var(--r-btn); padding: 11px 18px;
  font: inherit; font-weight: 800; font-size: 12.5px; cursor: pointer;
  background: var(--content); color: var(--fg); white-space: nowrap;
}
.btn:hover:not(:disabled) { filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-dark { background: var(--dark); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-quiet { background: none; color: var(--fg-muted); padding: 6px 10px; }
.btn-quiet:hover { color: var(--fg); }

/* The sticky bar every settings screen ends with. */
.actionbar {
  position: sticky; bottom: 0; margin: 18px -26px -26px;
  padding: 14px 26px; background: var(--content);
  display: flex; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 14px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--fg-muted); }
.row-error { font-size: 12.5px; color: var(--danger); }
.row-balance { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--fg-muted); min-width: 62px; text-align: right; }
.delta { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13px; }
.delta-up { color: var(--green); }
.delta-down { color: var(--fg-muted); }

.pill { font-size: 11.5px; font-weight: 800; padding: 4px 11px; border-radius: 999px; white-space: nowrap; }
.pill-ok { background: var(--ok); color: var(--ok-ink); }
.pill-bad { background: var(--bad); color: var(--bad-ink); }
.pill-busy { background: var(--warn); color: var(--warn-ink); }
.pill-off { background: var(--content); color: var(--fg-muted); }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { background: var(--card); border-radius: var(--r-card); padding: 20px 22px; }
.stat-icon {
  width: 40px; height: 40px; border-radius: 12px; background: var(--content);
  display: grid; place-items: center; font-size: 18px; margin-bottom: 14px;
}
.stat-value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12.5px; color: var(--fg-muted); }
.meter { height: 6px; background: var(--content); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.meter-fill { height: 100%; background: var(--primary); }

/* ------------------------------------------------------------ bot cards */
.bot-card {
  background: var(--card); border-radius: var(--r-card); padding: 20px;
  text-align: left; cursor: pointer; font: inherit; color: inherit;
  border: 2px solid transparent; display: flex; flex-direction: column; gap: 9px;
  transition: border-color .15s ease;
}
.bot-card:hover { border-color: var(--primary); }
.bot-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bot-name { font-weight: 700; font-size: 16px; }
.bot-id { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--fg-muted); }
.bot-stats { display: flex; gap: 16px; font-size: 12.5px; color: var(--fg-muted); }

/* ----------------------------------------------------------- two-column */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.preview { position: sticky; top: 0; }
.preview-frame {
  background: var(--card); border-radius: var(--r-card); overflow: hidden;
  height: 620px; display: flex; flex-direction: column;
}
.preview-head {
  background: var(--primary); color: #fff; padding: 15px 18px;
  display: flex; align-items: center; gap: 11px; font-weight: 700;
}
.preview-body { flex: 1; padding: 18px; overflow-y: auto; background: #fff; }
.preview-bubble {
  background: var(--content); border-radius: 14px; padding: 12px 14px;
  font-size: 13.5px; line-height: 1.5; margin-bottom: 10px;
}
.preview-bubble-user {
  background: var(--primary); color: #fff; margin-left: auto; max-width: 80%;
}
.preview-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.preview-input { flex: 1; height: 40px; background: var(--content); border-radius: 12px; }
.preview-send {
  width: 40px; height: 40px; border-radius: 12px; background: var(--primary);
  color: #fff; display: grid; place-items: center;
}
.preview-brand { text-align: center; font-size: 11px; color: var(--fg-muted); padding: 8px; }

/* ---------------------------------------------------------------- misc */
.snippet {
  background: #0f172a; color: #e2e8f0; padding: 15px 17px;
  border-radius: var(--r-input); overflow-x: auto; margin: 12px 0 0;
  font-size: 12.5px; line-height: 1.6;
}
.snippet code { font-family: ui-monospace, Menlo, Consolas, monospace; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  border: 0; background: var(--card); font: inherit; font-size: 13.5px;
  font-weight: 700; cursor: pointer; padding: 9px 16px; border-radius: var(--r-btn);
  color: var(--fg-muted);
}
.tabs button.active { background: var(--primary); color: #fff; }
.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 26px; background: var(--warn); color: var(--warn-ink); font-size: 14px;
}
.linkish { border: 0; background: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.alt-action { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 18px 0 0; font-size: 14px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 1.2em; margin: 10px 0 0; }
.danger-card { border: 1px solid #fecaca; }
.danger-card h3 { color: var(--danger); }
.inline-form { display: flex; gap: 10px; }
.inline-form input { flex: 1; }
.file-label { margin-top: 18px; }
input[type="file"] { font-size: 13px; margin-top: 6px; }
.plan-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-top: 6px; }
.plan { display: flex; flex-direction: column; gap: 7px; padding: 18px; background: var(--content); border-radius: var(--r-card); border: 2px solid transparent; }
.plan-current { border-color: var(--primary); background: #fff; }
.plan-name { font-weight: 700; }
.plan-price { font-size: 24px; font-weight: 800; }
.plan-features { list-style: none; padding: 0; margin: 4px 0 12px; font-size: 13px; color: var(--fg-muted); flex: 1; }
.plan .btn { width: 100%; text-align: center; }

/* ---------------------------------------------------------------- auth */

/* Two halves: the form on plain white, the panel on the dark brand colour. */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--card);
}
.auth-form {
  display: grid;
  place-items: center;
  padding: 40px 28px;
}
.auth-inner { width: 100%; max-width: 380px; }
.auth-inner form { display: flex; flex-direction: column; }
.auth-inner h1 { font-size: 22px; margin: 0 0 6px; }
.auth-inner .btn { margin-top: 20px; padding: 14px; font-size: 14px; }
.auth-blurb { margin-top: 0; }
/* The lead paragraph under a heading, which otherwise sits flush against the
   first field label. */
.auth-inner > .muted { margin: 0 0 20px; }

.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-mark { color: var(--primary); font-size: 26px; line-height: 1; }
.auth-word { font-size: 21px; font-weight: 800; letter-spacing: -.01em; }

/* The panel. Its own stacking context so the circuitry stays behind the copy. */
.auth-art {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 40px;
  background:
    radial-gradient(120% 90% at 78% 18%, rgba(56, 152, 255, .55), transparent 60%),
    linear-gradient(160deg, #14306e 0%, var(--frame) 55%, #0a1330 100%);
  color: #fff;
}
.auth-circuit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .5;
}
.auth-trace { fill: none; stroke: rgba(255, 255, 255, .18); stroke-width: 1.2; }
.auth-trace-lit { stroke: rgba(190, 225, 255, .85); stroke-width: 2.2; stroke-linecap: round; }
.auth-node { fill: rgba(255, 255, 255, .3); }

.auth-art-inner { position: relative; width: 100%; max-width: 420px; }
.auth-art-title {
  font-size: 26px;
  line-height: 1.25;
  margin: 0 0 22px;
  letter-spacing: -.01em;
}

/* ------------------------------------------------- the dashboard demo
 * A miniature of the product that plays on a loop. Built in code rather than
 * recorded, so it never goes stale and costs no video to host.
 */
.demo-window {
  background: var(--card);
  color: var(--fg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(3, 10, 30, .42);
}
.demo-bar {
  padding: 9px 12px;
  background: var(--content);
  border-bottom: 1px solid var(--line);
}
.demo-dots { display: flex; gap: 6px; }
.demo-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d6dbe6;
}
.demo-body { display: flex; min-height: 208px; }

.demo-rail {
  width: 34px;
  flex-shrink: 0;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--rail);
}
.demo-rail-mark {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: var(--primary);
}
.demo-rail-bot {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .18);
}
.demo-rail-on { background: rgba(255, 255, 255, .45); }

.demo-side {
  width: 116px;
  flex-shrink: 0;
  padding: 12px 8px;
  border-right: 1px solid var(--line);
}
.demo-nav-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 10.5px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-nav-on { background: var(--content); color: var(--fg); font-weight: 700; }
.demo-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
  opacity: .55;
  flex-shrink: 0;
}

.demo-main {
  flex: 1;
  min-width: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
/* Fixed height so the window does not jump as messages arrive. */
.demo-log { flex: 1; min-height: 104px; }
.demo-msg {
  margin: 0 0 7px;
  padding: 7px 10px;
  border-radius: 11px;
  font-size: 11.5px;
  line-height: 1.4;
  max-width: 86%;
  animation: demo-in .28s ease-out both;
}
.demo-msg-them { background: var(--content); border-bottom-left-radius: 4px; }
.demo-msg-us {
  margin-left: auto;
  background: var(--primary);
  color: var(--primary-ink);
  border-bottom-right-radius: 4px;
  /* Holds its shape while the text types in. */
  min-height: 1.4em;
}
@keyframes demo-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.demo-typing { display: flex; gap: 4px; align-items: center; padding: 10px; width: 42px; }
.demo-typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
  animation: demo-blink 1.1s infinite;
}
.demo-typing i:nth-child(2) { animation-delay: .15s; }
.demo-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes demo-blink {
  0%, 60%, 100% { opacity: .35; }
  30%           { opacity: 1; }
}

.demo-stats { display: flex; gap: 8px; margin-top: 10px; }
.demo-stat {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.demo-stat-value {
  display: block;
  font-size: 16px;
  line-height: 1.1;
  /* Tabular figures, or the box twitches as the number counts up. */
  font-variant-numeric: tabular-nums;
}
.demo-stat-label {
  display: block;
  margin-top: 1px;
  font-size: 9.5px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Asked not to be moved: the demo is built in its finished state instead. */
@media (prefers-reduced-motion: reduce) {
  .demo-msg { animation: none; }
  .demo-typing i { animation: none; }
}

.auth-points { list-style: none; padding: 0; margin: 24px 0 0; font-size: 14.5px; }
.auth-points li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 11px;
  color: rgba(255, 255, 255, .88);
}
.auth-points li::before {
  content: '✓';
  position: absolute;
  left: 0;
  font-weight: 800;
  color: #7dd3a0;
}

/*
 * Below this the panel is dropped rather than stacked. Somebody arriving on a
 * phone wants the form, and marketing above it is one more scroll between them
 * and signing in.
 */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}

/* --------------------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translate(-50%, 12px); opacity: 0;
  padding: 12px 20px; border-radius: var(--r-btn); z-index: 100;
  background: var(--dark); color: #fff; font-size: 14px; font-weight: 600;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .28);
  transition: opacity .2s ease, transform .2s ease;
}
.toast-shown { opacity: 1; transform: translate(-50%, 0); }
.toast-error { background: var(--danger); }

@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } .preview { display: none; } }
@media (max-width: 820px) {
  .rail { display: none; }
  .shell { margin: 0; border-radius: 0; }
  .sidebar { display: none; }
  .content { padding: 16px; }
  .actionbar { margin: 16px -16px -16px; padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) { .switch span, .switch span::after, .toast, .bot-card { transition: none; } }

/* Multi-select as pills, for choices that are a set rather than one value. */
.chipboxes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.chipbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.chipbox:has(input:checked) {
  border-color: var(--primary);
  background: rgba(33, 150, 243, .08);
  color: var(--primary);
}
.chipbox input { width: 14px; height: 14px; margin: 0; accent-color: var(--primary); }

/* =========================================================== my chatbots */

.search {
  width: 100%;
  padding: 15px 20px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  border-radius: var(--r-card);
  background: var(--card);
  font: inherit;
  font-size: 15px;
}
.search:focus { outline: none; border-color: var(--primary); }
/* Nothing to search yet. Kept in place rather than removed, so the page does
   not rearrange itself the moment the first chatbot appears. */
.search:disabled { background: var(--content); color: var(--fg-muted); cursor: not-allowed; }

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
  align-items: stretch;
}

/*
 * Block, not flex. As a flex column inside a grid cell the children shrink
 * below their own height - the progress bar collapsed to nothing and the
 * numbers spilled out of the white card entirely.
 */
.stat { display: block; }
.stat > * + * { margin-top: 10px; }
.stat-label { margin: 0; font-size: 13px; font-weight: 700; color: var(--fg-muted); }
.stat-value { margin: 0; line-height: 1; }
.stat-value strong { font-size: 34px; font-weight: 800; }
.stat-value span { font-size: 14px; color: var(--fg-muted); }
.stat-track {
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.stat-fill { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

.upgrade { display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.upgrade h3 { margin: 0; font-size: 15px; }
.upgrade p { margin: 0; font-size: 13px; color: var(--fg-muted); line-height: 1.5; }
.btn-upgrade {
  align-self: flex-start;
  margin-top: 4px;
  padding: 10px 16px;
  border-radius: var(--r-btn);
  background: var(--green);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
}
.btn-upgrade:hover { filter: brightness(1.05); }

/* The dashed "add another" tile, used in the summary strip and the grid. */
.create-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 24px;
  border: 2px dashed #c9d2e4;
  border-radius: var(--r-card);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.create-card:hover { border-color: var(--primary); color: var(--primary); }
.create-plus { font-size: 26px; line-height: 1; font-weight: 400; }

.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  align-items: stretch;
}

.bot-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r-card);
  background: var(--card);
}
.bot-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bot-card-actions { display: flex; align-items: center; gap: 8px; }

.tag {
  padding: 4px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--fg-muted);
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  background: var(--content);
}
.bot-state { font-size: 12px; font-weight: 800; }
.bot-state.is-on { color: var(--green); }
.bot-state.is-off { color: var(--fg-muted); }

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--fg-muted);
  font-size: 13px;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }

.bot-card-main {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.bot-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
}
.bot-card-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bot-name { font-size: 17px; font-weight: 800; }
.bot-date { font-size: 12.5px; color: var(--fg-muted); }

.bot-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.bot-visibility { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.bot-counts { color: var(--fg-muted); }

/* ============================================================ new chatbot */

.wizard { max-width: 1040px; margin: 0 auto; }
.wizard-head {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 22px;
  margin-bottom: 26px;
  border-radius: var(--r-card);
  background: rgba(255, 255, 255, .55);
}
.back-link { font-weight: 800; font-size: 14px; color: var(--primary); text-decoration: none; }

.stepper {
  display: flex;
  align-items: flex-start;
  flex: 1;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex: 1;
  position: relative;
}
/*
 * The connecting rule.
 *
 * It belongs to the later step, so without a z-index it paints over the
 * previous step's circle - siblings stack in document order. Stopping it short
 * of both circles is what makes the gap; the z-index is what guarantees it,
 * whatever the dot size becomes.
 */
.step + .step::before {
  content: '';
  position: absolute;
  z-index: 0;
  top: 16px;
  right: calc(50% + 21px);
  left: calc(-50% + 21px);
  height: 2px;
  background: var(--line);
}
.step.is-done + .step::before, .step.is-now::before { background: var(--primary); }
.step-dot {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card);
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 800;
}
.step.is-now .step-dot, .step.is-done .step-dot { background: var(--primary); color: #fff; }
.step-label {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.step.is-now .step-label { color: var(--primary); }

.wizard-title { margin: 0 0 6px; font-size: 25px; font-weight: 800; text-align: center; }
.wizard-sub { margin: 0 auto 22px; max-width: 620px; text-align: center; color: var(--fg-muted); }

.wizard-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px;
  border-radius: var(--r-card);
  background: var(--card);
}
.wizard-card h2, .wizard-card h3 { margin: 0; }
.wizard-card p { margin: 0; }
.wizard-card-narrow { max-width: 620px; margin: 0 auto; text-align: center; align-items: stretch; }
.wizard-card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.wizard-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(33, 150, 243, .1);
  font-size: 26px;
}
.wizard-icon-sm { width: 42px; height: 42px; margin: 0; font-size: 20px; border-radius: 12px; }

.big-input {
  padding: 15px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-input);
  background: var(--content);
  font: inherit;
  font-size: 16px;
  text-align: center;
}
.big-input:focus { outline: none; border-color: var(--primary); background: var(--card); }

.btn-block { width: 100%; justify-content: center; }
.btn-plain { background: transparent; color: var(--fg-muted); border: 0; font-weight: 700; }
.btn-plain:hover { color: var(--primary); }
.btn-done {
  padding: 14px 28px;
  border-radius: var(--r-btn);
  background: var(--green);
  color: #fff;
  border: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

.learn-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.learn-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) {
  .learn-grid, .learn-grid-3 { grid-template-columns: 1fr; }
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 18px;
  border: 2px dashed #c9d2e4;
  border-radius: var(--r-input);
  text-align: center;
  cursor: pointer;
}
.dropzone.is-over { border-color: var(--primary); background: rgba(33, 150, 243, .05); }
.drop-name { font-size: 13px; color: var(--fg-muted); word-break: break-all; }
.drop-hint { font-size: 12px; color: var(--fg-muted); }

.inline-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; }
.inline-check input { width: 15px; height: 15px; accent-color: var(--primary); margin: 0; }

.wizard-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}
.wizard-foot-center { justify-content: center; }
.wizard-done { text-align: center; margin-bottom: 22px; }
.wizard-done .pill { margin-bottom: 12px; }

.starter-list { display: flex; flex-direction: column; gap: 8px; }
.starter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13.5px;
}
.row { display: flex; gap: 8px; }
.row input { flex: 1; margin: 0; }

.ticks { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.ticks li { font-size: 13.5px; color: var(--fg-muted); line-height: 1.5; }

.test-frame { width: 100%; height: 520px; border: 0; display: block; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(14, 26, 60, .45);
}
.overlay-card {
  width: min(440px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 30px;
  border-radius: var(--r-card);
  background: var(--card);
  text-align: center;
}
.overlay-card h3, .overlay-card p { margin: 0; }
.progress-track { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill {
  display: block;
  width: 8%;
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width .4s ease;
}
.progress-detail { font-size: 13px; color: var(--fg-muted); }

.snippet-block {
  margin: 0;
  padding: 12px;
  border-radius: var(--r-input);
  background: var(--content);
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================== settings */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  align-items: start;
}
.settings-card { margin-bottom: 0; display: flex; flex-direction: column; gap: 4px; }
.settings-card > p.muted { margin: 0 0 4px; font-size: 13.5px; line-height: 1.5; }
.settings-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.settings-card-head h3 { margin: 0; font-size: 18px; }
.settings-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 18px;
}
.settings-icon-danger { border-color: #fecaca; background: var(--bad); }
.settings-card-foot { margin-top: auto; padding-top: 14px; }

/* A setting row inside a card, where the card already carries the heading. */
.setting-tight { margin-top: 14px; }
.setting-tight h4 { margin: 0 0 2px; font-size: 14px; font-weight: 700; }
.setting-tight p { margin: 0; font-size: 12.5px; color: var(--fg-muted); line-height: 1.45; }

/* ------------------------------------------------------- avatar and keys */

.avatar-row { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.avatar-preview {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--content) center / cover no-repeat;
  font-size: 24px;
}
.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.key-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  font-size: 13px;
}
.key-prefix {
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--content);
  font-size: 12px;
}
.key-reveal {
  padding: 14px;
  border: 1px solid var(--primary);
  border-radius: var(--r-input);
  background: rgba(33, 150, 243, .06);
}
.key-reveal p { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
.key-reveal code {
  display: block;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: 8px;
  background: var(--dark);
  color: #e2e8f0;
  font-size: 12px;
  word-break: break-all;
}

/* Two controls side by side, for things that belong together. */
.field-row { display: flex; gap: 14px; }
.field-row > div { flex: 1; }
input[type="color"] {
  width: 100%;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--card);
  cursor: pointer;
}
input[type="range"] { width: 100%; accent-color: var(--primary); }

/* ---------------------------------------------------- transcript / q&a */

.row-pick {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row-pick:hover { background: var(--content); }
.row-pick.is-open { background: rgba(33, 150, 243, .08); }

.transcript-pane { display: flex; flex-direction: column; }
.transcript {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding: 4px 2px;
}
.bubble {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 82%;
  padding: 10px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble-user { align-self: flex-end; background: var(--primary); color: #fff; }
.bubble-assistant { align-self: flex-start; background: var(--content); }
/* A human reply looks like the bot to the visitor, but the owner must be able
   to tell at a glance which ones a person actually wrote. */
.bubble-agent { align-self: flex-start; background: #dcfce7; }
.bubble-files { font-size: 12px; opacity: .85; }
.bubble-when { font-size: 11px; opacity: .6; }

.reply-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.reply-row textarea { flex: 1; min-height: 44px; margin: 0; }

.qa-row.is-off { opacity: .5; }
.qa-row .row-sub { white-space: normal; }

/* --------------------------------------------------------------- mcp */

.mcp-card { margin-bottom: 12px; border: 1px solid var(--line); }
.mcp-card .card-head h4 { margin: 0; font-size: 15px; }
.mcp-url {
  display: block;
  margin: 8px 0;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--content);
  font-size: 12px;
  word-break: break-all;
}
.mcp-tools { font-size: 12.5px; line-height: 1.5; }
.mcp-error { margin: 0; font-size: 12.5px; color: var(--danger); line-height: 1.5; }
.mcp-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.hint-ok { color: var(--green); font-weight: 600; }
.hint-bad { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------ google sso */

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  font-size: 12.5px;
  color: var(--fg-muted);
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--card);
  color: var(--fg);
  font-weight: 700;
  text-decoration: none;
}
.btn-google:hover { border-color: var(--fg-muted); }
.g-mark {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 800;
  font-size: 12px;
  color: #4285f4;
}

/* ------------------------------------------------------------- overview */

.ov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.ov-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  border-radius: var(--r-card);
  background: var(--card);
  min-height: 132px;
}
.ov-label {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--fg-muted);
}
.ov-value { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; }
.ov-sub { margin: 0; font-size: 12.5px; color: var(--fg-muted); line-height: 1.45; }
.ov-pair { display: flex; gap: 28px; margin-top: 4px; }
.ov-training { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }

.spark { width: 100%; height: 48px; margin-top: auto; display: block; }
.spark-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; }
.spark-fill { fill: rgba(33, 150, 243, .12); stroke: none; }

/* A proportion, drawn with one property rather than an SVG arc. */
.ring {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  position: relative;
}
.ring::after {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--card);
}
.ring-label {
  position: relative;
  z-index: 1;
  font-size: 11px;
  font-weight: 800;
  color: var(--fg);
  white-space: nowrap;
}
.range-value { font-size: 13px; font-weight: 800; color: var(--primary); }

/* The counts above the source list. */
.src-strip { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.src-tally { min-height: 0; padding: 14px 16px; gap: 2px; }
.src-tally .ov-value { font-size: 22px; }
.src-tally.is-busy .ov-value { color: var(--warn-ink); }
.src-tally.is-bad .ov-value { color: var(--danger); }

/* ------------------------------------------------------- account menu */

.account-menu { position: relative; }
.account-menu > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover { background: var(--content); }
.account-menu .chev { margin-left: 6px; color: var(--fg-muted); font-size: 11px; }

.menu-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 208px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(14, 26, 60, .16);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--content); }
.menu-icon { width: 18px; text-align: center; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }

/* -------------------------------------------------------- bot switcher */

.bot-switcher { position: relative; margin-left: auto; }
.bot-switcher > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  background: var(--card);
  font-size: 14px;
}
.bot-switcher > summary::-webkit-details-marker { display: none; }
.bot-switcher > summary:hover { border-color: var(--primary); }
.switcher-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--fg-muted);
}
.bot-switcher .chev { color: var(--fg-muted); font-size: 11px; }
/* Opens under the control it belongs to rather than the far right edge. */
.menu-pop-left { right: auto; left: 0; max-height: 60vh; overflow-y: auto; }
.menu-item-on { background: var(--content); font-weight: 700; }

/* ------------------------------------------------------------------ team */

.invite-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.invite-row input { flex: 2 1 200px; margin: 0; }
.invite-row select { flex: 1 1 180px; margin: 0; }
.team-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.team-row:last-of-type { border-bottom: 0; }
/* min-width:0 is what stops a long address from being squeezed to nothing by
   the controls beside it — flex items refuse to shrink past their content
   without it, so the whole row overflows instead of wrapping. */
.team-who { flex: 1 1 180px; min-width: 0; }
.team-who .row-title { display: flex; align-items: center; gap: 8px; }
.team-who .row-title, .team-who .row-sub { overflow-wrap: anywhere; }
.pill-you { font-size: 11px; padding: 1px 7px; }
.role-select { flex: 1 1 150px; max-width: 100%; font-size: 13px; padding: 6px 8px; margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-small { padding: 5px 10px; font-size: 13px; }

/* -------------------------------------------------------------- qr code */

.qr-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}
/* A fixed pixel size, and crisp edges: a QR resampled with smoothing is a QR
   that scans badly at small sizes. */
.qr {
  width: 190px;
  height: 190px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  image-rendering: pixelated;
  shape-rendering: crispEdges;
}
.qr-side { flex: 1 1 260px; min-width: 0; }
.snippet-inline {
  margin: 10px 0;
  word-break: break-all;
  font-size: 13px;
}

/* A row in the account menu that is a control rather than a button. */
.menu-item-static { cursor: default; }
.menu-item-static:hover { background: transparent; }
.lang-select {
  flex: 1;
  margin: 0;
  padding: 4px 8px;
  font-size: 14px;
  border-radius: 8px;
}

/* ------------------------------------------------- links and documents */

.src-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.src-search {
  flex: 1 1 220px;
  min-width: 0;
  margin: 0;
  padding: 9px 14px;
  font-size: 14px;
}
/* Pushes what follows to the right without a second flex container. */
.src-spacer { flex: 1 1 0; }
.src-add { margin: 0 0 14px; background: var(--content); }
.src-count { margin: 0 0 8px; font-size: 12.5px; color: var(--fg-muted); }

/* Its own scroller, so a long address widens the table and not the page. */
.src-table-wrap { overflow-x: auto; }
.src-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.src-table th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--fg-muted);
  white-space: nowrap;
}
.src-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.src-table tr:last-child td { border-bottom: 0; }
.src-table tr.is-picked td { background: #f5f8ff; }
.src-tick { width: 32px; }
.src-tick input { margin: 0; }
.src-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.src-when { color: var(--fg-muted); white-space: nowrap; }
.src-type { text-align: center; width: 44px; }
/* The address is the one column allowed to be long, and it wraps rather than
   forcing every other column narrow. */
.src-data { max-width: 460px; overflow-wrap: anywhere; }
.src-data a { color: var(--primary); }

.src-status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.src-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-muted);
}
.src-status.is-ok::before { background: var(--green); }
.src-status.is-bad::before { background: var(--danger); }
.src-status.is-busy::before { background: var(--primary); }

.src-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.src-size { width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }
.src-range { margin-right: auto; font-size: 12.5px; color: var(--fg-muted); }

/* A sortable header is a button so it is reachable by keyboard, but it should
   read as a header rather than as a control. */
.src-sortable { padding: 0; }
.src-sort-btn {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.src-sortable.src-num .src-sort-btn { text-align: right; }
.src-sort-btn:hover { color: var(--fg); }
.src-sortable.is-sorted .src-sort-btn { color: var(--primary); }

/*
 * The connector's public switch, set apart from the on/off switch beside it.
 * These do different jobs and one of them spends the customer's credentials on
 * a stranger's behalf, so it does not sit in the same row looking like a twin.
 */
.mcp-anon {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}
.mcp-anon-hint {
  flex-basis: 100%;
  font-size: 0.8rem;
}

/* The chat-history date filter: two boxes and a way out of them. */
.hist-filter {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}
.hist-date {
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
  background: var(--surface);
  color: inherit;
}

/* Bulk selection on the saved-answers list. */
.qa-bulk:empty { display: none; }
.qa-bulk {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: var(--surface-2, #f1f3f7);
  font-size: 0.85rem;
}
.qa-pick { margin-right: 0.5rem; flex: 0 0 auto; }
