:root {
  --bg: #0e0f13;
  --surface: #171922;
  --surface-2: #1f222d;
  --border: #2a2e3b;
  --text: #e6e8ee;
  --muted: #9aa1b2;
  --accent: #7c5cff;
  --accent-soft: #2b2154;
  --pick: #2dd4bf;
  --pick-soft: #103730;
  --alt: #f59e0b;
  --alt-soft: #3b2a0e;
  --danger: #ef4444;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.18);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Width of the sticky stage-label column inside each timeline row.
   * The time axis ticks and the now-line bake this offset in via calc()
   * so they line up with the lanes (which start after this column). */
  --stage-col-width: 88px;
  /* Approximate height of the fixed footer, used by every view + the FAB
   * + the loading bar to leave room above. Footer wraps gracefully on
   * very narrow viewports — this reserves enough space for the common
   * single-line layout. */
  --footer-h: 60px;
  --bottom-clearance: calc(var(--footer-h) + var(--safe-bottom));
}

@media (min-width: 700px) {
  :root {
    --stage-col-width: 120px;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

/* spektrum strips data-cloak from the bound root + descendants once
 * bindDOM completes, so this hides the bind-time flash of literal
 * "{{...}}" text. visibility:hidden preserves layout (no shift on
 * reveal). */
[data-cloak] {
  visibility: hidden;
}

h1,
h2,
h3 {
  margin: 0 0 0.4rem 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.15rem;
}

h2 {
  font-size: 1rem;
}

h3 {
  font-size: 0.95rem;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface), var(--bg));
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand .tag {
  color: var(--muted);
  font-size: 0.78rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-actions button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.topbar-live {
  font-weight: 600;
}

.topbar-live::first-letter {
  color: #ef4444;
}

/* ---------- Layout: mobile first (single column) ---------- */

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
  padding-bottom: calc(96px + var(--bottom-clearance));
  max-width: 1400px;
  margin: 0 auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

textarea,
input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  margin-top: 4px;
  resize: vertical;
}

textarea:focus,
input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

label {
  display: block;
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

label small {
  display: block;
  margin-top: 4px;
}

button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.12s ease, transform 0.06s ease;
}

button:hover {
  background: #262a36;
}

button:active {
  transform: translateY(1px);
}

button.primary {
  background: var(--accent);
  border-color: transparent;
  color: white;
  font-weight: 600;
}

button.primary:hover {
  background: #6f4dff;
}

button.primary:disabled {
  background: #4a3f8a;
  cursor: not-allowed;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: dw-spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
  flex: 0 0 auto;
}

@keyframes dw-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation-duration: 2s;
  }
}

/* ---------- Page-wide loading bar (fake progress) ----------
 * Fixed bottom strip, fills 0% → 95% with an ease-out curve so it feels
 * snappy at first then asymptotes — we don't know when the LLM will
 * actually return, so we never claim 100% mid-load. A second animation
 * scrolls the gradient continuously for the "alive, working" feel. */

.loading-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--bottom-clearance);
  height: 3px;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.loading-bar::before {
  content: "";
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(
    90deg,
    var(--accent),
    var(--pick),
    var(--alt),
    var(--danger),
    var(--accent)
  );
  background-size: 200% 100%;
  animation:
    dw-fake-progress 14s cubic-bezier(0.1, 0.6, 0.3, 1) forwards,
    dw-gradient-shimmer 1.4s linear infinite;
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.55),
    0 0 6px rgba(45, 212, 191, 0.3);
}

@keyframes dw-fake-progress {
  0% {
    width: 0%;
  }
  18% {
    width: 36%;
  }
  55% {
    width: 74%;
  }
  100% {
    width: 95%;
  }
}

@keyframes dw-gradient-shimmer {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: -200% 50%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-bar::before {
    animation: dw-fake-progress 14s linear forwards;
  }
}

button.ghost {
  background: transparent;
}

#recommend-btn,
#clear-recs-btn,
.card button.primary,
.card button.ghost {
  width: 100%;
  margin-top: 12px;
}

.status {
  margin: 10px 0 0 0;
  min-height: 1em;
}

.status.error {
  color: var(--danger);
}

.btn-hint {
  margin: 6px 0 0 0;
  font-size: 0.76rem;
  text-align: center;
  letter-spacing: 0.01em;
}

/* ---------- Role template picker ---------- */

.template-picker {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  background-image: linear-gradient(180deg, var(--surface-2), #1a1d28);
}

.template-picker:focus {
  color: var(--text);
}

/* ---------- Filters ---------- */

.filter-grid {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip {
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  user-select: none;
  color: var(--muted);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

/* Theme chips: color dot, and the theme color (not the accent) when active.
 * --theme is set inline per chip. */
.theme-chip {
  gap: 6px;
}

.theme-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--theme);
  flex: none;
}

.theme-chip.active {
  background: color-mix(in srgb, var(--theme) 18%, var(--surface-2));
  border-color: var(--theme);
}

.pitch-toggle {
  font-weight: 600;
}

.pitch-toggle.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--alt);
  color: #fcd58e;
}

/* ---------- Pitch / vendor flag pill ---------- */

.pitch-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: help;
  user-select: none;
}

.pitch-flag--strong {
  background: rgba(245, 158, 11, 0.18);
  color: #fbcb6c;
  border-color: rgba(245, 158, 11, 0.55);
}

.pitch-flag--soft {
  background: rgba(154, 161, 178, 0.14);
  color: #c8cdd9;
  border-color: rgba(154, 161, 178, 0.35);
}

/* ---------- Schedule grid ---------- */

.schedule {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slot {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.slot-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.slot-time {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.slot-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.slot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.session {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.session:hover {
  border-color: #404656;
}

.session.hidden {
  display: none;
}

/* Theme stripe on the left edge. inset box-shadow so it coexists with the
 * pick/alt border colors. */
.session[style*="--theme"] {
  box-shadow: inset 4px 0 0 var(--theme);
  padding-left: 16px;
}

.theme-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--theme, var(--muted));
}

.session.pick {
  border-color: var(--pick);
  background: linear-gradient(180deg, var(--pick-soft), var(--surface-2));
}

.session.alt {
  border-color: var(--alt);
}

.session-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
}

.session-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.session-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.session-tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: rgba(124, 92, 255, 0.12);
  color: #c5b9ff;
  border-radius: 999px;
}

.badge {
  position: absolute;
  top: -8px;
  right: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
}

.badge.pick {
  background: var(--pick);
  color: #032722;
}

.badge.alt {
  background: var(--alt);
  color: #2b1a02;
}

.rationale {
  font-size: 0.85rem;
  background: rgba(45, 212, 191, 0.06);
  border-left: 2px solid var(--pick);
  padding: 6px 8px;
  border-radius: 4px;
  margin-top: 4px;
  color: var(--text);
}

.session.alt .rationale {
  background: rgba(245, 158, 11, 0.06);
  border-left-color: var(--alt);
}

.session-desc {
  font-size: 0.82rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.session.expanded .session-desc {
  -webkit-line-clamp: unset;
  display: block;
}

details summary {
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--muted);
}

details[open] summary {
  margin-bottom: 6px;
}

.overall-advice {
  background: linear-gradient(180deg, #1a1832, var(--surface));
  border-color: #3a2e7a;
}

.overall-advice p {
  margin: 0;
  font-size: 0.9rem;
}

/* ---------- Demo mode pill (top-centre) ---------- */

.demo-pill {
  --y: 0;
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translate(-50%, var(--y));
  z-index: 15;
  background: rgba(245, 158, 11, 0.16);
  color: #fcd58e;
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 0;
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s ease, transform 0.06s ease;
}

.demo-pill:hover {
  background: rgba(245, 158, 11, 0.24);
  --y: -1px;
}

.demo-pill:active {
  --y: 0;
}

.demo-pill-icon {
  font-size: 0.85rem;
}

/* On narrow phones the brand sits next to the pill — give the pill its
 * own space by shifting the brand title slightly smaller. The pill keeps
 * its full label since it's the more action-y element. */
@media (max-width: 480px) {
  .demo-pill-label {
    /* "Demo mode · 14:15" only — drops "fictive time" at < 480px */
  }
}

/* When demo mode is on, the pill takes up ~32px above the topbar's
 * bottom edge. Sticky agenda + live headers need to clear that space
 * so the pill never sits over them on scroll. */
body.demo-on .agenda-header,
body.demo-on .live-header {
  top: calc(56px + 36px);
}

@media (min-width: 700px) {
  body.demo-on .agenda-header,
  body.demo-on .live-header {
    top: calc(64px + 36px);
  }
}

/* Settings modal Demo-toggle row */
.demo-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.demo-toggle-row > div {
  flex: 1 1 auto;
  min-width: 0;
}

.demo-toggle-row > div p {
  margin: 4px 0 0 0;
}

.demo-toggle-row > button {
  flex: 0 0 auto;
  min-width: 70px;
}

.demo-toggle-row > button.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--alt);
  color: #fcd58e;
}

/* Demo explanation modal */
.demo-card {
  border-color: rgba(245, 158, 11, 0.45);
}

.demo-body p {
  margin: 0 0 10px 0;
  line-height: 1.5;
}

.demo-list {
  margin: 4px 0 12px 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
}

/* ---------- Modal (Settings) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  /* mobile: no padding, modal-card fills the overlay */
  padding: 0;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--surface);
  color: var(--text);
  width: 100%;
  display: flex;
  flex-direction: column;
  /* full-screen on mobile */
  border-radius: 0;
  border: none;
  box-shadow: none;
  max-height: 100dvh;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 1;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  font-size: 1.6rem;
  line-height: 1;
  padding: 4px 12px;
  min-height: 40px;
  min-width: 40px;
  border: 1px solid transparent;
}

.modal-close:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  padding-bottom: calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.modal-footer button {
  flex: 1 1 50%;
  margin: 0;
}

@media (min-width: 700px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }

  .modal-card {
    width: min(480px, 100%);
    max-height: min(80vh, 720px);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  }

  .modal-header {
    padding-top: 14px;
  }

  .modal-footer {
    padding-bottom: 12px;
  }

  .modal-footer button {
    flex: 0 0 auto;
    min-width: 110px;
  }

  .modal-footer {
    justify-content: flex-end;
  }
}

/* ---------- Floating action button ---------- */

.fab {
  --fab-y: 0;
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(12px + var(--bottom-clearance));
  z-index: 30;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  box-shadow: 0 12px 30px rgba(124, 92, 255, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  min-height: 48px;
  width: auto;
  max-width: calc(100% - 32px);
  text-align: center;
  transform: translate(-50%, var(--fab-y));
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.12s ease;
}

.fab:hover {
  background: #6f4dff;
  --fab-y: -1px;
}

.fab:active {
  --fab-y: 0;
}


/* ---------- Agenda view ---------- */

.agenda {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px;
  padding-bottom: calc(24px + var(--bottom-clearance));
}

.agenda-header {
  position: sticky;
  top: 56px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.agenda-header .back {
  flex: 0 0 auto;
  padding: 8px 12px;
  min-height: 40px;
}

.agenda-heading {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  flex: 1 1 auto;
  min-width: 0;
}

.agenda-export {
  flex: 0 0 auto;
  padding: 8px 12px;
  min-height: 40px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.print-only {
  display: none;
}

.agenda-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.agenda-empty {
  text-align: center;
  padding: 32px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.agenda-empty p {
  margin: 0 0 16px 0;
}

.agenda-empty .primary {
  width: auto;
  display: inline-block;
}

.agenda-strategy {
  margin-bottom: 14px;
}

.notify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.88rem;
}

.notify-banner--on {
  border-color: rgba(45, 212, 191, 0.45);
  background: linear-gradient(180deg, rgba(45, 212, 191, 0.08), var(--surface));
}

.notify-banner--denied {
  border-color: rgba(239, 68, 68, 0.4);
}

.notify-icon {
  font-size: 1rem;
}

.notify-label {
  flex: 1 1 60%;
  min-width: 140px;
}

.notify-banner .notify-action {
  flex: 0 0 auto;
  padding: 6px 12px;
  min-height: 36px;
  font-size: 0.82rem;
  margin: 0;
  width: auto;
}

.agenda-strategy p {
  margin: 8px 0 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.agenda-strategy summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 0;
}

.agenda-strategy summary::-webkit-details-marker {
  display: none;
}

.agenda-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.agenda-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: stretch;
}

.agenda-time {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding-top: 14px;
  color: var(--accent);
}

.agenda-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--theme, var(--pick));
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow);
}

.agenda-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.agenda-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.agenda-rationale {
  margin: 0;
  font-size: 0.88rem;
  background: rgba(45, 212, 191, 0.08);
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
}

.agenda-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.agenda-pill {
  font-size: 0.7rem;
  padding: 2px 8px;
  background: rgba(124, 92, 255, 0.12);
  color: #c5b9ff;
  border-radius: 999px;
}

/* ---------- Desktop overrides ---------- */

@media (min-width: 700px) {
  .topbar {
    padding: 14px 20px;
  }

  .brand {
    flex-direction: row;
    align-items: baseline;
    gap: 12px;
  }

  h1 {
    font-size: 1.25rem;
  }

  .slot-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .agenda-row {
    grid-template-columns: 80px 1fr;
  }

  .agenda-header {
    top: 64px;
  }
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 360px 1fr;
    gap: 20px;
    padding: 20px;
    padding-bottom: 20px;
  }

  .sidebar {
    position: sticky;
    top: 70px;
    align-self: start;
    /* Stop above the fixed footer so the sticky recommend bar inside
     * isn't hidden behind it. */
    max-height: calc(100vh - 90px - var(--bottom-clearance));
    overflow-y: auto;
  }

  /* Keep "Get recommendations" pinned to the bottom of the sidebar's own
   * scroll area while the filters card is in view. Desktop only: on
   * mobile the page scrolls and the fixed agenda FAB owns that spot. */
  .recommend-bar {
    position: sticky;
    bottom: 0;
    z-index: 2;
    margin: 12px -14px -14px;
    padding: 0 14px 14px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 -10px 16px -12px rgba(0, 0, 0, 0.6);
  }

  .fab {
    bottom: calc(20px + var(--bottom-clearance));
    min-width: 180px;
  }

  .agenda {
    padding: 24px;
  }
}

/* ---------- Session detail modal ---------- */

@media (min-width: 700px) {
  .session-detail-card {
    width: min(640px, 100%);
    max-height: min(85vh, 800px);
  }
}

.session-detail-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.session-detail-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.session-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.85rem;
  color: var(--muted);
}

.session-detail-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.session-detail-section h4 {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.session-detail-section .rationale {
  margin: 0;
}

.session-detail-description {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
}

.speaker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.speaker-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.speaker-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.speaker-meta {
  font-size: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.small {
  font-size: 0.78rem;
}

/* ---------- Live timeline view ---------- */

.live {
  padding: 14px;
  padding-bottom: calc(24px + var(--bottom-clearance));
  max-width: 1400px;
  margin: 0 auto;
}

.live-header {
  position: sticky;
  top: 56px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.live-header .back {
  flex: 0 0 auto;
  padding: 8px 12px;
  min-height: 40px;
}

.live-title {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.live-title h2 {
  margin: 0;
  font-size: 1rem;
}

.live-mode-toggle {
  flex: 0 0 auto;
  padding: 8px 12px;
  min-height: 40px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.live-mode-toggle.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

.timeline-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  -webkit-overflow-scrolling: touch;
}

.timeline {
  position: relative;
  min-height: 220px;
}

.timeline-axis {
  position: relative;
  height: 26px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.timeline-tick {
  position: absolute;
  top: 6px;
  font-size: 0.7rem;
  color: var(--muted);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 0 2px;
}

.timeline-tick.major {
  color: var(--text);
  font-weight: 700;
}

.timeline-tick.major::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 1px;
  height: 8px;
  background: var(--border);
  transform: translateX(-50%);
}

.timeline-tracks {
  position: relative;
}

.timeline-row {
  position: relative;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  min-height: 60px;
}

.timeline-row:last-child {
  border-bottom: none;
}

.timeline-stage {
  position: sticky;
  left: 0;
  z-index: 3;
  flex: 0 0 var(--stage-col-width);
  width: var(--stage-col-width);
  background: var(--surface-2);
  padding: 8px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  line-height: 1.2;
}

.timeline-lane {
  position: relative;
  flex: 1 1 auto;
  min-height: 60px;
  background-image: linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(100% - 1px),
    rgba(255, 255, 255, 0.02) 100%
  );
}

.timeline-block {
  position: absolute;
  top: 6px;
  bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.06s ease;
  text-align: left;
  font: inherit;
  color: inherit;
}

.timeline-block:active {
  transform: scale(0.98);
}

.timeline-block:hover {
  border-color: var(--accent);
  z-index: 2;
}

.timeline-block.pick {
  border-color: var(--pick);
  background: linear-gradient(180deg, var(--pick-soft), var(--surface));
}

.timeline-block.alt {
  border-color: var(--alt);
}

.timeline-block.pitch {
  border-left: 3px solid var(--alt);
}

/* Theme stripe along the top; .pitch keeps the left edge. */
.timeline-block {
  box-shadow: inset 0 3px 0 var(--theme, transparent);
}

.timeline-block-time {
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.timeline-block-title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.timeline-now-label {
  position: absolute;
  top: 2px;
  left: 4px;
  background: #ef4444;
  color: white;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}

.live-empty {
  margin-top: 24px;
  text-align: center;
  padding: 24px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

@media (min-width: 700px) {
  .timeline-stage {
    font-size: 0.85rem;
  }
  .timeline-row {
    min-height: 70px;
  }
  .timeline-lane {
    min-height: 70px;
  }
  .timeline-block-title {
    font-size: 0.85rem;
  }
}

@media (min-width: 900px) {
  .live {
    padding: 24px;
  }
  .live-header {
    top: 64px;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.82rem;
  color: var(--muted);
  padding: 10px 18px calc(10px + var(--safe-bottom));
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: space-between;
  align-items: center;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-bottom: 1px dotted var(--muted);
  padding-bottom: 1px;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.site-footer a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.spektrum-mark {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex: 0 0 auto;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-footer .social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border-bottom: none;
  padding: 0;
  color: var(--muted);
  transition: color 0.12s ease, background 0.12s ease, transform 0.06s ease;
}

.site-footer .social-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.site-footer .social-link:active {
  transform: translateY(1px);
}

.site-footer .social-link svg {
  display: block;
}

/* ---------- Print (Save as PDF) ---------- */
@media print {
  @page {
    margin: 14mm 14mm 16mm 14mm;
  }

  html,
  body {
    background: white !important;
    color: black !important;
  }

  /* Hide everything except the agenda. */
  .topbar,
  .fab,
  .modal-overlay,
  .layout,
  .agenda-empty,
  .agenda-header,
  .agenda-export,
  .notify-banner,
  .site-footer {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  .print-header h1 {
    margin: 0 0 8px 0;
    font-size: 16pt;
    color: black;
  }

  .agenda {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  /* Force the strategy <details> open in print regardless of UI state. */
  details {
    display: block !important;
  }
  details > * {
    display: revert !important;
  }
  details > summary {
    list-style: none;
    font-weight: 700;
    margin-bottom: 6px;
    color: black;
  }
  details > summary::-webkit-details-marker {
    display: none;
  }

  .agenda-strategy {
    background: white !important;
    border: 1px solid #d0d0d0 !important;
    color: black !important;
    box-shadow: none !important;
    margin-bottom: 12pt !important;
    padding: 10pt !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .agenda-strategy p {
    color: #222 !important;
  }

  .agenda-list {
    gap: 8pt;
  }

  .agenda-row {
    grid-template-columns: 60pt 1fr !important;
    gap: 10pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .agenda-time {
    color: black !important;
    padding-top: 10pt;
    font-size: 11pt;
  }

  .agenda-card {
    background: white !important;
    color: black !important;
    border: 1px solid #c0c0c0 !important;
    border-left: 3px solid #2dd4bf !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .agenda-title {
    color: black !important;
    font-size: 12pt;
  }

  .agenda-meta {
    color: #444 !important;
    font-size: 9pt;
  }

  .agenda-rationale {
    background: #f4f4f4 !important;
    color: #111 !important;
    font-size: 9.5pt;
    padding: 6pt 8pt !important;
  }

  .agenda-pill {
    background: #efefef !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
    font-size: 8pt;
  }

  /* Avoid the sticky/positioning rules carrying into print. */
  .agenda-strategy,
  .agenda-card,
  .agenda-row {
    position: static !important;
  }
}

/* ---------- Most anticipated ------------------------------------------ */

:root {
  --crown: #facc15;
}

.crown {
  width: 1em;
  height: 1em;
  fill: currentColor;
  flex: none;
  vertical-align: -0.12em;
}

.anticipated-toggle {
  gap: 6px;
}

.anticipated-toggle .crown {
  color: var(--crown);
}

.anticipated-toggle.active {
  background: rgba(250, 204, 21, 0.14);
  border-color: var(--crown);
}

/* Layout-neutral root for data-each items whose element carries bindings
 * (see the .each-wrap comment in index.html). */
.each-wrap {
  display: contents;
}

/* Filters can leave a time slot with nothing visible; drop the header too. */
.slot.empty {
  display: none;
}

.session-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
}

.anticipated-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--crown);
}

.anticipated-icon {
  color: var(--crown);
  margin-right: 4px;
}

.anticipated-callout {
  border: 1px solid rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.07);
  border-radius: 8px;
  padding: 10px 12px;
}

.anticipated-callout p {
  margin: 4px 0 0;
  font-size: 0.88rem;
}

.anticipated-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.anticipated-card h2 .crown {
  color: var(--crown);
}

.anticipated-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.anticipated-item {
  width: 100%;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: inset 3px 0 0 var(--theme, var(--crown));
}

.anticipated-item:hover {
  background: var(--surface-2);
}

.anticipated-when {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.anticipated-title {
  font-size: 0.86rem;
  line-height: 1.3;
}

/* ---------- Day tabs --------------------------------------------------- */

.schedule-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.day-tabs {
  position: sticky;
  top: 56px;
  z-index: 6;
  background: var(--bg);
  padding: 6px 0;
}

@media (min-width: 700px) {
  .day-tabs {
    top: 64px;
  }
}

body.demo-on .day-tabs--schedule {
  top: calc(56px + 36px);
}

@media (min-width: 700px) {
  body.demo-on .day-tabs--schedule {
    top: calc(64px + 36px);
  }
}

/* The live header is already sticky; the tabs sit under it in flow. */
.day-tabs--live {
  position: static;
  margin: -6px 0 10px;
}

.day-tabs-row {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.day-tab {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 16px;
  min-height: 34px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.day-tab:hover {
  color: var(--text);
}

.day-tab.active {
  background: var(--accent);
  color: #fff;
}

/* Pre-event day (a single mixer): available, but visually secondary. */
.day-tab.minor:not(.active) {
  font-weight: 400;
  opacity: 0.75;
}

/* ---------- Agenda day headings ---------------------------------------- */

.agenda-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.agenda-day {
  margin: 14px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.agenda-item:first-child .agenda-day {
  margin-top: 0;
}

/* ---------- Capped filter lists (Tracks, Stages) ----------------------- */

/* ~3 rows of chips; the partly visible 4th row hints that it scrolls. */
.chip-row--capped {
  max-height: 128px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-right: 4px;
}

/* ---------- Share ------------------------------------------------------ */

.topbar-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
}

.topbar-actions .topbar-share {
  padding: 6px 9px;
}

.topbar-share svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.share-body p {
  margin: 0;
}

/* QR stays black-on-white in both themes so phone cameras read it. */
.share-qr-wrap {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  width: min(280px, 100%);
}

.share-qr {
  display: block;
  width: 100%;
  height: auto;
}

.share-url {
  color: var(--accent);
  font-weight: 600;
  word-break: break-all;
}

@media (min-width: 700px) {
  .share-card {
    width: min(380px, 100%);
  }
}

/* Phones: the centred demo pill collided with the topbar buttons. Drop it
 * just below the topbar (sticky headers already reserve 36px for it in
 * demo mode) and hide the tagline so the bar stays one line high. */
@media (max-width: 699px) {
  .brand .tag {
    display: none;
  }

  .demo-pill {
    top: 60px;
  }
}

/* Collapsible sidebar cards: a header toggle on the stacked (phone/tablet)
   layout; from 900px the sidebar sits beside the schedule and stays open. */
.card-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.chevron {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.collapsed .chevron {
  transform: rotate(-45deg);
}

@media (max-width: 899px) {
  .collapsible.collapsed .card-body {
    display: none;
  }

  .collapsible.collapsed .card-head {
    margin-bottom: 0;
  }
}

@media (min-width: 900px) {
  .card-toggle {
    pointer-events: none;
    cursor: default;
  }

  .chevron {
    display: none;
  }
}

/* Settings: one-click OpenRouter connect above the paste-a-key field. */
.connect-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
