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

/*
 * ── Design tokens ─────────────────────────────────────────────
 *
 *  Colors
 *  bg:                 #040714
 *  surface-1 (cards):  rgba(255,255,255,.03)
 *  surface-2 (hover):  rgba(255,255,255,.06)
 *  border-subtle:      rgba(255,255,255,.07)
 *  border:             rgba(255,255,255,.1)
 *  border-strong:      rgba(255,255,255,.22)
 *  blue accent:        #0063e5
 *  blue accent bright: #0080ff
 *  text primary:       #f9f9f9
 *  text secondary:     #cacaca
 *  text muted:         rgba(255,255,255,.55)
 *  header gradient:    in oklch 135deg, #B015B0 0%, #3D0080 50%, #040714 100%
 *
 *  Typography scale (rem)
 *  --text-xs: 0.75    --text-sm: 0.875   --text-base: 1
 *  --text-lg: 1.125   --text-xl: 1.25    --text-2xl: 1.5
 *  font stack: 'Avenir Next', -apple-system, BlinkMacSystemFont,
 *              'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif
 *
 *  Spacing scale (4px grid)
 *  --space-1: 4px   --space-2: 8px   --space-3: 12px   --space-4: 16px
 *  --space-6: 24px  --space-8: 32px
 *
 *  Radii
 *  --radius-sm: 6px   --radius: 10px   --radius-lg: 15px
 *
 *  Easing
 *  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1)  (spring/overshoot)
 *  --dur-fast: 120ms   --dur: 200ms
 *
 *  UI primitives
 *  --control-height: 44px   (touch minimum)
 *  --control-height-sm: 36px
 *  --z-sticky-header: 200   --z-modal: 400   --z-toast: 500
 */

:root {
  --load-green: #34d399;
  --load-amber: #fbbf24;
  --load-red: #f43f5e;
  --loot: #d97706;
  --bg: #040714;
  --surface-1: rgba(255,255,255,.03);
  --surface-2: rgba(255,255,255,.06);
  --surface-toast: #1a1730;
  --border-subtle: rgba(255,255,255,.07);
  --border: rgba(255,255,255,.1);
  --border-strong: rgba(255,255,255,.22);
  --text-primary: #f9f9f9;
  --text-secondary: #cacaca;
  --text-muted: rgba(255,255,255,.55);
  --accent: #0063e5;
  --accent-bright: #0080ff;
  --danger: #e11d48;
  --danger-hover: #f43f5e;
  --font: 'Avenir Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-base: 1rem;
  --text-lg: 1.125rem; --text-xl: 1.25rem; --text-2xl: 1.5rem;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-6: 24px; --space-8: 32px;
  --radius-sm: 6px; --radius: 10px; --radius-lg: 15px;
  --ease-snap: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 120ms; --dur: 200ms;
  --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;
}

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 ──────────────────────────────────────────────────
   Bar, logo, home icon, mobile collapse, and theme switcher come
   from the Neorgon Header Kit (css/neorgon-header.css, app mode:
   slim + auto-hides on scroll). Site keeps only .nav-link styles
   (Buttons section below). */

/* ── 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.72);
  backdrop-filter: blur(4px);
}
.modal__dialog {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(100%, 440px);
  max-height: min(88vh, 560px);
  overflow: hidden;
  background: var(--surface-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
}
.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;
}

/* ── 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 ────────────────────────────────────────────────── */

/* ── 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;
  }
}

/* ════════════════════════════════════════════════════════════
   LOADOUT — team meeting-load planner
   ════════════════════════════════════════════════════════════ */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Settings strip ────────────────────────────────────────── */
.settings-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  background: rgba(217,119,6,.06);
  border-bottom: 1px solid var(--border-subtle);
}
.strip-field { display: flex; flex-direction: column; gap: 3px; font-size: var(--text-xs); color: var(--text-muted); }
.strip-field span strong { color: var(--loot); font-weight: 700; }
.strip-select {
  min-height: var(--control-height-sm); padding: 0 var(--space-3);
  background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: var(--text-sm);
}
.strip-field--range { min-width: 220px; }
.strip-field--range input[type=range] { accent-color: var(--loot); cursor: pointer; }
.strip-hint { margin-left: auto; font-size: var(--text-xs); color: var(--text-muted); max-width: 32ch; }

/* ── Week tabs ─────────────────────────────────────────────── */
.week-bar {
  display: flex; align-items: center; gap: 6px;
  padding: var(--space-2) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-1);
  overflow-x: auto; flex-wrap: nowrap;
}
.week-tab {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 10px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-secondary);
  font-family: inherit; font-size: var(--text-sm); font-weight: 600; cursor: pointer;
  transition: background var(--dur), color var(--dur), border-color var(--dur);
}
.week-tab:hover { background: var(--surface-2); color: var(--text-primary); }
.week-tab--active {
  background: rgba(217,119,6,.14); color: var(--text-primary);
  border-color: color-mix(in srgb, var(--loot) 55%, var(--border));
}
.week-tab-label { cursor: text; }
.week-tab-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 800; background: var(--surface-2); color: var(--text-muted);
}
.week-tab--active .week-tab-count { background: var(--loot); color: #1a1200; }
.week-tab-x {
  margin-left: 2px; width: 16px; height: 16px; border-radius: 50%;
  display: inline-grid; place-items: center; font-size: 13px; line-height: 1;
  color: var(--text-muted);
}
.week-tab-x:hover { color: var(--load-red); background: rgba(244,63,94,.14); }
.week-name-input {
  min-height: 30px; width: 120px; padding: 0 8px;
  font-family: inherit; font-size: var(--text-sm); font-weight: 600;
  background: var(--bg); color: var(--text-primary);
  border: 1px solid var(--loot); border-radius: var(--radius-sm);
}
.week-add {
  min-height: 32px; padding: 0 10px; flex-shrink: 0;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted);
  font-family: inherit; font-size: var(--text-xs); font-weight: 600; cursor: pointer;
  transition: border-color var(--dur), color var(--dur), background var(--dur);
}
.week-add:hover { border-color: var(--loot); color: var(--loot); background: rgba(217,119,6,.08); }
.wall-caption { font-size: var(--text-xs); color: var(--text-muted); margin-top: 6px; }

/* ── Workspace layout (roster + board) ─────────────────────── */
main#main { flex: 1; min-height: 0; }
.workspace {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: 0;
  flex: 1; min-height: 0;
  height: 100%;
}

/* ── Roster (party rail) ───────────────────────────────────── */
.roster {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4);
  border-right: 1px solid var(--border-subtle);
  background: var(--surface-1);
  overflow-y: auto;
}
.roster-head { font-size: var(--text-sm); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.roster-list { display: flex; flex-direction: column; gap: var(--space-2); }
.roster-empty { font-size: var(--text-sm); color: var(--text-muted); line-height: 1.5; padding: var(--space-2) 0; }
.roster-add { display: flex; gap: var(--space-2); margin-top: auto; padding-top: var(--space-3); }
.roster-input {
  flex: 1; min-width: 0; min-height: var(--control-height-sm); padding: 0 var(--space-3);
  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.5; }

/* Character chip */
.chip {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 6px 8px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-1);
  cursor: grab; position: relative;
  transition: border-color var(--dur), background var(--dur), transform var(--dur-fast);
  touch-action: none;
}
.chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.chip:active { cursor: grabbing; }
.chip--picked {
  border-color: var(--loot);
  box-shadow: 0 0 0 2px rgba(217,119,6,.35), 0 6px 16px rgba(217,119,6,.2);
}
/* Radial ring doubles as a load gauge (conic fill up to --ring-deg) */
.chip-ring {
  --ring-deg: 0deg; --ring-color: var(--load-green);
  position: relative; width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  background: conic-gradient(var(--ring-color) var(--ring-deg), rgba(255,255,255,.1) 0);
  display: grid; place-items: center;
}
.chip-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: color-mix(in srgb, var(--class-color) 78%, #000);
}
.chip-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chip-name { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-load { font-size: var(--text-xs); }
.chip-load--green { color: var(--load-green); }
.chip-load--amber { color: var(--load-amber); }
.chip-load--red { color: var(--load-red); }
.chip-pip {
  position: absolute; top: 4px; left: 30px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--load-red); color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--bg);
  animation: pip-pulse 1.4s ease-in-out infinite;
}
@keyframes pip-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }
.chip-remove {
  margin-left: auto; 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(--load-red); background: rgba(244,63,94,.12); }

/* ── Board (Mon–Fri) ───────────────────────────────────────── */
.board {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-3);
  padding: var(--space-4); overflow: auto; min-height: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.05) 1px, transparent 0) 0 0 / 26px 26px;
}
.day {
  display: flex; flex-direction: column; gap: var(--space-2);
  min-width: 150px;
}
.day-head {
  display: flex; align-items: baseline; justify-content: space-between;
  position: sticky; top: 0; z-index: 2;
  padding: 6px 8px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border-subtle);
}
.day-name { font-weight: 700; font-size: var(--text-sm); letter-spacing: .04em; }
.day-total { font-size: var(--text-xs); color: var(--text-muted); }
.day-drop {
  display: flex; flex-direction: column; gap: 0;
  min-height: 80px; flex: 1;
  border-radius: var(--radius); padding: 4px;
  transition: background var(--dur), box-shadow var(--dur);
}
body.dragging-person .day-drop, body.picking .day-drop { background: rgba(255,255,255,.02); }
.day-empty {
  font-size: var(--text-xs); color: var(--text-muted);
  text-align: center; padding: var(--space-4) var(--space-2);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.day-add {
  margin-top: 4px; padding: 6px; width: 100%;
  border: 1px dashed var(--border); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted);
  font-family: inherit; font-size: var(--text-xs); font-weight: 600; cursor: pointer;
  transition: border-color var(--dur), color var(--dur), background var(--dur);
}
.day-add:hover { border-color: var(--loot); color: var(--loot); background: rgba(217,119,6,.08); }

/* ── Puzzle-piece meeting block ────────────────────────────── */
/* Vertical interlock: a notch on top, a tab on the bottom. Stacking blocks
   in a column reads as a connected chain without any horizontal layout math. */
.block {
  --type-color: #94a3b8;
  position: relative;
  margin: 9px 0;              /* room for the tab/notch to overlap neatly */
  padding: 10px 10px 8px;
  background: color-mix(in srgb, var(--type-color) 12%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--type-color) 40%, var(--border));
  border-left: 3px solid var(--type-color);
  border-radius: var(--radius);
  transition: transform var(--dur-fast), box-shadow var(--dur), border-color var(--dur);
}
.block:first-child { margin-top: 4px; }
/* top notch (carved in) */
.block-notch {
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 9px;
  background: var(--bg);
  border: 1px solid color-mix(in srgb, var(--type-color) 40%, var(--border));
  border-top: none;
  border-radius: 0 0 12px 12px;
}
/* bottom tab (bumps out) */
.block-tab {
  position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  width: 22px; height: 9px;
  background: color-mix(in srgb, var(--type-color) 12%, var(--surface-1));
  border: 1px solid color-mix(in srgb, var(--type-color) 40%, var(--border));
  border-top: none;
  border-radius: 0 0 12px 12px;
}
.block.drop-target {
  border-color: var(--loot);
  box-shadow: 0 0 0 2px rgba(217,119,6,.4), 0 8px 22px rgba(217,119,6,.28);
  transform: scale(1.02);
}
.block--oversized { border-color: var(--load-red); }
.block-head { display: flex; align-items: center; gap: 6px; }
.block-glyph { color: var(--type-color); font-size: 14px; flex-shrink: 0; }
.block-title {
  font-size: var(--text-sm); font-weight: 600; color: var(--text-primary);
  cursor: text; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.block-title-input {
  flex: 1; min-width: 0; font-family: inherit; font-size: var(--text-sm); font-weight: 600;
  background: var(--bg); color: var(--text-primary);
  border: 1px solid var(--loot); border-radius: var(--radius-sm); padding: 2px 6px;
}
.block-x {
  width: 20px; height: 20px; flex-shrink: 0; border: none; background: transparent;
  color: var(--text-muted); font-size: 16px; line-height: 1; cursor: pointer; border-radius: var(--radius-sm);
  opacity: 0; transition: opacity var(--dur), color var(--dur);
}
.block:hover .block-x { opacity: 1; }
.block-x:hover { color: var(--load-red); }
.block-meta { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.chiplet {
  font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer; font-family: inherit;
  transition: background var(--dur), border-color var(--dur);
}
.chiplet:hover { background: rgba(255,255,255,.12); border-color: var(--border-strong); }
.chiplet--ghost { cursor: default; opacity: .8; }
.chiplet--ghost:hover { background: var(--surface-2); border-color: var(--border); }
.block-seats { display: flex; flex-wrap: wrap; gap: 4px; min-height: 26px; align-content: flex-start; }
.seats-empty { font-size: 10px; color: var(--text-muted); font-style: italic; padding: 4px 2px; }
.seat {
  position: relative; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff;
  background: color-mix(in srgb, var(--class-color) 78%, #000);
  border: 1.5px solid color-mix(in srgb, var(--class-color) 50%, #fff);
}
.seat--land { animation: seat-land .45s var(--ease-snap); }
@keyframes seat-land { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.seat-x {
  position: absolute; top: -5px; right: -5px; width: 15px; height: 15px;
  border-radius: 50%; border: none; background: var(--load-red); color: #fff;
  font-size: 10px; line-height: 1; cursor: pointer; display: none; place-items: center;
}
.seat:hover .seat-x { display: grid; }

/* ── Drag ghost ────────────────────────────────────────────── */
.drag-ghost {
  position: fixed; z-index: var(--z-toast); pointer-events: none;
  width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff;
  background: color-mix(in srgb, var(--class-color) 80%, #000);
  border: 2px solid #fff; box-shadow: 0 10px 24px rgba(0,0,0,.5);
  opacity: .92; transform: scale(1.06);
}
body.dragging-person * { cursor: grabbing !important; }

/* ── Type picker popover ───────────────────────────────────── */
.type-picker {
  position: fixed; z-index: var(--z-modal);
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  width: 224px; background: var(--surface-toast);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-modal);
}
.type-opt {
  --type-color: #94a3b8;
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border: none; background: transparent; color: var(--text-primary);
  font-family: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer;
  border-radius: var(--radius-sm); border-left: 3px solid var(--type-color);
  transition: background var(--dur);
}
.type-opt:hover { background: var(--surface-2); }
.type-opt-glyph { color: var(--type-color); }
.type-opt-dur { margin-left: auto; font-size: 10px; color: var(--text-muted); }

/* ── Insight badge + drawer ────────────────────────────────── */
.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: var(--load-amber); color: #000;
}
.insight-badge[data-high="1"] { background: var(--load-red); color: #fff; }
.badge-pulse { animation: pip-pulse .4s ease-in-out 2; }

.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-snap);
}
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; }
.drawer-subhead { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: var(--space-4) 0 var(--space-2); }

/* Bottle wall */
.bottle-wall {
  display: flex; flex-wrap: wrap; gap: var(--space-3);
  padding-bottom: var(--space-2);
}
.bottle { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bottle-glass {
  position: relative; width: 34px; height: 84px; overflow: hidden;
  border: 2px solid var(--border-strong); border-radius: 6px 6px 9px 9px;
  background: rgba(255,255,255,.03);
}
.bottle-liquid {
  position: absolute; left: 0; right: 0; bottom: 0;
  transition: height .35s var(--ease-snap), background .3s;
}
.bottle-liquid--green { background: linear-gradient(180deg, color-mix(in srgb, var(--load-green) 70%, transparent), var(--load-green)); }
.bottle-liquid--amber { background: linear-gradient(180deg, color-mix(in srgb, var(--load-amber) 70%, transparent), var(--load-amber)); }
.bottle-liquid--red   { background: linear-gradient(180deg, color-mix(in srgb, var(--load-red) 70%, transparent), var(--load-red)); }
/* Threshold line sits at the top of the safe zone (100% of threshold = top of glass) */
.bottle-threshold {
  position: absolute; left: -2px; right: -2px; top: 2px; height: 0;
  border-top: 2px dashed rgba(255,255,255,.5);
}
.bottle--over .bottle-glass { border-color: var(--load-red); animation: bottle-flicker 1.6s ease-in-out infinite; }
@keyframes bottle-flicker { 0%,100% { box-shadow: 0 0 0 0 rgba(244,63,94,0); } 50% { box-shadow: 0 0 10px 1px rgba(244,63,94,.55); } }
.bottle-splash {
  position: absolute; top: -3px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 8px; background: var(--load-red); border-radius: 50%;
  filter: blur(2px); opacity: .8;
}
.bottle-name { font-size: 10px; font-weight: 700; color: var(--text-muted); }

/* Insight items */
.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-left: 3px solid var(--border-strong); border-radius: var(--radius);
}
.insight--high { border-left-color: var(--load-red); }
.insight--medium { border-left-color: var(--load-amber); }
.insight--low { border-left-color: var(--load-green); }
.insight--ok { border-left-color: var(--load-green); }
.insight-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: currentColor; }
.insight--high .insight-dot { color: var(--load-red); }
.insight--medium .insight-dot { color: var(--load-amber); }
.insight--low .insight-dot { color: var(--load-green); }
.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; }

/* ── Toast (pathfinder-style, distinct from template .toast) ── */
.toast-notification {
  position: fixed; bottom: var(--space-6); left: 50%; transform: translate(-50%, 8px);
  z-index: var(--z-toast); max-width: min(420px, calc(100vw - var(--space-8)));
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--surface-toast); color: var(--text-primary);
  border: 1px solid var(--border); box-shadow: var(--shadow-card);
  font-size: var(--text-sm); opacity: 0; transition: opacity .2s, transform .2s;
}
.toast-notification.visible { opacity: 1; transform: translate(-50%, 0); }
.toast-error { border-color: var(--load-red); }
.toast-error::before { content: '⚠ '; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 820px) {
  .workspace { grid-template-columns: 1fr; }
  .roster { border-right: none; border-bottom: 1px solid var(--border-subtle); max-height: 40vh; }
  .board { grid-template-columns: repeat(5, minmax(140px, 1fr)); }
  .strip-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chip-pip, .bottle--over .bottle-glass, .badge-pulse { animation: none !important; }
  .block.drop-target { transform: none; }
  .seat--land { animation: none; }
  .drag-ghost { transform: none; }
}
