/* ============================================================================
   BUBBLEGUM COMPONENTS — the reference implementation of every piece of UI,
   written only in tokens.css names. Apps adopt these classes (or match them
   exactly); the guide at styleguide.bubblegum.ai renders this very file.
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--bg-font-ui);
  font-size: var(--bg-text-md);
  line-height: var(--bg-leading);
  color: var(--bg-ink);
  background: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
}
code, kbd, .bg-mono { font-family: var(--bg-font-mono); font-size: 0.92em; }

/* ---- Type ------------------------------------------------------------------ */
.bg-h1 { margin: 0; font-size: var(--bg-text-3xl); font-weight: var(--bg-weight-bold); line-height: var(--bg-leading-tight); letter-spacing: -0.01em; }
.bg-h2 { margin: 0; font-size: var(--bg-text-2xl); font-weight: var(--bg-weight-bold); line-height: var(--bg-leading-tight); }
.bg-h3 { margin: 0; font-size: var(--bg-text-xl); font-weight: var(--bg-weight-semibold); line-height: var(--bg-leading-tight); }
.bg-h4 { margin: 0; font-size: var(--bg-text-lg); font-weight: var(--bg-weight-semibold); }
.bg-lede { margin: 6px 0 0; font-size: var(--bg-text-lg); color: var(--bg-ink-muted); line-height: 1.5; max-width: 62ch; }
.bg-body { margin: 0; }
.bg-small { font-size: var(--bg-text-sm); color: var(--bg-ink-muted); }
.bg-meta { font-size: var(--bg-text-xs); color: var(--bg-ink-muted); }
.bg-eyebrow {
  display: inline-block;
  font-size: var(--bg-text-2xs);
  font-weight: var(--bg-weight-bold);
  letter-spacing: var(--bg-tracking-eyebrow);
  text-transform: uppercase;
  color: var(--bg-ink-muted);
}
.bg-eyebrow--accent { color: var(--bg-accent); }
/* The one heading format for a setting, shelf or card: a header, then the
   sentence that says what it is. Never a header alone. */
.bg-title { display: grid; gap: 2px; }
.bg-title > b { font-size: var(--bg-text-lg); font-weight: var(--bg-weight-semibold); }
.bg-title > span { font-size: var(--bg-text-sm); color: var(--bg-ink-muted); line-height: 1.45; }
a.bg-link { color: var(--bg-accent); text-decoration: none; font-weight: var(--bg-weight-semibold); }
a.bg-link:hover { text-decoration: underline; }

/* ---- Buttons --------------------------------------------------------------- */
.bg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--bg-btn-h);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--bg-radius-press);
  background: var(--bg-panel);
  color: var(--bg-ink);
  font: inherit;
  font-size: var(--bg-text-md);
  font-weight: var(--bg-weight-semibold);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--bg-dur-hover) ease, border-color var(--bg-dur-hover) ease, color var(--bg-dur-hover) ease, box-shadow var(--bg-dur-hover) ease;
}
.bg-btn svg { width: 16px; height: 16px; flex: none; }
.bg-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--bg-accent-ring); }
.bg-btn[disabled], .bg-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.bg-btn--primary { background: var(--bg-accent); color: var(--bg-ink-inverse); box-shadow: var(--bg-shadow-accent); }
.bg-btn--primary:hover { background: var(--bg-accent-hover); }

.bg-btn--secondary { border-color: var(--bg-line); }
.bg-btn--secondary:hover { border-color: var(--bg-line-strong); }

.bg-btn--danger { background: var(--bg-danger-weak); color: var(--bg-danger-ink); }
.bg-btn--danger:hover { background: var(--bg-danger-line); }

.bg-btn--text { background: none; color: var(--bg-accent); padding: 0 6px; }
.bg-btn--text:hover { text-decoration: underline; }

/* Compact, inline, and always a pill: the action that lives inside a row or
   under a field (Test with agent, Save changes, Open in new tab). */
.bg-btn--sm {
  height: var(--bg-btn-h-sm);
  padding: 0 12px;
  border-color: var(--bg-line);
  font-size: var(--bg-text-xs);
  color: var(--bg-ink-muted);
}
.bg-btn--sm:hover { border-color: var(--bg-line-strong); color: var(--bg-ink); }
.bg-btn--sm.bg-btn--primary { border-color: transparent; color: var(--bg-ink-inverse); }
.bg-btn--sm.bg-btn--danger { border-color: transparent; }

/* A square that holds one glyph: close, chevron, overflow, prev/next. */
.bg-btn--icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--bg-radius-circle);
  background: none;
  color: var(--bg-ink-muted);
}
.bg-btn--icon:hover { background: var(--bg-soft-2); color: var(--bg-ink); }
.bg-btn--icon.bg-btn--round { border: 1px solid var(--bg-line); }
.bg-btn--icon svg { width: 17px; height: 17px; }

/* ---- Chips & tags ---------------------------------------------------------- */
/* A chip is a choice you press: a filter, a paste-in value, a toggle. */
.bg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--bg-btn-h-sm);
  padding: 0 12px;
  border: 1px solid var(--bg-line);
  border-radius: var(--bg-radius-press);
  background: var(--bg-panel);
  color: var(--bg-ink);
  font: inherit;
  font-size: var(--bg-text-xs);
  font-weight: var(--bg-weight-semibold);
  cursor: pointer;
  transition: border-color var(--bg-dur-hover) ease, background var(--bg-dur-hover) ease;
}
.bg-chip:hover { border-color: var(--bg-line-strong); }
.bg-chip[aria-pressed="true"], .bg-chip.is-on { border-color: var(--bg-accent); background: var(--bg-accent-weak); font-weight: var(--bg-weight-semibold); }
.bg-chip--dashed { border-style: dashed; }
/* SETTLED PILL (v1.3): what a setting IS right now — an event type, a
   duration, a location, an exception. One size for all of them: the small
   button's 30px, 12px/600, the pill. Only the COLOUR says which category it
   belongs to; shape and size never do. A pill may carry its own controls
   (a menu ≡, a remove ×) as 22px circles inside it — they never make it
   taller. Two linked values (a kind and its duration) are joined by a rule. */
.bg-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--bg-btn-h-sm);
  padding: 0 12px;
  border-radius: var(--bg-radius-press);
  background: var(--bg-soft-2);
  color: var(--bg-ink-muted);
  font-size: var(--bg-text-xs);
  font-weight: var(--bg-weight-semibold);
  line-height: 1;
  white-space: nowrap;
}
.bg-pill:has(.ctl) { padding-right: 5px; }
.bg-pill .ctl { width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: inherit; opacity: 0.7; display: inline-grid; place-items: center; cursor: pointer; padding: 0; font: inherit; }
.bg-pill .ctl:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.bg-pill .ctl svg { width: 13px; height: 13px; }
.bg-pill--saved { background: var(--bg-success-weak); color: var(--bg-success-ink); }
.bg-pill--pending { background: var(--bg-panel); color: var(--bg-accent); box-shadow: inset 0 0 0 1.5px var(--bg-accent); border: 0; outline: 0; background-image: none; }
.bg-pill--pending { box-shadow: none; border: 1.5px dashed var(--bg-accent); }
.bg-pill--warn { background: var(--bg-warning-weak); color: var(--bg-warning-ink); }
.bg-pill--accent { background: var(--bg-accent-weak); color: var(--bg-accent-ink); }
.bg-pill--pink { background: var(--bg-side-theirs-weak); color: var(--bg-side-theirs); }
.bg-pill--blue { background: #e0f2fe; color: #0369a1; }
.bg-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* A linked pair: pill — rule — pill. The rule takes the first pill's colour. */
.bg-pill-link { display: inline-flex; align-items: center; gap: 0; }
.bg-pill-link > i { width: 14px; height: 0; border-top: 1.5px solid var(--bg-success); }
/* A tag is a fact you read: a kind, a status, a count. Never clickable. */
.bg-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--bg-radius-pill);
  background: var(--bg-soft-2);
  color: var(--bg-ink-muted);
  font-size: var(--bg-text-2xs);
  font-weight: var(--bg-weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.6;
}
.bg-tag--accent { background: var(--bg-accent-weak); color: var(--bg-accent-ink); }
.bg-tag--ok { background: var(--bg-success-weak); color: var(--bg-success-ink); }
.bg-tag--warn { background: var(--bg-warning-weak); color: var(--bg-warning-ink); }
.bg-tag--danger { background: var(--bg-danger-weak); color: var(--bg-danger-ink); }
.bg-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- Inputs ---------------------------------------------------------------- */
.bg-field { display: grid; gap: 5px; }
.bg-field > label { font-size: var(--bg-text-md); font-weight: var(--bg-weight-semibold); }
.bg-field > .hint { font-size: var(--bg-text-sm); color: var(--bg-ink-muted); margin-top: -3px; }
.bg-input, .bg-textarea, .bg-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--bg-radius-md);
  background: var(--bg-soft);
  color: var(--bg-ink);
  font: inherit;
  font-size: var(--bg-text-md);
  line-height: 1.4;
  transition: background var(--bg-dur-hover) ease, border-color var(--bg-dur-hover) ease, box-shadow var(--bg-dur-hover) ease;
}
.bg-input::placeholder, .bg-textarea::placeholder { color: var(--bg-ink-subtle); }
.bg-input:focus, .bg-textarea:focus, .bg-select:focus { outline: none; background: var(--bg-panel); border-color: var(--bg-accent); box-shadow: 0 0 0 3px var(--bg-accent-ring); }
.bg-textarea { min-height: 76px; resize: vertical; }
/* ON A TINTED SURFACE THE INPUT INVERTS (v1.2, Joe: "these grey fields in grey
   blocks cannot be seen"). A soft fill is only visible on a white panel; inside
   a quiet card, a note or any soft-painted container the field is white with a
   line instead. Same focus ring either way. Mark the container `bg-on-soft`
   (or use a quiet card, which does it for you). */
.bg-card--quiet .bg-input, .bg-card--quiet .bg-textarea, .bg-card--quiet .bg-select,
.bg-note .bg-input, .bg-note .bg-textarea,
.bg-on-soft .bg-input, .bg-on-soft .bg-textarea, .bg-on-soft .bg-select {
  background: var(--bg-panel);
  border-color: var(--bg-line);
}
.bg-card--quiet .bg-input:focus, .bg-card--quiet .bg-textarea:focus, .bg-on-soft .bg-input:focus, .bg-on-soft .bg-textarea:focus { border-color: var(--bg-accent); }
.bg-input.is-invalid, .bg-textarea.is-invalid { border-color: var(--bg-danger); background: var(--bg-panel); }
.bg-input--danger:focus { border-color: var(--bg-danger); box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.12); }

/* Checkbox and radio: the native control, sized and coloured. */
.bg-check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--bg-text-md); cursor: pointer; }
.bg-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--bg-accent); }

/* A switch is for a state that takes effect at once (on / off), never for a
   choice that needs Save. */
.bg-switch { position: relative; width: 40px; height: 22px; border: 0; border-radius: var(--bg-radius-pill); background: var(--bg-line-strong); cursor: pointer; padding: 0; transition: background var(--bg-dur-hover) ease; }
.bg-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform var(--bg-dur-hover) ease; }
.bg-switch[aria-checked="true"] { background: var(--bg-accent); }
.bg-switch[aria-checked="true"]::after { transform: translateX(18px); }

/* Radio pill: one of a few short words (Low / Med. / High). */
.bg-radio-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.bg-radio-pill { display: inline-flex; align-items: center; gap: 6px; height: var(--bg-btn-h-sm); padding: 0 12px; border: 1px solid var(--bg-line); border-radius: var(--bg-radius-press); background: var(--bg-panel); font-size: var(--bg-text-xs); font-weight: var(--bg-weight-semibold); cursor: pointer; }
.bg-radio-pill input { margin: 0; accent-color: var(--bg-accent); }
.bg-radio-pill:has(input:checked) { border-color: var(--bg-accent); background: var(--bg-accent-weak); font-weight: var(--bg-weight-semibold); }

/* Option card: one of a few choices that each need a sentence (Proactiveness,
   sharing modes). Title plus description, the heading format again. */
.bg-options { display: grid; gap: 8px; }
.bg-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--bg-line); border-radius: var(--bg-radius-lg); background: var(--bg-panel); cursor: pointer; transition: border-color var(--bg-dur-hover) ease, background var(--bg-dur-hover) ease; }
.bg-option:hover { border-color: var(--bg-line-strong); }
.bg-option:has(input:checked) { border-color: var(--bg-accent); background: #f7f7ff; }
.bg-option input { margin-top: 2px; flex: none; accent-color: var(--bg-accent); }
.bg-option .bg-title > b { font-size: var(--bg-text-md); }

/* Segmented control: two to four tabs on one track. */
.bg-tabs { display: flex; gap: 4px; padding: 3px; border-radius: var(--bg-radius-press); background: var(--bg-soft-2); }
.bg-tab { flex: 1 1 auto; height: var(--bg-btn-h-sm); padding: 0 12px; border: 0; border-radius: var(--bg-radius-press); background: none; color: var(--bg-ink-muted); font: inherit; font-size: var(--bg-text-xs); font-weight: var(--bg-weight-semibold); cursor: pointer; }
.bg-tab[aria-selected="true"] { background: var(--bg-panel); color: var(--bg-ink); box-shadow: 0 1px 2px rgba(16, 16, 26, 0.12); }
/* A stacked list of views (Neurons / OpenAI Paid / Chats / Bookings): the same
   pill, the selected one in the accent tint. */
.bg-vtabs { display: grid; gap: 4px; }
.bg-vtab { height: var(--bg-btn-h-sm); padding: 0 12px; border: 1px solid transparent; border-radius: var(--bg-radius-press); background: none; color: var(--bg-ink-muted); font: inherit; font-size: var(--bg-text-xs); font-weight: var(--bg-weight-semibold); text-align: left; cursor: pointer; }
.bg-vtab:hover { background: var(--bg-soft-2); }
.bg-vtab[aria-selected="true"] { background: var(--bg-accent-weak); border-color: var(--bg-accent-line); color: var(--bg-accent); }

/* Dropdown (styled select): a button that opens a menu of tiles. */
.bg-dd { position: relative; }
.bg-dd-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 1px solid var(--bg-line); border-radius: var(--bg-radius-lg); background: var(--bg-panel); font: inherit; font-size: var(--bg-text-lg); font-weight: var(--bg-weight-semibold); cursor: pointer; text-align: left; }
.bg-dd-btn:hover { border-color: var(--bg-line-strong); }
.bg-dd-btn .chev { margin-left: auto; color: var(--bg-ink-subtle); width: 18px; height: 18px; }
.bg-dd-menu { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; padding: 5px; border: 1px solid var(--bg-line); border-radius: var(--bg-radius-lg); background: var(--bg-panel); box-shadow: var(--bg-shadow-float); display: grid; gap: 2px; }
.bg-dd-opt { display: flex; align-items: flex-start; gap: 10px; padding: 7px 8px; border: 0; border-radius: 9px; background: none; font: inherit; text-align: left; cursor: pointer; }
.bg-dd-opt:hover { background: var(--bg-soft-2); }
.bg-dd-opt.is-on { background: var(--bg-accent-weak); }

/* ---- Surfaces -------------------------------------------------------------- */
.bg-card { background: var(--bg-panel); border: 1px solid var(--bg-line); border-radius: var(--bg-radius-lg); box-shadow: var(--bg-shadow-rest); padding: var(--bg-space-4); }
.bg-card.is-link { cursor: pointer; transition: box-shadow var(--bg-dur-hover) ease, transform var(--bg-dur-hover) ease; }
.bg-card.is-link:hover { box-shadow: var(--bg-shadow-lift); transform: translateY(-1px); }
.bg-card--quiet { box-shadow: none; background: var(--bg-soft); border-color: transparent; }
.bg-rule { border: 0; border-top: 1px solid var(--bg-line); margin: var(--bg-space-3) 0; }
.bg-rule--dashed { border-top-style: dashed; }

/* List row with an avatar: an agent, a person, a file. */
.bg-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--bg-line); }
.bg-row:first-child { border-top: 0; }
.bg-row .bg-body-col { flex: 1; min-width: 0; }
.bg-row .name { font-size: var(--bg-text-lg); font-weight: var(--bg-weight-semibold); display: flex; align-items: center; gap: 8px; }
.bg-row .sub { font-size: var(--bg-text-sm); color: var(--bg-ink-muted); }
.bg-row .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.bg-avatar { width: 40px; height: 40px; border-radius: var(--bg-radius-circle); background: var(--bg-soft-2); display: inline-grid; place-items: center; flex: none; font-weight: var(--bg-weight-semibold); color: var(--bg-ink-muted); object-fit: cover; }
.bg-avatar--tint { background: var(--bg-accent-weak); color: var(--bg-accent); }
.bg-avatar--tint svg { width: 20px; height: 20px; }
.bg-tile { width: 32px; height: 32px; border-radius: var(--bg-radius-sm); background: var(--bg-accent-weak); display: inline-grid; place-items: center; }
.bg-tile img, .bg-tile svg { width: 16px; height: 16px; }

/* Every top bar: 57px including its rule, so seams meet across panels. */
.bg-head { display: flex; align-items: center; gap: 10px; min-height: var(--bg-bar-h); padding: 0 var(--bg-gutter); border-bottom: 1px solid var(--bg-line); background: var(--bg-panel); }
.bg-head > .bg-h3 { flex: 1; min-width: 0; }

/* Config card: the drawer's unit. Eyebrow head with a rule, folds beneath. */
.bg-config { padding: var(--bg-space-4) 0 var(--bg-space-6); }
.bg-config-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--bg-line); }
.bg-config-head .bg-eyebrow { color: var(--bg-ink-muted); }
.bg-config-head .bg-eyebrow--accent { color: var(--bg-accent); }
.bg-config-sub { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; }
.bg-config-sub .bg-eyebrow { font-size: var(--bg-text-2xs); }
.bg-config-sub .fold { width: 14px; height: 14px; color: var(--bg-ink-subtle); }

/* EXAMPLES LIST (v1.4): under a config card's instructions. A bulleted label
   in ink, then one or more example lines as quiet boxes — the words the owner
   could type, in the shape of the box they would type them into. */
.bg-examples { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.bg-examples > li { display: grid; gap: 5px; }
.bg-examples > li > b { font-weight: var(--bg-weight); font-size: var(--bg-text-md); padding-left: 14px; position: relative; }
.bg-examples > li > b::before { content: ""; position: absolute; left: 2px; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--bg-ink-subtle); }
.bg-examples > li > span { display: block; padding: 8px 12px; border-radius: var(--bg-radius-md); background: var(--bg-soft); color: var(--bg-ink-muted); font-size: var(--bg-text-md); line-height: 1.45; }
.bg-examples-h { margin: 12px 0 0; font-size: var(--bg-text-md); font-weight: var(--bg-weight-semibold); }
/* Notes: a sentence with a tint. Neutral for guidance, accent for "ask
   Bubbles", warn for something that changed, danger for something broken. */
.bg-note { display: grid; gap: 3px; padding: 9px 11px; border-radius: var(--bg-radius-lg); background: var(--bg-soft); border: 1px solid transparent; font-size: var(--bg-text-sm); line-height: 1.45; color: var(--bg-ink-muted); }
.bg-note > b { color: var(--bg-ink); font-size: var(--bg-text-sm); }
.bg-note--accent { background: var(--bg-accent-weak); color: var(--bg-ink-muted); border-color: transparent; }
.bg-note--accent b { color: var(--bg-accent); }
.bg-note--warn { background: var(--bg-warning-weak); border-color: var(--bg-warning-line); color: var(--bg-warning-ink); }
.bg-note--warn b { color: var(--bg-warning-ink); }
.bg-note--danger { background: var(--bg-danger-weak); border-color: var(--bg-danger-line); color: var(--bg-danger-ink); }
.bg-note--danger b { color: var(--bg-danger-ink); }
/* The ask row: a pixel sprite, a question, one accent verb. Always a button. */
.bg-ask { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 12px 8px 9px; border: 1px solid transparent; border-radius: var(--bg-radius-lg); background: var(--bg-accent-weak); color: var(--bg-ink-muted); font: inherit; font-size: var(--bg-text-sm); text-align: left; cursor: pointer; transition: background var(--bg-dur-hover) ease, border-color var(--bg-dur-hover) ease; }
.bg-ask:hover { background: #e8e8fa; border-color: var(--bg-accent-line); }
.bg-ask b { font-weight: var(--bg-weight-semibold); color: var(--bg-accent); }
.bg-ask img { width: 26px; height: 26px; image-rendering: pixelated; }

/* Chat bubbles: theirs is a tinted pill anchored right; ours is bare text. */
.bg-bubble { margin: 0 0 14px; line-height: var(--bg-leading-loose); font-size: var(--bg-text-md); }
.bg-bubble--me { background: var(--bg-accent-weak); border-radius: 12px 12px 4px 12px; padding: 8px 11px; margin-left: 28px; overflow-wrap: anywhere; }
.bg-bubble--err { color: var(--bg-danger-ink); }
.bg-chat-foot { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; border-top: 1px solid var(--bg-line); }
.bg-chat-foot .bg-textarea { min-height: 42px; border-radius: var(--bg-radius-xl); }
.bg-chat-foot .bg-btn--icon { width: 36px; height: 36px; background: var(--bg-accent); color: #fff; flex: none; }
.bg-chat-foot .bg-btn--icon[disabled] { background: var(--bg-soft-2); color: var(--bg-ink-subtle); }

/* Tooltip: our own, above, after a beat. `data-tip` on a positioned parent. */
.bg-tip { position: relative; }
.bg-tip::after { content: attr(data-tip); position: absolute; z-index: 8; bottom: calc(100% + 6px); left: 0; right: 0; width: auto; padding: 8px 10px; border-radius: var(--bg-radius-md); background: #1f2330; color: #fff; font-size: 11.5px; font-weight: var(--bg-weight); line-height: 1.45; white-space: normal; text-align: left; box-shadow: var(--bg-shadow-float); opacity: 0; visibility: hidden; transition: opacity 0.1s ease, visibility 0s linear 0.1s; pointer-events: none; }
.bg-tip:hover::after, .bg-tip:has(:focus-visible)::after { opacity: 1; visibility: visible; transition: opacity 0.12s ease var(--bg-tip-delay), visibility 0s linear var(--bg-tip-delay); }
.bg-tip[data-quiet]::after { opacity: 0 !important; visibility: hidden !important; transition: none !important; }

/* Toast: dark, bottom-weighted shadow, one line, top right. */
.bg-toast { display: inline-flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--bg-radius-lg); background: #1f2330; color: #fff; font-size: var(--bg-text-md); box-shadow: var(--bg-shadow-toast); }
.bg-toast--error { background: #4a1d1a; }
.bg-toast .bg-btn--text { color: #b9b9ff; }

/* Spinner and empty state. */
.bg-spinner { width: 18px; height: 18px; border: 2px solid var(--bg-line); border-top-color: var(--bg-accent); border-radius: 50%; animation: bg-spin 0.8s linear infinite; }
@keyframes bg-spin { to { transform: rotate(360deg); } }
.bg-empty { padding: var(--bg-space-6); text-align: center; color: var(--bg-ink-muted); font-size: var(--bg-text-sm); }
.bg-empty b { display: block; color: var(--bg-ink); font-size: var(--bg-text-md); margin-bottom: 4px; }

/* Panels (shown scaled in the guide; real ones are fixed to the viewport). */
.bg-drawer { display: flex; flex-direction: column; background: var(--bg-panel); border-left: 1px solid var(--bg-line); }
.bg-drawer--split { border-left: 0; border-right: 1px solid var(--bg-line); }
.bg-drawer .body { flex: 1; overflow: auto; padding: 0 var(--bg-gutter) 18px; }
.bg-modal { background: var(--bg-panel); border-radius: var(--bg-radius-xl); box-shadow: var(--bg-shadow-modal); max-width: var(--bg-modal-w); overflow: hidden; }
.bg-modal .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px var(--bg-gutter); border-top: 1px solid var(--bg-line); }
.bg-scrim { background: var(--bg-scrim); }

/* Sticky toolbar inside a scroller: the collapse bar, the pinned card head. */
.bg-pinned { position: sticky; top: 0; z-index: 4; background: var(--bg-panel); border-bottom: 1px solid var(--bg-line); padding: 10px var(--bg-gutter); }

/* Motion: a panel arrives with a short slide; leaves the way it came. */
@keyframes bg-in-right { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes bg-in-left { from { transform: translateX(-24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes bg-out-right { to { transform: translateX(101%); opacity: 0.6; } }
@keyframes bg-out-left { to { transform: translateX(-101%); opacity: 0.6; } }
@keyframes bg-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
