/*
 * Business Automator — member-area design system ("Orbit", 2026-09-30).
 *
 * Loaded by every signed-in member page (community, agents, CRM, Image Studio, learn,
 * admin) right AFTER /_styles/brand.css and BEFORE the page's own stylesheet. It owns:
 *   1. the theme — light (default) and dark, chosen by the member and stored in
 *      localStorage.ba_theme; a tiny inline script in each page's <head> writes
 *      <html data-theme="…"> before first paint, so there is no flash.
 *   2. the font — Geist for everything (Geist Mono for code). No serif anywhere.
 *   3. the brand tokens every app already uses (--ink, --line, --bg, --bg-soft,
 *      --bg-tint, --purple…), RE-TUNED for the new look and REDEFINED for dark mode,
 *      plus the new shell tokens (--panel, --surface, --accent, --ground…).
 *   4. the shared shell drawn by /app-shell.js: the floating left sidebar (collapsible
 *      to an icon rail, expanded by default), the phone dock + drawer, the account
 *      menu, and "the orb" (the Builder's animated presence).
 *
 * ⛔ Selectors here are html:root (0,1,1) / html:root[data-theme="dark"] (0,2,1) on
 *    purpose: they must beat a plain :root block in any page stylesheet in BOTH themes.
 * ⛔ Every shell class is prefixed .bas- so nothing here can restyle an app's own markup.
 * ⛔ Never put a backdrop-filter on anything that contains a position:fixed element
 *    (it becomes that element's containing block) — only the leaf dock and the menu use it.
 */

/* ── 1. Tokens: light ─────────────────────────────────────────────────── */
html:root {
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* brand tokens, re-tuned (every app reads these) */
  --ink:        #121022;
  --ink-2:      #2d2a45;
  --ink-3:      #57536f;   /* 7.3:1 on white */
  --ink-4:      #6b6784;   /* 5.4:1 on white, 4.8:1 on --surface — the apps use it for small secondary text */
  --line:       #ebe9f2;
  --line-2:     #dedbe8;
  --bg:         #ffffff;   /* cards / panels */
  --bg-soft:    #f8f7fb;   /* quiet fills inside a card */
  --bg-tint:    #f4f3f9;   /* the page ground */
  --purple-tint:#f1ebff;
  --shadow-sm:  0 1px 2px rgba(20,16,40,.05);
  --shadow-md:  0 1px 2px rgba(20,16,40,.035), 0 12px 36px rgba(20,16,40,.06);
  --shadow-lg:  0 1px 2px rgba(20,16,40,.04), 0 22px 60px rgba(40,20,110,.12);

  /* shell / new-look tokens */
  --panel:      #ffffff;
  --surface:    #f2f0f7;
  --surface-2:  #f8f7fb;
  --hover:      rgba(18,16,34,.045);
  --muted:      var(--ink-3);
  --accent:     #5b21e6;
  --accent-ink: #5b21e6;
  --accent-soft:rgba(91,33,230,.09);
  --on-accent:  #ffffff;
  --live:       #16a06b;
  --wait:       #d9820f;
  --sched:      #8b6bf2;
  --paused:     #8e89a6;
  --pulse:      rgba(22,160,107,.35);
  --danger-ink: #c42b45;
  --ground:     radial-gradient(1100px 680px at 92% -14%, rgba(122,51,255,.10), rgba(122,51,255,0) 70%), var(--bg-tint);
  --glass:      rgba(251,250,254,.82);
  --glass-line: rgba(18,16,34,.07);
  --shadow:        0 1px 2px rgba(20,16,40,.035), 0 12px 36px rgba(20,16,40,.05);
  --shadow-lift:   0 1px 2px rgba(20,16,40,.04), 0 18px 50px rgba(40,20,110,.10);
  --shadow-float:  inset 0 1px 0 rgba(255,255,255,.9), 0 16px 44px rgba(28,18,72,.12), 0 1px 4px rgba(28,18,72,.05);
  --shadow-accent: 0 6px 18px rgba(91,33,230,.22);
  --focus:      #5b21e6;
  --r-card:     20px;
  --r-ctl:      12px;

  /* the orb */
  --o1:#7a33ff; --o2:#c14dff; --o3:#ff7ab6; --o4:#4fc3ff;
  --o-core:#16063f; --o-deep:#3510a0; --o-rim:#b48cff;
  --orb-halo:rgba(140,70,255,.30); --orb-halo-2:rgba(79,195,255,.12);
  --orb-halo-talk:rgba(140,70,255,.46); --orb-ring:rgba(122,51,255,.45);
  --orb-shade:rgba(12,2,40,.55); --orb-rimlight:rgba(255,255,255,.28);

  /* shell geometry */
  --bas-w: 264px;
  --bas-rail: 72px;
  --bas-gap: 16px;
  --bas-offset: calc(var(--bas-w) + var(--bas-gap) * 2);
  --bas-bottom: 0px;
  /* The page frame every app uses (2026-09-30): content starts one gutter right of the
     sidebar and FILLS the width up to --bas-page-max, left-aligned — so collapsing the
     sidebar hands the page ~190px instead of just re-centring it. */
  --bas-page-max: 1480px;
  --bas-page-x: 28px;
  --bas-page-top: 28px;

  color-scheme: light;
}

/* ── 1b. Tokens: dark ─────────────────────────────────────────────────── */
html:root[data-theme="dark"] {
  --ink:        #f2f0ff;
  --ink-2:      #d9d5f0;
  --ink-3:      #aaa5c8;   /* 8.1:1 on the panel */
  --ink-4:      #8f8ab0;   /* 5.8:1 on the dark panel */
  --line:       #25214a;
  --line-2:     #302b5a;
  --bg:         #0f0d27;
  --bg-soft:    #16133a;
  --bg-tint:    #08071b;
  --purple:     #7c4dff;   /* white text on it: 4.8:1 (buttons, badges) */
  --purple-2:   #cf7bff;
  --purple-3:   #b69dff;   /* used for links/text in the apps — 7.6:1 on the panel */
  --purple-tint:#231b4d;
  --green:      #3ddc97;
  --green-tint: #0f2c23;
  --amber:      #ffb547;
  --amber-tint: #2f2410;
  --red:        #ff7488;
  --red-tint:   #35141f;
  --tier-plus:  #b69dff;
  --tier-pro:   #ffb547;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.4);
  --shadow-md:  inset 0 1px 0 rgba(255,255,255,.03), 0 0 0 1px rgba(255,255,255,.05), 0 14px 40px rgba(0,0,0,.35);
  --shadow-lg:  inset 0 1px 0 rgba(255,255,255,.04), 0 0 0 1px rgba(255,255,255,.06), 0 24px 64px rgba(0,0,0,.5);

  --panel:      #0f0d27;
  --surface:    #1a1740;
  --surface-2:  #131031;
  --hover:      rgba(255,255,255,.05);
  --accent:     #6d35f5;
  --accent-ink: #b8a2ff;
  --accent-soft:rgba(139,92,255,.16);
  --live:       #3ddc97;
  --wait:       #ffb547;
  --sched:      #9c80ff;
  --paused:     #7a749a;
  --pulse:      rgba(61,220,151,.4);
  --danger-ink: #ff7488;
  --ground:     radial-gradient(1100px 700px at 92% -16%, rgba(139,92,255,.20), rgba(139,92,255,0) 70%), var(--bg-tint);
  --glass:      rgba(15,13,39,.80);
  --glass-line: rgba(255,255,255,.08);
  --shadow:        inset 0 1px 0 rgba(255,255,255,.04), 0 0 0 1px rgba(255,255,255,.055), 0 16px 44px rgba(0,0,0,.35);
  --shadow-lift:   inset 0 1px 0 rgba(255,255,255,.05), 0 0 0 1px rgba(255,255,255,.07), 0 22px 60px rgba(0,0,0,.5);
  --shadow-float:  inset 0 1px 0 rgba(255,255,255,.07), 0 0 0 1px rgba(255,255,255,.05), 0 20px 50px rgba(0,0,0,.55);
  --shadow-accent: 0 6px 22px rgba(109,53,245,.42);
  --focus:      #b8a2ff;

  --orb-halo:rgba(150,80,255,.55); --orb-halo-2:rgba(79,195,255,.20);
  --orb-halo-talk:rgba(165,95,255,.70); --orb-ring:rgba(196,176,255,.75);

  color-scheme: dark;
}

/* ── 2. Base: font + ground (member pages only: they carry html.bas-on) ── */
html.bas-on body {
  font-family: var(--font);
  background: var(--ground);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
@media (min-width: 761px) { html.bas-on body { background-attachment: fixed; } }
html.bas-on code, html.bas-on kbd, html.bas-on pre, html.bas-on samp { font-family: var(--font-mono); }
html.bas-on button, html.bas-on input, html.bas-on select, html.bas-on textarea { font-family: inherit; }
html[data-theme="dark"] ::selection { background: rgba(139,92,255,.45); color: #fff; }

/* The page content sits beside the sidebar (desktop), beside the rail (tablet / forced
   rail), and above the dock (phone). Apps with full-height layouts subtract
   var(--bas-bottom) themselves; fixed full-width bars start at var(--bas-offset). */
html.bas-on body { padding-left: var(--bas-offset); padding-bottom: var(--bas-bottom); box-sizing: border-box; }
html.bas-collapsed, html.bas-rail { --bas-offset: calc(var(--bas-rail) + var(--bas-gap) * 2); }
@media (max-width: 1099px) and (min-width: 761px) {
  html.bas-on { --bas-offset: calc(var(--bas-rail) + var(--bas-gap) * 2); }
}
@media (max-width: 760px) {
  html.bas-on { --bas-offset: 0px; --bas-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); --bas-page-x: 16px; --bas-page-top: 16px; }
}

/* ── 3. The orb (the Builder's presence) ──────────────────────────────── */
/* Calm by design (2026-09-30): no orbit lines, just the moving colour field and a slow
   breath. Layers are % of the wrapper, so one markup serves 28px → 240px. `.orb-talk`
   is the listening / speaking state (faster field, a slow voice pulse, soft ripples). */
.orb { position: relative; display: inline-block; flex-shrink: 0; width: 40px; height: 40px; }
.orb > span { position: absolute; border-radius: 50%; }
.orb .orb-glow { inset: -24%; background: radial-gradient(closest-side, var(--orb-halo) 0%, var(--orb-halo) 62%, var(--orb-halo-2) 82%, rgba(0,0,0,0) 100%); filter: blur(3px); animation: orbBreath 14s ease-in-out -4s infinite; }
.orb .orb-body { inset: 0; overflow: hidden; isolation: isolate; background: radial-gradient(circle at 50% 62%, var(--o-core) 0%, var(--o-deep) 44%, var(--o1) 78%, var(--o-rim) 100%); box-shadow: inset 0 -3px 8px var(--orb-shade), inset 0 1px 3px var(--orb-rimlight); animation: orbFloat 16s ease-in-out -3s infinite; }
/* ⛔ WebKit (iOS + macOS Safari) does NOT clip animated, blurred, blended children to a
   border-radius: the turning colour swirls painted as a SQUARE around every orb on iPhones
   (operator screenshot, 2026-10-01). A circular clip-path plus the classic full mask make
   WebKit clip them to the circle; Chrome/Firefox render exactly as before. */
.orb .orb-body { clip-path: circle(50% at 50% 50%); -webkit-mask-image: -webkit-radial-gradient(white, black); }
.orb .orb-body > span { position: absolute; border-radius: 50%; }
.orb .orb-sw1 { inset: -26%; background: conic-gradient(from 20deg, var(--o2) 0%, rgba(0,0,0,0) 13%, var(--o3) 25%, rgba(0,0,0,0) 38%, var(--o4) 50%, rgba(0,0,0,0) 63%, var(--o1) 75%, rgba(0,0,0,0) 88%, var(--o2) 100%); mix-blend-mode: screen; opacity: .9; filter: blur(4px); animation: orbSpin 34s linear -9s infinite; will-change: transform; }
.orb .orb-sw2 { inset: -10%; background: conic-gradient(from 150deg, rgba(0,0,0,0) 0%, var(--o4) 12%, rgba(0,0,0,0) 26%, var(--o2) 44%, rgba(0,0,0,0) 60%, var(--o3) 76%, rgba(0,0,0,0) 92%); mix-blend-mode: screen; opacity: .72; filter: blur(3px); animation: orbSpinRev 24s linear -6s infinite; will-change: transform; }
.orb .orb-core { left: 24%; top: 26%; width: 52%; height: 48%; background: radial-gradient(circle at 46% 46%, rgba(255,255,255,.78), rgba(255,160,225,.42) 30%, rgba(193,77,255,.2) 55%, rgba(0,0,0,0) 72%); mix-blend-mode: screen; filter: blur(2px); animation: orbMorph 26s ease-in-out -5s infinite alternate; }
.orb .orb-spec { inset: 0; background: radial-gradient(circle at 31% 23%, rgba(255,255,255,.95), rgba(255,255,255,0) 19%), radial-gradient(circle at 70% 88%, rgba(120,220,255,.40), rgba(120,220,255,0) 32%), radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 62%, rgba(255,255,255,.14) 100%); }
.orb .orb-rip { inset: 0; border: 2px solid var(--orb-ring); box-shadow: 0 0 12px var(--orb-ring), inset 0 0 12px var(--orb-ring); display: none; }
/* Bigger orbs get proportionally softer layers. */
.orb.orb-lg .orb-glow { filter: blur(8px); }
.orb.orb-lg .orb-sw1 { filter: blur(9px); }
.orb.orb-lg .orb-sw2 { filter: blur(6px); }
.orb.orb-lg .orb-core { filter: blur(5px); }
.orb.orb-lg .orb-body { box-shadow: inset 0 -8px 20px var(--orb-shade), inset 0 3px 8px var(--orb-rimlight); }
/* Small orbs (≤64px: the sidebar, the dock, buttons) — at that size the slow drift reads
   as a still picture, so the colour field turns faster, the blur is lighter (the bands
   stay visible) and the body breathes enough to see (2026-09-30, "the small orb isn't
   moving"). The big orb keeps its calm, slow pulse. */
.orb.orb-sm .orb-glow { inset: -20%; filter: blur(2px); animation: orbBreathSm 6s ease-in-out -2s infinite; }
.orb.orb-sm .orb-body { animation: orbFloatSm 6s ease-in-out -1s infinite; }
.orb.orb-sm .orb-sw1 { filter: blur(2px); opacity: .95; animation-duration: 8s; }
.orb.orb-sm .orb-sw2 { filter: blur(1.5px); opacity: .8; animation-duration: 5.5s; }
.orb.orb-sm .orb-core { filter: blur(1.5px); animation-duration: 7s; }
@keyframes orbFloatSm { 0%,100% { transform: scale(.96); } 50% { transform: scale(1.04); } }
@keyframes orbBreathSm { 0%,100% { transform: scale(.92); opacity: .62; } 50% { transform: scale(1.06); opacity: 1; } }
/* Talk mode: the field moves faster, the body pulses slowly with the voice. */
.orb.orb-talk .orb-rip { display: block; animation: orbRipple 3.6s cubic-bezier(.22,.61,.36,1) infinite; }
.orb.orb-talk .orb-rip:nth-of-type(3) { animation-delay: -1.2s; }
.orb.orb-talk .orb-rip:nth-of-type(4) { animation-delay: -2.4s; }
.orb.orb-talk .orb-body { animation: orbVoice 2.2s ease-in-out -.4s infinite; }
.orb.orb-talk .orb-sw1 { animation-duration: 12s; }
.orb.orb-talk .orb-sw2 { animation-duration: 8s; }
.orb.orb-talk .orb-core { animation-duration: 6s; }
.orb.orb-talk .orb-glow { inset: -32%; background: radial-gradient(closest-side, var(--orb-halo-talk) 0%, var(--orb-halo-talk) 60%, var(--orb-halo-2) 80%, rgba(0,0,0,0) 100%); animation: orbBreathTalk 3s ease-in-out -.6s infinite; }
/* A small orb that is talking turns faster still. */
.orb.orb-sm.orb-talk .orb-sw1 { animation-duration: 3.2s; }
.orb.orb-sm.orb-talk .orb-sw2 { animation-duration: 2.4s; }
.orb.orb-sm.orb-talk .orb-core { animation-duration: 2.6s; }
@keyframes orbSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes orbSpinRev { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes orbMorph {
  0%   { border-radius: 42% 58% 63% 37% / 45% 38% 62% 55%; transform: translate(0,0) scale(1); }
  35%  { border-radius: 58% 42% 40% 60% / 55% 60% 40% 45%; transform: translate(7%,-5%) scale(1.08); }
  70%  { border-radius: 36% 64% 52% 48% / 62% 44% 56% 38%; transform: translate(-6%,6%) scale(.94); }
  100% { border-radius: 50% 50% 38% 62% / 40% 58% 42% 60%; transform: translate(4%,3%) scale(1.03); }
}
@keyframes orbBreath { 0%,100% { transform: scale(1.02); opacity: .9; } 50% { transform: scale(.94); opacity: .66; } }
@keyframes orbBreathTalk { 0%,100% { transform: scale(1.03); opacity: 1; } 45% { transform: scale(.94); opacity: .8; } 72% { transform: scale(1.07); opacity: .95; } }
@keyframes orbFloat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes orbVoice { 0% { transform: scale(1.02); } 22% { transform: scale(1.07); } 45% { transform: scale(1); } 68% { transform: scale(1.06); } 100% { transform: scale(1.02); } }
@keyframes orbRipple { 0% { transform: scale(.98); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes basPulse { 0% { box-shadow: 0 0 0 0 var(--pulse); } 60% { box-shadow: 0 0 0 6px rgba(0,0,0,0); } 100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); } }
/* A hidden tab or an off-screen orb costs nothing. */
html.bas-still .orb *, .orb.orb-still * { animation-play-state: paused !important; }

/* ── 4. Sidebar ───────────────────────────────────────────────────────── */
.bas {
  position: fixed; z-index: 60;
  top: var(--bas-gap); bottom: var(--bas-gap); left: var(--bas-gap);
  width: var(--bas-w);
  display: flex; flex-direction: column;
  padding: 16px 12px 12px;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px; line-height: 1.4;
  box-sizing: border-box;
  overflow: hidden;
}
/* Width animates only while the member toggles it (app-shell adds .bas-anim for ~300ms),
   never on load or on a resize. */
.bas.bas-anim { transition: width .22s ease, padding .22s ease; }
.bas *, .bas *::before, .bas *::after, .bas-menu *, .bas-dock * { box-sizing: border-box; }
.bas [hidden], .bas-menu [hidden], .bas-dock [hidden], .bas[hidden], .bas-menu[hidden] { display: none !important; }
.bas a, .bas-menu a, .bas-dock a { color: inherit; text-decoration: none; }
.bas button, .bas-menu button, .bas-dock button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
.bas svg, .bas-menu svg, .bas-dock svg { display: block; flex-shrink: 0; }
.bas :focus-visible, .bas-menu :focus-visible, .bas-dock :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.bas-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; scrollbar-color: transparent transparent; }
/* The scrollbar shows only while the pointer is over the sidebar (or it has focus) — a
   permanent track down the middle of the menu read as a layout fault on shorter screens. */
.bas-scroll:hover, .bas-scroll:focus-within { scrollbar-color: var(--line) transparent; }
.bas-scroll::-webkit-scrollbar { width: 6px; }
.bas-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.bas-scroll:hover::-webkit-scrollbar-thumb, .bas-scroll:focus-within::-webkit-scrollbar-thumb { background: var(--line); }

.bas-head { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 2px 0 6px; flex-shrink: 0; }
.bas-brand { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; border-radius: 12px; }
.bas-logo { width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; background: linear-gradient(135deg, #9a3bff, #5e1ad8); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; letter-spacing: .01em; }
.bas-word { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bas-icon-btn { width: 36px; height: 36px; flex-shrink: 0; border-radius: 12px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; position: relative; }
.bas-icon-btn:hover { background: var(--hover); color: var(--ink); }

.bas-builder { display: flex; align-items: center; gap: 12px; height: 60px; margin-top: 14px; padding: 0 12px 0 10px; border-radius: 18px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); flex-shrink: 0; transition: box-shadow .18s ease; }
.bas-builder:hover { box-shadow: inset 0 0 0 1px var(--line), inset 0 0 0 999px var(--hover); }
.bas-builder-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.bas-builder-txt b { font-weight: 500; font-size: 15px; white-space: nowrap; }
.bas-builder-txt small { font-size: 13.5px; color: var(--muted); white-space: nowrap; }

.bas-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.bas-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px; border-radius: 12px; color: var(--ink); font-size: 15px; transition: background .15s ease; }
.bas-item:hover { background: var(--hover); }
.bas-item .bas-ico { color: var(--muted); display: flex; }
.bas-item[aria-current="page"], .bas-item.is-active { background: var(--surface); font-weight: 500; }
.bas-item[aria-current="page"] .bas-ico, .bas-item.is-active .bas-ico { color: var(--ink); }
.bas-lbl { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bas-lock { color: var(--muted); display: flex; }
.bas-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--wait); color: #1a1200; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.bas-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 26px; padding-left: 12px; border-left: 1px solid var(--line); }
.bas-sub a { min-height: 34px; display: flex; align-items: center; padding: 0 10px; border-radius: 10px; font-size: 14px; color: var(--muted); }
.bas-sub a:hover { background: var(--hover); color: var(--ink); }
.bas-sub a[aria-current="page"] { color: var(--ink); font-weight: 500; background: var(--hover); }

.bas-sep { height: 1px; background: var(--line); margin: 14px 12px 12px; flex-shrink: 0; }
.bas-nav-sep { height: 1px; background: var(--line); margin: 8px 12px; flex-shrink: 0; }
.bas.is-rail .bas-nav-sep { margin: 6px 8px; }
.bas-sec-head { display: flex; align-items: baseline; gap: 8px; padding: 0 12px 6px; }
.bas-sec-head h2 { flex: 1 1 auto; margin: 0; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.bas-sec-head a { font-size: 13.5px; color: var(--muted); border-radius: 6px; }
.bas-sec-head a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.bas-agents { display: flex; flex-direction: column; gap: 1px; }
.bas-agent { display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 0 12px; border-radius: 12px; font-size: 14.5px; }
.bas-agent:hover { background: var(--hover); }
.bas-agent[aria-current="page"] { background: var(--surface); font-weight: 500; }
.bas-agent .bas-lbl { color: var(--ink); }
.bas-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--paused); }
.bas-dot.is-live { background: var(--live); animation: basPulse 3.2s ease-out infinite; }
.bas-dot.is-wait { background: var(--wait); }
.bas-dot.is-paused { background: transparent; box-shadow: inset 0 0 0 2px var(--paused); }
.bas-dot.is-draft { background: var(--line-2); }
.bas-empty { padding: 4px 12px 8px; font-size: 13.5px; color: var(--muted); }
.bas-empty a { color: var(--accent-ink); }

.bas-foot { flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; padding-top: 10px; }
.bas-credits { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 14px; }
.bas-credits:hover { background: var(--hover); }
.bas-credits-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 14px; }
.bas-credits-row b { font-weight: 500; font-variant-numeric: tabular-nums; }
.bas-credits-row span:last-child { color: var(--muted); white-space: nowrap; }
.bas-meter { height: 4px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.bas-meter > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); width: 0; transition: width .4s ease; }
.bas-credits.is-low .bas-meter > span { background: var(--wait); }
.bas-credits.is-out .bas-meter > span, .bas-credits.is-paused .bas-meter > span { background: var(--danger-ink); }
.bas-credits.is-out .bas-credits-row b, .bas-credits.is-paused .bas-credits-row b { color: var(--danger-ink); }
.bas-credits-ico { display: none; }

.bas-me { display: flex; align-items: center; gap: 4px; padding: 4px 0 0; }
.bas-me-btn { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 4px 8px; border-radius: 14px; }
.bas-me-btn:hover { background: var(--hover); }
.bas-avatar { width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 600; overflow: hidden; }
.bas-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bas-me-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.bas-me-txt b { font-weight: 500; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bas-me-txt small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bas-bell-count { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 600; line-height: 16px; text-align: center; }

/* The collapse / expand control. */
.bas-toggle .bas-ico-collapse { display: block; }
.bas-toggle .bas-ico-expand { display: none; }

/* ── 4b. Rail ─────────────────────────────────────────────────────────── */
/* The sidebar's LOOK is one class on the aside, set by app-shell.js: `.is-rail` when
   the member collapsed it, on a page that forces the rail (admin, learn) and on
   tablets; never in the phone drawer. The page OFFSET is the html classes above, so
   "peeking" (opening the full sidebar over a rail page) never moves the content. */
.bas.is-rail { width: var(--bas-rail); padding: 14px 10px 12px; }
.bas.is-rail .bas-word, .bas.is-rail .bas-lbl, .bas.is-rail .bas-builder-txt,
.bas.is-rail .bas-agents-wrap, .bas.is-rail .bas-sub, .bas.is-rail .bas-me-txt,
.bas.is-rail .bas-credits-row, .bas.is-rail .bas-meter, .bas.is-rail .bas-lock,
.bas.is-rail .bas-item .bas-badge { display: none; }
.bas.is-rail .bas-head { flex-direction: column; height: auto; gap: 8px; padding: 0; }
.bas.is-rail .bas-brand { flex: 0 0 auto; }
.bas.is-rail .bas-toggle .bas-ico-collapse { display: none; }
.bas.is-rail .bas-toggle .bas-ico-expand { display: block; }
.bas.is-rail .bas-builder { height: 52px; width: 52px; padding: 0; justify-content: center; margin-left: auto; margin-right: auto; border-radius: 16px; }
.bas.is-rail .bas-item { width: 44px; min-height: 44px; padding: 0; justify-content: center; margin: 0 auto; }
.bas.is-rail .bas-sep { margin: 10px 8px; }
.bas.is-rail .bas-credits { width: 44px; height: 44px; padding: 0; margin: 0 auto; align-items: center; justify-content: center; }
.bas.is-rail .bas-credits-ico { display: flex; color: var(--muted); }
.bas.is-rail .bas-credits.is-low .bas-credits-ico { color: var(--wait); }
.bas.is-rail .bas-credits.is-out .bas-credits-ico, .bas.is-rail .bas-credits.is-paused .bas-credits-ico { color: var(--danger-ink); }
.bas.is-rail .bas-me { flex-direction: column; gap: 4px; }
.bas.is-rail .bas-me-btn { flex: 0 0 auto; padding: 4px; justify-content: center; min-height: 44px; }
.bas.is-rail .bas-dotbadge { display: block; }
.bas-dotbadge { display: none; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--wait); box-shadow: 0 0 0 2px var(--panel); }
/* Opened over a rail page (tablet, admin, learn): the full sidebar floats above the page. */
.bas.is-peek { z-index: 95; box-shadow: var(--shadow-float); }
.bas-scrim { position: fixed; inset: 0; z-index: 94; background: rgba(8,6,26,.32); }
html[data-theme="dark"] .bas-scrim { background: rgba(0,0,0,.5); }
.bas-scrim[hidden] { display: none; }

/* Rail tooltips (a real label, not only the aria-label). */
.bas-tip { position: fixed; z-index: 120; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: #121022; color: #fff; font: 500 13px/1.3 var(--font); white-space: nowrap; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
html[data-theme="dark"] .bas-tip { background: #f2f0ff; color: #121022; }
.bas-tip[hidden] { display: none; }

/* ── 5. Account menu (opens above the avatar) ────────────────────────── */
.bas-menu {
  position: fixed; z-index: 110;
  width: 264px; max-width: calc(100vw - 24px);
  padding: 8px;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow-float);
  color: var(--ink);
  font: 400 14.5px/1.4 var(--font);
}
.bas-menu[hidden] { display: none; }
.bas-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.bas-menu-head b { display: block; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bas-menu-head small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bas-menu a, .bas-menu button.bas-mi { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border-radius: 10px; font-size: 14.5px; }
.bas-menu a:hover, .bas-menu button.bas-mi:hover { background: var(--hover); }
.bas-menu .bas-ico { color: var(--muted); display: flex; }
.bas-menu .bas-mi-cta { color: var(--accent-ink); font-weight: 500; }
.bas-menu .bas-mi-cta .bas-ico { color: var(--accent-ink); }
.bas-menu .bas-mi-danger { color: var(--danger-ink); }
.bas-menu .bas-mi-danger .bas-ico { color: var(--danger-ink); }
.bas-menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.bas-menu-status { padding: 4px 4px 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }

/* ── 6. Phone: dock + drawer ─────────────────────────────────────────── */
.bas-dock { display: none; }
@media (max-width: 760px) {
  .bas { top: 0; bottom: 0; left: 0; width: min(320px, 86vw) !important; border-radius: 0 24px 24px 0; padding: calc(16px + env(safe-area-inset-top, 0px)) 12px calc(12px + env(safe-area-inset-bottom, 0px)) !important; transform: translateX(-104%); transition: transform .24s ease; z-index: 96; visibility: hidden; }
  html.bas-drawer .bas { transform: none; visibility: visible; box-shadow: var(--shadow-float); }
  html.bas-on .bas .bas-item, html.bas-on .bas .bas-agent { min-height: 44px; }
  html.bas-on .bas .bas-icon-btn { width: 44px; height: 44px; }
  html.bas-on .bas .bas-toggle { display: none; }
  html.bas-on .bas .bas-close { display: inline-flex; }

  .bas-dock {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
    position: fixed; z-index: 58;
    left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    height: 68px; padding: 0 6px;
    border-radius: 24px;
    background: var(--glass);
    -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
    box-shadow: var(--shadow-float);
    font-family: var(--font);
  }
  .bas-dock a, .bas-dock button { height: 56px; min-width: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); border-radius: 16px; position: relative; }
  .bas-dock a[aria-current="page"] { color: var(--accent-ink); }
  .bas-dock .bas-dock-lbl { font-size: 11.5px; font-weight: 500; line-height: 1; letter-spacing: .01em; }
  .bas-dock a[aria-current="page"] .bas-dock-lbl { font-weight: 600; }
  .bas-dock .bas-dock-orb { margin-top: -26px; border-radius: 50%; padding: 4px; background: var(--glass); box-shadow: 0 0 0 1px var(--glass-line); }
  .bas-dock .bas-dotbadge { display: block; top: 6px; right: calc(50% - 18px); }
  .bas-dock .bas-dotbadge[hidden] { display: none; }
  html.bas-kb .bas-dock { display: none; }
}
.bas-close { display: none; }

/* The consent banner's floating cookie button would cover the sidebar's account row; on
   member pages "Cookie settings" lives in the account menu (app-shell.js) instead. The
   banner itself still appears for a visitor who has not chosen yet. */
html.bas-on #bac-fab { display: none !important; }

/* ── 7. Shared bits the apps may use ─────────────────────────────────── */
.bas-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .orb *, .bas-dot, .bas, .bas-meter > span { animation: none !important; transition: none !important; }
  .orb .orb-rip { display: none !important; }
}
@media (forced-colors: active) {
  .bas, .bas-menu, .bas-dock { border: 1px solid CanvasText; }
  .bas-item[aria-current="page"] { outline: 2px solid Highlight; }
}
@media print { .bas, .bas-dock, .bas-menu, .bas-scrim { display: none !important; } html.bas-on body { padding: 0 !important; } }

/* ── 8. The page header every section uses (2026-09-30) ───────────────── */
/* One title style across the member area: a 32px title (no serif, no trailing
   period), a one-line muted description, and the page's actions on the right. */
.bas-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin: 0 0 24px; }
.bas-page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.bas-page-head h1 { margin: 0; font: 500 32px/1.15 var(--font); letter-spacing: -.025em; color: var(--ink); }
.bas-page-head p { margin: 8px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; max-width: 680px; }
.bas-page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 760px) {
  .bas-page-head { margin-bottom: 18px; }
  .bas-page-head h1 { font-size: 28px; }
  .bas-page-actions { width: 100%; }
}
