/*
 * ByteSize SimLab — Editorial Redesign (Phase 17)
 *
 * Loaded after main.css. Applies the "Just in Time L&D" editorial design
 * system to every view: facilitator and participant, mobile and desktop.
 *
 * Brand placeholder slots in base.html are preserved verbatim:
 *   1. .header-logo         → Company Logo (admin / Brand Settings)
 *   2. .header-banner-img   → Simulation Banner Image (admin / Templates / General)
 *   3. .header-client-logo  → Client Logo (admin / Templates / Branding Override)
 */

/* =====================================================================
 * 1. Design tokens
 * =================================================================== */
:root {
  /* Typography — editorial pairing */
  --font-display: 'Fraunces', 'New Spirit', 'Tiempos', ui-serif, Georgia, serif;
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace;

  /* Ink palette */
  --ink-1: #14151A;
  --ink-2: #3A3D47;
  --ink-3: #767A85;
  --ink-4: #B4B7BF;

  /* Paper canvas — warm off-white */
  --paper:   #FBFAF6;
  --paper-2: #F4F2EC;
  --line:        #E8E5DD;
  --line-strong: #D4D0C4;

  /* Accent — indigo-ink */
  --accent:      #3730A3;
  --accent-ink:  #1E1B6B;
  --accent-soft: #EEF0FF;

  /* Semantic — muted, editorial */
  --success-2:      #0F766E;
  --success-soft-2: #E6F4F1;
  --warning-2:      #B45309;
  --warning-soft-2: #FDF3E5;
  --danger-2:       #9F1239;
  --danger-soft-2:  #FDECEF;

  /* Team accent palette */
  --team-a: #C2410C;
  --team-b: #0F766E;
  --team-c: #6D28D9;
  --team-d: #B45309;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  /* Shadows */
  --shadow-1: 0 1px 2px rgba(20,21,26,0.04), 0 1px 1px rgba(20,21,26,0.03);
  --shadow-2: 0 4px 16px rgba(20,21,26,0.06), 0 1px 2px rgba(20,21,26,0.04);
  --shadow-3: 0 24px 48px -12px rgba(20,21,26,0.12), 0 2px 4px rgba(20,21,26,0.04);

  /* Motion (--motion scalar; reduced-motion users get effectively zero)
     Default 1.5× — the redesign's "lush" tweak that emphasises spring
     and dwell on transitions. Reduced-motion users still get ~0. */
  --motion: 1.5;
  --dur-fast: calc(180ms * var(--motion));
  --dur-med:  calc(320ms * var(--motion));
  --dur-slow: calc(560ms * var(--motion));
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root { --motion: 0.0001; }
}

/* =====================================================================
 * 2. Remap legacy main.css tokens onto the editorial palette
 *    so every existing class (.btn--primary, .card, .badge, etc.)
 *    inherits the new look without touching templates.
 * =================================================================== */
:root {
  --bg:           var(--paper);
  --surface:      #FFFFFF;
  --text:         var(--ink-1);
  --text-muted:   var(--ink-3);
  --primary:      var(--accent);
  --primary-hover: var(--accent-ink);
  --primary-light: var(--accent-soft);
  --border:       var(--line);
  --radius:       var(--radius-md);
  --shadow:       var(--shadow-1);
  --shadow-lg:    var(--shadow-2);
  --font:         var(--font-sans);
}

/* =====================================================================
 * 3. Base typography — editorial display + neutral body
 * =================================================================== */
body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink-1);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--ink-1);
  font-variation-settings: "SOFT" 50, "WONK" 0;
  text-wrap: balance;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem;  }
@media (min-width: 640px) {
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.55rem; }
}

p { text-wrap: pretty; line-height: 1.55; }

.subtitle { color: var(--ink-3); font-size: 0.9rem; font-family: var(--font-sans); }

/* Editorial display utility — opt-in, italic accent */
.editorial-display em,
.display em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

/* Uppercase eyebrow / meta label */
.meta-uppercase {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
  font-family: var(--font-sans);
}

/* =====================================================================
 * 4. Header (preserves the three brand placeholders)
 * =================================================================== */
.app-header {
  background: rgba(251, 250, 246, 0.92);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  min-height: 64px;
}

.header-brand-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--ink-1);
  letter-spacing: -0.015em;
}

.header-nav-link {
  color: var(--ink-3);
  font-weight: 500;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.header-nav-link:hover { background: var(--paper-2); color: var(--ink-1); }

.header-user-name { color: var(--ink-2); }
.header-logout    { color: var(--ink-3); }

.header-avatar,
.header-avatar--initials {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #fff;
  font-weight: 600; font-size: 0.85rem;
}

/* Brand placeholder slot 1 — Company Logo */
.header-logo {
  max-height: 44px;
  width: auto;
  border-radius: 4px;
}

/* Brand placeholder slot 2 — Simulation Banner Image */
.header-banner-img {
  max-height: 48px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

/* Brand placeholder slot 3 — Client Logo (Branding Override) */
.header-client-logo {
  max-height: 44px;
  width: auto;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .header-logo,
  .header-client-logo { max-height: 36px; }
  .header-banner-img  { max-height: 32px; }
}

/* =====================================================================
 * 5. Footer
 * =================================================================== */
.app-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-3);
  font-size: 0.8rem;
}
.powered-by { color: var(--ink-4); font-family: var(--font-mono); font-size: 0.7rem; }

/* =====================================================================
 * 6. Buttons — pill, ink-primary
 * =================================================================== */
.btn {
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 500;
  min-height: 48px;
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--ink-1); color: var(--paper); }
.btn--primary:hover { background: var(--accent-ink); }

.btn--accent  { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-ink); }

.btn--success { background: var(--success-2); color: #fff; }
.btn--warning { background: var(--warning-2); color: #fff; }
.btn--danger  { background: var(--danger-2);  color: #fff; }

.btn--outline,
.btn--secondary {
  background: transparent;
  color: var(--ink-1);
  border: 1px solid var(--line-strong);
}
.btn--outline:hover,
.btn--secondary:hover { background: var(--paper-2); }

.btn--sm { min-height: 36px; padding: 0.4rem 0.9rem; font-size: 0.82rem; }

/* =====================================================================
 * 7. Cards
 * =================================================================== */
.card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 1.5rem;
}
@media (min-width: 640px) {
  .card { padding: 1.75rem; }
}

/* =====================================================================
 * 8. Forms
 * =================================================================== */
.form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: #FFFFFF;
  color: var(--ink-1);
  font-family: var(--font-sans);
  transition: border-color var(--dur-fast) ease;
}
.form-input:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Hairline editorial field (opt-in via .field) */
.field {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--line-strong);
  padding: 12px 0;
  font-family: var(--font-sans);
  font-size: 1.25rem;
  color: var(--ink-1);
  border-radius: 0;
  transition: border-color var(--dur-fast) ease;
}
.field:focus { outline: none; border-color: var(--accent); box-shadow: none; }
.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 6px;
  font-family: var(--font-sans);
}

/* =====================================================================
 * 9. Badges (re-skinned, keeps existing class names)
 * =================================================================== */
.badge {
  font-family: var(--font-sans);
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-weight: 600;
  font-size: 0.7rem;
}

/* =====================================================================
 * 10. Session code — editorial mono
 * =================================================================== */
.session-code {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
}

/* =====================================================================
 * 11. Sortable list — editorial card treatment
 *     (existing templates use .sortable-item / .sortable-list)
 * =================================================================== */
.sortable-item {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  transition: transform var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease;
}
.sortable-item:hover { border-color: var(--line-strong); }
.sortable-item.sortable-chosen {
  border-color: var(--accent);
  box-shadow: var(--shadow-2);
}
.sortable-ghost { opacity: 0.3; background: var(--accent-soft); }
/* SortableJS adds sortable-fallback to the cloned ghost element in forceFallback
   mode. Suppress any CSS transition on the ghost so it snaps to the pointer/finger
   position on every move event instead of animating between positions. */
.sortable-fallback { transition: none !important; }

.rank-badge {
  background: var(--ink-1);
  color: var(--paper);
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.drag-handle span { background: var(--ink-4); }

.sortable-title {
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--ink-1);
}

/* =====================================================================
 * 12. Editorial components introduced by the redesign
 *     (opt-in via class — templates can adopt incrementally)
 * =================================================================== */

/* 12.1 Stage progress ribbon (participant) */
.p-progress {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.p-progress__item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-4); font-weight: 600;
}
.p-progress__bar {
  width: 100%; height: 3px; border-radius: 999px;
  background: var(--line);
  transition: background var(--dur-med) ease;
}
.p-progress__item.done .p-progress__bar   { background: var(--success-2); }
.p-progress__item.done                    { color: var(--success-2); }
.p-progress__item.active .p-progress__bar { background: var(--accent); }
.p-progress__item.active                  { color: var(--accent); }

/* 12.2 Rank chip grid (replaces tiny up/down arrows on touch) */
.rank-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media (min-width: 768px) {
  .rank-grid { grid-template-columns: repeat(10, 1fr); }
}
.rank-chip {
  aspect-ratio: 1;
  border: 1.5px solid var(--line-strong);
  background: #FFFFFF;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-1);
  transition: transform var(--dur-fast) var(--ease-spring),
              background var(--dur-fast) ease,
              border-color var(--dur-fast) ease,
              color var(--dur-fast) ease;
}
.rank-chip:hover { border-color: var(--accent); }
.rank-chip:active { transform: scale(0.92); }
.rank-chip.taken {
  color: var(--ink-4);
  background: var(--paper-2);
  cursor: default;
}
.rank-chip.mine,
.rank-chip.is-active {
  background: var(--ink-1);
  color: var(--paper);
  border-color: var(--ink-1);
}

/* 12.3 Confidence row (L / M / H) */
.conf-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.conf-btn {
  min-height: 56px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line-strong);
  background: #FFFFFF;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  cursor: pointer;
  color: var(--ink-1);
  transition: transform var(--dur-fast) var(--ease-spring),
              background var(--dur-fast) ease,
              border-color var(--dur-fast) ease;
}
.conf-btn:active { transform: scale(0.96); }
.conf-btn__letter { font-size: 1.1rem; font-family: var(--font-mono); }
.conf-btn__label  { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.conf-btn.active-L { background: var(--danger-soft-2);  border-color: var(--danger-2);  color: var(--danger-2); }
.conf-btn.active-L .conf-btn__label { color: var(--danger-2); }
.conf-btn.active-M { background: var(--warning-soft-2); border-color: var(--warning-2); color: var(--warning-2); }
.conf-btn.active-M .conf-btn__label { color: var(--warning-2); }
.conf-btn.active-H { background: var(--success-soft-2); border-color: var(--success-2); color: var(--success-2); }
.conf-btn.active-H .conf-btn__label { color: var(--success-2); }

/* 12.4 Facilitator projector — big-screen legibility */
.f-proj {
  display: flex; flex-direction: column;
  padding: 2rem clamp(1rem, 4vw, 3.5rem);
  gap: 2rem;
  color: var(--ink-1);
}
.f-proj__eyebrow {
  font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-3);
}
.f-proj__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.025em;
  margin-top: 6px;
}
.f-proj__code {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
}

.f-proj__timer-label {
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
}
.f-proj__timer-big {
  font-family: var(--font-mono);
  font-size: clamp(4rem, 12vw, 10rem);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-1);
  transition: color var(--dur-med) ease;
}
.f-proj__timer-big.warn { color: var(--warning-2); }
.f-proj__timer-big.crit { color: var(--danger-2);  animation: ds-pulse calc(900ms * var(--motion)) infinite; }

/* 12.5 Team card on facilitator dashboard */
.f-team-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-1);
}
.f-team-card__dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent);
}
.f-team-card__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  flex: 1;
}
.f-team-card__ratio {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}

/* =====================================================================
 * 13. Animations (used by waiting / breathing / pulses)
 * =================================================================== */
@keyframes ds-pulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  50%      { transform: scale(1.06); opacity: 0.85; }
}
@keyframes ds-breathe {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.3); }
}
@keyframes ds-pop-in {
  0%   { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes ds-spin { to { transform: rotate(360deg); } }

.ds-breathe-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: ds-breathe calc(1600ms * var(--motion)) ease-in-out infinite;
}
.ds-spin-ring {
  width: 96px; height: 96px; border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  animation: ds-spin calc(1800ms * var(--motion)) linear infinite;
}

/* =====================================================================
 * 14. Re-skin connection / sync banners injected by base.html JS
 * =================================================================== */
#conn-banner {
  font-family: var(--font-sans) !important;
  border-radius: 999px !important;
  font-weight: 600 !important;
}

/* =====================================================================
 * 15. Help / mode panels — softer borders + paper background
 * =================================================================== */
.help-trigger {
  border-color: var(--accent);
  color: var(--accent);
  background: #FFFFFF;
  font-family: var(--font-sans);
  border-radius: 999px;
}
.help-trigger:hover { background: var(--accent-soft); }

/* =====================================================================
 * 16. Materials bar — bottom pill row
 * =================================================================== */
.materials-bar {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
}
.material-link {
  font-family: var(--font-sans);
  border-radius: 999px;
  border: 1px solid transparent;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.material-link:hover { border-color: var(--accent); background: #FFFFFF; }

/* =====================================================================
 * 17. Ordering surfaces — individual_ordering.html / team_ordering.html
 *     Re-skins the existing classes used by both templates so the
 *     editorial palette + typography + motion apply uniformly to
 *     mobile and desktop, facilitator and participant.
 *     No template/JS edits required.
 * =================================================================== */

/* 17.1 Timer ribbon */
.timer-bar {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-2);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-1);
}
.timer-bar .timer-value,
.timer-bar [data-timer-value],
.timer-bar .time-remaining {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--ink-1);
}
.timer-bar.warning,
.timer-bar.is-warning   { background: var(--warning-soft-2); border-color: var(--warning-2); color: var(--warning-2); }
.timer-bar.warning  .timer-value,
.timer-bar.is-warning  .timer-value { color: var(--warning-2); }
.timer-bar.critical,
.timer-bar.is-critical  { background: var(--danger-soft-2);  border-color: var(--danger-2);  color: var(--danger-2); }
.timer-bar.critical .timer-value,
.timer-bar.is-critical .timer-value { color: var(--danger-2);  animation: ds-pulse calc(900ms * var(--motion)) infinite; }

/* 17.2 Sync status / "last updated by …" line */
#sync-status,
.sync-status {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
#sync-status strong,
.sync-status strong { color: var(--ink-1); font-weight: 600; }

/* 17.3 Move buttons (up/down on mobile column) */
.move-btn {
  background: #FFFFFF;
  border: 1.5px solid var(--line-strong);
  color: var(--ink-1);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  transition: transform var(--dur-fast) var(--ease-spring),
              border-color var(--dur-fast) ease,
              background var(--dur-fast) ease;
}
.move-btn:hover:not(:disabled)  { border-color: var(--accent); color: var(--accent); }
.move-btn:active:not(:disabled) { transform: scale(0.94); background: var(--accent-soft); }
.move-btn:disabled              { opacity: 0.3; cursor: not-allowed; }

/* 17.4 Drag handle dots */
.drag-handle { color: var(--ink-4); }
.drag-handle:hover { color: var(--ink-2); }

/* 17.5 Confidence buttons inside the sortable row
        (existing markup uses .confidence-btn with .active-low/medium/high) */
.confidence-zone,
.confidence-row {
  background: transparent;
}
.confidence-btn {
  background: #FFFFFF;
  border: 1.5px solid var(--line-strong);
  color: var(--ink-2);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform var(--dur-fast) var(--ease-spring),
              background var(--dur-fast) ease,
              border-color var(--dur-fast) ease,
              color var(--dur-fast) ease;
}
.confidence-btn:hover  { border-color: var(--ink-3); color: var(--ink-1); }
.confidence-btn:active { transform: scale(0.94); }

.confidence-btn.active-low,
.confidence-btn.is-active-low {
  background: var(--danger-soft-2);
  border-color: var(--danger-2);
  color: var(--danger-2);
}
.confidence-btn.active-medium,
.confidence-btn.is-active-medium {
  background: var(--warning-soft-2);
  border-color: var(--warning-2);
  color: var(--warning-2);
}
.confidence-btn.active-high,
.confidence-btn.is-active-high {
  background: var(--success-soft-2);
  border-color: var(--success-2);
  color: var(--success-2);
}

/* 17.6 Workspace section (Complex mode container) */
.workspace-section {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.workspace-section + .workspace-section { margin-top: 1rem; }
.workspace-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  border-top-left-radius:  var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}
.workspace-section__header > div { min-width: 0; flex: 1; }
.workspace-section__title {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink-1);
}
.workspace-section__subtitle,
.workspace-section__hint {
  font-family: var(--font-sans);
  overflow-wrap: anywhere;
  color: var(--ink-3);
  font-size: 0.85rem;
}

/* 17.7 Workspace pills (the "X / Y items" / "Drag here" affordances) */
.workspace-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.7rem;
}

/* 17.8 Tray (included / not-needed columns in Complex mode) */
.workspace-tray {
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.workspace-tray.is-drop-target,
.workspace-tray.sortable-drag-over,
.workspace-tray.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.workspace-tray__title,
.tray-title {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

.tray-list { gap: 0.5rem; }
.tray-item {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  color: var(--ink-1);
  font-family: var(--font-sans);
  transition: transform var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease;
}
.tray-item:hover           { border-color: var(--line-strong); }
.tray-item.sortable-chosen { border-color: var(--accent); box-shadow: var(--shadow-2); }

.tray-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  background: var(--paper-2);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
}

/* 17.9 Decision items (Complex-mode prompts) */
.decision-state {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.decision-action {
  background: #FFFFFF;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-spring);
}
.decision-action:hover  { background: var(--accent-soft); }
.decision-action:active { transform: scale(0.96); }
.decision-action.is-confirmed,
.decision-action.confirmed {
  background: var(--accent);
  color: #FFFFFF;
}
.decision-summary {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-2);
  font-family: var(--font-sans);
}
.decision-hint {
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-style: italic;
}

/* 17.10 Complex-mode progress strip */
.complex-progress {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  color: var(--ink-2);
}
.complex-progress__list { gap: 0.4rem; }
.complex-progress__item {
  font-size: 0.78rem;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.complex-progress__item.is-done,
.complex-progress__item.done    { color: var(--success-2); font-weight: 600; }
.complex-progress__item.is-active,
.complex-progress__item.active  { color: var(--accent);   font-weight: 600; }

/* 17.11 Help trigger — "noted" state */
.help-trigger.help-trigger--noted,
.help-trigger.is-noted {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* 17.12 Blocked sortable item (Complex mode: cannot be ranked yet) */
.sortable-item--blocked {
  background: var(--paper-2);
  border-style: dashed;
  border-color: var(--line-strong);
  opacity: 0.78;
}
.sortable-item--blocked .sortable-title { color: var(--ink-3); }

/* 17.13 Pending rank badge */
.rank-badge--pending,
.rank-badge.pending {
  background: var(--paper-2);
  color: var(--ink-3);
  border: 1.5px dashed var(--line-strong);
}

/* 17.14 Observer controls (team_ordering only) */
.observer-controls {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-2);
  font-family: var(--font-sans);
}
.observer-controls .btn { min-height: 36px; padding: 0.4rem 0.9rem; }

/* 17.15 Team badge in team_ordering header */
.badge--team {
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
}

/* =====================================================================
 * 18. Facilitator dashboard — facilitator_dashboard.html
 *     CSS-only re-skin. All forms, JS, auto-refresh, fullscreen handler,
 *     and table structure remain untouched.
 * =================================================================== */

/* 18.1 Dashboard header — eyebrow + title pairing */
body.dashboard h1,
.facilitator-dashboard h1,
.dashboard-header h1 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.022em;
  color: var(--ink-1);
}

/* 18.2 Zone headings (Session Flow / Analysis / Management) */
.dashboard .card > h2,
.facilitator-dashboard .card > h2,
.dashboard h2.zone-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.012em;
  color: var(--ink-1);
  padding-bottom: 0.4rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

/* 18.3 Score / submission cards */
.score-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: 1.25rem 1.5rem;
}
.score-card__label,
.score-card .label,
.score-card h3 {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
  margin: 0 0 0.5rem 0;
}
.score-big {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
}
.score-big .score-suffix,
.score-big small {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0;
  margin-left: 0.4rem;
}

/* 18.4 Tables — editorial typography, paper-2 thead, line borders */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #FFFFFF;
  overflow-x: auto;
  box-shadow: var(--shadow-1);
}
.table-wrap table,
.dashboard table,
.facilitator-dashboard table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--ink-1);
}
.table-wrap thead th,
.dashboard table thead th {
  background: var(--paper-2);
  color: var(--ink-3);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table-wrap tbody td,
.dashboard table tbody td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td,
.dashboard table tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover td,
.dashboard table tbody tr:hover td { background: var(--paper); }

/* Numeric / mono cells get tabular figures */
.table-wrap td.num,
.table-wrap td.mono,
.dashboard table td.num,
.dashboard table td.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-1);
}

/* Heartbeat dot inside the status column */
.heartbeat-dot,
.hb-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-4);
  vertical-align: middle;
  margin-right: 6px;
}
.heartbeat-dot.online,
.hb-dot.online { background: var(--success-2); animation: ds-breathe calc(2400ms * var(--motion)) ease-in-out infinite; }
.heartbeat-dot.idle,
.hb-dot.idle   { background: var(--warning-2); }
.heartbeat-dot.offline,
.hb-dot.offline { background: var(--danger-2); }

/* 18.5 Inline forms inside table rows (move_participant / assign_group_input) */
.table-wrap form,
.dashboard table form {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}
.table-wrap form select,
.table-wrap form input,
.dashboard table form select,
.dashboard table form input {
  min-height: 32px;
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
}
.table-wrap form button,
.dashboard table form button {
  min-height: 32px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 999px;
  font-weight: 600;
  font-family: var(--font-sans);
}

/* 18.6 "Needs attention" panel
        (template uses inline border-left:4px solid var(--danger);
         we soften with paper-2 and danger accent) */
.needs-attention,
.alert-attention,
.attention-card,
.dashboard .card[style*="border-left"] {
  background: var(--danger-soft-2) !important;
  border: 1px solid var(--danger-2) !important;
  border-left: 4px solid var(--danger-2) !important;
  border-radius: var(--radius-md) !important;
  color: var(--danger-2);
}
.needs-attention h2,
.needs-attention h3,
.attention-card h2,
.attention-card h3 {
  color: var(--danger-2);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.needs-attention p,
.attention-card p { color: var(--ink-2); }

/* 18.7 Force Advance section — warning surface */
.force-advance,
.force-advance-section {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
}
.force-advance .btn--danger,
.force-advance-section .btn--danger {
  background: var(--danger-2);
  color: #FFFFFF;
}
.force-advance__hint,
.force-advance-section .hint,
.force-advance small {
  color: var(--ink-3);
  font-family: var(--font-sans);
  font-size: 0.8rem;
}

/* 18.8 Rostered banner */
.rostered-banner,
.roster-banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
.rostered-banner strong,
.roster-banner strong { color: var(--accent-ink); font-weight: 600; }

/* 18.9 Per-team card on dashboard (h3 + score + dynamics) */
.team-block,
.team-card,
.dashboard .card.mt-1 > h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink-1);
}
.team-block .team-score,
.team-card .team-score,
.team-score-display {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
}
.team-dynamics,
.team-block .dynamics {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--ink-2);
}

/* 18.10 Toolbar / action button row at top of dashboard */
.dashboard-actions,
.facilitator-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 18.11 Fullscreen mode — let editorial display breathe */
body.is-fullscreen .app-header,
body.is-fullscreen .app-footer,
body.fullscreen   .app-header,
body.fullscreen   .app-footer { display: none; }
body.is-fullscreen .main,
body.fullscreen .main         { padding: 1.5rem clamp(1rem, 4vw, 3rem); }
body.is-fullscreen h1,
body.fullscreen h1            { font-size: clamp(1.8rem, 4vw, 2.8rem); }
body.is-fullscreen .score-big,
body.fullscreen .score-big    { font-size: clamp(3rem, 7vw, 5rem); }
body.is-fullscreen .table-wrap,
body.fullscreen .table-wrap   { font-size: 1rem; }

/* 18.12 Auto-refresh "live" indicator (if rendered) */
.live-dot,
.refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.live-dot::before,
.refresh-indicator::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success-2);
  animation: ds-breathe calc(2200ms * var(--motion)) ease-in-out infinite;
}

/* =====================================================================
 * 19. Phase 17b — Redesign mechanics
 *     Implements the redesign/index.html prototype's screen patterns:
 *     editorial Join, Lobby, Done; tap-to-open item drawer that replaces
 *     drag with a rank-chip picker; per-item teammate avatar dots on the
 *     team alignment screen; facilitator projector overlay; and the
 *     debrief blur-then-reveal hero.
 *
 *     All classes here are additive — existing markup keeps working;
 *     templates opt in by adding the redesign markup alongside.
 * =================================================================== */

/* 19.1 Participant top bar (avatar + name + team + timer chip) */
.p-topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.p-topbar__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 0.8rem;
  background: var(--accent);
  flex-shrink: 0;
}
.p-topbar__name { font-weight: 600; font-size: 0.875rem; color: var(--ink-1); }
.p-topbar__team {
  font-size: 0.68rem; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
}
.p-topbar__spacer { flex: 1; }
.p-topbar__timer {
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600;
  color: var(--ink-1);
  padding: 4px 10px; border-radius: 999px;
  background: var(--paper-2);
  font-variant-numeric: tabular-nums;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.p-topbar__timer.warn { background: var(--warning-soft-2); color: var(--warning-2); }
.p-topbar__timer.crit {
  background: var(--danger-soft-2); color: var(--danger-2);
  animation: ds-pulse calc(900ms * var(--motion)) ease-in-out infinite;
}

/* 19.2 Join screen (editorial hero + spiral) */
.p-join {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center;
  padding: 32px 28px 40px;
  gap: 28px;
  position: relative;
  overflow: hidden;
  min-height: 70vh;
}
.p-join__eyebrow {
  color: var(--ink-3); font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600;
}
.p-join__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 2.6rem);
  font-weight: 400; line-height: 1.05; letter-spacing: -0.03em;
  color: var(--ink-1);
  text-wrap: balance;
}
.p-join__title em { font-style: italic; color: var(--accent); font-weight: 400; }
.p-join__form {
  display: flex; flex-direction: column;
  gap: 24px;
  position: relative;
  z-index: 1;
}
.p-join__error {
  background: var(--danger-soft-2);
  border: 1px solid var(--danger-2);
  color: var(--danger-2);
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  font-family: var(--font-sans);
}
.p-join__spiral {
  position: absolute; bottom: -40px; right: -60px;
  width: 260px; opacity: 0.10; pointer-events: none;
  animation: ds-drift calc(22s * var(--motion)) ease-in-out infinite;
  z-index: 0;
}
@keyframes ds-drift {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50%      { transform: rotate(8deg) translateY(-12px); }
}

/* Pill submit button used inside .p-join, .p-lobby, .p-drawer */
.btn--full { width: 100%; justify-content: center; }
.btn--ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.btn--ghost:hover { background: var(--paper-2); }

/* 19.3 Lobby (team card + avatars + breathing dot) */
.p-lobby {
  flex: 1; display: flex; flex-direction: column;
  padding: 28px 24px;
  gap: 20px;
}
.p-lobby__hi {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 6vw, 2.25rem);
  font-weight: 400; letter-spacing: -0.03em; line-height: 1.05;
  color: var(--ink-1);
  text-wrap: balance;
}
.p-lobby__hi em { font-style: italic; color: var(--accent); }
.p-lobby__team-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-1);
}
.p-lobby__team-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-3); margin-bottom: 8px;
}
.p-lobby__team-name {
  font-family: var(--font-display);
  font-size: 1.5rem; font-weight: 500; letter-spacing: -0.02em;
  color: var(--ink-1);
  margin-bottom: 14px;
}
.p-lobby__avatars { display: flex; flex-wrap: wrap; gap: 6px; }
.p-lobby__member-list { display: flex; flex-direction: column; gap: 8px; }
.p-lobby__member {
  display: flex; align-items: center; gap: 10px;
  animation: ds-pop-in calc(300ms * var(--motion)) var(--ease-spring) both;
}
.p-lobby__member-name { font-size: 0.9rem; color: var(--ink-1); }
.p-lobby__avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
  background: var(--accent);
  animation: ds-pop-in calc(400ms * var(--motion)) var(--ease-spring) both;
}
.p-lobby__avatar--me { box-shadow: 0 0 0 2px var(--ink-1); }
.p-lobby__waiting {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-3); font-size: 0.85rem;
  padding: 14px 16px;
  background: var(--paper-2);
  border-radius: var(--radius-md);
}
.p-lobby__dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: ds-breathe calc(1600ms * var(--motion)) ease-in-out infinite;
}

/* Self-select team option card */
.p-lobby__select-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.p-lobby__select-card:hover { border-color: var(--accent); box-shadow: var(--shadow-1); }
.p-lobby__select-name { font-weight: 600; color: var(--ink-1); }
.p-lobby__select-meta { font-size: 0.75rem; color: var(--ink-3); margin-top: 2px; }

/* 19.4 Done / waiting screen (post-submit) */
.p-done {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 32px 28px;
  gap: 24px;
  text-align: center;
}
.p-done__tick {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--success-2); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 2rem;
  animation: ds-pop-in calc(500ms * var(--motion)) var(--ease-spring);
}
.p-done__title {
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 500; letter-spacing: -0.02em;
  color: var(--ink-1);
}
.p-done__sub { color: var(--ink-3); font-size: 0.95rem; max-width: 28rem; }
.p-done__waiting-ring {
  width: 96px; height: 96px; border-radius: 50%;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  animation: ds-spin calc(1800ms * var(--motion)) linear infinite;
}
.p-done__meta {
  font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
}

/* 19.5 Queue view — stack of tappable cards (Typeform-style) */
.p-queue { display: flex; flex-direction: column; gap: 14px; }
.p-queue__header { padding: 4px 4px 6px; }
.p-queue__step-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-3);
}
.p-queue__question {
  font-family: var(--font-display);
  font-size: 1.4rem; line-height: 1.2;
  letter-spacing: -0.015em;
  margin-top: 8px; font-weight: 500;
  color: var(--ink-1);
  text-wrap: balance;
}
.p-queue__card-deck { display: flex; flex-direction: column; gap: 10px; }
.p-queue__card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) ease,
              border-color var(--dur-fast) ease;
  min-height: 56px;
}
.p-queue__card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.p-queue__card:active { transform: scale(0.985); }
.p-queue__card.is-ranked { background: var(--paper-2); }
.p-queue__card.is-blocked { border-style: dashed; opacity: 0.78; }
.p-queue__rank {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.875rem;
  background: var(--ink-1); color: var(--paper);
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.p-queue__rank.empty {
  background: transparent; color: var(--ink-4);
  border: 1.5px dashed var(--line-strong);
}
.p-queue__card-title {
  flex: 1; font-size: 0.9rem; line-height: 1.35; font-weight: 500; color: var(--ink-1);
}
.p-queue__card-conf {
  width: 26px; height: 26px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.72rem; font-weight: 700;
  flex-shrink: 0;
}
.p-queue__card-conf.L { background: var(--danger-soft-2);  color: var(--danger-2); }
.p-queue__card-conf.M { background: var(--warning-soft-2); color: var(--warning-2); }
.p-queue__card-conf.H { background: var(--success-soft-2); color: var(--success-2); }
.p-queue__card-conf.empty { border: 1.5px dashed var(--line-strong); color: var(--ink-4); }
.p-queue__card-note {
  width: 18px; height: 18px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 0.65rem; font-weight: 700;
  flex-shrink: 0;
}

/* Submit hero */
.p-submit {
  padding: 16px 4px 4px;
  display: flex; align-items: center; gap: 12px;
}
.p-submit__status {
  font-size: 0.78rem; color: var(--ink-3); flex: 1;
  font-family: var(--font-sans);
}
.p-queue__instruction {
  margin: 0.35rem 0 0;
  max-width: 62ch;
  color: var(--ink-3);
  font-size: 0.92rem;
  line-height: 1.5;
}
.p-queue__card.is-arranged,
.team-item.is-arranged,
.ordering-overview-card.is-arranged {
  /* Fallback for iOS Safari < 16.2 — participant must still see the
     "arranged" ring even when color-mix() is unavailable. */
  border-color: var(--success-2);
  border-color: color-mix(in srgb, var(--success-2) 62%, white);
  box-shadow: 0 0 0 1px var(--success-2), var(--shadow-2);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success-2) 32%, white), var(--shadow-2);
}
.confidence-quick-popover {
  position: fixed;
  z-index: 1200;
  display: flex;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.18);
}
/* `[hidden]` MUST win over the base `display: flex` above. Using `:not([hidden])`
   (the previous pattern) is fragile — any descendant selector or media query
   that re-declares `display:` sinks the cascade. Force `display:none` with
   `!important` instead, matching the rank-picker sheet/backdrop fix. */
.confidence-quick-popover[hidden] {
  display: none !important;
}
.confidence-quick-popover__option {
  min-width: 58px;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-1);
  font-weight: 700;
}
.confidence-quick-popover__option.is-active,
.confidence-quick-popover__option:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 64%, white);
}

.ordering-overview-item {
  list-style: none;
}
.ordering-overview-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 30px;
  gap: 12px;
  align-items: center;
  text-align: left;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) ease, border-color var(--dur-fast) ease;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.ordering-overview-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
}
.ordering-overview-card:active {
  transform: scale(0.985);
}
.ordering-overview-card.is-blocked {
  border-style: dashed;
}
.ordering-overview-item.sortable-chosen .ordering-overview-card,
.ordering-overview-item.is-dragging .ordering-overview-card {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line-strong));
  box-shadow: 0 18px 36px rgba(20, 21, 26, 0.16);
}
.ordering-overview-item.sortable-drag .ordering-overview-card,
.ordering-overview-item.is-dragging .ordering-overview-card {
  transform: rotate(1deg);
}
.ordering-overview-item.sortable-ghost .ordering-overview-card {
  opacity: 0.38;
}
.ordering-overview-card--excluded {
  background: var(--paper-2);
}
.ordering-overview-card__rank {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink-1);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ordering-overview-card__rank.is-empty {
  background: transparent;
  color: var(--ink-4);
  border: 1.5px dashed var(--line-strong);
}
.ordering-overview-card.is-blocked .ordering-overview-card__rank,
.ordering-overview-card--excluded .ordering-overview-card__rank {
  background: transparent;
  color: var(--ink-4);
  border: 1.5px dashed var(--line-strong);
}
.ordering-overview-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.ordering-overview-card__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink-1);
  overflow-wrap: anywhere;
}
.ordering-overview-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.ordering-overview-card__badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ordering-overview-card__badge--warning {
  background: var(--warning-soft-2);
  color: var(--warning-2);
}
.ordering-overview-card__badge--muted {
  background: var(--paper-3);
  color: var(--ink-3);
}
.ordering-overview-card__badge--needs-rank {
  background: color-mix(in srgb, var(--paper-2) 70%, white);
  color: var(--ink-3);
  border: 1px dashed var(--line-strong);
}
.ordering-overview-card__status {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--line-strong);
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-weight: 700;
}
.ordering-overview-card__status.is-low {
  border-style: solid;
  border-color: var(--danger-2);
  background: var(--danger-soft-2);
  color: var(--danger-2);
}
.ordering-overview-card__status.is-medium {
  border-style: solid;
  border-color: var(--warning-2);
  background: var(--warning-soft-2);
  color: var(--warning-2);
}
.ordering-overview-card__status.is-high {
  border-style: solid;
  border-color: var(--success-2);
  background: var(--success-soft-2);
  color: var(--success-2);
}
.ordering-overview-card__status[data-role="confidence-quick-trigger"] {
  cursor: pointer;
}
.ordering-overview-card__avatars {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.ordering-overview-card__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  border: 2px solid #fff;
}
.ordering-overview-card__avatar.is-me {
  box-shadow: 0 0 0 2px var(--ink-1);
}
.ordering-overview-card__avatar.is-match {
  background: var(--success-2);
}
@media (max-width: 640px) {
  .ordering-overview-card {
    grid-template-columns: 34px minmax(0, 1fr) 28px;
    padding: 12px 14px;
  }
  .ordering-overview-card__title {
    font-size: 0.96rem;
  }
}

/* 19.55 Activity cards — shared participant/team ordering shell */
.activity-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.activity-card-list--participant,
.activity-card-list--team,
.activity-card-list--sortable {
  padding: 0;
  margin: 0;
}
.activity-card-shell {
  list-style: none;
}
.activity-card {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 58px;
  align-items: stretch;
  gap: 0;
  min-height: 132px;
  width: 100%;
  /* Fallbacks for iOS Safari < 16.2 which lacks color-mix(). Without the
     plain-color declarations the border/background resolve to `unset` and
     the card paints as a flat white rectangle with no frame. */
  border: 1px solid var(--line);
  border: 1px solid color-mix(in srgb, var(--line-strong) 72%, white);
  border-radius: 22px;
  background: #ffffff;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 18%, white) 0%, #ffffff 100%);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  transition:
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}
.activity-card:hover {
  border-color: var(--line-strong);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line-strong));
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.12);
}
.activity-card--readonly:hover {
  border-color: var(--line);
  border-color: color-mix(in srgb, var(--line-strong) 72%, white);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}
.activity-card--blocked {
  background: var(--warning-soft-2);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--warning-soft-2) 28%, white) 0%, #ffffff 100%);
  border-style: dashed;
}
.activity-card__drag-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 8px;
  border-right: 1px solid var(--line);
  border-right: 1px solid color-mix(in srgb, var(--line-strong) 50%, white);
  background: var(--paper-2);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper-2) 88%, white) 0%, color-mix(in srgb, var(--accent-soft) 38%, white) 100%);
  cursor: grab;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.activity-card__drag-zone--disabled {
  cursor: default;
  opacity: 0.74;
}
.activity-card__drag-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-3);
}
.activity-card__drag-handle {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
}
.activity-card__drag-handle span {
  display: block;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-ink) 42%, white);
}
.activity-card__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  padding: 16px 18px;
}
.activity-card__topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.activity-card__topbar-spacer {
  flex: 1;
  min-width: 0;
}
.activity-card__rank {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.activity-card__title-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.activity-card__title {
  margin: 0;
  min-width: 0;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 500;
  color: var(--ink-1);
  overflow-wrap: anywhere;
}
.activity-card__info {
  min-height: 34px;
  max-width: 100%;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in srgb, var(--accent) 72%, white);
  background: #fff;
  color: var(--accent);
  font-size: 0.74rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.activity-card__footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.activity-card__note-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.activity-card__note-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 78%, white);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.activity-card__confidence-row {
  display: flex;
  justify-content: center;
}
.activity-card__confidence-row .confidence-row {
  justify-content: center;
  width: min(100%, 280px);
}
.activity-card__move-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 12px;
  /* Fallback first for iOS Safari < 16.2 lacking color-mix(). */
  border-left: 1px solid var(--line);
  border-left: 1px solid color-mix(in srgb, var(--line-strong) 50%, white);
  background: var(--paper-2);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--paper-2) 92%, white) 0%, #ffffff 100%);
}
.activity-card__move-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.activity-card__move-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border-color: color-mix(in srgb, var(--line-strong) 75%, white);
  background: #fff;
  font-size: 0.85rem;
}
.activity-card__move-btn:disabled {
  opacity: 0.42;
}
.activity-card__move-placeholder {
  width: 36px;
  height: 80px;
}
.activity-card__peer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.activity-card__peer-label {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-3);
}
.activity-card__peer-avatars {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}
.activity-card__peer-avatar {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.activity-card__peer-avatar.is-me {
  box-shadow: 0 0 0 2px var(--ink-1);
}
.activity-card__peer-avatar.is-match {
  background: var(--success-2);
}
.workspace-tray__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-width: 18px;
  transition: transform var(--dur-fast) ease;
}
.workspace-tray[open] .workspace-tray__chevron {
  transform: rotate(90deg);
}
.team-ordering-shell {
  display: grid;
  /* Phase 30: reference panel is secondary (~1/3); workspace is primary (~2/3).
     minmax prevents the panel collapsing below 180px on narrow desktops. */
  grid-template-columns: minmax(180px, 240px) minmax(0, 2fr);
  gap: 18px;
  align-items: start;
}
.team-ordering-shell__panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--paper-2) 60%, white);
  padding: 12px;
  opacity: 0.92;
}
.team-ordering-shell__title {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.team-ordering-shell__hint {
  margin: 0 0 0.7rem;
  color: var(--ink-4);
  font-size: 0.78rem;
}
.team-snapshot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.team-snapshot-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, white 80%, var(--paper-2));
  padding: 9px 10px;
}
.team-snapshot-card__header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.team-snapshot-card__avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.65rem;
  flex-shrink: 0;
}
.team-snapshot-card__name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-2);
}
.team-snapshot-card__items {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.team-snapshot-card__item {
  color: var(--ink-3);
  font-size: 0.78rem;
  line-height: 1.3;
}
.team-snapshot-card__item.is-excluded {
  color: var(--ink-4);
  text-decoration: line-through;
}
.team-snapshot-card__empty {
  margin: 0;
  color: var(--ink-4);
  font-size: 0.78rem;
}
.activity-modal__exclude-action {
  border-color: color-mix(in srgb, var(--danger-2) 48%, white);
  background: color-mix(in srgb, var(--danger-soft-2) 72%, white);
  color: var(--danger-2);
}
.activity-modal__restore-action {
  border-color: color-mix(in srgb, var(--success-2) 38%, white);
  color: var(--success-2);
}
.activity-card-list .decision-state {
  margin-top: 0;
}
.activity-card-list .decision-summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 86%, white);
}
.activity-card-list .decision-action {
  min-height: 34px;
}
.activity-card-list .confidence-row {
  gap: 8px;
}
.activity-card-list .confidence-btn {
  min-width: 42px;
  min-height: 42px;
}
.activity-card-list .sortable-title {
  margin: 0;
}
.activity-card-shell.sortable-chosen .activity-card,
.activity-card-shell.sortable-drag .activity-card {
  border-color: var(--accent);
  box-shadow: 0 26px 48px rgba(37, 99, 235, 0.18);
}
@media (min-width: 900px) {
  .activity-card {
    grid-template-columns: 74px minmax(0, 1fr) 64px;
    min-height: 144px;
  }
  .activity-card__content {
    padding: 18px 22px;
  }
  .activity-card__move-btn {
    width: 40px;
    height: 40px;
  }
}
@media (max-width: 900px) {
  .team-ordering-shell {
    grid-template-columns: 1fr;
  }
  .team-ordering-shell__snapshots {
    order: 2;
  }
  .team-ordering-shell__workspace {
    order: 1;
  }
}
@media (max-width: 760px) {
  .activity-card {
    grid-template-columns: 58px minmax(0, 1fr) 52px;
    min-height: 122px;
    border-radius: 18px;
  }
  .activity-card__content {
    padding: 14px 14px 14px 12px;
    gap: 10px;
  }
  .activity-card__info {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.68rem;
  }
  .activity-card__peer-row {
    gap: 8px;
  }
}
@media (max-width: 560px) {
  .activity-card__drag-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    letter-spacing: 0.08em;
  }
  .activity-card__move-zone {
    padding: 12px 8px;
  }
  .activity-card__move-stack {
    gap: 6px;
  }
  .activity-card__move-btn {
    width: 34px;
    height: 34px;
  }
  .activity-card__title {
    font-size: 0.98rem;
  }
  .activity-card__footer {
    gap: 8px;
  }
  .activity-card__confidence-row .confidence-row {
    width: 100%;
  }
}
@media (max-width: 420px) {
  .activity-card {
    grid-template-columns: 52px minmax(0, 1fr) 48px;
  }
  .activity-card__content {
    padding-right: 10px;
  }
  .activity-card__info {
    padding: 0 8px;
    font-size: 0.64rem;
  }
  .activity-card__rank {
    width: 30px;
    height: 30px;
  }
  .activity-card-list .confidence-btn {
    min-width: 38px;
    min-height: 38px;
  }
}

/* 19.6 Drawer — fullscreen focus view for one item */
.p-drawer {
  position: fixed; inset: 0;
  background: var(--paper);
  z-index: 1000;
  display: flex; flex-direction: column;
  animation: ds-drawer-in calc(320ms * var(--motion)) var(--ease-out);
  overflow: hidden;
}
/* `display: flex` above has class-level specificity; a later rule (media query,
   descendant selector, or a design refactor) can override it and leave the
   drawer visible on first paint. Force the hidden state to win. */
.p-drawer[hidden] { display: none !important; }
@keyframes ds-drawer-in {
  0%   { transform: translateY(12px); opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}
.p-drawer__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--paper);
}
.p-drawer__close {
  appearance: none; border: none; background: var(--paper-2);
  width: 40px; height: 40px; border-radius: 50%;
  font-size: 1.1rem; cursor: pointer; color: var(--ink-1);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast) ease;
}
.p-drawer__close:hover { background: var(--line); }
.p-drawer__counter {
  font-family: var(--font-mono); font-size: 0.78rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.p-drawer__body {
  flex: 1;
  padding: 24px 20px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}
.p-drawer__title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 5vw, 1.7rem);
  line-height: 1.2; letter-spacing: -0.02em; font-weight: 500;
  color: var(--ink-1);
  text-wrap: balance;
}
.p-drawer__desc {
  color: var(--ink-3); font-size: 0.9rem; line-height: 1.55;
}
.p-drawer__section-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-3);
  margin-bottom: 10px;
}
.p-drawer__hint {
  font-size: 0.78rem; color: var(--ink-3); margin-top: 6px;
  font-family: var(--font-sans);
}
.p-drawer__foot {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--line);
  display: flex; gap: 10px; flex-shrink: 0;
  background: var(--paper);
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.p-drawer__foot .btn { min-height: 48px; }

.note-field {
  width: 100%; min-height: 88px; resize: vertical;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: inherit; font-size: 0.95rem; color: var(--ink-1);
  background: #FFFFFF;
  transition: border-color var(--dur-fast) ease;
}
.note-field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Drawer-internal decision options (re-uses .activity-modal__option markup) */
.p-drawer .activity-modal__option {
  background: #FFFFFF;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.p-drawer .activity-modal__option--selected {
  border-color: var(--accent); background: var(--accent-soft);
}
.p-drawer .activity-modal__option-title { font-weight: 600; color: var(--ink-1); margin-bottom: 4px; }
.p-drawer .activity-modal__option-summary { color: var(--ink-3); font-size: 0.85rem; line-height: 1.45; }

/* 19.7 Team alignment row — title + per-teammate avatar dots showing their rank */
.team-item {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  position: relative;
  transition: border-color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
  cursor: pointer;
  width: 100%; text-align: left;
  font: inherit; color: inherit;
}
.team-item:hover { border-color: var(--line-strong); }
.team-item:active { transform: scale(0.99); }
.team-item.is-disabled { cursor: default; }
.team-item.is-disabled:active { transform: none; }
.team-item__rank {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink-1); color: var(--paper);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 600; flex-shrink: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.team-item__rank.is-pending {
  background: transparent; color: var(--ink-4);
  border: 1.5px dashed var(--line-strong);
}
.team-item__title {
  flex: 1;
  font-size: 0.86rem; line-height: 1.35; font-weight: 500;
  color: var(--ink-1);
}
.team-item__avatars { display: flex; gap: 2px; flex-shrink: 0; }
.team-item__avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.65rem; font-weight: 700;
  background: var(--accent);
  border: 2px solid #FFFFFF;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  position: relative;
}
.team-item__avatar.is-me { box-shadow: 0 0 0 2px var(--ink-1); }
.team-item__avatar.no-rank {
  background: transparent;
  color: var(--ink-4);
  border: 2px dashed var(--line-strong);
}

.team-consensus {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-3);
}
.team-consensus__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success-2);
  animation: ds-breathe calc(1400ms * var(--motion)) infinite;
}

/* 19.8 Facilitator projector overlay (160px timer, stage pips, team rows) */
.f-projector {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--paper);
  display: none;
  flex-direction: column;
  color: var(--ink-1);
  overflow: hidden;
}
.f-projector.is-open { display: flex; }
.f-projector__main {
  flex: 1; display: flex; flex-direction: column;
  padding: clamp(24px, 4vw, 56px);
  gap: clamp(20px, 3vw, 32px);
  overflow: hidden;
}
.f-projector__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px;
}
.f-projector__eyebrow {
  font-size: 0.85rem; letter-spacing: 0.16em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-3);
}
.f-projector__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 500; line-height: 1.02;
  letter-spacing: -0.025em;
  margin-top: 6px;
  color: var(--ink-1);
}
.f-projector__code {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 2vw, 1.25rem);
  letter-spacing: 0.2em; color: var(--accent);
  background: var(--accent-soft);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  align-self: flex-start;
}

.f-projector__stages {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.f-projector__stage {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.95rem; font-weight: 500; color: var(--ink-3);
  padding: 8px 16px; border-radius: 999px;
  background: transparent;
  transition: all var(--dur-med) ease;
}
.f-projector__stage-pip {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--line-strong);
}
.f-projector__stage.done { color: var(--success-2); }
.f-projector__stage.done .f-projector__stage-pip { background: var(--success-2); }
.f-projector__stage.active { background: var(--ink-1); color: var(--paper); }
.f-projector__stage.active .f-projector__stage-pip {
  background: var(--paper);
  animation: ds-breathe calc(1600ms * var(--motion)) infinite;
}

.f-projector__body {
  flex: 1; display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(16px, 3vw, 32px);
  align-items: stretch; min-height: 0;
}
@media (max-width: 900px) {
  .f-projector__body { grid-template-columns: 1fr; }
}
.f-projector__timer-block {
  display: flex; flex-direction: column; justify-content: center; gap: 12px;
}
.f-projector__timer-label {
  font-size: 0.95rem; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-3);
}
.f-projector__timer-big {
  font-family: var(--font-mono);
  font-size: clamp(80px, 14vw, 160px);
  line-height: 0.95; font-weight: 500;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums;
  color: var(--ink-1);
  transition: color var(--dur-med) ease;
}
.f-projector__timer-big.warn { color: var(--warning-2); }
.f-projector__timer-big.crit {
  color: var(--danger-2);
  animation: ds-pulse calc(900ms * var(--motion)) infinite;
}
.f-projector__progress-line {
  display: flex; align-items: center; gap: 14px;
  font-size: 0.9rem; color: var(--ink-3);
}
.f-projector__progress-count {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: var(--ink-1); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.f-projector__progress-bar {
  flex: 1; height: 8px; border-radius: 999px;
  background: var(--line); overflow: hidden;
  max-width: 420px;
}
.f-projector__progress-fill {
  height: 100%; background: var(--success-2);
  border-radius: 999px;
  transition: width var(--dur-slow) var(--ease-out);
}

.f-projector__teams {
  display: flex; flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  min-height: 0;
}
.f-projector__team {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 16%, white) 0%, #ffffff 100%);
  border: 1px solid color-mix(in srgb, var(--line-strong) 72%, white);
  border-radius: 22px;
  padding: 16px 18px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
}
.f-projector__team-dot {
  width: 14px;
  height: 100%;
  min-height: 66px;
  border-radius: 999px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-ink) 100%);
}
.f-projector__team-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}
.f-projector__team-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.f-projector__team-name {
  font-family: var(--font-display);
  font-size: 1.25rem; font-weight: 500; letter-spacing: -0.015em;
  flex: 1; color: var(--ink-1);
  min-width: 0;
}
.f-projector__team-avatars { display: flex; flex-shrink: 0; flex-wrap: wrap; row-gap: 6px; }
.f-projector__team-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.7rem; font-weight: 600;
  background: var(--accent);
  border: 2px solid #FFFFFF;
  margin-left: -6px;
  position: relative;
}
.f-projector__team-avatar:first-child { margin-left: 0; }
.f-projector__team-avatar.waiting { filter: saturate(0.3) brightness(1.1); }
.f-projector__team-avatar.waiting::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid var(--warning-2);
  animation: ds-breathe calc(1400ms * var(--motion)) infinite;
}
.f-projector__team-ratio {
  font-family: var(--font-mono);
  font-size: 1rem; font-weight: 600;
  color: var(--ink-1); min-width: 48px; text-align: right;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-2) 88%, white);
  border: 1px solid color-mix(in srgb, var(--line-strong) 58%, white);
}
@media (max-width: 720px) {
  .f-projector__team {
    grid-template-columns: 16px minmax(0, 1fr);
    padding: 14px 14px;
    gap: 12px;
  }
  .f-projector__team-topline {
    flex-wrap: wrap;
  }
  .f-projector__team-ratio {
    justify-content: flex-start;
  }
}

.f-projector__controls {
  padding: 16px clamp(24px, 4vw, 56px) 20px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.f-projector__controls-spacer { flex: 1; }
.f-projector__btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: #FFFFFF;
  color: var(--ink-1);
  font-size: 0.95rem; font-weight: 500; padding: 12px 20px;
  border-radius: 999px; cursor: pointer; min-height: 46px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.f-projector__btn:hover { background: var(--paper-2); }
.f-projector__btn--primary {
  background: var(--ink-1); color: var(--paper);
  border-color: var(--ink-1);
}
.f-projector__btn--primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }

/* 19.9 Debrief reveal — score blurred until facilitator taps Reveal */
.reveal-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 28px);
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow-2);
}
.reveal-card__head { display: flex; align-items: center; gap: 12px; }
.reveal-card__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); }
.reveal-card__name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  font-weight: 500; letter-spacing: -0.02em;
  color: var(--ink-1);
}
.reveal-card__score {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 500; line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink-1);
  font-variant-numeric: tabular-nums;
  filter: blur(14px);
  transition: filter calc(900ms * var(--motion)) var(--ease-out),
              color calc(600ms * var(--motion)) ease;
}
.reveal-card.is-revealed .reveal-card__score { filter: none; }
.reveal-card__score-placeholder {
  color: var(--line-strong);
  letter-spacing: 0.4em;
}

.reveal-trigger {
  appearance: none; border: none;
  background: var(--ink-1); color: var(--paper);
  font-family: var(--font-sans);
  font-weight: 600; font-size: 0.95rem;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  min-height: 48px;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast) ease;
}
.reveal-trigger:hover:not(:disabled) { background: var(--accent-ink); transform: translateY(-1px); }
.reveal-trigger:active:not(:disabled) { transform: scale(0.97); }
.reveal-trigger:disabled { opacity: 0.45; cursor: not-allowed; }

/* 19.10 Phone-frame max-width on participant screens (gives editorial breathing room on tablet/desktop) */
body.page-participant-live .main {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 80px; /* leave room for the fixed progress ribbon */
}
body.page-participant-live .p-progress {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
}

/* 19.11 Tighten layout when the redesign markup is present */
.page-participant-live .card { padding: 1.25rem; }
@media (min-width: 640px) {
  .page-participant-live .card { padding: 1.5rem; }
}

/* =====================================================================
 * 20. Rank quick picker (Phase 32)
 *     Compact rank selection widget — desktop grid popover / mobile wheel.
 * =================================================================== */

/* Rank badge: clickable on cards */
.p-queue__rank[data-role="rank-quick-trigger"],
.ordering-overview-card__rank[data-role="rank-quick-trigger"] {
  cursor: pointer;
  transition: opacity var(--dur-fast) ease, transform var(--dur-fast) var(--ease-spring);
}
.p-queue__rank[data-role="rank-quick-trigger"]:hover,
.ordering-overview-card__rank[data-role="rank-quick-trigger"]:hover {
  opacity: 0.78;
}
.p-queue__rank[data-role="rank-quick-trigger"]:active,
.ordering-overview-card__rank[data-role="rank-quick-trigger"]:active {
  transform: scale(0.88);
}

/* Phase 28: inner triggers are now real <button> elements (see V8 mobile
   audit — `<span role="button" tabindex="0">` inside a real `<button>` was
   invalid HTML and triggered iOS Safari parser recovery). Reset user-agent
   button chrome so the element keeps the span-shaped appearance it had
   before, across browsers. */
button.p-queue__rank,
button.p-queue__card-conf,
button.ordering-overview-card__status {
  padding: 0;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
button.p-queue__rank,
button.p-queue__card-conf {
  border: 0;
}
/* .ordering-overview-card__status has its own border (dashed base, solid
   variants); keep it, don't zero it out here. */

/* Backdrop (mobile only) */
.rank-quick-picker__backdrop {
  display: none;
}
@media (max-width: 639px) {
  .rank-quick-picker__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 21, 26, 0.42);
    z-index: 1208;
    display: block;
  }
}

/* Desktop: floating grid popover */
.rank-quick-picker__popover {
  position: fixed;
  z-index: 1210;
  background: rgba(255, 255, 255, 0.99);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: 0 18px 40px rgba(20, 21, 26, 0.18), 0 2px 6px rgba(20, 21, 26, 0.06);
  min-width: 188px;
  max-width: 264px;
}
.rank-quick-picker__popover-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 8px;
}
/* Reuse .rank-quick-picker__grid like the drawer rank-grid but compact */
.rank-quick-picker__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.rank-picker-chip {
  aspect-ratio: 1;
  min-width: 34px;
  border: 1.5px solid var(--line-strong);
  background: #FFFFFF;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-1);
  touch-action: manipulation;
  transition: background var(--dur-fast) ease,
              border-color var(--dur-fast) ease,
              color var(--dur-fast) ease,
              transform var(--dur-fast) var(--ease-spring);
}
.rank-picker-chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.rank-picker-chip:active { transform: scale(0.88); }
.rank-picker-chip.is-current {
  background: var(--ink-1);
  border-color: var(--ink-1);
  color: var(--paper);
}

/* Hide desktop popover on mobile; hide sheet on desktop */
@media (max-width: 639px) {
  .rank-quick-picker__popover { display: none !important; }
}
@media (min-width: 640px) {
  .rank-quick-picker__sheet  { display: none !important; }
  .rank-quick-picker__backdrop { display: none !important; }
}

/* Mobile: bottom sheet with wheel */
.rank-quick-picker__sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1210;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-shadow: 0 -8px 32px rgba(20, 21, 26, 0.14);
  padding-bottom: env(safe-area-inset-bottom, 16px);
}
.rank-quick-picker__sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.rank-quick-picker__sheet-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink-1);
  font-family: var(--font-sans);
}
.rank-quick-picker__cancel {
  appearance: none;
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 4px 0;
  touch-action: manipulation;
}
.rank-quick-picker__cancel:active { color: var(--ink-1); }

/* Wheel */
.rank-quick-picker__wheel-wrap {
  position: relative;
  /* Show 7 rows: 3 above + selected + 3 below at 48px each */
  height: 336px;
  overflow: hidden;
  flex-shrink: 0;
}
.rank-quick-picker__wheel {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.rank-quick-picker__wheel::-webkit-scrollbar { display: none; }
.rank-picker-wheel__item {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink-4);
  user-select: none;
  transition: color var(--dur-fast) ease, font-size var(--dur-fast) ease;
}
.rank-picker-wheel__item--pad {
  color: transparent;
  pointer-events: none;
}
.rank-picker-wheel__item.is-selected {
  color: var(--ink-1);
  font-size: 1.85rem;
}
/* Fade masks */
.rank-quick-picker__wheel-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 144px;
  pointer-events: none;
  z-index: 1;
}
.rank-quick-picker__wheel-fade--top {
  top: 0;
  background: linear-gradient(to bottom, var(--surface) 0%, transparent 100%);
}
.rank-quick-picker__wheel-fade--bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--surface) 0%, transparent 100%);
}
/* Center selection indicator */
.rank-quick-picker__wheel-selection {
  position: absolute;
  top: 50%;
  left: 24px;
  right: 24px;
  height: 48px;
  margin-top: -24px;
  border-top: 1.5px solid var(--line-strong);
  border-bottom: 1.5px solid var(--line-strong);
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}
.rank-quick-picker__sheet-footer {
  padding: 10px 16px 4px;
  flex-shrink: 0;
}
.rank-quick-picker__sheet-footer .btn {
  width: 100%;
  min-height: 48px;
}
/* [hidden] must win even when display is set explicitly by rules above.
   Without this, display:flex on the sheet and display:block (mobile media
   query) on the backdrop override [hidden], making the picker always-visible
   on mobile on page load before any JS interaction. */
.rank-quick-picker__sheet[hidden],
.rank-quick-picker__backdrop[hidden] {
  display: none !important;
}
