/*
 * workbench-analyze.css — the raw-data analysis control panel for the Workbench.
 *
 * Kept in its own file (not style.css) so it stays out of the way of parallel
 * work in the shared stylesheet. Cool editor chrome at rest, alive on hover —
 * the card itself stays the warm .rcard owned by stats-bridge; this only styles
 * the right-hand control drawer and the raw-data launcher.
 */

:root {
  --wba-bg: #fff;
  --wba-border: #ebebeb;
  --wba-border-strong: #d6d6d6;
  --wba-text: #1a1a1a;
  --wba-text-sec: #6e6e6e;
  --wba-text-muted: #a0a0a0;
  --wba-text-subtle: #c5c5c5;
  --wba-data: #2d4a6e;
  --wba-data-soft: #eaf0f7;
  --wba-green: #1a4a38;
  --wba-green-soft: #7fc4b0;
  --wba-hover: #f5f5f5;
  --wba-shadow: -8px 0 24px rgba(0, 0, 0, .06);
  --wba-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --wba-panel-width: 420px;
  --wba-top: 158px;     /* below the topbar + tab strip + doc-bar — level with the content panes */
  --wba-bottom: 36px;   /* above the bottom saved-stats strip — matches the source pane */
}

/* ── docked Analyzer panel (flush right; pushes content via body.wba-open) ── */
.wba-panel {
  position: fixed;
  top: var(--wba-top);
  right: 0;
  bottom: var(--wba-bottom);
  width: var(--wba-panel-width);
  min-width: 320px;
  max-width: calc(100vw - 36px);
  z-index: 52;
  background: var(--ed-bg, var(--wba-bg));
  border: none;
  border-left: 1px solid var(--ed-border, var(--wba-border));
  border-radius: 0;
  box-shadow: -10px 0 30px rgba(26, 29, 36, 0.10), -2px 0 8px rgba(26, 29, 36, 0.05);
  padding: 18px 18px 20px;
  overflow: auto;
  font-family: var(--sans, system-ui, -apple-system, 'Segoe UI', sans-serif);
  font-size: 14px;
  color: var(--wba-text);
  opacity: 0;
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition:
    transform .3s var(--wba-ease),
    opacity .2s ease,
    visibility 0s linear .3s;
}
.wba-panel[hidden] { display: none; }
.wba-panel.open {
  opacity: 1;
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
  transition:
    transform .3s var(--wba-ease),
    opacity .2s ease,
    visibility 0s linear 0s;
}
.wba-panel.is-resizing { transition: none; }

/* The dock reserves space from the CONTENT row only (the source|result split),
   so the top menu (tabs + doc-bar) stays full-width and independent. The dock's
   top/bottom are measured from the split in JS so it matches the source pane. */
#statsCardSplit { transition: padding-right .3s var(--wba-ease); }
body.wba-open #statsCardSplit { padding-right: var(--wba-panel-width); }

/* Small screens: the Analyzer takes over (overlay) instead of a cramped split. */
@media (max-width: 760px) {
  body.wba-open #statsCardSplit { padding-right: 0; }
  .wba-panel { width: min(440px, calc(100vw - 24px)); max-width: 100vw; }
}

.wba-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -5px;
  width: 10px;
  cursor: ew-resize;
  z-index: 3;
}
.wba-resize::before,
.wba-resize::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 1px;
  height: 34px;
  border-radius: 999px;
  background: rgba(26, 29, 36, .16);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity .14s, background .14s;
}
.wba-resize::after {
  left: 7px;
  height: 22px;
}
.wba-resize:hover::before,
.wba-resize:hover::after,
.wba-resize:focus-visible::before,
.wba-resize:focus-visible::after,
body.wba-resizing .wba-resize::before,
body.wba-resizing .wba-resize::after {
  opacity: 1;
  background: rgba(45, 74, 110, .46);
}
body.wba-resizing,
body.wba-resizing * {
  cursor: ew-resize !important;
  user-select: none !important;
}

.wba-head {
  font-family: var(--sans, system-ui, -apple-system, 'Segoe UI', sans-serif);
  font-size: 17px; font-weight: 650;
  display: flex; align-items: center; gap: 8px;
  color: var(--ed-text-pri, var(--wba-text));
  padding-bottom: 11px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--ed-border-soft, var(--wba-border));
}
.wba-collapse {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--sans, system-ui, sans-serif); font-size: 11px; font-weight: 500;
  color: var(--wba-text-sec); background: none;
  border: 1px solid var(--wba-border); border-radius: 8px;
  padding: 5px 9px; cursor: pointer; transition: .14s var(--wba-ease);
}
.wba-collapse:hover { border-color: var(--wba-data); color: var(--wba-data); background: var(--wba-data-soft); }
.wba-collapse svg { transform: rotate(0deg); }
.wba-head .wba-close {
  margin-left: 6px; color: var(--wba-text-muted);
  cursor: pointer; font-size: 18px; line-height: 1;
  width: 24px; height: 24px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: .14s var(--wba-ease);
}
.wba-head .wba-close:hover { background: var(--wba-hover); color: var(--wba-text); }
.wba-sub { font-size: 11.5px; color: var(--wba-text-muted); margin: 2px 0 16px; }

.wba-seclbl {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--wba-text-muted); margin: 16px 0 8px;
}

/* The inactive figure alternative fades to signal you can pick one, not both.
   It stays interactive — choosing in it clears and un-fades the other. */
.wba-seclbl.is-faded, .wba-opt.is-faded { opacity: .4; transition: opacity .14s var(--wba-ease); }
.wba-seclbl.is-faded { margin-top: 10px; }

/* ── Mellio Analyzer brand head ─────────────────────────────────────── */
.wba-brandhead { gap: 10px; }
/* The "Mo" mark is the real favicon, so it matches the browser tab exactly. */
.wba-mono {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; display: block;
  border: 1px solid var(--wba-border); box-shadow: 0 1px 2px rgba(26, 29, 36, .06);
}
.wba-wm {
  font-family: var(--serif, Georgia, serif); font-weight: 500; font-size: 19px;
  letter-spacing: -.02em; line-height: 1; color: var(--wba-text);
}
.wba-wm .wba-o { font-style: italic; color: var(--wba-green); }
.wba-wm .wba-an { color: var(--wba-data); font-weight: 600; }

/* ── segmented control (regression type) ────────────────────────────── */
.wba-seg { display: flex; gap: 4px; background: #f4f5f7; border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.wba-seg-btn {
  flex: 1; text-align: center; font-size: 12.5px; font-weight: 550; color: var(--wba-text-sec);
  padding: 8px 6px; border-radius: 7px; border: none; background: none; cursor: pointer;
  font-family: inherit; transition: .16s var(--wba-ease);
}
.wba-seg-btn:hover { color: var(--wba-text); }
.wba-seg-btn.on { background: #fff; color: var(--wba-data); box-shadow: 0 1px 3px rgba(26, 29, 36, .12); }


/* ── analysis chooser (collapsed card → searchable catalog) ─────────── */
.wba-chooser { margin-bottom: 4px; }
.wba-curcard {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: 1px solid var(--wba-border-strong); border-radius: 11px; padding: 11px 12px;
  background: #fff; cursor: pointer; color: var(--wba-text); transition: .16s var(--wba-ease);
}
.wba-curcard:hover { border-color: var(--wba-data); box-shadow: 0 3px 10px rgba(26, 29, 36, .06); }
.wba-chooser.open .wba-curcard {
  border-color: var(--wba-data);
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.wba-cic {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: var(--wba-data-soft); color: var(--wba-data);
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.wba-curtxt { display: flex; flex-direction: column; min-width: 0; }
.wba-curname { font-size: 13.5px; font-weight: 600; }
.wba-curdef { font-size: 11px; color: var(--wba-text-muted); }
.wba-curchg {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--wba-data); flex-shrink: 0;
}
.wba-curchg svg { width: 13px; height: 13px; transition: transform .28s var(--wba-ease); }
.wba-chooser.open .wba-curchg svg { transform: rotate(180deg); }

.wba-catalog {
  max-height: 0; overflow: hidden; opacity: 0;
  border: 1px solid var(--wba-data); border-top: none; border-radius: 0 0 11px 11px;
  transition: max-height .32s var(--wba-ease), opacity .22s;
}
.wba-chooser.open .wba-catalog { max-height: 360px; opacity: 1; }
.wba-catsearch { padding: 9px; border-bottom: 1px solid var(--wba-border); }
.wba-catinput {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--wba-border-strong); border-radius: 8px;
  padding: 8px 11px; font-size: 12.5px; font-family: inherit;
  color: var(--wba-text); background: #fff;
}
.wba-catinput:focus { outline: none; border-color: var(--wba-data); box-shadow: 0 0 0 2px var(--wba-data-soft); }
.wba-catscroll { max-height: 300px; overflow: auto; padding: 5px; }
.wba-famlbl {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 8.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--wba-text-subtle); padding: 8px 8px 4px;
}
.wba-tcard {
  display: flex; align-items: center; gap: 11px; padding: 9px;
  border-radius: 9px; cursor: pointer; transition: .13s var(--wba-ease);
}
.wba-tcard:hover { background: var(--wba-hover); }
.wba-tcard.sel { background: var(--wba-data-soft); }
.wba-tcard.soon { opacity: .5; cursor: not-allowed; }
.wba-tic {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: #f1f3f6; color: var(--wba-data);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}
.wba-tcard.sel .wba-tic { background: #fff; }
.wba-ttxt { display: flex; flex-direction: column; min-width: 0; }
.wba-tt { font-size: 13px; font-weight: 550; }
.wba-td { font-size: 11px; color: var(--wba-text-muted); }
.wba-tok { margin-left: auto; color: var(--wba-data); flex-shrink: 0; }
.wba-tsoon {
  margin-left: auto; font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9px; color: var(--wba-text-subtle); flex-shrink: 0; text-align: right;
}
.wba-catnone { font-size: 12px; color: var(--wba-text-muted); font-style: italic; padding: 16px; text-align: center; }

/* ── predictor picker (bounded, searchable, shape-dot types) ─────────── */
.wba-pickhdr { display: flex; align-items: center; margin-bottom: 8px; }
.wba-pcount {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9px; color: var(--wba-data); background: var(--wba-data-soft);
  padding: 2px 7px; border-radius: 20px;
}
.wba-bulk { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.wba-bchip {
  font-size: 11px; padding: 5px 10px; border-radius: 7px;
  border: 1px solid var(--wba-border); background: #fff; color: var(--wba-text-sec);
  cursor: pointer; transition: .14s var(--wba-ease); font-family: inherit;
}
.wba-bchip:hover { border-color: var(--wba-data); color: var(--wba-data); background: var(--wba-data-soft); }
.wba-psearch { position: relative; }
.wba-pinput {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--wba-border-strong); border-radius: 9px;
  padding: 8px 11px 8px 30px; font-size: 12.5px; font-family: inherit;
  color: var(--wba-text); background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none'%3E%3Ccircle cx='7' cy='7' r='5' stroke='%23a0a0a0' stroke-width='1.5'/%3E%3Cpath d='M11 11l3 3' stroke='%23a0a0a0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 10px center;
}
.wba-pinput:focus { outline: none; border-color: var(--wba-data); box-shadow: 0 0 0 2px var(--wba-data-soft); }
.wba-plist {
  margin-top: 8px; border: 1px solid var(--wba-border); border-radius: 10px;
  max-height: 212px; overflow: auto; background: #fafbfc;
}
.wba-pgrp {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 8.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--wba-text-subtle); padding: 9px 11px 4px;
  position: sticky; top: 0; background: #fafbfc; z-index: 1;
}
.wba-pitem {
  display: flex; align-items: center; gap: 9px; padding: 7px 11px;
  cursor: pointer; font-size: 12.5px; color: var(--wba-text);
}
.wba-pitem:hover { background: #fff; }
.wba-pbox {
  width: 15px; height: 15px; border-radius: 5px; flex-shrink: 0;
  border: 1.5px solid var(--wba-border-strong); transition: .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.wba-pitem.on .wba-pbox { background: var(--wba-data); border-color: var(--wba-data); }
.wba-pitem.on .wba-pbox::after {
  content: ''; width: 8px; height: 4px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.wba-pty { width: 7px; height: 7px; background: var(--wba-text-subtle); flex-shrink: 0; }
.wba-pitem.num .wba-pty { border-radius: 50%; }
.wba-pitem.cat .wba-pty { border-radius: 2px; }
.wba-pitem.on .wba-pty { background: var(--wba-data); }
.wba-pnone { font-size: 12px; color: var(--wba-text-muted); font-style: italic; padding: 16px; text-align: center; }

/* ── hierarchical block builder (per-variable block + build-up preview) ─ */
.wba-bitem { display: flex; align-items: center; gap: 9px; padding: 6px 9px 6px 11px; font-size: 12.5px; color: var(--wba-text); }
.wba-bitem.num .wba-pty { border-radius: 50%; }
.wba-bitem.cat .wba-pty { border-radius: 2px; }
.wba-bitem.on .wba-pty { background: var(--wba-data); }
.wba-bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wba-bsel {
  width: 86px; flex-shrink: 0; appearance: none; -webkit-appearance: none;
  border: 1px solid var(--wba-border-strong); border-radius: 7px;
  padding: 5px 24px 5px 9px; font-size: 11.5px; font-family: inherit; color: var(--wba-text); cursor: pointer;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236e6e6e' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.wba-bitem.on .wba-bsel { border-color: #c4d4ea; color: var(--wba-data); font-weight: 550; }
.wba-bsel:focus { outline: none; border-color: var(--wba-data); box-shadow: 0 0 0 2px var(--wba-data-soft); }

.wba-blockpreview {
  margin-top: 14px; border: 1px solid var(--wba-border); border-radius: 11px;
  background: #fafbfc; padding: 12px 13px;
}
.wba-bp-lbl {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--wba-text-muted); margin-bottom: 10px;
}
.wba-bp-hint { font-size: 12px; color: var(--wba-text-muted); font-style: italic; line-height: 1.45; }
.wba-bp-step { display: flex; align-items: flex-start; gap: 10px; padding: 4px 0; font-size: 12.5px; }
.wba-bp-num {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  background: var(--wba-data-soft); color: var(--wba-data);
  font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.wba-bp-txt { flex: 1; min-width: 0; color: var(--wba-text); line-height: 1.5; }
.wba-bp-delta {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 10px;
  color: var(--wba-data); background: var(--wba-data-soft); padding: 1px 6px; border-radius: 20px;
}

/* ── interaction builder ────────────────────────────────────────────── */
.wba-iterms { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.wba-inone { font-size: 12px; color: var(--wba-text-muted); font-style: italic; }
.wba-iterm {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; padding: 6px 8px 6px 11px; border-radius: 9px;
  background: #fff; border: 1px solid #c4d4ea; color: var(--wba-data); font-weight: 550;
}
.wba-irm {
  cursor: pointer; color: var(--wba-text-muted); width: 16px; height: 16px;
  border-radius: 5px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; transition: .14s;
}
.wba-irm:hover { background: #fde8e8; color: #c0392b; }
.wba-isel {
  appearance: none; -webkit-appearance: none; margin-left: 2px;
  border: 1px solid #c4d4ea; border-radius: 6px; cursor: pointer;
  padding: 2px 17px 2px 7px; font-size: 10.5px; font-family: inherit; color: var(--wba-data);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='6' fill='none'%3E%3Cpath d='M1 1l3.5 3.5L8 1' stroke='%232d4a6e' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.wba-isel:focus { outline: none; box-shadow: 0 0 0 2px var(--wba-data-soft); }
.wba-iadd {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 7px 12px; border-radius: 9px;
  border: 1px dashed var(--wba-border-strong); color: var(--wba-text-sec);
  cursor: pointer; background: #fafbfc; transition: .16s var(--wba-ease);
}
.wba-iadd:hover { border-color: var(--wba-data); color: var(--wba-data); background: var(--wba-data-soft); }

/* ── interaction popover ────────────────────────────────────────────── */
.wba-pop {
  position: fixed; z-index: 60; width: 240px;
  background: #fff; border: 1px solid var(--wba-border-strong); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(26, 29, 36, .2);
  opacity: 0; transform: translateY(-6px) scale(.97); pointer-events: none;
  transition: .18s var(--wba-ease);
}
.wba-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.wba-poph {
  padding: 10px 12px 8px; font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--wba-text-muted);
}
.wba-popsearch { padding: 0 10px 8px; }
.wba-popinput {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--wba-border-strong); border-radius: 8px;
  padding: 7px 10px; font-size: 12.5px; font-family: inherit; color: var(--wba-text);
}
.wba-popinput:focus { outline: none; border-color: var(--wba-data); box-shadow: 0 0 0 2px var(--wba-data-soft); }
.wba-popitems { max-height: 200px; overflow: auto; padding: 0 8px; }
.wba-popitem {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px;
  border-radius: 8px; cursor: pointer; font-size: 12.5px; transition: .1s;
}
.wba-popitem:hover { background: var(--wba-hover); }
.wba-popcheck {
  width: 15px; height: 15px; border-radius: 5px; flex-shrink: 0;
  border: 1.5px solid var(--wba-border-strong);
  display: inline-flex; align-items: center; justify-content: center;
}
.wba-popitem.sel .wba-popcheck { background: var(--wba-data); border-color: var(--wba-data); }
.wba-popitem.sel .wba-popcheck::after {
  content: ''; width: 8px; height: 4px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.wba-popfoot { display: flex; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--wba-border); }
.wba-popfoot button { flex: 1; font-size: 12px; padding: 7px; border-radius: 8px; border: none; cursor: pointer; font-family: inherit; }
.wba-popcancel { background: var(--wba-hover); color: var(--wba-text-sec); }
.wba-popok { background: var(--wba-data); color: #fff; }
.wba-popok:disabled { opacity: .4; cursor: not-allowed; }

/* ── accordions (factor coding / options) ───────────────────────────── */
.wba-acc {
  border: 1px solid var(--wba-border); border-radius: 11px;
  margin: 9px 0; overflow: hidden; transition: border-color .16s;
}
.wba-acc:hover { border-color: var(--wba-border-strong); }
.wba-acchdr { display: flex; align-items: center; gap: 10px; padding: 12px 13px; cursor: pointer; user-select: none; }
.wba-aclbl { font-size: 13px; font-weight: 550; }
.wba-acsum {
  margin-left: auto; font-size: 11px; color: var(--wba-text-muted);
  font-family: var(--mono, ui-monospace, Menlo, monospace); text-align: right;
}
.wba-caret { width: 15px; height: 15px; color: var(--wba-text-muted); flex-shrink: 0; transition: transform .28s var(--wba-ease); }
.wba-acc.open .wba-caret { transform: rotate(90deg); }
.wba-acbody { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .3s var(--wba-ease), opacity .22s; }
.wba-acc.open .wba-acbody { max-height: 600px; overflow-y: auto; opacity: 1; }
.wba-acinner { padding: 2px 13px 12px; }

/* ── data-entry empty state (workbook upload) ───────────────────────── */
.wba-dataentry { padding-top: 4px; margin: 0 0 14px; }
.wba-de-head { text-align: left; margin: 0 0 9px; }
.wba-de-title { font-size: 13.5px; font-weight: 650; color: var(--wba-text); }
.wba-de-sub { font-size: 11.5px; color: var(--wba-text-muted); margin-top: 3px; line-height: 1.4; }
.wba-drop {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; column-gap: 10px;
  border: 1.5px dashed var(--wba-border-strong); border-radius: 11px;
  padding: 10px 11px; text-align: left; background: #fcfdfe;
  cursor: pointer; transition: .18s var(--wba-ease);
}
.wba-drop:hover, .wba-drop.is-drag { border-color: var(--wba-data); background: var(--wba-data-soft); }
.wba-drop-glyph {
  grid-row: 1 / span 2; width: 34px; height: 34px; border-radius: 9px; margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.wba-drop-glyph svg { width: 24px; height: 24px; }
.wba-drop-t { font-size: 13px; font-weight: 600; color: var(--wba-text); min-width: 0; }
.wba-drop-s {
  font-size: 10.5px; color: var(--wba-text-muted); margin-top: 2px; min-width: 0;
  font-family: var(--mono, ui-monospace, Menlo, monospace); letter-spacing: .03em;
}
.wba-upbtn {
  grid-column: 3; grid-row: 1 / span 2; margin-top: 0; display: inline-flex; align-items: center; gap: 6px;
  background: var(--wba-data); color: #fff; border: none;
  font-size: 12.5px; font-weight: 600; font-family: inherit; white-space: nowrap;
  padding: 8px 12px; border-radius: 9px; cursor: pointer; transition: .16s var(--wba-ease);
}
.wba-upbtn:hover { background: #26405f; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(45, 74, 110, .26); }
.wba-de-status { font-size: 11.5px; margin-top: 9px; text-align: left; color: var(--wba-text-muted); }
.wba-de-status.err { color: #c0392b; }
.wba-de-status.ok { color: #2e7d52; }
.wba-de-status.warn { color: var(--wba-data); }
/* The browsable chooser (no data yet) reads as a header, not a clickable card. */
.wba-chooser.browse .wba-curcard {
  cursor: default; border-color: var(--wba-border-strong); background: #fbfcfd;
}
.wba-chooser.browse .wba-curcard:hover { border-color: var(--wba-border-strong); box-shadow: none; }
.wba-chooser.browse.open .wba-curcard {
  border-color: var(--wba-border-strong);
}
.wba-chooser.browse .wba-catalog {
  border-color: var(--wba-border-strong); background: #fff;
}
.wba-chooser.browse .wba-curchg {
  font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 9px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--wba-text-subtle);
}
.wba-chooser.browse .wba-tcard { cursor: default; }
.wba-chooser.browse .wba-tcard:hover { background: transparent; }
.wba-tcard.preview { opacity: 1; }

.wba-engine-status {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 0; padding: 8px 10px;
  border: 1px solid #d8e2ee; border-radius: 7px;
  background: #f6f9fc; color: var(--wba-data);
  font-size: 11.5px; line-height: 1.35;
}
.wba-engine-status[hidden] { display: none; }
.wba-engine-status::before {
  content: ""; width: 12px; height: 12px; flex: 0 0 12px;
  border: 2px solid rgba(45, 74, 110, .18);
  border-top-color: var(--wba-data);
  border-radius: 50%;
  animation: wba-engine-spin .78s linear infinite;
}
.wba-engine-status.err {
  background: #fbecec; border-color: #f0cdcd; color: #8a3b3b;
}
.wba-engine-status.err::before {
  content: "!"; display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; flex-basis: 14px;
  border: none; border-radius: 50%; animation: none;
  background: #8a3b3b; color: #fff; font-size: 10px; font-weight: 700;
}
@keyframes wba-engine-spin { to { transform: rotate(360deg); } }

/* ── dataset bar (shown once a dataset is loaded) ────────────────────── */
.wba-dataset {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; margin-bottom: 14px;
  background: #fafbfc; border: 1px solid var(--wba-border); border-radius: 10px;
}
.wba-ds-xls {
  width: 22px; height: 22px; border-radius: 5px; flex-shrink: 0; background: #217346;
  display: inline-flex; align-items: center; justify-content: center;
}
.wba-ds-xls svg { width: 13px; height: 13px; }
.wba-ds-name { font-size: 12.5px; font-weight: 550; color: var(--wba-text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wba-ds-dim { font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 10px; color: var(--wba-text-muted); flex-shrink: 0; }
.wba-ds-replace {
  margin-left: auto; flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--wba-data); cursor: pointer; font-family: inherit;
  background: #fff; border: 1px solid var(--wba-border); border-radius: 8px; padding: 5px 10px; transition: .14s;
}
.wba-ds-replace:hover { border-color: var(--wba-data); background: var(--wba-data-soft); }

/* variable role rows */
.wba-role { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
.wba-role .wba-rl {
  width: 76px; font-size: 11.5px; color: var(--wba-text-sec); font-weight: 550;
  text-align: right; flex-shrink: 0;
}
/* Minimal pill selector — quiet at rest, highlights on hover/focus. */
.wba-role select {
  flex: 1; min-width: 0; appearance: none; -webkit-appearance: none;
  border: 1px solid var(--wba-border-strong); border-radius: 9px;
  padding: 8px 30px 8px 12px; font-size: 13px; font-family: inherit;
  color: var(--wba-text); cursor: pointer; transition: .15s var(--wba-ease);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236e6e6e' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.wba-role select:hover { border-color: var(--wba-data); background-color: var(--wba-data-soft); }
.wba-role select:focus { outline: none; border-color: var(--wba-data); box-shadow: 0 0 0 2px var(--wba-data-soft); }
.wba-role input[type=number] {
  flex: 1; min-width: 0;
  border: 1px solid var(--wba-border-strong); border-radius: 7px;
  padding: 7px 9px; font-size: 12px; font-family: inherit; background: #fff;
}
.wba-ty {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 8.5px; min-width: 18px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px; font-weight: 600; flex-shrink: 0;
}
.wba-ty.num { background: #eaf0f7; color: #2d4a6e; }
.wba-ty.cat { background: #f1ece4; color: #8a6d3b; }

/* test options (tails / CI level / equal variance / null difference) */
.wba-opts {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--wba-border);
}
.wba-optlbl {
  font-family: var(--mono, ui-monospace, Menlo, monospace);
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--wba-text-muted); margin: 0 0 9px;
}
.wba-opt { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.wba-opt .wba-ol { font-size: 11.5px; color: var(--wba-text-sec); flex: 1; min-width: 0; }
.wba-opt select, .wba-opt input[type=number] {
  width: 96px; flex-shrink: 0;
  border: 1px solid var(--wba-border-strong); border-radius: 7px;
  padding: 6px 8px; font-size: 12px; font-family: inherit;
  background: #fff; color: var(--wba-text); cursor: pointer;
  transition: .13s var(--wba-ease);
}
.wba-opt select {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  padding: 6px 30px 6px 10px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236e6e6e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}
.wba-opt select.wba-select-direction {
  width: 148px;
}
.wba-opt select.wba-select-level {
  width: 190px;
}
.wba-opt select.wba-select-ss-type {
  width: 172px;
}
.wba-opt select:focus, .wba-opt input:focus {
  outline: none; border-color: var(--wba-data); box-shadow: 0 0 0 2px var(--wba-data-soft);
}
/* level-quality flags (probable typos / singletons) in the level picker */
.wba-lvlissue {
  display: flex; align-items: center; gap: 8px; margin: 5px 0;
  font-size: 11px; color: var(--wba-text-sec);
}
.wba-lvlissue.is-selected .wba-lvlissue-t { color: var(--wba-text); }
.wba-lvlissue-t { flex: 1; min-width: 0; }
.wba-lvlissue-a { display: flex; gap: 5px; flex-shrink: 0; }
.wba-lvlbtn {
  border: 1px solid var(--wba-border-strong); border-radius: 6px;
  padding: 3px 8px; font-size: 10.5px; font-family: inherit;
  background: #fff; color: var(--wba-text); cursor: pointer;
  transition: .13s var(--wba-ease);
}
.wba-lvlbtn:hover { border-color: var(--wba-data); color: var(--wba-data); background: var(--wba-data-soft); }
.wba-lvlbtn.is-active {
  font-weight: 600;
  border-color: rgba(45, 74, 110, .42);
  background: var(--wba-data-soft);
  color: var(--wba-data);
}
.wba-lvlbtn.is-exclude.is-active {
  border-color: #e5b8b8;
  background: #fbecec;
  color: #8a3b3b;
}

/* detected-ID note under the role rows */
.wba-idnote {
  margin: 2px 0 4px; font-size: 10.5px; line-height: 1.4;
  color: var(--wba-text-subtle); font-style: italic;
}

/* inline message under Analyze (degenerate data / bad selection) */
.wba-runmsg {
  margin-top: 10px; font-size: 11.5px; line-height: 1.45;
  color: #8a3b3b; background: #fbecec; border: 1px solid #f0cdcd;
  border-radius: 7px; padding: 8px 10px;
}
.wba-runmsg.busy {
  color: #24405f; background: #eef4fb; border-color: #d8e5f2;
}
.wba-runmsg[hidden] { display: none; }

.wba-opt-check { cursor: pointer; }
.wba-opt-check input { accent-color: var(--wba-data); width: 14px; height: 14px; flex-shrink: 0; }
.wba-opt-check .wba-ol { order: 2; }

.wba-redirect {
  font-size: 11.5px; color: #8a6d3b; background: #fbf4e6;
  border: 1px solid #f0e2c5; border-radius: 7px;
  padding: 8px 10px; margin-top: 10px; line-height: 1.45;
}
.wba-redirect[hidden] { display: none; }
.wba-redirect b { color: #6b5420; }
.wba-redirect.err { color: #8a3b3b; background: #fbecec; border-color: #f0cdcd; }
.wba-redirect.err b { color: #6b2020; }

.wba-run {
  margin-top: 18px; width: 100%;
  background: var(--wba-data); color: #fff; border: none; border-radius: 8px;
  padding: 11px; font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: .14s var(--wba-ease);
}
.wba-run:hover { background: #24405f; }
.wba-run:disabled { background: #c7cdd6; cursor: not-allowed; }
.wba-run.is-busy {
  position: relative;
  background: #2d4a6e;
  color: #fff;
}
.wba-run.is-busy::before {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: wba-spin .8s linear infinite;
}
.wba-panel.is-analyzing #wbaRoles {
  opacity: .62;
  pointer-events: none;
}
@keyframes wba-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 520px) {
  .wba-panel {
    top: 70px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
    min-width: 0;
    border-radius: 12px;
  }
  .wba-resize { display: none; }
}
