/* ============================================================
   Botnest component classes — the visual layer.
   Usable from plain HTML directly; the React primitives in
   components/ are thin wrappers over these classes.
   Sizing tracks the density tokens, so any component inside
   [data-bn-density="compact"] tightens automatically.
   ============================================================ */

/* ---------- Actions ---------- */
.bn-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; height: var(--bn-control-h); padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--bn-radius-sm);
  font: var(--bn-weight-bold) var(--bn-text-body)/1 var(--bn-font-ui);
  cursor: pointer; white-space: nowrap; user-select: none;
  background: var(--bn-action); color: var(--bn-on-action);
  transition: background var(--bn-dur-1) var(--bn-ease),
              border-color var(--bn-dur-1) var(--bn-ease),
              color var(--bn-dur-1) var(--bn-ease),
              box-shadow var(--bn-dur-1) var(--bn-ease),
              transform var(--bn-dur-1) var(--bn-ease);
}
.bn-btn:hover  { background: var(--bn-action-hover); }
.bn-btn:active { background: var(--bn-action-press); transform: translateY(1px); }
.bn-btn:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }

.bn-btn--secondary {
  background: transparent; color: var(--bn-link);
  border-color: var(--bn-border-strong);
}
.bn-btn--secondary:hover  { background: var(--bn-action-subtle); border-color: var(--bn-link); }
.bn-btn--secondary:active { background: var(--bn-action-subtle-hover); }

.bn-btn--ghost { background: transparent; color: var(--bn-link); }
.bn-btn--ghost:hover  { background: var(--bn-action-subtle); }
.bn-btn--ghost:active { background: var(--bn-action-subtle-hover); }

.bn-btn--success { background: var(--bn-success-fill); color: var(--bn-on-success); }
.bn-btn--success:hover { filter: brightness(1.08); background: var(--bn-success-fill); }

.bn-btn--danger { background: var(--bn-danger-fill); color: var(--bn-on-danger); }
.bn-btn--danger:hover { background: var(--bn-danger-hover); }

.bn-btn--danger-ghost { background: transparent; color: var(--bn-danger-text); border-color: var(--bn-danger-border); }
.bn-btn--danger-ghost:hover { background: var(--bn-danger-subtle); }

.bn-btn--sm { height: var(--bn-control-h-sm); padding: 0 12px; font-size: var(--bn-text-small); gap: 6px; }
.bn-btn--lg { height: var(--bn-control-h-lg); padding: 0 22px; font-size: 16px; }
.bn-btn--icon { width: var(--bn-control-h); padding: 0; }
.bn-btn--icon.bn-btn--sm { width: var(--bn-control-h-sm); }

.bn-btn-group { display: inline-flex; }
.bn-btn-group > .bn-btn { border-radius: 0; }
.bn-btn-group > .bn-btn:first-child { border-radius: var(--bn-radius-sm) 0 0 var(--bn-radius-sm); }
.bn-btn-group > .bn-btn:last-child  { border-radius: 0 var(--bn-radius-sm) var(--bn-radius-sm) 0; }
.bn-btn-group > .bn-btn--secondary + .bn-btn--secondary { margin-left: -1px; }
.bn-btn-group > .bn-btn[aria-pressed="true"] { background: var(--bn-selected); color: var(--bn-text); border-color: var(--bn-link); position: relative; z-index: 1; }

/* ---------- Forms ---------- */
.bn-field { display: flex; flex-direction: column; gap: 6px; }
.bn-label { font: var(--bn-weight-medium) var(--bn-text-small)/1.3 var(--bn-font-ui); color: var(--bn-text-2); }
.bn-help  { font-size: var(--bn-text-tiny); color: var(--bn-text-3); }
.bn-error-text { font-size: var(--bn-text-tiny); color: var(--bn-danger-text); }

.bn-input, .bn-textarea, .bn-select {
  width: 100%; height: var(--bn-control-h); padding: 0 12px;
  background: var(--bn-surface); color: var(--bn-text);
  border: 1px solid var(--bn-border); border-radius: var(--bn-radius-sm);
  transition: border-color var(--bn-dur-1) var(--bn-ease), box-shadow var(--bn-dur-1) var(--bn-ease), background var(--bn-dur-1) var(--bn-ease);
}
.bn-input::placeholder, .bn-textarea::placeholder { color: var(--bn-text-3); }
.bn-input:hover, .bn-textarea:hover, .bn-select:hover { border-color: var(--bn-border-strong); }
.bn-input:focus, .bn-textarea:focus, .bn-select:focus {
  outline: none; border-color: var(--bn-focus-ring); box-shadow: var(--bn-focus-glow);
}
.bn-input[aria-invalid="true"], .bn-textarea[aria-invalid="true"] {
  border-color: var(--bn-danger-border);
}
.bn-input:disabled, .bn-textarea:disabled, .bn-select:disabled { opacity: 0.5; cursor: not-allowed; }
.bn-textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: var(--bn-leading-body); }
.bn-select { appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888f9e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}

.bn-input-wrap { position: relative; display: flex; align-items: center; }
.bn-input-wrap > .bn-input { padding-left: 36px; }
.bn-input-wrap > .bn-input-icon { position: absolute; left: 10px; color: var(--bn-text-3); pointer-events: none; display: flex; }
.bn-input-wrap.has-trailing > .bn-input { padding-right: 38px; }
.bn-input-wrap > .bn-input-trailing { position: absolute; right: 4px; display: flex; }

/* ---------- Auth — the doorway: brand panel left, form right ---------- */
.bn-auth { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr); min-height: 100vh; background: var(--bn-bg); }
.bn-auth-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 28px; padding: 40px; }
.bn-auth-tagline { margin: 0; max-width: 20ch; font: var(--bn-weight-heavy) var(--bn-text-h1)/1.12 var(--bn-font-ui); letter-spacing: -0.02em; text-wrap: pretty; }
.bn-auth-note { margin: 0; max-width: 34ch; color: var(--bn-chrome-text-dim); font-size: var(--bn-text-small); text-wrap: pretty; }
.bn-auth-body { display: flex; align-items: center; justify-content: center; padding: 40px 24px; overflow-y: auto; }
.bn-auth-form { width: 100%; max-width: 372px; display: flex; flex-direction: column; gap: 16px; }
.bn-auth-divider { display: flex; align-items: center; gap: 12px; color: var(--bn-text-3);
  font: var(--bn-weight-bold) var(--bn-text-tiny)/1 var(--bn-font-ui); letter-spacing: 0.09em; text-transform: uppercase; }
.bn-auth-divider::before, .bn-auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--bn-border); }
.bn-auth-foot { margin: 0; text-align: center; color: var(--bn-text-2); font-size: var(--bn-text-small); }
@media (max-width: 860px) {
  .bn-auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; }
  .bn-auth-brand { padding: 22px 22px 26px; gap: 14px; border-right: none; border-bottom: 1px solid var(--bn-border); }
  .bn-auth-tagline { font-size: var(--bn-text-h3); max-width: none; }
  .bn-auth-note { display: none; }
  .bn-auth-body { padding: 26px 20px 40px; align-items: flex-start; }
  /* Touch targets: inputs and the action stack grow past 44px */
  .bn-auth-form .bn-input, .bn-auth-form .bn-btn { height: 48px; }
  .bn-auth-form .bn-btn--sm { height: var(--bn-control-h-sm); }
  .bn-auth-form .bn-btn--icon { width: 40px; height: 40px; }
  .bn-auth-form .bn-check { padding: 6px 0; }
}

/* Checkbox & radio */
.bn-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--bn-text-body); }
.bn-check input { appearance: none; margin: 0; width: 18px; height: 18px; flex: none;
  border: 1.5px solid var(--bn-border-strong); border-radius: 5px; background: var(--bn-surface);
  display: grid; place-content: center; cursor: pointer;
  transition: background var(--bn-dur-1) var(--bn-ease), border-color var(--bn-dur-1) var(--bn-ease);
}
.bn-check input[type="radio"] { border-radius: 50%; }
.bn-check input::before { content: ""; width: 10px; height: 10px; transform: scale(0);
  transition: transform var(--bn-dur-1) var(--bn-ease);
  background: var(--bn-on-action);
  clip-path: polygon(14% 46%, 0 62%, 40% 100%, 100% 18%, 84% 4%, 38% 68%);
}
.bn-check input[type="radio"]::before { clip-path: none; border-radius: 50%; width: 8px; height: 8px; }
.bn-check input:checked { background: var(--bn-action); border-color: var(--bn-action); }
.bn-check input:checked::before { transform: scale(1); }
.bn-check input:disabled { opacity: 0.45; cursor: not-allowed; }

/* Switch */
.bn-switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--bn-text-body); }
.bn-switch input { appearance: none; margin: 0; width: 40px; height: 22px; flex: none; border-radius: 999px;
  background: var(--bn-track); border: 1px solid var(--bn-border);
  transition: background var(--bn-dur-2) var(--bn-ease); cursor: pointer; position: relative;
}
.bn-switch input::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--bn-text-3);
  transition: transform var(--bn-dur-2) var(--bn-ease-io), background var(--bn-dur-2) var(--bn-ease);
}
.bn-switch input:checked { background: var(--bn-action); border-color: var(--bn-action); }
.bn-switch input:checked::before { transform: translateX(18px); background: var(--bn-on-action); }

/* Slider */
.bn-slider { appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
.bn-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--bn-track); }
.bn-slider::-webkit-slider-thumb { appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--bn-action); border: none; margin-top: -6px;
  transition: box-shadow var(--bn-dur-1) var(--bn-ease);
}
.bn-slider::-webkit-slider-thumb:hover { box-shadow: 0 0 0 6px var(--bn-action-subtle); }
.bn-slider::-moz-range-track { height: 6px; border-radius: 999px; background: var(--bn-track); }
.bn-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--bn-action); border: none; }

/* File upload */
.bn-dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 28px 20px; text-align: center; color: var(--bn-text-2);
  border: 1.5px dashed var(--bn-border-strong); border-radius: var(--bn-radius-md);
  background: var(--bn-surface); cursor: pointer;
  transition: border-color var(--bn-dur-1) var(--bn-ease), background var(--bn-dur-1) var(--bn-ease);
}
.bn-dropzone:hover, .bn-dropzone.is-drag { border-color: var(--bn-focus-ring); background: var(--bn-action-subtle); }

/* Calendar */
.bn-cal { width: 280px; padding: 12px; background: var(--bn-surface); border: 1px solid var(--bn-border); border-radius: var(--bn-radius-md); box-shadow: var(--bn-shadow-2); }
.bn-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: var(--bn-weight-bold); }
.bn-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.bn-cal-dow { font-size: 11px; color: var(--bn-text-3); text-align: center; padding: 4px 0; text-transform: uppercase; letter-spacing: 0.05em; }
.bn-cal-day { height: 32px; display: grid; place-content: center; border: none; background: none; color: var(--bn-text);
  border-radius: var(--bn-radius-xs); cursor: pointer; font-size: var(--bn-text-small);
  transition: background var(--bn-dur-1) var(--bn-ease);
}
.bn-cal-day:hover { background: var(--bn-action-subtle); }
.bn-cal-day.is-muted { color: var(--bn-text-disabled); }
.bn-cal-day.is-today { color: var(--bn-link); font-weight: var(--bn-weight-bold); }
.bn-cal-day.is-selected { background: var(--bn-action); color: var(--bn-on-action); font-weight: var(--bn-weight-bold); }

/* Menu / popover list (Select, Combobox, NavMenu dropdowns) */
.bn-menu { min-width: 180px; padding: 6px; background: var(--bn-glass);
  -webkit-backdrop-filter: blur(var(--bn-blur)); backdrop-filter: blur(var(--bn-blur));
  border: 1px solid var(--bn-border); border-radius: var(--bn-radius-md);
  box-shadow: var(--bn-shadow-2); animation: bn-rise var(--bn-dur-2) var(--bn-ease);
}
.bn-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: none; background: none; text-align: left; color: var(--bn-text);
  border-radius: var(--bn-radius-xs); cursor: pointer; font-size: var(--bn-text-body);
  transition: background var(--bn-dur-1) var(--bn-ease);
}
.bn-menu-item:hover { background: var(--bn-action-subtle); }
.bn-menu-item[aria-selected="true"] { background: var(--bn-selected); color: var(--bn-link); font-weight: var(--bn-weight-medium); }
.bn-menu-item--danger { color: var(--bn-danger-text); }
.bn-menu-item--danger:hover { background: var(--bn-danger-subtle); }

/* ---------- Navigation ---------- */
.bn-sidebar {
  display: flex; flex-direction: column; width: 248px; min-height: 100%;
  padding: 16px 12px; gap: 2px;
}
/* Chrome rail scene — horizon glow + ridge silhouette (+ stars at night).
   .bn-nightsky applies the same scene to any custom rail. */
.bn-sidebar, .bn-nightsky {
  position: relative; overflow: hidden;
  color: var(--bn-chrome-text);
  background-color: var(--bn-chrome-bg);
  border-right: 1px solid var(--bn-border);
}
.bn-sidebar > *, .bn-nightsky > * { position: relative; z-index: 1; }
.bn-sidebar::before, .bn-nightsky::before,
.bn-sidebar::after, .bn-nightsky::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.bn-sidebar::after, .bn-nightsky::after {
  top: auto; height: 92px;
  background-position: bottom; background-size: 100% 92px; background-repeat: no-repeat;
}
/* Dawn (default): first light rising behind the ridge */
.bn-sidebar::before, .bn-nightsky::before {
  background-image:
    radial-gradient(120% 52% at 50% 108%, rgba(224, 172, 71, 0.34), rgba(224, 172, 71, 0.08) 55%, transparent 78%),
    radial-gradient(70% 26% at 76% 90%, rgba(214, 71, 138, 0.10), transparent 70%),
    linear-gradient(180deg, #FBF7ED 0%, #F7EEDD 55%, #F2E2C8 100%);
}
.bn-sidebar::after, .bn-nightsky::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 92' preserveAspectRatio='none'%3E%3Cpath d='M0 92 L0 48 L40 24 L78 46 L120 12 L156 40 L200 20 L232 46 L260 34 L260 92 Z' fill='%23E3CD9E' opacity='.5'/%3E%3Cpath d='M0 92 L0 64 L30 44 L64 60 L102 32 L138 56 L176 40 L214 62 L244 50 L260 58 L260 92 Z' fill='%23C4AE85' opacity='.34'/%3E%3C/svg%3E"); }
/* Night: stars above, aurora glow on the horizon */
[data-bn-theme="night"] .bn-sidebar::before, [data-bn-theme="night"] .bn-nightsky::before {
  background-image:
    radial-gradient(120% 52% at 50% 108%, rgba(76, 203, 151, 0.30), rgba(76, 203, 151, 0.07) 55%, transparent 78%),
    radial-gradient(70% 26% at 76% 90%, rgba(231, 107, 163, 0.13), transparent 70%),
    linear-gradient(180deg, #0A101E 0%, #0C1729 55%, #10263B 100%);
}
[data-bn-theme="night"] .bn-sidebar::after, [data-bn-theme="night"] .bn-nightsky::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 260 92' preserveAspectRatio='none'%3E%3Cpath d='M0 92 L0 48 L40 24 L78 46 L120 12 L156 40 L200 20 L232 46 L260 34 L260 92 Z' fill='%2316384A' opacity='.4'/%3E%3Cpath d='M0 92 L0 64 L30 44 L64 60 L102 32 L138 56 L176 40 L214 62 L244 50 L260 58 L260 92 Z' fill='%23081020' opacity='.7'/%3E%3C/svg%3E"); }
.bn-sidebar-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  border: none; background: none; width: 100%; text-align: left;
  color: var(--bn-chrome-text); border-radius: var(--bn-radius-sm);
  font: var(--bn-weight-medium) var(--bn-text-body)/1.2 var(--bn-font-ui);
  cursor: pointer; text-decoration: none;
  transition: background var(--bn-dur-1) var(--bn-ease), color var(--bn-dur-1) var(--bn-ease);
}
.bn-sidebar-item:hover { background: rgba(42,36,28,0.06); text-decoration: none; color: var(--bn-chrome-text); }
[data-bn-theme="night"] .bn-sidebar-item:hover { background: rgba(255,255,255,0.07); }
/* Active — the raised pill: lifts off the rail as a card, icon takes aurora green */
.bn-sidebar-item.is-active {
  background: var(--bn-stone-0); color: var(--bn-stone-900); font-weight: var(--bn-weight-bold);
  border: 1px solid transparent; padding: 8px 11px; box-shadow: var(--bn-shadow-1);
}
[data-bn-theme="night"] .bn-sidebar-item.is-active {
  background: linear-gradient(180deg, var(--bn-night-700), var(--bn-night-750));
  color: #FFFFFF; border-color: rgba(183,196,218,0.30);
  box-shadow: 0 3px 12px rgba(2,6,14,0.6), inset 0 1px 0 rgba(255,255,255,0.12);
}
.bn-sidebar-item.is-active > svg { color: var(--bn-accent-green); }
.bn-sidebar-group { margin: 18px 12px 6px; font: var(--bn-weight-bold) 11px/1 var(--bn-font-ui); letter-spacing: 0.09em; text-transform: uppercase; color: var(--bn-chrome-text-dim); }

/* ---------- Mobile drawer — the rail slides in from the left ---------- */
.bn-drawer-scrim {
  position: fixed; inset: 0; z-index: 90; background: var(--bn-overlay);
  opacity: 0; pointer-events: none; transition: opacity var(--bn-dur-3) var(--bn-ease);
}
.bn-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }
.bn-sidebar.bn-drawer {
  position: fixed; inset: 0 auto 0 0; z-index: 91; width: 280px; max-width: 84vw; height: 100%;
  transform: translateX(-102%); transition: transform var(--bn-dur-3) var(--bn-ease-io);
  border-right: 1px solid var(--bn-border);
}
.bn-sidebar.bn-drawer.is-open { transform: translateX(0); box-shadow: var(--bn-shadow-3); }
/* Touch-friendly rows in the drawer (≥44px hit targets) */
.bn-drawer .bn-sidebar-item { padding: 12px; }
.bn-drawer .bn-sidebar-item.is-active { padding: 11px; }
/* Inner scroll wrapper — keeps the horizon scene pinned while items scroll */
.bn-sidebar-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}

.bn-topbar {
  display: flex; align-items: center; gap: 16px; height: 56px; padding: 0 20px;
  background: var(--bn-surface); border-bottom: 1px solid var(--bn-border-subtle);
}

.bn-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bn-border-subtle); }
.bn-tab { padding: 10px 14px; border: none; background: none; cursor: pointer;
  font: var(--bn-weight-medium) var(--bn-text-body)/1.2 var(--bn-font-ui); color: var(--bn-text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--bn-dur-1) var(--bn-ease), border-color var(--bn-dur-1) var(--bn-ease);
}
.bn-tab:hover { color: var(--bn-text); }
.bn-tab[aria-selected="true"] { color: var(--bn-link); border-bottom-color: var(--bn-link); }

/* Enclosed tabs — for sections within a page; active tab merges with the panel below */
.bn-tabs--enclosed { border-bottom: 1px solid var(--bn-border); gap: 4px; }
.bn-tab--enclosed {
  border: 1px solid transparent; border-bottom: 1px solid transparent;
  border-radius: var(--bn-radius-sm) var(--bn-radius-sm) 0 0;
  padding: 10px 18px; margin-bottom: -1px;
}
.bn-tab--enclosed[aria-selected="true"] {
  background: var(--bn-surface); color: var(--bn-text); font-weight: var(--bn-weight-bold);
  border-color: var(--bn-border); border-bottom-color: var(--bn-surface);
}
.bn-tab-panel {
  background: var(--bn-surface); border: 1px solid var(--bn-border); border-top: none;
  border-radius: 0 0 var(--bn-radius-md) var(--bn-radius-md); padding: var(--bn-card-pad);
}

.bn-breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: var(--bn-text-small); color: var(--bn-text-3); }
.bn-breadcrumbs a { color: var(--bn-text-2); }
.bn-breadcrumbs a:hover { color: var(--bn-link); text-decoration: none; }
.bn-breadcrumbs .bn-crumb-sep { color: var(--bn-text-disabled); user-select: none; }
.bn-breadcrumbs [aria-current="page"] { color: var(--bn-text); font-weight: var(--bn-weight-medium); }

.bn-pagination { display: flex; align-items: center; gap: 4px; }
.bn-page-btn { min-width: 32px; height: 32px; padding: 0 6px; display: inline-grid; place-content: center;
  border: none; background: none; color: var(--bn-text-2); border-radius: var(--bn-radius-xs);
  cursor: pointer; font: var(--bn-weight-medium) var(--bn-text-small)/1 var(--bn-font-ui);
  font-variant-numeric: tabular-nums;
  transition: background var(--bn-dur-1) var(--bn-ease), color var(--bn-dur-1) var(--bn-ease);
}
.bn-page-btn:hover { background: var(--bn-action-subtle); color: var(--bn-text); }
.bn-page-btn[aria-current="page"] { background: var(--bn-action); color: var(--bn-on-action); }
.bn-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Data display ---------- */
.bn-table-wrap { border: 1px solid var(--bn-border-subtle); border-radius: var(--bn-radius-md); overflow: auto; background: var(--bn-surface); }
.bn-table { width: 100%; border-collapse: collapse; font-size: var(--bn-text-body); }
.bn-table th {
  position: sticky; top: 0; z-index: 1; text-align: left;
  padding: var(--bn-cell-pad-y) var(--bn-cell-pad-x);
  font: var(--bn-weight-bold) var(--bn-text-small)/1.3 var(--bn-font-ui);
  color: var(--bn-text-2); background: var(--bn-surface-2);
  border-bottom: 1px solid var(--bn-border); white-space: nowrap;
}
.bn-table td { height: var(--bn-row-h); padding: var(--bn-cell-pad-y) var(--bn-cell-pad-x); border-bottom: 1px solid var(--bn-border-subtle); }
.bn-table tbody tr { transition: background var(--bn-dur-1) var(--bn-ease); }
.bn-table tbody tr:hover { background: var(--bn-action-subtle); }
/* Cursor-tracking spotlight — the row's mousemove writes --tx/--ty; lives on the hovered tr only */
.bn-table--spotlight tbody tr:hover {
  background: radial-gradient(170px circle at var(--tx, 50%) var(--ty, 50%),
    var(--bn-spotlight-strong) 0%,
    var(--bn-spotlight-soft) 42%,
    transparent 80%), var(--bn-action-subtle);
}
.bn-table tbody tr.is-selected { background: var(--bn-selected); }
.bn-table tbody tr:last-child td { border-bottom: none; }
.bn-table .bn-td-num { text-align: right; font-variant-numeric: tabular-nums; }
.bn-th-sort { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; border: none; background: none; color: inherit; font: inherit; padding: 0; }
.bn-th-sort:hover { color: var(--bn-link); }

.bn-chip { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px;
  border-radius: var(--bn-radius-pill); font: var(--bn-weight-medium) var(--bn-text-tiny)/1 var(--bn-font-ui);
  background: var(--bn-surface-2); color: var(--bn-text-2); border: 1px solid var(--bn-border-subtle);
}
.bn-chip .bn-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bn-chip--success { background: var(--bn-success-subtle); color: var(--bn-success-text); border-color: transparent; }
.bn-chip--danger  { background: var(--bn-danger-subtle);  color: var(--bn-danger-text);  border-color: transparent; }
.bn-chip--warning { background: var(--bn-warning-subtle); color: var(--bn-warning-text); border-color: transparent; }
.bn-chip--info    { background: var(--bn-info-subtle);    color: var(--bn-info-text);    border-color: transparent; }
.bn-chip--accent  { background: var(--bn-action-subtle);  color: var(--bn-link);         border-color: transparent; }

/* ---------- Mobile filter bar — one scrolling row of value pills ---------- */
.bn-filterbar { display: flex; flex-direction: column; gap: 8px; }
.bn-filterbar-row {
  display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 2px 14px; margin: 0 -14px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.bn-filterbar-row::-webkit-scrollbar { display: none; }
.bn-filterpill {
  display: inline-flex; align-items: center; flex: none; scroll-snap-align: start;
  height: 44px; border-radius: var(--bn-radius-pill);
  font: var(--bn-weight-medium) var(--bn-text-small)/1 var(--bn-font-ui);
  color: var(--bn-text-2); background: var(--bn-surface); border: 1px solid var(--bn-border);
  white-space: nowrap; transition: background var(--bn-dur-1) var(--bn-ease), color var(--bn-dur-1) var(--bn-ease);
}
.bn-filterpill:hover { color: var(--bn-text); }
.bn-filterpill.is-set {
  background: var(--bn-action-subtle); color: var(--bn-link); border-color: transparent;
  font-weight: var(--bn-weight-bold);
}
/* the label button fills the pill; the clear button is its sibling, never nested */
.bn-filterpill-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 100%; padding: 0 14px;
  background: none; border: 0; border-radius: inherit; cursor: pointer;
  font: inherit; color: inherit; white-space: nowrap;
}
.bn-filterpill.is-set > .bn-filterpill-btn { padding-right: 4px; }
.bn-filterpill-clear {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 34px; height: 100%; padding: 0 12px 0 2px; margin: 0;
  background: none; border: 0; border-radius: inherit; cursor: pointer; color: inherit;
}
button.bn-filterpill { padding: 0 14px; cursor: pointer; gap: 6px; }
.bn-filterpill--reset { background: transparent; border-style: dashed; }
.bn-filterbar-meta {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: var(--bn-text-tiny); color: var(--bn-text-3);
}

/* ---------- Bottom sheet — the mobile option picker ---------- */
.bn-sheet-scrim {
  position: fixed; inset: 0; z-index: 94; background: var(--bn-overlay);
  opacity: 0; pointer-events: none; transition: opacity var(--bn-dur-3) var(--bn-ease);
}
.bn-sheet-scrim.is-open { opacity: 1; pointer-events: auto; }
.bn-sheet {
  position: fixed; inset: auto 0 0 0; z-index: 95; display: flex; flex-direction: column;
  max-height: 72vh; padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--bn-surface); color: var(--bn-text);
  border-top: 1px solid var(--bn-border);
  border-radius: var(--bn-radius-lg, 16px) var(--bn-radius-lg, 16px) 0 0;
  transform: translateY(101%); transition: transform var(--bn-dur-3) var(--bn-ease-io);
}
.bn-sheet.is-open { transform: translateY(0); box-shadow: var(--bn-shadow-3); }
.bn-sheet-grip-hit { flex: none; display: flex; align-items: center; justify-content: center; height: 22px; width: 100%; padding: 0; margin: 0; background: none; border: 0; cursor: pointer; }
.bn-sheet-grip { width: 38px; height: 4px; border-radius: 999px; background: var(--bn-border); }
.bn-sheet-head {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 2px 10px 8px 16px; font: var(--bn-weight-bold) var(--bn-text-small)/1.2 var(--bn-font-ui);
}
.bn-sheet-head .bn-btn--icon { width: 44px; height: 44px; }
.bn-sheet-list { overflow-y: auto; padding: 0 8px 10px; }
.bn-sheet-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px;
  background: none; border: 0; border-radius: var(--bn-radius-sm, 8px); cursor: pointer;
  font: var(--bn-weight-medium) var(--bn-text-body, 15px)/1.3 var(--bn-font-ui);
  color: var(--bn-text); text-align: left;
}
.bn-sheet-row:hover { background: var(--bn-surface-2); }
.bn-sheet-row.is-selected { color: var(--bn-link); font-weight: var(--bn-weight-bold); }
.bn-sheet-row > .bn-sheet-count { margin-left: auto; color: var(--bn-text-3); font-weight: var(--bn-weight-medium); font-size: var(--bn-text-tiny); }
.bn-sheet-row > .bn-sheet-tick { margin-left: auto; display: flex; color: var(--bn-link); }
.bn-sheet-row > .bn-sheet-count + .bn-sheet-tick { margin-left: 0; }

.bn-kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  font: var(--bn-weight-medium) 11.5px/1 var(--bn-font-mono); color: var(--bn-text-2);
  background: var(--bn-surface-2); border: 1px solid var(--bn-border); border-bottom-width: 2px; border-radius: 5px;
}
.bn-kbd-combo { display: inline-flex; align-items: center; gap: 3px; }

.bn-tooltip { position: absolute; z-index: 60; max-width: 260px; padding: 7px 10px;
  background: var(--bn-chart-tooltip-bg); color: var(--bn-chart-tooltip-text);
  font-size: var(--bn-text-tiny); line-height: 1.45; border-radius: var(--bn-radius-xs);
  box-shadow: var(--bn-shadow-2); pointer-events: none;
  animation: bn-fade var(--bn-dur-1) var(--bn-ease);
}

.bn-avatar { display: inline-grid; place-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bn-action-subtle-hover); color: var(--bn-link); overflow: hidden;
  font: var(--bn-weight-bold) 13px/1 var(--bn-font-ui); flex: none;
}
.bn-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bn-avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.bn-avatar--lg { width: 44px; height: 44px; font-size: 17px; }

.bn-separator { border: none; border-top: 1px solid var(--bn-border-subtle); margin: var(--bn-sp-4) 0; }
.bn-separator--v { display: inline-block; width: 1px; align-self: stretch; background: var(--bn-border-subtle); border: none; margin: 0 var(--bn-sp-3); }

.bn-counter { display: inline-grid; place-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--bn-danger-fill); color: var(--bn-on-danger);
  font: var(--bn-weight-bold) 11px/1 var(--bn-font-ui); font-variant-numeric: tabular-nums;
}
.bn-counter--neutral { background: var(--bn-surface-3); color: var(--bn-text-2); }
.bn-counter--accent { background: var(--bn-action); color: var(--bn-on-action); }

/* ---------- Feedback ---------- */
.bn-alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--bn-radius-sm);
  border: 1px solid var(--bn-info-border); background: var(--bn-info-subtle); color: var(--bn-text);
  font-size: var(--bn-text-body); line-height: 1.5;
}
.bn-alert .bn-alert-icon { flex: none; margin-top: 1px; color: var(--bn-info-text); }
.bn-alert-title { font-weight: var(--bn-weight-bold); margin: 0 0 2px; }
.bn-alert--success { background: var(--bn-success-subtle); border-color: var(--bn-success-border); }
.bn-alert--success .bn-alert-icon { color: var(--bn-success-text); }
.bn-alert--warning { background: var(--bn-warning-subtle); border-color: var(--bn-warning-border); }
.bn-alert--warning .bn-alert-icon { color: var(--bn-warning-text); }
.bn-alert--danger { background: var(--bn-danger-subtle); border-color: var(--bn-danger-border); }
.bn-alert--danger .bn-alert-icon { color: var(--bn-danger-text); }

.bn-toast { display: flex; align-items: flex-start; gap: 12px; width: 340px; padding: 13px 14px;
  background: var(--bn-glass);
  -webkit-backdrop-filter: blur(var(--bn-blur)); backdrop-filter: blur(var(--bn-blur));
  border: 1px solid var(--bn-border); border-radius: var(--bn-radius-md);
  box-shadow: var(--bn-shadow-2); color: var(--bn-text);
  animation: bn-slide-left var(--bn-dur-3) var(--bn-ease);
}
.bn-toast .bn-alert-icon { flex: none; margin-top: 1px; }
.bn-toast--success .bn-alert-icon { color: var(--bn-success-text); }
.bn-toast--danger  .bn-alert-icon { color: var(--bn-danger-text); }
.bn-toast--warning .bn-alert-icon { color: var(--bn-warning-text); }
.bn-toast--info    .bn-alert-icon { color: var(--bn-info-text); }

.bn-backdrop { position: fixed; inset: 0; z-index: 50; background: var(--bn-overlay);
  display: grid; place-items: center; animation: bn-fade var(--bn-dur-2) var(--bn-ease);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.bn-modal { width: min(520px, calc(100vw - 48px)); max-height: min(84vh, 720px); overflow: auto;
  background: var(--bn-surface); border: 1px solid var(--bn-border);
  border-radius: var(--bn-radius-lg); box-shadow: var(--bn-shadow-3);
  animation: bn-scale-in var(--bn-dur-3) var(--bn-ease);
}
.bn-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.bn-modal-body { padding: 14px 20px 20px; }
.bn-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; }

.bn-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 55; width: min(420px, 92vw);
  background: var(--bn-surface); border-left: 1px solid var(--bn-border);
  box-shadow: var(--bn-shadow-3); display: flex; flex-direction: column;
  animation: bn-slide-left var(--bn-dur-3) var(--bn-ease);
}
.bn-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--bn-border-subtle); }
.bn-panel-body { padding: 20px; overflow: auto; flex: 1; }

.bn-skeleton { border-radius: var(--bn-radius-xs); background: linear-gradient(90deg, var(--bn-skeleton-a) 25%, var(--bn-skeleton-b) 42%, var(--bn-skeleton-a) 60%);
  background-size: 200% 100%; animation: bn-shimmer 1.6s linear infinite;
}

.bn-spinner { width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 2.5px solid var(--bn-track); border-top-color: var(--bn-link);
  animation: bn-spin 0.8s linear infinite;
}
.bn-spinner--lg { width: 32px; height: 32px; border-width: 3px; }

.bn-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 48px 24px; text-align: center; border-radius: var(--bn-radius-lg);
  background-image: var(--bn-grad-aurora-rose), var(--bn-grad-hero);
  color: var(--bn-chrome-text);
}
.bn-empty .bn-empty-icon { color: var(--bn-accent-green); filter: drop-shadow(0 0 12px rgba(76,203,151,0.4)); }
.bn-empty-title { font: var(--bn-weight-bold) var(--bn-text-h4)/1.3 var(--bn-font-ui); }
.bn-empty-hint { color: var(--bn-chrome-text-dim); max-width: 40ch; font-size: var(--bn-text-small); }

/* ---------- Content ---------- */
.bn-card { background: var(--bn-surface); border: 1px solid var(--bn-border-subtle);
  border-radius: var(--bn-radius-md); padding: var(--bn-card-pad); box-shadow: var(--bn-shadow-1);
}
.bn-card[data-tilt] { transform-origin: center; will-change: transform; }
.bn-card--hover { transition: border-color var(--bn-dur-2) var(--bn-ease), box-shadow var(--bn-dur-2) var(--bn-ease), transform var(--bn-dur-2) var(--bn-ease); cursor: pointer; }
.bn-card--hover:hover { border-color: var(--bn-border-strong); box-shadow: var(--bn-shadow-2); transform: translateY(-1px); }
.bn-card-title { font: var(--bn-weight-bold) var(--bn-text-h4)/1.3 var(--bn-font-ui); margin: 0 0 4px; }

.bn-kpi-value { font: var(--bn-weight-heavy) 30px/1.1 var(--bn-font-ui); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bn-kpi-label { font: var(--bn-weight-medium) var(--bn-text-small)/1.3 var(--bn-font-ui); color: var(--bn-text-2); }
.bn-delta { display: inline-flex; align-items: center; gap: 3px; font: var(--bn-weight-bold) var(--bn-text-tiny)/1 var(--bn-font-ui); font-variant-numeric: tabular-nums; }
.bn-delta--up { color: var(--bn-success-text); }
.bn-delta--down { color: var(--bn-danger-text); }
.bn-delta--flat { color: var(--bn-text-3); }

.bn-accordion { border: 1px solid var(--bn-border-subtle); border-radius: var(--bn-radius-md); background: var(--bn-surface); overflow: hidden; }
.bn-accordion-item + .bn-accordion-item { border-top: 1px solid var(--bn-border-subtle); }
.bn-accordion-trigger { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 14px 16px; border: none; background: none; cursor: pointer; text-align: left;
  font: var(--bn-weight-medium) var(--bn-text-body)/1.3 var(--bn-font-ui); color: var(--bn-text);
  transition: background var(--bn-dur-1) var(--bn-ease);
}
.bn-accordion-trigger:hover { background: var(--bn-action-subtle); }
.bn-accordion-trigger .bn-acc-chev { transition: transform var(--bn-dur-2) var(--bn-ease); color: var(--bn-text-3); }
.bn-accordion-trigger[aria-expanded="true"] .bn-acc-chev { transform: rotate(180deg); }
.bn-accordion-body { padding: 0 16px 14px; color: var(--bn-text-2); animation: bn-rise var(--bn-dur-2) var(--bn-ease); }

/* ---------- Progress & gamification ---------- */
.bn-progress { height: 8px; border-radius: 999px; background: var(--bn-track); overflow: hidden; }
.bn-progress > .bn-progress-fill { height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--bn-accent-green), var(--bn-chart-5));
  transition: width var(--bn-dur-3) var(--bn-ease-io);
}
.bn-progress--thin { height: 4px; }
.bn-progress.is-complete > .bn-progress-fill { box-shadow: var(--bn-glow-green); }

.bn-streak { display: inline-flex; align-items: center; gap: 5px; }
.bn-streak .bn-streak-day { width: 10px; height: 10px; border-radius: 50%; background: var(--bn-track); }
.bn-streak .bn-streak-day.is-hit { background: var(--bn-accent-green); box-shadow: 0 0 6px rgba(76,203,151,0.5); }
.bn-streak .bn-streak-day.is-today { outline: 1.5px solid var(--bn-focus-ring); outline-offset: 2px; }
.bn-streak-count { font: var(--bn-weight-heavy) var(--bn-text-h4)/1 var(--bn-font-ui); color: var(--bn-success-text); font-variant-numeric: tabular-nums; }

.bn-badge { display: inline-flex; flex-direction: column; align-items: center; gap: 8px; width: 88px; text-align: center; }
.bn-badge .bn-badge-medal { width: 56px; height: 56px; border-radius: 50%; display: grid; place-content: center;
  background: radial-gradient(circle at 35% 30%, var(--bn-surface-3), var(--bn-surface-2));
  border: 1px solid var(--bn-border); color: var(--bn-text-3);
}
.bn-badge.is-earned .bn-badge-medal {
  background: var(--bn-grad-aurora); border-color: var(--bn-success-border);
  color: var(--bn-accent-green); box-shadow: var(--bn-glow-green);
}
.bn-badge .bn-badge-name { font-size: var(--bn-text-tiny); color: var(--bn-text-2); line-height: 1.3; }
.bn-badge.is-earned .bn-badge-name { color: var(--bn-text); font-weight: var(--bn-weight-medium); }

.bn-stepper { display: flex; align-items: center; gap: 0; }
.bn-step { display: flex; align-items: center; gap: 10px; }
.bn-step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-content: center; flex: none;
  font: var(--bn-weight-bold) 12px/1 var(--bn-font-ui);
  background: var(--bn-surface-2); border: 1.5px solid var(--bn-border-strong); color: var(--bn-text-2);
  transition: background var(--bn-dur-2) var(--bn-ease), border-color var(--bn-dur-2) var(--bn-ease);
}
.bn-step.is-done .bn-step-dot { background: var(--bn-success-fill); border-color: var(--bn-success-fill); color: var(--bn-on-success); }
.bn-step.is-current .bn-step-dot { border-color: var(--bn-focus-ring); color: var(--bn-link); box-shadow: var(--bn-focus-glow); }
.bn-step-label { font-size: var(--bn-text-small); color: var(--bn-text-2); white-space: nowrap; }
.bn-step.is-current .bn-step-label { color: var(--bn-text); font-weight: var(--bn-weight-medium); }
.bn-step-line { width: 40px; height: 1.5px; background: var(--bn-border); margin: 0 10px; flex: none; }
.bn-step-line.is-done { background: var(--bn-success-fill); }

/* ---------- Living charts ---------- */
.bn-chart { position: relative; width: 100%; }
.bn-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.bn-ch-grid { stroke: var(--bn-chart-grid); stroke-width: 1; animation: bn-fade .5s var(--bn-ease) both; }
.bn-ch-axis { font: 400 10.5px/1 var(--bn-font-ui); fill: var(--bn-chart-label); animation: bn-fade .5s var(--bn-ease) both; }
.bn-ch-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: bn-ch-draw 1.1s var(--bn-ease) forwards; }
.bn-ch-line[data-dashed] { stroke-dasharray: 1 5; stroke-dashoffset: 0; animation: bn-fade .7s var(--bn-ease) both; opacity: .65; }
.bn-ch-area { opacity: 0; transform-origin: bottom; animation: bn-ch-rise .8s var(--bn-ease) .2s forwards; }
.bn-ch-live { animation: bn-ch-pulse 2.6s var(--bn-ease) infinite; transform-box: fill-box; transform-origin: center; }
.bn-ch-cross { stroke: var(--bn-link); stroke-width: 1; stroke-dasharray: 3 3; opacity: .45; }
.bn-ch-hdot { stroke: var(--bn-surface); stroke-width: 2; }
.bn-ch-tip { position: absolute; transform: translate(-50%, -118%); pointer-events: none;
  background: var(--bn-surface); border: 1px solid var(--bn-border); border-radius: var(--bn-radius-sm);
  box-shadow: var(--bn-shadow-2); padding: 8px 10px; white-space: nowrap; z-index: 3;
  transition: left .09s var(--bn-ease), top .09s var(--bn-ease); }
.bn-ch-tip-lbl { font: 700 10px/1 var(--bn-font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--bn-text-3); margin-bottom: 6px; }
.bn-ch-tip-row { display: flex; align-items: center; gap: 7px; font: 500 12px/1.5 var(--bn-font-ui); color: var(--bn-text); }
.bn-ch-tip-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.bn-ch-tip-row b { font: 700 12px/1.5 var(--bn-font-ui); font-variant-numeric: tabular-nums; margin-left: auto; padding-left: 12px; }
/* Focus-dim: wrapper gets data-dim, hovered element gets data-on; legends share the state */
.bn-dim { transition: opacity .15s var(--bn-ease); }
[data-dim] .bn-dim:not([data-on]) { opacity: .35; }
/* Load-in utilities for hand-built charts (bars, arcs, heatmaps) — stagger via animation-delay */
.bn-ch-bar { transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); animation: bn-ch-bargrow .6s var(--bn-ease-spring) both; }
.bn-ch-hfill { transform-origin: left; transform: scaleX(0); animation: bn-ch-hbarin .7s var(--bn-ease-spring) both; }
.bn-ch-arc { transition: stroke-width .2s var(--bn-ease-spring), opacity .2s var(--bn-ease); }
.bn-ch-arc-in { animation: bn-ch-arcsweep 1s var(--bn-ease) both; }
.bn-ch-cell { transform: scale(0); animation: bn-ch-cellin .4s var(--bn-ease-spring) both; } /* delay = (row+col)*45ms */
@keyframes bn-ch-draw { to { stroke-dashoffset: 0; } }
@keyframes bn-ch-rise { from { opacity: 0; transform: scaleY(.82); } to { opacity: 1; transform: scaleY(1); } }
@keyframes bn-ch-pulse { 0%, 100% { transform: scale(1); opacity: .18; } 50% { transform: scale(1.5); opacity: .32; } }
@keyframes bn-ch-bargrow { to { transform: scaleY(1); } }
@keyframes bn-ch-hbarin { to { transform: scaleX(1); } }
@keyframes bn-ch-arcsweep { from { stroke-dashoffset: var(--seg); } }
@keyframes bn-ch-cellin { to { transform: scale(1); } }

/* ---- Floating navigation (reading apps only; 1 Oct 2026) ------------------------------
   A reading app with two sections (notis: News and its Library) puts a glass tab bar at the
   foot of the phone screen and the OTHER section as an edge tab, flush with the screen edge,
   so switching reads as entering a new place. Tool apps keep the drawer. Glass floats over
   content and is never a content surface. --bn-floatbar-accent and --bn-edgetab-tint are the
   app's per-section colours; both default to the interactive blue. */
.bn-floatbar {
  /* Anchored from the top of what the reader can see (--bn-screen-h, else 100dvh), not to
     bottom: 0. On Chrome for Android the layout viewport at load reaches under the URL bar,
     so a bar pinned to the bottom sits below the screen until the first scroll (notis, t-51).
     An installed app has no URL bar, so it pins to the bottom (below). */
  --bn-float-top: calc(var(--bn-screen-h, 100dvh) - 80px - env(safe-area-inset-bottom, 0px));
  position: fixed; z-index: 40; left: 12px; right: 12px;
  top: calc(100vh - 80px - env(safe-area-inset-bottom, 0px)); top: var(--bn-float-top);
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px;
  height: 64px; box-sizing: border-box; padding: 5px; border-radius: var(--bn-radius-pill);
  background: var(--bn-glass-float); border: 1px solid var(--bn-glass-edge);
  box-shadow: var(--bn-shadow-3), inset 0 1px 0 var(--bn-glass-highlight);
  -webkit-backdrop-filter: var(--bn-glass-filter); backdrop-filter: var(--bn-glass-filter);
}
.bn-floatbar--edge-end { right: 92px; }      /* room for an edge tab on the right */
.bn-floatbar--edge-start { left: 92px; }     /* room for an edge tab on the left */
.bn-floatbar-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; min-height: 44px; border: 0; border-radius: var(--bn-radius-pill); background: transparent;
  color: var(--bn-text); font: var(--bn-weight-medium) 11.5px/1 var(--bn-font-ui); text-decoration: none;
  cursor: pointer; transition: background var(--bn-dur-1) var(--bn-ease), color var(--bn-dur-1) var(--bn-ease);
}
.bn-floatbar-item svg { width: 21px; height: 21px; flex: none; }
.bn-floatbar-item[aria-current="page"], .bn-floatbar-item[aria-current="true"] {
  background: var(--bn-glass-lens); color: var(--bn-text);
  font-weight: var(--bn-weight-bold); box-shadow: inset 0 1px 0 var(--bn-glass-highlight), var(--bn-shadow-1);
}
/* the accent is the icon's alone: on see-through glass a coloured label cannot hold 4.5:1 */
.bn-floatbar-item[aria-current="page"] svg, .bn-floatbar-item[aria-current="true"] svg { color: var(--bn-floatbar-accent, var(--bn-action)); }
.bn-edgetab {
  --bn-float-top: calc(var(--bn-screen-h, 100dvh) - 80px - env(safe-area-inset-bottom, 0px));
  position: fixed; z-index: 40;
  top: calc(100vh - 80px - env(safe-area-inset-bottom, 0px)); top: var(--bn-float-top);
  width: 80px; height: 64px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--bn-text); font: var(--bn-weight-bold) 11.5px/1 var(--bn-font-ui); text-decoration: none;
  background: color-mix(in srgb, var(--bn-edgetab-tint, var(--bn-action)) 22%, var(--bn-glass-float));
  border: 1px solid var(--bn-glass-edge); box-shadow: var(--bn-shadow-3), inset 0 1px 0 var(--bn-glass-highlight);
  -webkit-backdrop-filter: var(--bn-glass-filter); backdrop-filter: var(--bn-glass-filter);
}
.bn-edgetab svg { width: 21px; height: 21px; color: color-mix(in srgb, var(--bn-edgetab-tint, var(--bn-action)) 62%, var(--bn-text)); }   /* toward the ink: 3:1 on see-through glass (1.1.4) */
.bn-edgetab--end { right: 0; border-right: 0; border-radius: var(--bn-radius-xl) 0 0 var(--bn-radius-xl); }
.bn-edgetab--start { left: 0; border-left: 0; border-radius: 0 var(--bn-radius-xl) var(--bn-radius-xl) 0; }
/* The desktop form: a two-part switch in the header, the same lens as the phone's tabs. */
.bn-worldswitch { display: inline-flex; padding: 4px; border-radius: var(--bn-radius-pill);
  border: 1px solid var(--bn-border); background: var(--bn-surface-2); }
.bn-worldswitch > a { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 16px;
  border-radius: var(--bn-radius-pill); color: var(--bn-text-2); text-decoration: none;
  font: var(--bn-weight-medium) 15px/1 var(--bn-font-ui); }
.bn-worldswitch > a svg { width: 18px; height: 18px; }
.bn-worldswitch > a[aria-current] { background: var(--bn-surface); color: var(--bn-worldswitch-accent, var(--bn-action));
  font-weight: var(--bn-weight-bold); box-shadow: var(--bn-shadow-1); }
@media (display-mode: standalone) {
  .bn-floatbar, .bn-edgetab { top: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
}
/* No glass where it cannot be drawn or is not wanted: a solid surface instead. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .bn-floatbar { background: var(--bn-surface); }
  .bn-edgetab { background: color-mix(in srgb, var(--bn-edgetab-tint, var(--bn-action)) 18%, var(--bn-surface)); }
}
@media (prefers-reduced-transparency: reduce) {
  .bn-floatbar, .bn-edgetab { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .bn-floatbar { background: var(--bn-surface); }
  .bn-edgetab { background: color-mix(in srgb, var(--bn-edgetab-tint, var(--bn-action)) 18%, var(--bn-surface)); }
}
