/* ============================================================
   Brainstack - Admin & Operator console design spec
   Brand-strict stylesheet. Bricolage Grotesque + Archivo.
   No italics, no mono, left justified, rounded corners.
   ============================================================ */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/BricolageGrotesque.ttf") format("truetype-variations");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/Archivo.ttf") format("truetype-variations");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  /* Signal — dark theme (authoritative). A coherent light→dark conversion:
     every surface, text, border and state is defined here as a token; the
     components below read the tokens, so the whole app themes from this block.
     Brand aliases (--navy/--bleu/--growth) are re-pointed to the cyan accent
     so existing "navy/green accent" fills read as Signal without touching
     every rule. */
  --black:  #0B1220;
  --navy:   #35C6F4;       /* re-pointed: legacy "navy accent" fills → cyan */
  --bleu:   #35C6F4;       /* re-pointed: eyebrow/label accent → cyan */
  --sand:   #0B1220;
  --snow:   #FFFFFF;       /* logo tile only */
  --abyss:  #060B14;
  --growth: #35C6F4;       /* re-pointed: "active/on/ok" → cyan (no green in Signal) */
  --sall:   #F5486B;       /* destructive / hard-error red (brightened for dark) */

  /* Signal accents */
  --accent:      #35C6F4;  /* active nav, primary buttons, links, galaxy nodes */
  --accent-tint: rgba(53,198,244,0.14);
  --amber:       #F5B44A;  /* conflict / stale markers, key highlights */
  --amber-tint:  rgba(245,180,74,0.14);

  /* Surfaces */
  --page:        #0B1220;
  --card:        #16233A;
  --card-elev:   #1C2A45;  /* raised / hover surface */
  --card-sunken: #101B30;  /* recessed inset (inputs, seg track, table heads) */
  --sidebar:     #0E1A2E;

  /* Text */
  --ink:    #DCE7F2;
  --ink-2:  #AEC0D6;       /* secondary */
  --ink-3:  #7C93B0;       /* muted */

  /* Lines */
  --line:    #2A3B57;
  --line-2:  #3A4F73;
  --tint:    rgba(255,255,255,0.05);

  /* Channels — cyan (ok/active), amber (warn/stale), red (error). Distinct. */
  --ok-fg:    #6FD8F6;
  --ok-bd:    rgba(53,198,244,0.45);
  --ok-bg:    rgba(53,198,244,0.13);
  --ok-solid: var(--accent);

  --warn-fg:  #F5B44A;
  --warn-ac:  #F5B44A;
  --warn-bd:  rgba(245,180,74,0.45);
  --warn-bg:  rgba(245,180,74,0.14);

  --err-fg:   #FF8199;
  --err-bd:   rgba(245,72,107,0.45);
  --err-bg:   rgba(245,72,107,0.13);
  --err-solid:var(--sall);

  --info-fg:  #8FB4CC;
  --info-bd:  rgba(108,149,167,0.45);
  --info-bg:  rgba(53,198,244,0.10);

  /* Radii (keep existing scale) */
  --r-chip: 10px;
  --r-card: 16px;
  --r-hero: 24px;
  --r-pill: 999px;

  /* Elevation */
  --sh-1: 0 1px 2px rgba(11,11,11,0.05);
  --sh-2: 0 1px 3px rgba(11,11,11,0.06), 0 4px 14px rgba(11,11,11,0.05);
  --sh-3: 0 10px 30px rgba(11,11,11,0.12), 0 2px 6px rgba(11,11,11,0.06);
  --sh-4: 0 28px 70px rgba(11,11,11,0.26), 0 6px 16px rgba(11,11,11,0.12);

  --font-head: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Archivo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
}
::selection { background: rgba(53,198,244,0.28); }
a { color: inherit; }

.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
.scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- Layout shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex: none;
  background: var(--sidebar);
  color: rgba(255,255,255,0.92);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 24px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: var(--r-chip); flex: none;
  background: var(--snow); display: flex; align-items: center; justify-content: center;
}
.brand-mark img { width: 22px; height: 22px; object-fit: contain; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 18px; color: var(--snow); letter-spacing: -0.02em; }
.brand-sub { font-size: 11px; color: var(--bleu); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255,255,255,0.4); font-weight: 600; padding: 16px 12px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--r-chip);
  color: rgba(255,255,255,0.78); text-decoration: none;
  font-size: 14px; font-weight: 500; border: none; background: none; cursor: pointer; width: 100%; text-align: left;
  transition: background .14s, color .14s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.on { background: rgba(255,255,255,0.13); color: #fff; }
.nav-item.on svg { opacity: 1; color: var(--growth); }
.nav-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.12); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex: none;
  border-bottom: 1px solid var(--line);
  background: rgba(11,18,32,0.82);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; position: sticky; top: 0; z-index: 20;
}
.crumb { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.crumb b { color: var(--ink); font-weight: 600; }
.content { padding: 34px 28px 64px; max-width: none; width: 100%; }

/* ---------- Page header ---------- */
.page-head { margin-bottom: 26px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bleu); margin-bottom: 9px; }
.page-title { font-size: 31px; }
.page-sub { font-size: 14.5px; color: var(--ink-2); margin-top: 9px; max-width: 660px; }

/* Section title - non-italic, brand-correct (weight + Bleu/Navy accent) */
.section-title { font-family: var(--font-head); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.section-title .accent { color: var(--bleu); }

/* ---------- Card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--sh-2); }
.card-pad { padding: 22px 24px; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600;
  padding: 9px 15px; border-radius: var(--r-chip);
  border: 1px solid transparent; background: none; color: var(--ink); cursor: pointer;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); color: var(--page); }
.btn-primary:hover { background: #5AD2F7; box-shadow: var(--sh-2); }
.btn-ghost { border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--tint); border-color: var(--line-2); }
.btn-soft { background: var(--tint); color: var(--ink); }
.btn-soft:hover { background: rgba(255,255,255,0.08); }
.btn-ok { background: var(--ok-solid); color: var(--page); }
.btn-ok:hover { background: #5AD2F7; }
.btn-danger { border-color: var(--err-bd); color: var(--err-fg); }
.btn-danger:hover { background: var(--err-bg); border-color: var(--sall); }
.btn-danger-solid { background: var(--err-solid); color: #fff; }
.btn-danger-solid:hover { background: #D63A5D; }
.btn-danger-solid:disabled, .btn-primary:disabled, .btn-danger:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-icon { padding: 8px; border-radius: 9px; }
.btn-icon svg { width: 17px; height: 17px; }

/* ---------- Chips, pills, tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600; line-height: 1.3; white-space: nowrap;
  border: 1px solid var(--line); background: var(--card-sunken); color: var(--ink-2);
}
.chip .swatch { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.chip-home { background: var(--accent-tint); border-color: rgba(53,198,244,0.32); color: var(--accent); font-weight: 700; }
.chip-x { display: inline-flex; padding: 1px; border-radius: 999px; color: var(--ink-3); cursor: pointer; border: none; background: none; }
.chip-x:hover { color: var(--sall); }
.chip-x svg { width: 13px; height: 13px; }
.chip-dashed { background: none; border-style: dashed; border-color: var(--line-2); color: var(--ink-3); }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 600;
}
.tag-ok   { background: var(--ok-bg);   color: var(--ok-fg); }
.tag-warn { background: var(--warn-bg); color: var(--warn-fg); }
.tag-err  { background: var(--err-bg);  color: var(--err-fg); }
.tag-info { background: var(--info-bg); color: var(--info-fg); }
.tag-navy { background: var(--accent-tint); color: var(--accent); }
.tag-neutral { background: var(--tint); color: var(--ink-2); }
.tag .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

.count { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: var(--r-pill); background: var(--tint); color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- Avatar ---------- */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; color: #fff; font-family: var(--font-head); font-weight: 700; flex: none; }

/* ---------- Banners (channels) ---------- */
.banner { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; border-radius: var(--r-chip); border: 1px solid; font-size: 13.5px; line-height: 1.5; }
.banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner .grow { flex: 1; min-width: 0; }
.banner-ok   { background: var(--ok-bg);   border-color: var(--ok-bd);   color: var(--ok-fg); }
.banner-warn { background: var(--warn-bg); border-color: var(--warn-bd); color: var(--warn-fg); }
.banner-err  { background: var(--err-bg);  border-color: var(--err-bd);  color: var(--err-fg); }
.banner-info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info-fg); }
.banner b { color: inherit; }

/* ---------- Toast ---------- */
.toast {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 17px; border-radius: var(--r-chip); font-size: 13.5px; font-weight: 600;
  box-shadow: var(--sh-3);
}
.toast svg { width: 17px; height: 17px; flex: none; }
.toast-ok   { background: var(--card-elev); color: var(--ink); border: 1px solid var(--line); }
.toast-ok svg { color: var(--accent); }
.toast-err  { background: var(--err-solid); color: #fff; }

/* ---------- Inputs ---------- */
.field-label { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--bleu); display: block; margin-bottom: 8px; }
.input, .select, .textarea {
  width: 100%; font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: var(--card-sunken); border: 1px solid var(--line-2); border-radius: var(--r-chip);
  padding: 10px 13px; outline: none; transition: border-color .14s, box-shadow .14s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

.search { display: flex; align-items: center; gap: 9px; background: var(--card-sunken); border: 1px solid var(--line); border-radius: var(--r-chip); padding: 0 13px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.search svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.search input { border: none; outline: none; background: none; padding: 9px 0; font-size: 14px; width: 100%; font-family: var(--font-body); color: var(--ink); }

/* Segmented control */
.seg { display: inline-flex; background: var(--tint); border-radius: var(--r-chip); padding: 3px; gap: 2px; }
.seg button { font-family: var(--font-body); font-size: 12.5px; font-weight: 600; padding: 6px 13px; border: none; background: none; cursor: pointer; border-radius: 8px; color: var(--ink-2); transition: background .14s, color .14s, box-shadow .14s; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--sh-1); }

/* Toggle */
.toggle { width: 40px; height: 23px; border-radius: 999px; background: rgba(255,255,255,0.16); position: relative; cursor: pointer; border: none; flex: none; padding: 0; transition: background .18s; }
.toggle.on { background: var(--growth); }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 999px; background: #fff; box-shadow: var(--sh-1); transition: transform .18s; }
.toggle.on::after { transform: translateX(17px); }

/* Checkbox */
.cbx { width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--line-2); background: var(--card); cursor: pointer; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.cbx.on { background: var(--navy); border-color: var(--navy); }
.cbx.on svg { color: #fff; width: 13px; height: 13px; }

/* ---------- Rows / lists ---------- */
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 22px; }
.row + .row { border-top: 1px solid var(--line); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { padding: 20px 22px; }
.kpi .label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.kpi .num { font-family: var(--font-head); font-weight: 700; font-size: 46px; line-height: 1; letter-spacing: -0.03em; margin-top: 12px; font-variant-numeric: tabular-nums; }
.kpi .meta { font-size: 12.5px; color: var(--ink-2); margin-top: 9px; }

/* ---------- Skeleton (loading) ---------- */
.sk { background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.10), rgba(255,255,255,0.05)); background-size: 200% 100%; border-radius: 7px; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Empty state ---------- */
.empty { text-align: left; padding: 30px 24px; color: var(--ink-3); display: flex; gap: 14px; align-items: flex-start; }
.empty .ico { width: 42px; height: 42px; border-radius: var(--r-chip); background: var(--tint); display: flex; align-items: center; justify-content: center; flex: none; color: var(--ink-3); }
.empty h4 { font-size: 16px; color: var(--ink); }
.empty p { font-size: 13.5px; margin: 5px 0 0; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 32px; z-index: 100; }
/* Full-screen backdrop for the shared modal pattern (alias of .overlay).
   Pages add `hidden` to toggle visibility via vgOpen/vgClose. */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 32px; z-index: 100; }
.modal { background: var(--card); border-radius: var(--r-card); box-shadow: var(--sh-4); width: 100%; max-width: 520px; max-height: calc(100vh - 64px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { padding: 22px 24px 16px; }
.modal-head.danger { background: var(--err-bg); border-bottom: 1px solid var(--err-bd); }
.modal-head.warn { background: var(--warn-bg); border-bottom: 1px solid var(--warn-bd); }
.modal-title { font-size: 21px; }
.modal-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 7px; line-height: 1.5; }
.modal-head.danger .modal-sub, .modal-head.warn .modal-sub { color: inherit; }
.modal-body { padding: 20px 24px; overflow: auto; }
.modal-foot { padding: 15px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--card-sunken); }

/* ---------- Overflow menu ---------- */
.menu { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-chip); box-shadow: var(--sh-3); padding: 6px; min-width: 200px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; }
.menu-item:hover { background: var(--tint); }
.menu-item svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.menu-item.danger { color: var(--err-fg); }
.menu-item.danger svg { color: var(--err-fg); }
.menu-item.danger:hover { background: var(--err-bg); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; padding: 8px 11px 4px; }

/* ---------- Utilities ---------- */
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums; }
.handle { font-weight: 500; color: var(--ink-3); font-size: 12.5px; }
.stack { display: flex; flex-direction: column; }
.rowflex { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap6 { gap: 6px; } .gap8 { gap: 8px; } .gap10 { gap: 10px; } .gap14 { gap: 14px; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mt18 { margin-top: 18px; } .mt24 { margin-top: 24px; }
.hidden { display: none !important; }

/* ---------- Overflow menu positioning ---------- */
[data-menu] { position: relative; }
[data-menu] .menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 50; display: none; }
[data-menu].open .menu { display: block; }

/* ---------- Write-status pill ---------- */
.wstat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-pill); }
.wstat .dot { width: 7px; height: 7px; border-radius: 999px; }
.wstat-ok { background: var(--ok-bg); color: var(--ok-fg); }
.wstat-ok .dot { background: var(--growth); }
.wstat-warn { background: var(--warn-bg); color: var(--warn-fg); }
.wstat-warn .dot { background: var(--warn-ac); }

/* ---------- Members row grid ---------- */
.mrow { display: grid; grid-template-columns: 1fr auto; gap: 16px 22px; padding: 16px 22px; align-items: start; }
.mrow + .mrow { border-top: 1px solid var(--line); }
.mrow .person { display: flex; align-items: center; gap: 13px; min-width: 0; }
.mrow .teamline { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 10px; }
.teamline .lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-right: 2px; }

/* ---------- Capture health bar ---------- */
.hbar { height: 8px; border-radius: 999px; background: var(--tint); overflow: hidden; display: flex; }
.hbar i { display: block; height: 100%; }

/* ---------- Tree ---------- */
.tree-node rect { transition: fill .12s, stroke .12s; }

/* ---------- Definition row ---------- */
.def { display: grid; grid-template-columns: 150px 1fr; gap: 4px 16px; font-size: 13.5px; }
.def dt { color: var(--ink-3); font-weight: 600; }
.def dd { margin: 0; color: var(--ink); }

/* ---------- Members rows (simple grid: person · home team · admin · menu) ---------- */
.mhead, .mrow2 { display: grid; grid-template-columns: minmax(170px,1fr) minmax(190px,230px) 128px 36px; align-items: center; gap: 18px; padding: 14px 22px; }
.mhead { padding: 11px 22px; background: var(--card-sunken); }
.mrow2 + .mrow2 { border-top: 1px solid var(--line); }
.mrow2 .person { display: flex; align-items: center; gap: 13px; min-width: 0; }
.radio-dot { width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--line-2); flex: none; position: relative; }

/* ---------- Unassigned people rail (Teams page) ---------- */
.rail { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 12px; scroll-snap-type: x proximity; }
.rail::-webkit-scrollbar { height: 8px; }
.rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 999px; }
.pcard { flex: none; width: 168px; scroll-snap-align: start; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); padding: 16px 14px; display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; }
.pcard .nm { font-weight: 700; font-size: 13.5px; line-height: 1.2; }
.rail-hint { display: flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 12px; flex: none; }
.pchip { flex: none; display: flex; align-items: center; gap: 9px; padding: 6px 8px 6px 10px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--card); scroll-snap-align: start; }
.pchip .nm { font-weight: 600; font-size: 13px; white-space: nowrap; }
.pchip[draggable="true"] { cursor: grab; transition: box-shadow .14s, opacity .14s, transform .08s; }
.pchip[draggable="true"]:active { cursor: grabbing; }
.pchip.dragging { opacity: 0.45; }
.pchip .grip { color: var(--ink-3); display: inline-flex; margin-right: -2px; cursor: grab; }
.team-card { transition: background .12s, box-shadow .12s, outline-color .12s; outline: 2px solid transparent; outline-offset: -2px; }
.team-card.drop-ok { background: var(--ok-bg); outline-color: var(--growth); border-radius: var(--r-card); }
.team-card.drop-no { background: var(--err-bg); outline-color: var(--sall); border-radius: var(--r-card); cursor: not-allowed; }
.rail.dragging-active { outline: 2px dashed var(--bleu); outline-offset: 3px; border-radius: var(--r-card); }
@media (prefers-reduced-motion: no-preference) { .pchip.just-removed { animation: chipout .22s ease forwards; } }
@keyframes chipout { to { opacity: 0; transform: scale(0.8); width: 0; margin: 0; padding: 0; } }

/* ---------- Door / visibility radio ---------- */
.door { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.door-opt { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1.5px solid var(--line-2); border-radius: var(--r-card); cursor: pointer; background: var(--card); transition: border-color .14s, background .14s, box-shadow .14s; }
.door-opt:hover { border-color: var(--bleu); }
.door-opt.on { border-color: var(--navy); background: var(--info-bg); box-shadow: 0 0 0 3px rgba(108,149,167,0.18); }
.door-opt .radio { width: 20px; height: 20px; border-radius: 999px; border: 2px solid var(--line-2); flex: none; margin-top: 1px; position: relative; }
.door-opt.on .radio { border-color: var(--navy); }
.door-opt.on .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 999px; background: var(--navy); }
.door-opt .di { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; }
.door-opt .dsub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }
.door-opt .rec { font-size: 11px; font-weight: 700; color: var(--ok-fg); background: var(--ok-bg); padding: 1px 7px; border-radius: 999px; }

/* ---------- Stepper ---------- */
.steps { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.step-dot { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.step-dot .n { width: 22px; height: 22px; border-radius: 999px; background: var(--tint); color: var(--ink-3); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.step-dot.on .n { background: var(--navy); color: #fff; }
.step-dot.on { color: var(--ink); }
.step-line { flex: 1; height: 1.5px; background: var(--line); }

/* ---------- Directory ---------- */
.dir-section { margin-bottom: 10px; }
.dir-shead { display: flex; align-items: center; gap: 9px; padding: 12px 6px 10px; }
.dir-shead .caret { color: var(--ink-3); }
.dir-shead .name { font-family: var(--font-head); font-weight: 700; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.team-card { display: flex; align-items: center; gap: 14px; padding: 15px 18px; }
.team-card + .team-card { border-top: 1px solid var(--line); }
.team-hash { width: 40px; height: 40px; border-radius: var(--r-chip); display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 19px; color: #fff; flex: none; }
.team-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; }
.you-tag { font-size: 11px; font-weight: 700; color: var(--ok-fg); background: var(--ok-bg); padding: 2px 8px; border-radius: 999px; }
.avstack { display: flex; }
.avstack .avatar { border: 2px solid var(--card); margin-left: -8px; }
.avstack .avatar:first-child { margin-left: 0; }
.sealed-row { background: repeating-linear-gradient(135deg, transparent, transparent 9px, rgba(255,255,255,0.03) 9px, rgba(255,255,255,0.03) 18px); }

/* ---------- Spaces ---------- */
.space-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.owner-badge { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-tint); padding: 2px 8px 2px 6px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Brain ---------- */
.brain-wrap { position: relative; border-radius: var(--r-hero); overflow: hidden; background: radial-gradient(130% 130% at 50% 0%, #16273f 0%, #0d1a2e 48%, #0a1120 100%); box-shadow: var(--sh-3); }
.brain-canvas { display: block; width: 100%; height: 100%; }
.brain-legend { position: absolute; left: 18px; bottom: 18px; display: flex; gap: 16px; flex-wrap: wrap; background: rgba(7,21,27,0.55); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.12); border-radius: var(--r-chip); padding: 10px 15px; }
.brain-legend span { display: flex; align-items: center; gap: 7px; font-size: 12px; color: rgba(255,255,255,0.82); }
.brain-hud { position: absolute; right: 18px; top: 18px; min-width: 210px; background: rgba(7,21,27,0.62); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.14); border-radius: var(--r-card); padding: 16px 18px; color: #fff; }
.brain-pill { position: absolute; left: 18px; top: 18px; display: flex; align-items: center; gap: 8px; background: rgba(7,21,27,0.55); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.12); border-radius: 999px; padding: 7px 13px; font-size: 12.5px; color: rgba(255,255,255,0.9); font-weight: 600; }
