/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/*
 * ── Design tokens ─────────────────────────────────────────────
 *
 * Canonical tokens (colors, font, type scale, spacing, radii) come from the CDN:
 *   https://cdn.neorgon.org/v1.0.0/styles/base.css   (linked in index.html)
 * Do NOT redeclare them here; a local copy is how the fleet drifted. The block
 * below holds only what base.css does not define, plus the per-site accent.
 *
 * Motion: base.css still ships --ease-snap (bounce) for legacy sites, but it is
 * deprecated for new work (impeccable law: ease-out exponential, no bounce).
 * Use --ease-out below.
 */

:root {
  /* Per-site identity: set to this site's hub card accent (PROJECTS.md section 4) */
  --accent: #0369a1;
  --accent-bright: #0284c7;

  /* Site extras base.css does not define */
  --surface-toast: #1a1730;
  --danger: #e11d48;
  --danger-hover: #f43f5e;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --control-height: 44px;
  --control-height-sm: 36px;
  --shadow-card: 0 12px 28px rgba(15, 23, 42, 0.5);
  --shadow-modal: 0 24px 48px rgba(2, 6, 23, 0.58);
  --z-sticky-header: 200;
  --z-modal: 400;
  --z-toast: 500;
}

/* Author display values (e.g. .section/.stack flex) would otherwise defeat the
   hidden attribute; restore its authority once, globally. */
[hidden] { display: none !important; }

html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  min-height: 100%;
  color: var(--text-primary);
  display: flex; flex-direction: column;
}

body.modal-open {
  overflow: hidden;
}

main#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

/* ── Layout ────────────────────────────────────────────────── */
/*
 * GOTCHA: body { display:flex; flex-direction:column } + margin: 0 auto
 * on a child collapses its width; always pair with width: 100%.
 *
 * GOTCHA: External images (YouTube ggpht, Gravatar, etc.) may block loading
 * when the Referer header points to localhost or an unknown origin. Fix:
 * 1. Add <meta name="referrer" content="no-referrer"> in <head> (global)
 * 2. Or add referrerpolicy="no-referrer" on each <img> tag
 */
.container {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-6);
  flex: 1;
}

/* Vertical rhythm: use inside .container or nested regions */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.stack--tight { gap: var(--space-4); }
.stack--loose { gap: var(--space-8); }

/* Page section: title row + body (replaces “card everything” for grouping) */
.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.section__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
}
.section__titles {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}
.section__title {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}
.section__lead {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
  max-width: 52ch;
}
.section__lead code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
  color: var(--text-secondary);
}
.stack > .card { margin-bottom: 0; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* ── Header ────────────────────────────────────────────────────
 * Owned by the Neorgon Header Kit (css/neorgon-header.css; canonical
 * source: packages/neorgon-ui/header/). Do NOT style .header-bar,
 * .header-logo*, .header-title-link, .header-subtitle, .header-right,
 * .header-actions, or .header-home here. Auth styles (.auth-*) stay
 * site-owned below.
 */
nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Buttons (canonical) ─────────────────────────────────────
 * Use .btn + a variant. Aliases: .nav-link = toolbar ghost; .auth-* map below.
 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  transition:
    background-color var(--dur),
    color var(--dur),
    border-color var(--dur),
    box-shadow var(--dur),
    transform var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn--sm {
  min-height: var(--control-height-sm);
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}
.btn--block { width: 100%; }
.btn--icon {
  min-width: var(--control-height);
  padding: 0;
}
.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.btn--primary:hover { background: var(--accent-bright); }
.btn--secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}
.btn--ghost {
  background: transparent;
  color: rgba(255,255,255,0.92);
  border-color: rgba(255,255,255,0.18);
}
.btn--ghost:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}
.btn--danger:hover { background: var(--danger-hover); }

/* Toolbar ghost (header nav), same as .btn.btn--ghost.btn--sm */
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.auth-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--control-height);
  min-height: var(--control-height);
  padding: 0;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255,255,255,0.92);
  cursor: pointer;
  font-family: inherit;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.auth-toggle:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.auth-toggle svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: block;
}
.auth-toggle.logged-in { color: var(--accent); }
.auth-toggle.logged-in svg circle:nth-of-type(2) {
  fill: currentColor;
  stroke: none;
}

/* ── Sheet (inline panel under header), not a modal ─────────
 * Use for auth, filters, compact forms. No backdrop; page scrolls.
 * For blocking overlays use .modal below.
 */
.auth-panel {
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border-subtle);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.auth-panel.open { max-height: 300px; }
.auth-panel-inner {
  padding: var(--space-6);
  max-width: 400px;
  margin: 0 auto;
}
.auth-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.auth-tab {
  flex: 1;
  min-height: var(--control-height-sm);
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.auth-tab.active {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.auth-form input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
}
.auth-submit {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background-color var(--dur);
}
.auth-submit:hover { background: var(--accent-bright); }
#authUser {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.auth-username {
  color: var(--text-primary);
  font-weight: 600;
}
.auth-logout {
  min-height: var(--control-height-sm);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  transition: background-color var(--dur), color var(--dur), border-color var(--dur);
}
.auth-logout:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.auth-divider {
  height: 1px;
  background: var(--border-subtle);
}

/* ── Modal (blocking overlay) ──────────────────────────────── */
.modal[hidden] {
  display: none !important;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 12, 0.85);
  -webkit-backdrop-filter: blur(10px); /* Safari still needs the prefix */
  backdrop-filter: blur(10px);
}
.modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: min(90vh, 680px);
  overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}
/* For modals holding option grids or editors; narrow dialogs cramp them */
.modal__dialog--wide {
  width: min(100%, 760px);
}
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}
.modal__header h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}
.modal__body {
  padding: var(--space-6);
  overflow: auto;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.55;
}
.modal__body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
  color: var(--text-primary);
}
.modal__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-subtle);
}

/* ── Card ──────────────────────────────────────────────────── */
/*
 * GOTCHA: backdrop-filter creates a stacking context; dropdowns inside
 * a card can be clipped by a later card's stacking context. Fix by adding
 * position: relative; z-index: 10 to the card that owns the open dropdown.
 *
 * Default: static surface (no hover lift, avoids generic “dashboard demo”).
 * Use .card--interactive for raised hover + entrance motion.
 *
 * GOTCHA: a <button> or <a> used AS a card does not inherit body text color;
 * buttons default to canvas text (near-black), rendering invisible on the dark
 * bg. When a card is an interactive element, set color: var(--text-primary)
 * and font-family: var(--font) explicitly on it.
 */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  backdrop-filter: blur(10px);
  transition: border-color var(--dur), box-shadow var(--dur);
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.45);
}
.card--interactive {
  transition:
    transform var(--dur) ease-out,
    box-shadow var(--dur) ease-out,
    border-color var(--dur);
  animation: fadeIn 0.35s ease-out both;
}
.card--interactive:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
  border-color: var(--border-strong);
}
.card--enter {
  animation: fadeIn 0.35s ease-out both;
}
.card--flat:hover {
  box-shadow: none;
}
/* Card with an action row, in an equal-height grid: pin the toolbar to the
   bottom so buttons align across cards whose text wraps differently. */
.card--actions {
  display: flex;
  flex-direction: column;
}
.card--actions > .toolbar:last-child {
  margin-top: auto;
}

/* ── Button press feedback ─────────────────────────────────── */
button:active,
.btn:active,
.nav-link:active,
.auth-toggle:active,
.auth-tab:active,
.auth-submit:active,
.auth-logout:active {
  transform: scale(0.98);
  transition-duration: var(--dur-fast);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Skeleton loading ──────────────────────────────────────── */
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  max-width: min(360px, calc(100vw - var(--space-8)));
  background: var(--surface-toast);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
  pointer-events: none;
  transform: translateY(8px);
  opacity: 0;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}
.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ── Footer ────────────────────────────────────────────────────
   Owned by the Neorgon Footer Kit (css/neorgon-footer.css).
   Don't add .neo-footer rules here; edit packages/neorgon-ui/footer/
   and re-run sync-footer.sh. */

/* ── Focus styles ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* ── Skip link ─────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--accent-bright);
  color: #000;
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top var(--dur);
}
.skip-link:focus { top: 0; }

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card--interactive:hover { transform: none; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 600px) {
  .container { padding: var(--space-4); }
  .toast {
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }
}

/* ════════════════════════════════════════════════════════════
   Floorplan app shell. Shared seat/face/badge styles live here because
   both views use them; diagram.css and building.css hold the view skins.
   ════════════════════════════════════════════════════════════ */
:root {
  --ok: #34d399; --under: #fbbf24; --over: #f43f5e; --none: #64748b;
  --ws-h: calc(100dvh - 106px);    /* app header 56 + app footer 50 */
  --roster-w: 252px; --yaml-w: 440px;
  --z-sheet: 350;
}
.px-avatar { image-rendering: pixelated; image-rendering: crisp-edges; display: block; flex-shrink: 0; user-select: none; -webkit-user-drag: none; }
.px-avatar--vacant { opacity: .6; }
kbd { font-family: ui-monospace, Menlo, monospace; font-size: .85em; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }

/* ── Header bits ───────────────────────────────────────────── */
.mode-switch { display: inline-flex; }
.mode-switch .nav-link { border-radius: 0; }
.mode-switch .nav-link:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.mode-switch .nav-link:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.nav-link[aria-pressed="true"] { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.4); }
.menu-wrap { position: relative; }
.header-menu small { display: block; font-size: 11px; opacity: .7; font-weight: 400; }
.nav-link--badge { position: relative; }
.insight-badge {
  margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px;
  display: inline-grid; place-items: center; border-radius: 999px;
  font-size: 11px; font-weight: 800; background: rgba(255,255,255,.22); color: #fff;
}
.insight-badge[data-loud="1"] { background: var(--under); color: #000; }
.insight-badge[data-high="1"] { background: var(--over); color: #fff; }

/* ── Workspace ─────────────────────────────────────────────── */
main#main { flex: 1; min-height: 0; display: flex; }
.workspace {
  flex: none; width: 100%;
  height: var(--ws-h); min-height: 480px;
  display: grid; grid-template-columns: var(--roster-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
}
.workspace > * { min-height: 0; min-width: 0; }
body.yaml-open .workspace { grid-template-columns: var(--roster-w) minmax(0, 1fr) var(--yaml-w); }

/* ── Roster ────────────────────────────────────────────────── */
.roster {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); min-height: 0; overflow: hidden;
  border-right: 1px solid var(--border-subtle); background: var(--surface-1);
}
.roster-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.roster-head h2 { font-size: var(--text-sm); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.roster-count { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; }
.roster-list {
  display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 80px; overflow-y: auto;
  padding: 4px; margin: -4px; border-radius: var(--radius);
  transition: background var(--dur), box-shadow var(--dur);
}
.roster-list.drop-target { background: rgba(244,63,94,.08); box-shadow: inset 0 0 0 2px var(--over); }
.roster-empty { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.5; }
.roster-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; padding-top: var(--space-2); }
.roster-input {
  min-width: 0; min-height: var(--control-height-sm); padding: 0 10px;
  background: var(--bg); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: var(--text-sm);
}
.roster-tip { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.55; }

.chip {
  display: flex; align-items: center; gap: 8px; position: relative;
  padding: 6px 8px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-1);
  cursor: grab; touch-action: none; user-select: none;
  transition: border-color var(--dur), background var(--dur), box-shadow var(--dur);
}
.chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.chip:active { cursor: grabbing; }
.chip.is-selected { border-color: var(--accent-bright); }
.chip.is-picked, .seat.is-picked { box-shadow: 0 0 0 2px var(--under), 0 6px 16px rgba(251,191,36,.25); border-color: var(--under); }
.chip.is-dragging, .seat.is-dragging { opacity: .45; }
.chip-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.chip-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-sub { font-size: var(--text-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-pct[data-band="ok"] { color: var(--ok); } .chip-pct[data-band="under"] { color: var(--under); } .chip-pct[data-band="over"] { color: var(--over); font-weight: 700; }
.chip-bar { display: block; height: 3px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; }
.chip-bar i { display: block; height: 100%; background: var(--none); }
.chip-bar i[data-band="ok"] { background: var(--ok); } .chip-bar i[data-band="under"] { background: var(--under); } .chip-bar i[data-band="over"] { background: var(--over); }
.chip[data-band="over"] .chip-bar { box-shadow: 0 0 0 1px var(--over); }
.chip-remove {
  width: 22px; height: 22px; flex-shrink: 0; border: none; background: transparent; color: var(--text-muted);
  font-size: 18px; line-height: 1; cursor: pointer; border-radius: var(--radius-sm); opacity: 0;
  transition: opacity var(--dur), color var(--dur), background var(--dur);
}
.chip:hover .chip-remove, .chip:focus-within .chip-remove { opacity: 1; }
.chip-remove:hover { color: var(--over); background: rgba(244,63,94,.12); }

/* ── Board ─────────────────────────────────────────────────── */
.board-wrap { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.board-toolbar {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  padding: 8px var(--space-4); border-bottom: 1px solid var(--border-subtle); background: rgba(255,255,255,.02);
}
.doc-title {
  flex: 1 1 200px; min-width: 160px; min-height: var(--control-height-sm); padding: 0 10px;
  background: transparent; color: var(--text-primary); border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-size: var(--text-base); font-weight: 700;
}
.doc-title:hover, .doc-title:focus { border-color: var(--border); background: var(--bg); }
.toolbar-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.scale-field { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-muted); }
.scale-field input { width: 90px; accent-color: var(--accent-bright); }
.only-building { display: none; align-items: center; gap: var(--space-2); }
body[data-mode="building"] .only-building { display: inline-flex; }
body[data-mode="building"] #avatarsToggle { display: none; }
.btn--clear { margin-left: auto; }
.doc-notes { padding: 8px var(--space-4) 0; font-size: var(--text-sm); color: var(--text-secondary); max-height: 120px; overflow: auto; }
.board {
  flex: 1; min-height: 0; overflow: auto; position: relative;
  background: radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0) 0 0 / 26px 26px;
}
.board-empty { max-width: 520px; margin: 10vh auto; padding: var(--space-6); text-align: center; color: var(--text-secondary); line-height: 1.6; }
.board-empty h2 { font-size: var(--text-xl); color: var(--text-primary); margin-bottom: var(--space-2); }
.board-empty .toolbar { justify-content: center; margin-top: var(--space-4); }

/* drop feedback */
[data-drop="group"] { transition: box-shadow var(--dur), background-color var(--dur); }
body.dragging-person [data-drop="group"], body.picking [data-drop="group"] { box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
[data-drop="group"].drop-target { box-shadow: inset 0 0 0 2px var(--accent-bright), 0 0 0 4px rgba(2,132,199,.25) !important; }
[data-drop]:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: -2px; }
@media (pointer: coarse) { .pct-badge, .pct-input { height: 26px; min-width: 42px; font-size: 12px; } .chip-remove { opacity: 1; } .pct-bar { height: 12px; } }
body.dragging-person * { cursor: grabbing !important; }
body.dragging-room * { cursor: grabbing !important; }
.drag-ghost {
  position: fixed; z-index: var(--z-toast); pointer-events: none; transform: translate(-50%, -50%) scale(1.08);
  display: grid; place-items: center; gap: 2px;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.6));
}
.drag-ghost img { image-rendering: pixelated; width: 44px; height: 44px; }
.drag-ghost-ini { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: color-mix(in srgb, var(--face) 80%, #000); border: 2px solid #fff; }
.drag-ghost-hint { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #000; background: var(--under); border-radius: 3px; padding: 0 4px; min-height: 0; }
.drag-ghost-hint:empty { display: none; }
.drag-ghost.is-split img, .drag-ghost.is-split .drag-ghost-ini { outline: 3px dashed var(--under); outline-offset: 2px; }

/* ── Seats (shared by both views) ──────────────────────────── */
.seat {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 14px; min-height: 58px; border-radius: var(--radius-sm);
  background: var(--surface-1); border: 1px solid var(--border);
  cursor: grab; touch-action: none; user-select: none; max-width: 100%;
  transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur-fast);
}
.seat:hover { border-color: var(--border-strong); }
.seat:active { cursor: grabbing; }
.seat.is-selected { border-color: var(--accent-bright); box-shadow: 0 0 0 1px var(--accent-bright); }
.seat[data-band="over"] { border-color: color-mix(in srgb, var(--over) 60%, var(--border)); }
.seat-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.seat-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.seat-loc { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.face-disc { border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; background: color-mix(in srgb, var(--face) 78%, #000); flex-shrink: 0; }
.pct-badge, .pct-input {
  margin-left: auto; min-width: 34px; height: 20px; padding: 0 5px; border-radius: 999px;
  font: inherit; font-size: 11px; font-weight: 800; line-height: 1; cursor: pointer;
  background: rgba(255,255,255,.12); color: var(--text-primary); border: 1px solid rgba(255,255,255,.16);
}
.pct-badge:hover { background: rgba(255,255,255,.2); }
.pct-badge[data-band="over"] { background: color-mix(in srgb, var(--over) 35%, transparent); border-color: var(--over); }
.pct-badge[data-band="under"] { background: color-mix(in srgb, var(--under) 30%, transparent); border-color: var(--under); }
.pct-input { width: 54px; text-align: center; background: var(--bg); border-color: var(--accent-bright); cursor: text; }
.seat--vacant { opacity: .55; border-style: dashed; cursor: default; }
.seat--vacant .seat-name { color: var(--text-muted); font-style: italic; }
.is-flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(2,132,199,.9); } 100% { box-shadow: 0 0 0 14px rgba(2,132,199,0); } }

/* Share bar: a segmented pixel bar, 5% per nudge, dragged or clicked to set */
.pct-bar {
  position: absolute; left: 8px; right: 8px; bottom: 4px; height: 7px; box-sizing: border-box;
  background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.3);
  cursor: ew-resize; touch-action: none; user-select: none;
}
.pct-bar .pct-fill {
  position: absolute; top: 0; bottom: 0; left: 0; width: calc(var(--p, 100) * 1%);
  background: var(--seat-color, #64748b);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.3);
  transition: width .12s steps(4, end);
}
.pct-bar::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(0,0,0,.6) calc(10% - 1px) 10%);
}
.pct-bar[data-band="over"] .pct-fill { background: var(--over); }
.pct-bar .pct-num {
  position: absolute; right: -2px; bottom: 9px; font-size: 10px; font-weight: 800; font-style: normal; line-height: 1.3;
  padding: 0 4px; background: #0b1020; color: #fff; border: 1px solid rgba(255,255,255,.45);
  opacity: 0; pointer-events: none; transition: opacity var(--dur); white-space: nowrap;
}
.pct-bar:hover .pct-num, .pct-bar.is-dragging .pct-num, .pct-bar:focus-visible .pct-num { opacity: 1; }
.pct-bar:hover, .pct-bar:focus-visible { border-color: rgba(255,255,255,.7); }
.pct-bar:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 1px; }
.pct-bar.is-dragging .pct-fill { transition: none; }
body.dragging-pct * { cursor: ew-resize !important; }
body.readonly .pct-bar { cursor: default; }
body.readonly .pct-bar .pct-num { display: none; }

/* group header shared */
.g-head { display: flex; align-items: center; gap: 8px; min-width: 0; cursor: pointer; }
.g-head.is-selected .g-name { text-decoration: underline; text-decoration-color: var(--accent-bright); text-underline-offset: 3px; }
.g-name { font-weight: 700; font-size: var(--text-sm); color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-stats { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.g-note-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--under); flex-shrink: 0; cursor: pointer; }
.g-more { margin-left: auto; flex-shrink: 0; border: none; background: transparent; color: var(--text-muted); font: inherit; font-weight: 800; letter-spacing: .1em; cursor: pointer; border-radius: 4px; padding: 0 4px; opacity: 0; transition: opacity var(--dur); }
.g-head:hover .g-more, .g-more:focus-visible, .room--title:hover .g-more { opacity: 1; }
.g-more:hover { background: rgba(255,255,255,.12); color: #fff; }
.g-empty { font-size: var(--text-xs); color: var(--text-muted); text-align: center; padding: 10px; border: 1px dashed rgba(255,255,255,.18); border-radius: var(--radius-sm); }
.g-owns { display: flex; flex-wrap: wrap; gap: 4px; }
.own-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; background: rgba(255,255,255,.08); color: var(--text-secondary); border: 1px solid rgba(255,255,255,.1); }

/* ── YAML side panel ───────────────────────────────────────── */
.side-panel {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  border-left: 1px solid var(--border-subtle); background: var(--surface-1);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); }
.panel-head h2 { font-size: var(--text-sm); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.panel-status { font-size: 11px; color: var(--text-muted); padding: 6px 12px 0; line-height: 1.4; }
.panel-hint { font-size: 11px; color: var(--text-muted); padding: 6px 12px 10px; line-height: 1.5; }
.panel-hint code { font-family: ui-monospace, Menlo, monospace; }
.yaml-text {
  flex: 1; min-height: 160px; margin: 8px 12px 0; padding: 10px; resize: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; line-height: 1.5; tab-size: 2;
  background: var(--bg); color: var(--text-primary); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.yaml-text--import { width: 100%; min-height: 220px; margin: 8px 0 0; }
.yaml-errors { margin: 8px 12px 0; display: flex; flex-direction: column; gap: 4px; max-height: 140px; overflow: auto; }
.yaml-msg { font-size: 12px; padding: 6px 8px; border-radius: var(--radius-sm); border: 1px solid; line-height: 1.4; }
.yaml-msg--error { background: rgba(244,63,94,.1); border-color: rgba(244,63,94,.45); color: #fecdd3; }
.yaml-msg--warn { background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.4); color: #fde68a; }

/* ── Detail sheet ──────────────────────────────────────────── */
.detail-sheet {
  position: fixed; top: 56px; right: 0; bottom: 0; z-index: var(--z-sheet);
  width: min(380px, 94vw); display: flex; flex-direction: column;
  background: #0b0a1a; border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-modal);
}
body.yaml-open .detail-sheet { right: var(--yaml-w); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); }
.sheet-head h2 { font-size: var(--text-lg); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { padding: 12px 16px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.sheet-face { display: flex; align-items: center; gap: 12px; }
.sheet-total { font-weight: 700; font-size: var(--text-sm); }
.sheet-total[data-band="ok"] { color: var(--ok); } .sheet-total[data-band="under"] { color: var(--under); } .sheet-total[data-band="over"] { color: var(--over); }
.sheet-field { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-xs); color: var(--text-muted); }
.sheet-field input, .sheet-field textarea {
  font: inherit; font-size: var(--text-sm); color: var(--text-primary); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 9px; min-height: var(--control-height-sm);
}
.sheet-field textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.sheet-field--color input { padding: 2px; width: 56px; height: 36px; }
.sheet-row { display: flex; gap: 10px; }
.sheet-row .sheet-field { flex: 1; }
.sheet-hint { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; }
.sheet-sub { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-top: 6px; }
.share-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.share-list li { display: flex; align-items: center; gap: 6px; }
.share-name { flex: 1; font-size: var(--text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-list input { width: 64px; font: inherit; font-size: var(--text-sm); color: var(--text-primary); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 6px; }
.share-pct { font-size: var(--text-xs); color: var(--text-muted); }
.span-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; font-size: var(--text-xs); color: var(--text-secondary); }
.span-grid label { display: flex; align-items: center; gap: 6px; }
fieldset.sheet-field { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
fieldset.sheet-field legend { padding: 0 4px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ── Markdown preview ──────────────────────────────────────── */
.md-preview { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.55; }
.md-preview > * + * { margin-top: .5em; }
.md-preview h2, .md-preview h3, .md-preview h4 { color: var(--text-primary); font-size: 1em; font-weight: 700; }
.md-preview ul, .md-preview ol { padding-left: 1.2em; }
.md-preview code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: rgba(255,255,255,.08); padding: 0 4px; border-radius: 3px; }
.md-preview .md-code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; overflow: auto; }
.md-preview blockquote { border-left: 3px solid var(--border-strong); padding-left: 10px; color: var(--text-muted); }
.md-preview a { color: var(--accent-bright); }
.md-preview table { border-collapse: collapse; font-size: .9em; }
.md-preview th, .md-preview td { border: 1px solid var(--border); padding: 3px 8px; text-align: left; }

/* ── Insights drawer ───────────────────────────────────────── */
.insight-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-modal);
  width: min(380px, 90vw); display: flex; flex-direction: column;
  background: #0b0a1a; border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-modal);
  transform: translateX(100%); transition: transform .28s var(--ease-out);
}
body.drawer-open .insight-drawer { transform: translateX(0); }
.drawer-scrim { position: fixed; inset: 0; z-index: 390; background: rgba(2,4,12,.5); opacity: 0; pointer-events: none; transition: opacity var(--dur); }
body.drawer-open .drawer-scrim { opacity: 1; pointer-events: auto; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-6); border-bottom: 1px solid var(--border-subtle); }
.drawer-head h2 { font-size: var(--text-lg); font-weight: 600; }
.drawer-body { padding: var(--space-4) var(--space-6); overflow-y: auto; }
.insight-items { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.insight { display: flex; gap: 10px; padding: 10px 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
.insight[data-action] { cursor: pointer; }
.insight[data-action]:hover { border-color: var(--border-strong); background: var(--surface-2); }
.insight--high { background: rgba(244,63,94,.07); border-color: rgba(244,63,94,.35); } .insight--medium { background: rgba(251,191,36,.06); border-color: rgba(251,191,36,.3); } .insight--low, .insight--ok { border-color: var(--border); }
.insight-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: currentColor; }
.insight--high .insight-dot { color: var(--over); } .insight--medium .insight-dot { color: var(--under); } .insight--low .insight-dot, .insight--ok .insight-dot { color: var(--ok); }
.insight-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); }
.insight-detail { font-size: var(--text-xs); color: var(--text-muted); line-height: 1.5; margin-top: 2px; }

/* ── Dialogs ───────────────────────────────────────────────── */
.fp-dialog { width: min(100% - 32px, 640px); padding: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-1); color: var(--text-primary); box-shadow: var(--shadow-modal); }
.fp-dialog::backdrop { background: rgba(2,4,12,.8); backdrop-filter: blur(8px); }
.fp-dialog .modal__body p { margin-bottom: 8px; }
.help-body p { line-height: 1.55; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin-top: 12px; font-size: var(--text-sm); }
.keys dt { white-space: nowrap; }
.keys dd { color: var(--text-secondary); }

/* ── Embed (iframe) and read-only ──────────────────────────── */
body.embed .header-bar, body.embed .neo-footer, body.embed .roster, body.embed .board-toolbar,
body.embed .side-panel, body.embed .detail-sheet, body.embed .skip-link { display: none !important; }
body.embed .workspace { grid-template-columns: 1fr; height: 100dvh; min-height: 0; }
body.embed .board { background-color: var(--bg); }
body.embed .doc-notes { max-height: 72px; }
.embed-link {
  position: fixed; right: 10px; bottom: 8px; z-index: var(--z-toast);
  font-size: 11px; font-weight: 700; text-decoration: none; color: #fff;
  background: rgba(11,16,32,.85); border: 1px solid rgba(255,255,255,.3); border-radius: 3px; padding: 3px 8px;
}
.embed-link:hover { background: var(--accent); }
body.readonly .seat, body.readonly .chip, body.readonly .room-grip { cursor: default; }
body.readonly .room-resize, body.readonly .room-grip, body.readonly .chip-remove, body.readonly .g-more { display: none !important; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --yaml-w: 360px; }
  .workspace { grid-template-columns: 1fr; height: auto; min-height: var(--ws-h); grid-template-rows: auto minmax(0, 1fr); }
  body.yaml-open .workspace { grid-template-columns: 1fr; }
  .roster { border-right: none; border-bottom: 1px solid var(--border-subtle); max-height: 34vh; }
  .roster-list { flex-direction: row; flex-wrap: wrap; }
  .chip { width: auto; }
  .side-panel { position: fixed; top: 56px; right: 0; bottom: 0; width: min(100%, 440px); z-index: 340; }
  .detail-sheet { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 60vh; border-left: none; border-top: 1px solid var(--border-strong); }
  body.yaml-open .detail-sheet { right: 0; }
  .board { min-height: 60vh; }
}
@media (prefers-reduced-motion: reduce) {
  .is-flash, .drag-ghost { animation: none !important; }
}
