/* Cabin font loaded via <link> in HTML — do not @import here (causes render-blocking waterfall) */

/* ---------------------------------------------------------------
   Trackscout icon set — inline SVGs use this class for sizing,
   colour inheritance and baseline alignment. SVG paths come from
   icons.js (or are inlined directly in HTML for first-paint reasons).
--------------------------------------------------------------- */
.ts-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  flex-shrink: 0;
}
.ts-icon.filled { fill: currentColor; stroke: none; }


:root{
  --primary:#60a5fa;
  --accent:#94a3b8;
  --background:#111827;
  --surface:#1f2937;
  --text:#e5e7eb;
  --muted:#6b7280;
  --logo-colour:#eee8e3;
  --wave-colour:#8ed1ff;
  --progress-colour:#1f9cef;
  --marker-colour:#94a3b8;
  --badge-soundtrack:#818cf8;
  --badge-video-editor:#fbbf24;
  --badge-supervisor:#34d399;
  --badge-file-share:#38bdf8;
  --badge-presentation:#f472b6;
  --badge-published:#4ade80;
  --badge-password:#fbbf24;
  --badge-beta:#a78bfa;
  --waveform-bg:#1e293b;
  --waveform-bg-mid:#334155;
  --waveform-active-bg:#1e3a5f;
  --waveform-active-bg-mid:#2d4a6f;
  --danger:#ef4444;
  --success:#22c55e;
  --separator:rgba(255,255,255,0.08);
  --supervisor-accent:#a855f7;
  --font-family:'Cabin',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --page-max-width:1400px;
}

/* Light mode overrides — applied via .light-mode on <html> */
.light-mode {
  --primary: #2563eb;
  --accent: #475569;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --logo-colour: #1e293b;
  --wave-colour: #3b82f6;
  --progress-colour: #2563eb;
  --marker-colour: #475569;
  --badge-soundtrack: #6366f1;
  --badge-video-editor: #d97706;
  --badge-supervisor: #059669;
  --badge-file-share: #0284c7;
  --badge-presentation: #db2777;
  --badge-published: #22c55e;
  --badge-password: #d97706;
  --badge-beta: #6366f1;
  --waveform-bg: #d4cdc4;
  --waveform-bg-mid: #e0d9d0;
  --waveform-active-bg: #c8bfb2;
  --waveform-active-bg-mid: #d8cfc4;
  --danger: #dc2626;
  --success: #16a34a;
  --separator: rgba(0,0,0,0.08);
  --supervisor-accent: #9333ea;
  --page-max-width: 1400px;
}

*{box-sizing:border-box;}
body{
  font-family:var(--font-family);
  margin:0;
  padding:0 1rem 1rem;
  background:var(--background);
  color:var(--text);
  font-weight:500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Page-specific tonal backgrounds (dark mode only) ─────────────────── */
html:not(.light-mode) body.page-dashboard  { --background: #111827; }
html:not(.light-mode) body.page-uploader   { --background: #131720; }
html:not(.light-mode) body.page-project    { --background: #151515; --surface: #1e1e1e; }
html:not(.light-mode) body.page-player     { --background: #0e1622; }
html:not(.light-mode) body.page-canvas     { --background: #121428; }
html:not(.light-mode) body.page-admin      { --background: #161118; }
html:not(.light-mode) body.page-help       { --background: #0f181e; }
html:not(.light-mode) body.page-settings   { --background: #141620; }
html:not(.light-mode) body.page-login      { --background: #111827; }
html:not(.light-mode) body.page-fileshare  { --background: #13161e; }

/* Pin footer to the very bottom of the viewport on file-share pages
   (fileshare + its matching download page). Uses fixed positioning so
   the footer sits at the edge regardless of body content length. */
body.page-fileshare,
body.page-fileshare-download {
  min-height: 100vh;
  padding-bottom: 4rem; /* reserve space for the fixed footer */
  box-sizing: border-box;
}
body.page-fileshare .site-footer,
body.page-fileshare-download .site-footer {
  position: fixed !important;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 !important;
  max-width: none !important;
  padding: 0.85rem 1rem;
  z-index: 8;
  background: rgba(12, 14, 20, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.light-mode body.page-fileshare .site-footer,
.light-mode body.page-fileshare-download .site-footer {
  background: rgba(248, 250, 252, 0.88);
  border-top-color: rgba(0, 0, 0, 0.08);
}

/* File share panel — card with a defined border so it reads over a wallpaper */
body.page-fileshare #fileSharePanel {
  max-width: 760px;
  margin: 2rem auto;
  padding: 1.25rem 1.5rem 1.5rem;
  background: rgba(20, 22, 30, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.light-mode body.page-fileshare #fileSharePanel {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* Light mode: per-page tonal shifts removed — use --background from live theme or .light-mode defaults */
h1,h2{color:var(--primary);font-weight:500;}
h3{font-weight:500;margin:0;}
section{margin-top:2rem;padding:1rem;background:var(--surface);box-shadow:0 1px 4px rgba(0,0,0,0.6);border-radius:6px;}
button, .secondary, input, select, textarea { border-radius: 6px; }
/* ── Comments side panel layout ────────────────────────────────────────── */
.player-layout {
  display: flex;
  gap: 0;
  align-items: flex-start;
  margin-top: 0;
  padding-top: 0.5rem; /* single source of vertical offset — keeps panel & player aligned */
  max-width: var(--page-max-width);
  margin-left: auto;
  margin-right: auto;
}
#playerMain {
  position: relative;
  flex: 1;
  min-width: 0; /* prevent flex overflow */
  overflow: hidden;
}

/* ── Comments panel — collapsible, left side by default ──────────────── */
.comments-panel {
  flex-shrink: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-self: stretch;
  order: -1; /* left side */
  margin-top: 0;
  padding: 0; /* override section default */
  box-shadow: none; /* override section default */
  z-index: 5;
  transition: width 0.25s ease;
  overflow: hidden;
}
.comments-panel.hidden { display: none; }

/* Expanded state */
.comments-panel.panel-open {
  width: 30vw;
  min-width: 280px;
  max-width: 400px;
  height: calc(100vh - 32px);
  position: sticky;
  top: 32px;
  box-shadow: 1px 0 6px rgba(0,0,0,0.3);
}

/* Collapsed state (default) — just the vertical tab */
.comments-panel:not(.panel-open) {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
}
.comments-panel:not(.panel-open) .comments-panel-header,
.comments-panel:not(.panel-open) .comments-panel-body {
  display: none;
}

/* Vertical tab — always visible */
.comments-panel-tab {
  width: 36px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* top-align to match header position when open */
  padding-top: 0.6rem; /* match .comments-panel-header padding-top */
  cursor: pointer;
  background: var(--surface);
  border-right: 1px solid rgba(255,255,255,0.06);
  z-index: 2;
  transition: background 0.2s;
  flex-shrink: 0;
}
/* When panel is open, hide the tab */
.comments-panel.panel-open .comments-panel-tab {
  display: none;
}
.comments-panel-tab:hover {
  background: rgba(255,255,255,0.04);
}
.comments-panel-tab-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: 0.03em;
  user-select: none;
}
.comments-panel-tab-count {
  display: inline-block;
  background: var(--accent, #6c63ff);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  margin-top: 6px;
  writing-mode: horizontal-tb;
  transform: rotate(0deg);
}
/* Right-side variant */
.player-layout.comments-right .comments-panel {
  order: 1;
}
.player-layout.comments-right .comments-panel.panel-open {
  box-shadow: -1px 0 6px rgba(0,0,0,0.3);
}
.player-layout.comments-right .comments-panel-tab {
  left: auto;
  right: 0;
  border-right: none;
  border-left: 1px solid rgba(255,255,255,0.06);
}
.player-layout.comments-right .comments-panel-tab-label {
  transform: rotate(0deg);
}
.player-layout.comments-right .comments-panel-tab-count {
  transform: rotate(0deg);
}

/* Panel header (visible when open) */
.comments-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  gap: 0.5rem;
}
.comments-panel-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}
.comments-panel-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.comments-panel-close:hover { color: var(--text); background: none; }

/* Panel body */
.comments-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.6rem 0.75rem;
  -webkit-overflow-scrolling: touch;
}

/* Override default section styles */
.comments-panel { padding: 0; margin-top: 0; }
.comments-panel #commentList { padding: 0; margin: 0; list-style: none; }

/* Responsive: stack vertically on narrow screens */
@media (max-width: 900px) {
  .player-layout {
    flex-direction: column;
    margin-left: 0;
    margin-right: 0;
  }
  #playerMain { padding: 0; }
  .comments-panel {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    max-height: none;
    position: static;
    order: 1;
  }
  .comments-panel:not(.panel-open) { width: 100% !important; }
  .comments-panel-tab {
    position: static;
    width: 100%;
    height: auto;
    min-height: 0;
    flex-direction: row;
    padding: 0.5rem 1rem;
    border-right: none;
    border-top: 1px solid rgba(255,255,255,0.06);
  }
  .comments-panel-tab-label {
    writing-mode: horizontal-tb;
    transform: none;
  }
  .comments-panel-tab-count {
    writing-mode: horizontal-tb;
    transform: none;
    margin-top: 0;
    margin-left: 6px;
  }
}

/* Light mode */
.light-mode .comments-panel.panel-open {
  box-shadow: 1px 0 6px rgba(0,0,0,0.08);
}
.light-mode .comments-panel-header {
  border-bottom-color: #e5e7eb;
}
.light-mode .comments-panel-tab {
  border-right-color: #e5e7eb;
}
.light-mode .comments-panel-tab:hover {
  background: rgba(0,0,0,0.02);
}
.light-mode .player-layout.comments-right .comments-panel.panel-open {
  box-shadow: -1px 0 6px rgba(0,0,0,0.08);
}
.light-mode .player-layout.comments-right .comments-panel-tab {
  border-left-color: #e5e7eb;
}
.light-mode .comments-panel-tab-count {
  background: var(--accent, #6c63ff);
  color: #fff;
}

#player{margin-top:0;position:relative;}
#player h2{margin-top:0;margin-bottom:0;}

/* ── Visual hierarchy — subdue secondary areas, let the video dominate ──── */
#playerHeader,
#waveformHeader,
#waveformContainer,
#videoAudioWaveform,
#videoAudioWaveformUpload,
#comments,
.share-bar,
/* All sections at full opacity — no hover fade-in on upload pages */
/* Progress bar stays fully visible (part of the video experience) */
#controls {
  opacity: 1;
}

/* Buffer gate — overlay that holds playback until media is ready */
.buffer-gate {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.85);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  transition: opacity 0.3s ease;
}
.buffer-gate.hidden { display: none; }
.buffer-gate.fade-out { opacity: 0; pointer-events: none; }

.buffer-gate-inner { text-align: center; }

.buffer-gate-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 0.75rem;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: earshots-spin 0.75s linear infinite;
}

.buffer-gate-text {
  color: var(--text);
  font-size: 0.9rem;
  margin: 0;
  opacity: 0.8;
}

.buffer-gate-progress {
  width: 120px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 0.75rem auto 0;
  overflow: hidden;
}
.buffer-gate-progress.hidden { display: none; }

.buffer-gate-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.light-mode .buffer-gate { background: rgba(248, 250, 252, 0.9); }
.light-mode .buffer-gate-spinner { border-color: rgba(0, 0, 0, 0.1); border-top-color: var(--primary); }

/* Buffering indicator (shown when audio stalls after seek) */
#bufferingIndicator {
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
#bufferingIndicator.visible {
  opacity: 1;
}
.buffering-dots::after {
  content: '...';
  display: inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: bottom;
  animation: buffering-ellipsis 1.2s steps(4, end) infinite;
}
@keyframes buffering-ellipsis {
  to { width: 1em; }
}

/* Player Header */
#playerHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.25rem;
}

#playerTitleArea {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.25rem;
}

#playerTitle {
  outline: none;
  cursor: text;
  border-radius: 0.25rem;
  padding: 0 0.25rem;
}

#playerTitleArea .last-modified {
  width: 100%; /* forces to new line */
}

#playerTitle:hover {
  background: rgba(255,255,255,0.05);
}

#playerTitle:focus {
  background: rgba(255,255,255,0.1);
}

.last-modified {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.7;
}

/* Video Controls in header */
#videoControls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#videoSizeSelect,
#replaceVideoBtn {
  height: 28px;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--muted);
  color: var(--muted);
  cursor: pointer;
  box-sizing: border-box;
}

#videoSizeSelect:hover,
#replaceVideoBtn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#replaceVideoLabel {
  display: flex;
  margin: 0;
}

/* Video Container Sizing */
#videoContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  transition: outline 0.2s, background 0.2s;
  width: 100%;  /* ensure the container spans the full width of #playerMain
                   so align-items:center actually centres against the viewport
                   width, not the content-width of whichever child is widest */
}

#videoContainer video {
  max-width: 100%;
  height: auto;
  display: block;
  margin-left: auto;  /* belt-and-braces: auto margins centre the video
                         even if align-items gets overridden in a mode
                         transition (e.g. cut-sharing rebuild) */
  margin-right: auto;
}

/* Cut-sharing: stack videos for crossfade dissolve */
#videoContainer.cut-sharing-mode video {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 30ms linear;
}
#videoContainer.cut-sharing-mode video.cut-active {
  opacity: 1;
}
#videoContainer.cut-sharing-mode {
  overflow: hidden;
}

.video-filename {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.7;
  text-align: right;
  width: 100%;
  margin-bottom: 0.25rem;
}

#videoContainer.video-size-25 video { width: 25%; }
#videoContainer.video-size-50 video { width: 50%; }
#videoContainer.video-size-75 video { width: 75%; }
#videoContainer.video-size-100 video { width: 100%; }

/* Native Fullscreen API */
#videoContainer:fullscreen,
#videoContainer:-webkit-full-screen {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
#videoContainer:fullscreen video,
#videoContainer:-webkit-full-screen video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

/* Fullscreen button — sits in the video controls area */
.video-fullscreen-btn {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--separator);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.5rem;
  vertical-align: middle;
}
.video-fullscreen-btn:hover { background: var(--hover); }

/* CSS fallback fullscreen — used when Fullscreen API is blocked */
#videoContainer.video-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border-radius: 0;
}
#videoContainer.video-fullscreen video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

/* Transport Row - play button absolutely centered */
#transportRow {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.75rem 0;
  position: relative;
  min-height: 48px;
}

#transportLeft {
  position: absolute;
  right: calc(50% + 28px);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

#transportRight {
  position: absolute;
  left: calc(50% + 28px);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Overflow "More actions" menu pinned to the right edge of the
   transport row, aligned with the transport controls. Uses id +
   class specificity to beat the generic .overflow-menu rule which
   sets position: relative and comes later in the cascade.
   A flex wrapper vertically centres the button without a transform
   (transform creates a stacking context which can interfere with the
   position:fixed dropdown that wireOverflowMenus lays on top). */
#transportRow .overflow-menu.transport-overflow-menu {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  left: auto;
  display: flex;
  align-items: center;
  z-index: 4;
}

#playPause {
  background: var(--accent);
  border: 1px solid transparent;
  color: #000;
  cursor: pointer;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 1;
}

#playPause:hover {
  background: #b0bec5;
  color: #000;
}

#crossfaderRow {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 35%;
}
#crossfaderRow input[type="range"] {
  min-width: 50px;
  flex: 1;
}

#crossfaderRow #showCrossfader,
#crossfaderRow #crossfaderToggle {
  width: auto;
  margin: 0;
  cursor: pointer;
  pointer-events: auto;
}

#transportLeft button,
#transportRight button {
  background: rgba(107, 114, 128, 0.2);
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 1.1rem;
}

#transportLeft button:hover,
#transportRight button:hover {
  background: rgba(107, 114, 128, 0.4);
  color: var(--text);
}

#timeDisplay {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: 'Cabin', monospace;
  background: rgba(107, 114, 128, 0.2);
  border: 1px solid transparent;
  padding: 0.5rem 0.75rem;
  height: 40px;
  min-width: 160px; /* wide enough for "M:SS:FF / M:SS:FF" at 0.8rem tabular */
  display: flex;
  align-items: center;
  justify-content: center;
}

#currentTime, #duration {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.crossfader-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
}

#crossfader {
  width: 100px;
  flex-shrink: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--accent) 0%, var(--muted) 100%);
  cursor: pointer;
}

#crossfader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: none;
  border: none;
  border-top: 2.5px solid var(--text);
  border-right: 2.5px solid var(--text);
  rotate: 45deg;
  cursor: pointer;
}

#crossfader::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: none;
  border: none;
  border-top: 2.5px solid var(--text);
  border-right: 2.5px solid var(--text);
  rotate: 45deg;
  cursor: pointer;
  border-radius: 0;
}

/* Edit indicator for player title */
.edit-indicator {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.5;
  margin-left: 0.25rem;
}

#playerTitleArea:hover .edit-indicator {
  opacity: 1;
  color: var(--accent);
}

#playerTitle:focus ~ .edit-indicator {
  display: none; /* hide pencil while actively editing the title */
}

/* Timestamp button next to project title */
.timestamp-btn {
  background: none;
  border: none;
  font-size: 0.8rem;
  cursor: pointer;
  opacity: 0.4;
  padding: 0 0.25rem;
  transition: opacity 0.2s;
}
.timestamp-btn:hover {
  opacity: 1;
}
#playerTitle:focus ~ .timestamp-btn {
  display: none;
}

/* Waveform Header */
#waveformHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

#waveformTitleArea h3 {
  color: var(--primary);
  margin-bottom: 0.1rem;
}

.waveform-instruction {
  font-size: 0.7rem;
  color: var(--muted);
  opacity: 0.7;
}

#waveformActions {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

#addAudioLabel {
  display: flex;
  margin: 0;
}

#waveformActions button,
#addAudioBtn {
  height: 36px;
  padding: 0 1rem;
  font-size: 0.85rem;
  line-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  margin: 0;
}
}

/* Drop zone hover states for adding media */
#videoContainer.drop-hover,
#waveformContainer.drop-hover {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: rgba(254, 172, 0, 0.1);
}

/* Full-area drop overlay shown when dragging files over the player */
.player-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  border: 2px dashed var(--accent);
  border-radius: 8px;
  pointer-events: none;
}
.player-drop-overlay.hidden { display: none; }
.player-drop-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.player-drop-overlay-icon {
  font-size: 2.5rem;
  color: var(--accent);
  line-height: 1;
}
.player-drop-overlay-text {
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
}

/* Project Note Display */
#projectNoteDisplay {
  background: rgba(254, 172, 0, 0.1);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

#projectNoteContent {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

#projectNoteLabel {
  display: block;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#projectAttachments a:hover {
  text-decoration: underline;
}

/* Dashboard tab bar */
#dashboardTabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border, #334155);
}
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  outline: none;
  -webkit-appearance: none;
}
.tab-btn:hover { color: var(--text); background: transparent; }
.tab-btn:focus, .tab-btn:active { background: transparent; outline: none; }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
}

/* Collaborator project cards — simpler than owner cards */
.collaborator-card .project-actions { gap: 0.5rem; }
.collaborator-card .project-meta { font-size: 0.8rem; }
.mode-badge {
  font-size: 0.65rem; font-weight: 500; padding: 0.15rem 0.5rem;
  border-radius: 999px; background: rgba(108, 99, 255, 0.15); color: var(--accent, #6c63ff);
  margin-left: 0.5rem; vertical-align: middle; white-space: nowrap;
}
.remove-collab-btn {
  padding: 0.25rem 0.5rem !important; font-size: 0.75rem !important;
  min-width: auto !important; opacity: 0.5; transition: opacity 0.2s;
}
.remove-collab-btn:hover { opacity: 1; }

/* Player page user menu */
#playerUserMenu { gap: 0.5rem; }
/* Comments panel is always fully visible (override visual hierarchy opacity) */
.comments-panel#comments { opacity: 1; }
/* Old margin rules replaced by panel layout */
#comments h2{margin-top:0;margin-bottom:0.5rem;}
#share{margin-top:0.5rem;}
#share h2{margin-top:0;margin-bottom:0.5rem;}
label{display:block;margin-bottom:0.5rem;font-weight:500;}
input[type=file]{margin-top:0.3rem;color:var(--text);}
#dropzone{
  border:2px dashed var(--muted);
  border-radius:6px;
  padding:2rem;
  text-align:center;
  transition:border-color .2s;
  margin-bottom:1rem;
  color:var(--muted);
}
#dropzone.dragover{border-color:var(--primary);background:color-mix(in srgb, var(--primary) 8%, var(--surface));}

/* Dashboard full-page drop overlay */
.dash-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

.dash-drop-overlay-inner {
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 3rem 4rem;
  text-align: center;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
}

.dash-drop-overlay-inner small {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
}

/* New Project modal — shown from dashboard */
.new-project-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 1rem;
}
.new-project-modal.hidden { display: none; }

.new-project-modal-inner {
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: 2rem 2rem 2.25rem;
  width: 100%;
  max-width: 560px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.new-project-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--text);
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.new-project-modal-close:hover { background: var(--hover); }

.new-project-modal h3 {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  font-weight: 600;
}
.new-project-modal-subtitle {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.new-project-modal-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.new-project-option {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.9rem;
  row-gap: 0.1rem;
  align-items: center;
  text-align: left;
  background: var(--surface-2, rgba(255,255,255,0.04));
  color: var(--text);
  border: 1px solid var(--separator);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.new-project-option:hover {
  background: var(--hover);
  border-color: var(--primary);
}
.new-project-option:active { transform: translateY(1px); }

.new-project-option-icon {
  grid-row: 1 / span 2;
  font-size: 1.6rem;
  line-height: 1;
}
.new-project-option-title {
  font-weight: 600;
  font-size: 0.95rem;
}
.new-project-option-desc {
  color: var(--muted);
  font-size: 0.82rem;
}

/* Simplified Soundtrack empty state ─────────────────────────────────────── */
/*
 * Active while at least one of #videoContainer / #waveformContainer is
 * still empty. Body-level classes:
 *   .empty-needs-video  — no video yet
 *   .empty-needs-audio  — no audio yet
 * Non-essential chrome is blurred until BOTH are resolved.
 */
/*
 * Blur the surrounding chrome — everything except the two active
 * dropzones — so the empty state reads as a ghost overlay of the
 * populated page. Layout stays IDENTICAL: the dropzones sit in the
 * exact positions they'll occupy once populated.
 */
body.empty-needs-video #playerHeader,
body.empty-needs-video #controls,
body.empty-needs-video #transportRow,
body.empty-needs-video #waveformHeader,
body.empty-needs-video #roundsTabBar,
body.empty-needs-video #transcriptSection,
body.empty-needs-video #share,
body.empty-needs-video #comments,
body.empty-needs-video .site-footer,
body.empty-needs-audio #playerHeader,
body.empty-needs-audio #transcriptSection,
body.empty-needs-audio #share,
body.empty-needs-audio #comments,
body.empty-needs-audio .site-footer {
  filter: blur(2.5px);
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
  transition: filter 0.25s, opacity 0.25s;
}

/* Suppress inline hint cards until the project is fully populated */
body.empty-needs-video .hint-card,
body.empty-needs-audio .hint-card {
  display: none !important;
}

/* Suppress the page-wide drop overlay — dropzones are now scoped to each area */
body.empty-needs-video #playerDropOverlay,
body.empty-needs-audio #playerDropOverlay {
  display: none !important;
}

/* Hide the empty <video> element while the prompt is showing — otherwise
   its default 300×150 intrinsic size eats ~150px at the top of the
   container and pushes the dropzone down. */
body.empty-needs-video #videoContainer video {
  display: none;
}

/*
 * Video-area dropzone — matches the default 50% video width at 16:9 so it
 * looks exactly like the video that will replace it.
 */
.empty-state-video-prompt {
  width: 50%;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-align: center;
  color: var(--text);
  border: 2px dashed var(--border, #334155);
  border-radius: 8px;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}

/*
 * Audio-area dropzone — matches .round-dropzone exactly (border, padding,
 * radius) so the empty state lays out identically to the populated
 * video+no-audio state.
 */
.empty-state-audio-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 2rem;
  text-align: center;
  color: var(--text);
  border: 2px dashed var(--border, #334155);
  border-radius: 8px;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.empty-state-prompt.drop-hover {
  background: rgba(59, 130, 246, 0.16);
  border-color: var(--accent);
}

.empty-state-prompt-icon {
  font-size: 2.4rem;
  line-height: 1;
}
.empty-state-prompt-title {
  font-size: 1rem;
  font-weight: 600;
}

/* "No video — audio only" button (empty state, after audio drop) */
.no-video-btn {
  display: block;
  margin: 0.5rem auto 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--muted);
  padding: 0.45rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  animation: no-video-fade-in 0.3s ease;
}
.no-video-btn:hover {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
}
@keyframes no-video-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

/* Hide Music Supervisor option in the legacy mode popup (mode retired for beta) */
#modeMusicSupervisor { display: none !important; }
button{
  background:var(--primary);
  color:#000;
  border:none;
  border-radius:0;
  padding:0.5rem 0.75rem;
  cursor:pointer;
  font-size:0.9rem;
  transition:background 0.2s;
}
button:hover{background:#3b82f6;}
button.active{background:var(--accent);color:#000;}
button.btn-saved{background:#22c55e;color:#fff;}
button.btn-saved:hover{background:#22c55e;}
button.secondary{
  background:var(--surface);
  color:var(--text);
  border:1px solid var(--muted);
}
button.secondary:hover{
  background:var(--muted);
  color:#fff;
}
/* Video container with replace button */
#videoContainer {
  position: relative;
  margin-bottom: 0;
}

#replaceVideoLabel {
  /* positioned in videoControls flex column */
}

#replaceVideoBtn {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
}

#replaceVideoBtn:hover {
  opacity: 1;
}

#controls{display:flex;align-items:center;gap:0.5rem;margin:0.15rem 0 0.5rem;}

#skipBack {
  font-size: 1em;
  line-height: 1;
}

#trimBtn {
  transition: background 0.2s;
}

#trimBtn.active {
  background: var(--accent);
  color: #000;
}

/* (Old collapsible comments toggle removed — now using panel-open/tab approach) */

#commentsHeader:hover {
  color: var(--accent);
}

/* Progress container for markers */
#progressContainer {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  height: 20px;
}

#progress {
  width: 100%;
  margin: 0;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--muted);
  cursor: pointer;
}

/* Hide the native thumb - we use a custom playhead div */
#progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 0;
  background: transparent;
  cursor: pointer;
}

#progress::-moz-range-thumb {
  width: 0;
  height: 0;
  background: transparent;
  cursor: pointer;
  border: none;
}

#progress::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--muted);
}

#progress::-moz-range-track {
  height: 6px;
  background: var(--muted);
}

/* Buffer bar — shows how much has been downloaded (YouTube-style grey bar) */
#progressBuffer {
  position: absolute;
  top: 50%;
  left: 0;
  height: 6px;
  width: 0%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
  z-index: 1;
}

/* Custom playhead — chevron ">" rendered via clip-path.
   The previous implementation used two CSS borders + rotate(45deg), but
   an L-shape rotated around its box center leaves the *visible* centroid
   offset from the box center, so the chevron never sat cleanly on the
   track line. A clip-path polygon on a solid rectangle gives a shape
   whose box centre matches the visual centre — so translate(-50%, -50%)
   reliably lands the chevron on the playhead position. */
/* Playhead chevron — uses mask-image so the shape is driven by a CSS
   variable (--playhead-svg), making it swappable from the Styleguide's
   icon-replace + Push-to-Live flow without touching CSS. Colour comes
   from the background fill (so it still picks up --text / accent). */
:root {
  /* viewBox tight-wraps the chevron-right path so mask-size:contain
     fills the playhead div without wasted padding */
  --playhead-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='10.5858 4.92896 8.4853 14.1421'><path d='M10.5858 6.34317L12 4.92896L19.0711 12L12 19.0711L10.5858 17.6569L16.2427 12L10.5858 6.34317Z'/></svg>");
}
#progressPlayhead {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 14px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
  background: var(--text);
  -webkit-mask-image: var(--playhead-svg);
          mask-image: var(--playhead-svg);
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
}

/* Comment markers container */
#commentMarkers {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

/* Individual comment marker */
.comment-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: var(--marker-colour);
  border-radius:0;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 4px rgba(251, 191, 36, 0.6);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 11;
}

.comment-marker:hover {
  transform: translate(-50%, -50%) scale(1.4);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.9);
}

/* Marker tooltip on hover */
.comment-marker::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text);
  padding: 4px 8px;
  border-radius:0;
  font-size: 0.75rem;
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  border: 1px solid var(--muted);
}

.comment-marker:hover::after {
  opacity: 1;
}

/* Waveform Container - holds all waveforms */
#waveformContainer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 0.5rem;
  position: relative;
  overflow: hidden;
}

/* Rounds tab bar */
.rounds-tab-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border, #334155);
}

/* "Share this round with your reviewers?" banner shown on secondary
   viewer pages when a new round cascades down from the primary. */
.round-share-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.5rem 0.85rem;
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text);
}
.round-share-banner.hidden { display: none; }
.round-share-banner-text { flex: 1; }
.round-share-banner-share {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}
.round-share-banner-share:hover { filter: brightness(1.1); }
.round-share-banner-share:disabled {
  opacity: 0.5;
  cursor: default;
  filter: none;
}
.round-share-banner-dismiss {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.round-share-banner-dismiss:hover {
  color: var(--text);
  border-color: var(--muted);
}
.rounds-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.rounds-tab-btn {
  /* Flex row so the round-name text and the comment-count pill share a
     common vertical centre line. Without this the inline-flex pill sits
     at the text baseline and reads as slightly dropped. */
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted, #999);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.rounds-tab-btn:hover { color: var(--text, #e2e8f0); }
.rounds-tab-btn.active {
  color: var(--text, #e2e8f0);
  border-bottom-color: var(--accent, #feac00);
  background: rgba(255, 255, 255, 0.05);
}
.rounds-tab-btn .rounds-tab-text {
  outline: none;
}
/* WhatsApp-style badge showing the number of comments on a round.
   Sits alongside the round name, centred vertically thanks to the parent
   `.rounds-tab-btn` being a flex row. */
.rounds-tab-btn .rounds-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent, #feac00);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
}
.rounds-tab-btn.active .rounds-tab-count {
  /* When the tab is active the count is already drawing attention through
     the tab's own highlight, so dim the badge a touch. */
  opacity: 0.85;
}
.rounds-add-btn {
  background: none;
  border: none;
  color: var(--muted, #999);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.4rem 0.75rem;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}
.rounds-add-btn { opacity: 0.4; }
.rounds-add-btn:hover { opacity: 1; color: var(--primary, #6b8afd); }

/* Round dropzone — shown inside waveform container for empty rounds */
.round-dropzone {
  border: 2px dashed var(--border, #334155);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.round-dropzone:hover,
.round-dropzone.drag-over {
  border-color: var(--primary, #6b8afd);
  background: rgba(107, 138, 253, 0.05);
}
.round-dropzone-content p {
  margin: 0 0 0.5rem;
  color: var(--text, #e2e8f0);
}
.round-dropzone-content .round-dropzone-hint {
  color: var(--muted, #999);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.round-dropzone-content button {
  font-size: 0.85rem;
}

/* Round publish button — shown below waveforms when a round has tracks */
.round-save-btn {
  display: block;
  align-self: stretch;
  box-sizing: border-box;
  padding: 0.6rem 1rem;
  margin-top: 0.5rem;
  background: var(--primary, #6b8afd);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.round-save-btn:hover { background: #5a7ae6; }
.round-save-btn:disabled { opacity: 0.6; cursor: default; }

/* Individual waveform wrapper */
.waveform-item {
  width: 100%;
  background: linear-gradient(to bottom, var(--waveform-bg) 0%, var(--waveform-bg-mid) 50%, var(--waveform-bg) 100%);
  border-radius:4px;
  overflow: visible;
  cursor: pointer;
  transition: height 0.3s ease, opacity 0.3s ease, background 0.3s ease;
  position: relative;
}
/* Per-track colour tint — blends track colour into the waveform background */
.waveform-item[style*="--track-color"] {
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--track-color) 12%, var(--waveform-bg)) 0%,
    color-mix(in srgb, var(--track-color) 18%, var(--waveform-bg-mid)) 50%,
    color-mix(in srgb, var(--track-color) 12%, var(--waveform-bg)) 100%);
}

.waveform-item.active {
  height: 120px;
  background: linear-gradient(to bottom, var(--waveform-active-bg) 0%, var(--waveform-active-bg-mid) 50%, var(--waveform-active-bg) 100%);
}
.waveform-item.active[style*="--track-color"] {
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--track-color) 18%, var(--waveform-active-bg)) 0%,
    color-mix(in srgb, var(--track-color) 25%, var(--waveform-active-bg-mid)) 50%,
    color-mix(in srgb, var(--track-color) 18%, var(--waveform-active-bg)) 100%);
}

.waveform-item.inactive {
  height: 40px;
  opacity: 0.7;
}

.waveform-item.inactive:hover {
  opacity: 0.7;
}

/* Fold anchor — dashed outline on cmd/ctrl-clicked tracks/cuts */
.waveform-item.fold-anchor,
.cut-item.fold-anchor {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

/* Folded group block — colours applied inline by JS using group's assigned colour */
.waveform-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 32px;
  border: 1px dashed;
  border-radius: 4px;
  cursor: pointer;
  padding: 0 10px;
  transition: filter 0.15s ease;
  overflow: hidden;
}

.waveform-group:hover {
  filter: brightness(1);
}

.waveform-group-chevron {
  font-size: 0.6rem;
  flex-shrink: 0;
}

.waveform-group-label {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  cursor: text;
}

.waveform-group-label:hover {
  text-decoration: underline;
}

.waveform-group-count {
  font-size: 0.7rem;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Expanded group header — thin band above the member tracks */
.waveform-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 22px;
  border-left: 3px solid;
  border-bottom: 1px solid;
  padding: 0 8px;
  overflow: hidden;
}

.group-header-name {
  font-size: 0.73rem;
  font-weight: 600;
  cursor: text;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.group-header-name:hover {
  text-decoration: underline;
}


/* Member tracks — coloured left stripe while group is expanded */
.waveform-item.waveform-group-member,
.cut-item.waveform-group-member {
  border-left: 3px solid var(--group-color, rgba(96, 165, 250, 0.6));
}

/* Transcript section — collapsible chevron panel below waveforms */
.transcript-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem 0;
  user-select: none;
}

.transcript-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.transcript-chevron {
  font-size: 0.6rem;
  flex-shrink: 0;
  color: var(--muted);
}

.transcript-body {
  padding: 0 0 0.5rem;
}

#transcriptControls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

#transcribeStatus {
  font-size: 0.8rem;
  color: var(--muted);
}

.transcript-content {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid rgba(107, 114, 128, 0.3);
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--text);
}

.transcript-word {
  cursor: pointer;
  padding: 0.1rem 0.05rem;
  border-radius: 2px;
  transition: background 0.1s;
}

.transcript-word:hover {
  background: rgba(96, 165, 250, 0.2);
}

.transcript-word-active {
  background: rgba(96, 165, 250, 0.35);
  font-weight: 600;
}

/* Translate dropdown (mirrors #videoSizeSelect styling) */
#translateLangSelect {
  height: 28px;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--muted);
  color: var(--muted);
  cursor: pointer;
  box-sizing: border-box;
}
#translateLangSelect:hover {
  border-color: var(--primary);
  color: var(--primary);
}

#translateStatus {
  font-size: 0.8rem;
  color: var(--muted);
}

.transcript-translated {
  white-space: pre-wrap;
  line-height: 1.8;
}

/* Group multi-select action bar */
#groupSelectionBar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 10px 14px;
  background: rgba(30, 42, 58, 0.9);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--muted);
}
#groupSelectionBar.hidden { display: none; }
#groupSelectionBar .group-sel-count { flex: 1; text-align: center; }
#groupSelectionBar button { font-size: 0.85rem; padding: 5px 14px; }

/* Inline rename input (appears in bar or header on name click) */
.group-rename-input {
  border: 1px solid;
  border-radius: 2px;
  padding: 0 4px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  width: 160px;
  max-width: 100%;
  line-height: 1.4;
}

/* Loading spinner — shown on each track until audio fires canplay */
@keyframes earshots-spin {
  to { transform: rotate(360deg); }
}

.waveform-loading .waveform-track::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(96, 165, 250, 0.8);
  border-radius: 50%;
  animation: earshots-spin 0.75s linear infinite;
  pointer-events: none;
  z-index: 10;
}
/* Loading spinner fallback — targets waveform-item directly (Project Management page) */
.waveform-loading::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(96, 165, 250, 0.8);
  border-radius: 50%;
  animation: earshots-spin 0.75s linear infinite;
  pointer-events: none;
  z-index: 10;
}

/* Track label on waveform */
.waveform-label {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 23, 42, 0.95);
  padding: 5px 12px;
  border-radius:0;
  z-index: 5;
  pointer-events: none;
  transition: all 0.3s ease;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.waveform-item.active .waveform-label {
  font-size: 0.95rem;
  color: #000;
  background: var(--accent);
  text-shadow: none;
}

/* Waveform label — allow double-click to rename */
.waveform-label {
  pointer-events: auto;
  cursor: default;
}
.waveform-label.editing {
  cursor: text;
  outline: 1px solid var(--accent);
  background: rgba(15, 23, 42, 0.98);
  color: #fff;
  min-width: 60px;
  z-index: 10;
}
.waveform-item.active .waveform-label.editing {
  background: var(--accent);
  color: #000;
  outline-color: #fff;
}

/* Waveform delete button */
.waveform-delete {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: rgba(15, 23, 42, 0.8);
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.waveform-item:hover .waveform-delete {
  opacity: 1;
}

.waveform-delete:hover {
  background: #ef4444;
  color: #fff;
}

/* Scissors button — overlength preview, positioned just right of the track label */
.waveform-scissors-btn {
  position: absolute;
  top: 5px;
  z-index: 10;
  width: 22px;
  height: 22px;
  background: rgba(15, 23, 42, 0.8);
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  border-radius: 4px;
  padding: 0;
}
.waveform-item:hover .waveform-scissors-btn,
.waveform-item.active .waveform-scissors-btn {
  opacity: 1;
}
.waveform-scissors-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* Waveform drag reorder styles */
.waveform-ghost {
  opacity: 0.4;
}

.waveform-chosen {
  box-shadow: 0 4px 12px rgba(254, 172, 0, 0.3);
}

/* Canvas inside waveform */
.waveform-item canvas {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none; /* Prevent click-to-seek on waveform canvases — only progress bar seeks */
}

/* Playhead line on each waveform */
.waveform-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  pointer-events: none;
  z-index: 10;
  left: 0;
  box-shadow: 0 0 6px var(--accent);
  display: none;
}

.waveform-item.active .waveform-playhead {
  display: block;
}

/* Played region overlay */
.waveform-played {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: rgba(96, 165, 250, 0.15);
  pointer-events: none;
  z-index: 3;
  display: none;
}

.waveform-item.active .waveform-played {
  display: block;
  background: rgba(96, 165, 250, 0.2);
}

/* Legacy single waveform (for backwards compatibility) */
#waveform{
  width:100%;
  height:120px;
  background:#334155;
  border-radius:0;
}

.hidden{display:none !important;}

/* Copy icon button (clipboard → checkmark) */
.copy-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  color: var(--muted);
  border-radius: 4px;
  transition: color 0.15s, background-color 0.15s;
}
.copy-icon-btn:hover {
  color: var(--text);
}
.copy-icon-btn.copied {
  color: var(--accent, #22c55e);
}
.copy-icon-btn .copied-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: none;
}
.copy-icon-btn.copied .copied-label {
  display: inline;
}

#audioSwitch {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#addAudioLabel {
  margin-left: auto;
}

#addAudioBtn {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

/* Hide trim handles when trim mode is off */
.trim-disabled .trim-handle,
.trim-disabled .trim-overlay,
.trim-disabled .offset-indicator {
  display: none !important;
}

/* Waveform track (draggable container) */
.waveform-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-width: 100%;
  overflow: hidden;
  transition: none;
  display: flex;
  align-items: center;
}

.waveform-track canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Only show grab cursor on active overlength tracks (they have ellipsis indicator) */
.waveform-item.active .waveform-track {
  cursor: default;
}

.waveform-item.active:has(.ellipsis-indicator[style*="block"]) .waveform-track {
  cursor: grab;
}

.waveform-item.active.dragging .waveform-track {
  cursor: grabbing;
}

/* Offset indicator */
.offset-indicator {
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 0.7rem;
  color: var(--accent);
  background: rgba(15, 23, 42, 0.9);
  padding: 2px 6px;
  border-radius:0;
  z-index: 20;
  display: none;
}

/* Ellipsis indicators for overlength audio — clickable to open the preview modal */
.ellipsis-indicator {
  position: absolute;
  bottom: 4px;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
  z-index: 20;
  display: none;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
}
.ellipsis-indicator:hover {
  transform: scale(1.2);
  color: var(--accent);
}

.ellipsis-indicator-right {
  right: 8px;
}

.ellipsis-indicator-left {
  left: 8px;
}

/* Overlength track hint — waveform flash + toast */
@keyframes overlength-flash {
  0%   { opacity: 0.5; }
  100% { opacity: 0; }
}

.waveform-overlength-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(100, 160, 255, 0.4);
  z-index: 15;
  pointer-events: none;
  animation: overlength-flash 2s ease-out forwards;
}

#audioSwitch button{
  margin-right:0;
  margin-top:0;
  display:inline-flex;
  align-items:center;
  gap:0.5rem;
  position:relative;
  transition:transform 0.2s, box-shadow 0.2s;
}

/* Subtle color variations for soundtrack buttons - same hue, different shades */
#audioSwitch button:not(#addAudioBtn):nth-child(1) { background: linear-gradient(135deg, #60a5fa 0%, #4d9af9 100%); }
#audioSwitch button:not(#addAudioBtn):nth-child(2) { background: linear-gradient(135deg, #6aabfb 0%, #58a0fa 100%); }
#audioSwitch button:not(#addAudioBtn):nth-child(3) { background: linear-gradient(135deg, #74b1fb 0%, #62a6fa 100%); }
#audioSwitch button:not(#addAudioBtn):nth-child(4) { background: linear-gradient(135deg, #7eb7fc 0%, #6cacfb 100%); }
#audioSwitch button:not(#addAudioBtn):nth-child(5) { background: linear-gradient(135deg, #88bdfc 0%, #76b2fb 100%); }
#audioSwitch button:not(#addAudioBtn):nth-child(6) { background: linear-gradient(135deg, #92c3fd 0%, #80b8fc 100%); }
#audioSwitch button:not(#addAudioBtn):nth-child(7) { background: linear-gradient(135deg, #9cc9fd 0%, #8abefc 100%); }
#audioSwitch button:not(#addAudioBtn):nth-child(8) { background: linear-gradient(135deg, #a6cffd 0%, #94c4fc 100%); }

#audioSwitch button:not(#addAudioBtn).active {
  box-shadow: 0 0 0 2px var(--accent), 0 4px 12px rgba(0,0,0,0.3);
}

/* +Add Audio button styled like soundtrack button but dashed */
#audioSwitch #addAudioLabel {
  display: inline-flex;
}

#audioSwitch #addAudioBtn {
  background: transparent;
  border: 2px dashed var(--muted);
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  margin: 0;
}

#audioSwitch #addAudioBtn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(251, 191, 36, 0.1);
}

/* Approval indicator */
.approval-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: #22c55e;
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  border-radius:0;
  margin-left: 0.35rem;
  flex-shrink: 0;
  cursor: pointer;
}

/* Approval detail panel */
.approval-detail {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius:0;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.approval-detail-content {
  color: var(--text);
}

.approval-detail-content strong {
  color: #22c55e;
}

/* Drag handle styling */
.drag-handle {
  font-size:0.8rem;
  color:var(--muted);
  font-weight:bold;
  letter-spacing:-1px;
}

/* Drag and drop states */
#audioSwitch button:hover {
  transform:translateY(-1px);
  box-shadow:0 2px 8px rgba(0,0,0,0.3);
}

/* Sortable animation */
#audioSwitch .sortable-ghost {
  opacity:0.4;
}

#audioSwitch .sortable-chosen {
  background:var(--accent) !important;
}

#commentList li {
  margin-bottom: 0.75rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius:0;
  background: rgba(51, 65, 85, 0.3);
  transition: background 0.2s;
}

#commentList li:hover {
  background: rgba(96, 165, 250, 0.15);
}

.comment-item .comment-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.comment-item .comment-time {
  color: var(--accent);
  font-weight: 600;
  font-family: monospace;
}

.comment-item .comment-track {
  color: var(--primary);
  font-size: 0.75rem;
}

.comment-item .comment-author {
  color: var(--muted);
  font-style: italic;
}

.comment-item .comment-text {
  color: var(--text);
  line-height: 1.4;
}

/* Comment delete button */
.comment-delete {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
  padding: 0 0.3rem;
  line-height: 1;
}
#commentList li { position: relative; }
#commentList li:hover .comment-delete { opacity: 1; }
.comment-delete:hover { color: #ef4444; }

code{background:#374151;padding:2px 4px;border-radius:3px;color:var(--text);}

/* Responsive improvements */
@media (max-width: 768px) {
  #audioSwitch button {
    display:block;
    width:100%;
    margin-bottom:0.25rem;
    margin-right:0;
  }
  
  #controls {
    flex-wrap:wrap;
    gap:0.25rem;
  }
  
  #progressContainer {
    width: 100%;
    order: 10;
    margin-top: 0.5rem;
  }
  
  .comment-marker {
    width: 10px;
    height: 10px;
  }
}

/* ---------------------------------------------------------------------------
   Header Bar & Auth
--------------------------------------------------------------------------- */
#headerBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin-bottom: 0;
  padding: 0 0;
  height: 56px;
  border-bottom: 1px solid var(--surface);
  max-width: var(--page-max-width);
  margin-left: auto;
  margin-right: auto;
}

#headerBar.compact {
  margin-bottom: 0;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  height: 100%;
}

.logo-link {
  display: flex;
  align-items: center;
  height: 100%;
}

.logo {
  display: inline-block;
  height: 52px;
  aspect-ratio: 158.36 / 32.9;
  -webkit-mask-image: url('earshots-logo.svg');
  mask-image: url('earshots-logo.svg');
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  background-color: var(--logo-colour);
}
/* Ensure logo is always visible — light needs dark, dark needs light.
   Live theme once set --logo-colour to #fff in light mode, making it invisible.
   These overrides use higher specificity than var() to guarantee contrast. */
.light-mode .logo { background-color: #1e293b; }
html:not(.light-mode) .logo { background-color: #eee8e3; }

.tagline {
  display: none; /* hidden — compact header like Livid */
}

#headerBar h1 {
  margin: 0;
}

#authButtons {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* ── Header actions wrapper (groups theme toggle + help button) ─────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Help button (? circle in header) ──────────────────────────────────── */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.help-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
}

.light-mode .help-btn {
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
}

.light-mode .help-btn:hover {
  border-color: rgba(0,0,0,0.25);
  background: rgba(0,0,0,0.06);
}

/* ── Theme toggle button (sun/moon in header) ─────────────────────────── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.theme-toggle-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
}

.light-mode .theme-toggle-btn {
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
}

.light-mode .theme-toggle-btn:hover {
  border-color: rgba(0,0,0,0.25);
  background: rgba(0,0,0,0.06);
}

/* ── Account menu (person icon + dropdown) ─────────────────────────────── */
.account-menu {
  position: relative;
  display: inline-flex;
  z-index: 1000;
}
.account-menu-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  padding: 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, border-color 0.15s;
}
.account-menu-btn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
}
.account-menu-btn svg { display: block; }
.account-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  min-width: 150px;
  padding: 0.3rem 0;
  z-index: 100;
}
.account-menu-dropdown.open { display: block; }
.account-menu-dropdown a,
.account-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 0.5rem 0.85rem;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.account-menu-dropdown a:hover,
.account-menu-dropdown button:hover {
  background: rgba(255,255,255,0.06);
}
.account-menu-dropdown hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin: 0.25rem 0;
}

/* Page label badge — sits in #headerBar between logo and auth buttons */
.page-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 0.1rem 0.35rem;
  border: 1px solid rgba(128, 128, 128, 0.15);
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0.7;
}

/* Page label type colours — match Canvas node colours */
.page-label.type-soundtrack { color: var(--badge-soundtrack); border-color: color-mix(in srgb, var(--badge-soundtrack) 25%, transparent); }
.page-label.type-cut-share { color: var(--badge-video-editor); border-color: color-mix(in srgb, var(--badge-video-editor) 25%, transparent); }
.page-label.type-supervisor { color: var(--badge-supervisor); border-color: color-mix(in srgb, var(--badge-supervisor) 25%, transparent); }
.page-label.type-file-share { color: var(--badge-file-share); border-color: color-mix(in srgb, var(--badge-file-share) 25%, transparent); }
.page-label.type-presentation { color: var(--badge-presentation); border-color: color-mix(in srgb, var(--badge-presentation) 25%, transparent); }

/* Overflow menu (⋯ button + dropdown) — progressive disclosure */
.overflow-menu {
  position: relative;
  display: inline-block;
}
.copy-link-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
}
.copy-link-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.3);
}
.overflow-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  letter-spacing: 0.15em;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.overflow-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

#videoControls .overflow-btn {
  color: var(--text);
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06);
  font-size: 1.3rem;
  padding: 0.35rem 0.7rem;
}

#videoControls .overflow-btn:hover {
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.1);
}
.overflow-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  min-width: 180px;
  margin-top: 0.25rem;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.overflow-dropdown.open { display: block; }
.overflow-dropdown button,
.overflow-dropdown button.export-btn,
.overflow-dropdown button.review-share-btn,
.overflow-dropdown button.delete-btn,
.overflow-dropdown button.secondary {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  color: var(--text);
  border: none;
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  font-weight: normal;
  cursor: pointer;
  transform: none;
}
.overflow-dropdown button:hover,
.overflow-dropdown a.overflow-link:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: none;
}
.overflow-dropdown a.overflow-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

/* ── Video version selector (inside overflow menu) ─────────────────── */
.version-section {
  border-top: 1px solid rgba(128, 128, 128, 0.15);
  padding-bottom: 0.25rem;
}
.version-select-btn {
  display: block;
  width: calc(100% - 1.5rem);
  margin: 0 0.75rem 0.25rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
}
.version-select-btn:hover {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
}
.version-list-dropdown {
  margin: 0 0.5rem 0.25rem;
  background: var(--background);
  border: 1px solid rgba(128, 128, 128, 0.2);
  border-radius: 4px;
  overflow: hidden;
}
.version-list-dropdown .version-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.version-list-dropdown .version-item:hover {
  background: rgba(128, 128, 128, 0.1);
}
.version-list-dropdown .version-item.active {
  color: var(--primary);
  font-weight: 600;
}
.version-list-dropdown .version-item .version-date {
  font-size: 0.72rem;
  color: var(--muted);
}
.version-list-dropdown .version-item.new-version {
  border-top: 1px solid rgba(128, 128, 128, 0.15);
  color: var(--primary);
  font-weight: 500;
}

#userMenu {
  display: flex;
  gap: 0.5rem;
}

/* Compact section styling */
section.compact {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
}

section.compact h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
}

/* Audio-only mode styling */
.audio-only-mode #videoContainer {
  display: none !important;
}

.audio-only-mode #crossfaderRow {
  display: none !important;
}

.audio-only-mode #waveformContainer {
  margin-top: 0;
}

.audio-only-waveforms {
  min-height: 200px;
}

.audio-only-waveforms .waveform-item.active {
  height: 180px;
}

.audio-only-waveforms .waveform-item.inactive {
  height: 60px;
}

/* End User page - smaller waveform */
.end-user-waveforms .waveform-item.active {
  height: 60px;
}

.end-user-waveforms .waveform-item.active .waveform-label {
  font-size: 0.8rem;
  padding: 3px 8px;
}

#userMenu.hidden {
  display: none;
}

/* ---------------------------------------------------------------------------
   Dashboard
--------------------------------------------------------------------------- */
#dashboard {
  max-width: var(--page-max-width);
  margin: 0 auto;
}

#dashboardHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

#dashboardHeader h2 {
  margin: 0;
}

/* ── Dashboard controls row ──────────────────────────────────────────── */
#dashboardControls {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
  align-items: center;
}

#dashboardControls input[type="text"] {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 0.9rem;
}

#dashboardSort {
  padding: 0.5rem 0.6rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
}

#layoutToggle {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

#layoutToggle:hover {
  color: var(--text);
  border-color: rgba(255,255,255,0.25);
}

#storageTotal {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.light-mode #dashboardControls input[type="text"],
.light-mode #dashboardSort,
.light-mode #layoutToggle {
  border-color: rgba(0,0,0,0.1);
}

.light-mode #layoutToggle:hover {
  border-color: rgba(0,0,0,0.25);
}

/* ── Visibility badges ───────────────────────────────────────────────── */
.visibility-badge {
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.badge-published { background: color-mix(in srgb, var(--badge-published) 13%, transparent); color: var(--badge-published); }
.badge-password { background: color-mix(in srgb, var(--badge-password) 13%, transparent); color: var(--badge-password); }

/* ── Grid layout for project list ────────────────────────────────────── */
#projectList.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

#projectList.grid-layout .project-card {
  flex-direction: column;
  align-items: flex-start;
}

#projectList.grid-layout .project-actions {
  width: 100%;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

#projectList.grid-layout .project-name {
  flex-wrap: wrap;
}

#projectList {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Folder chevron — matches the transport play-button chevron so dashboard
   and player share the same expand glyph. Sits just to the right of the
   folder icon; rotates 90° when the folder is expanded. */
.folder-chevron-btn {
  background: transparent;
  border: none;
  padding: 0.35rem;
  margin: 0 0.35rem 0 -0.15rem;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.18s ease, color 0.18s ease;
}
.folder-chevron-btn:hover { color: var(--text); }
.project-card.folder-expanded > .folder-chevron-btn { transform: rotate(90deg); }
.folder-chevron-btn svg { display: block; }

/* Folder children — indented so the child's thumbnail lines up with
   the parent folder's NAME. The margin is the sum of all the visual
   elements the parent has before its name:
   padding-left + checkbox + gap + thumb + gap + chevron + gap
   minus the child's own leading padding + checkbox + gap + border.
   Left accent line makes the hierarchy readable. */
.project-card.is-folder-child {
  margin-left: 6.75rem;
  border-left: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
  padding-left: 1.25rem;
}
#projectList.grid-layout .project-card.is-folder-child {
  margin-left: 6.75rem;
}

/* Hover-reveal for .card-checkbox lives with the main rule below —
   see the .card-checkbox block in the dashboard section. */

.project-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius:6px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.12s ease;
}
.light-mode .project-card {
  border-color: rgba(0, 0, 0, 0.06);
}
/* Zebra striping — alternate VISIBLE top-level rows get a slightly
   lighter fill. Driven by JS (.row-even class) because CSS nth-child
   can't skip hidden folder children. Folder children keep the default
   surface background since they have their own left-accent treatment. */
.project-card.row-even {
  background: color-mix(in srgb, var(--surface) 97%, #ffffff 3%);
}
.light-mode .project-card.row-even {
  background: color-mix(in srgb, var(--surface) 98%, #000000 2%);
}
/* Hover highlight — gentle lift on whichever card the cursor is over. */
.project-card:hover {
  background: color-mix(in srgb, var(--surface) 92%, #ffffff 8%) !important;
}
.light-mode .project-card:hover {
  background: color-mix(in srgb, var(--surface) 95%, #000000 5%) !important;
}

/* ── Project thumbnail ─────────────────────────────────────────────── */
.project-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-thumb-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-thumb svg {
  width: 24px;
  height: 24px;
  color: var(--muted);
  opacity: 0.6;
}

/* Grid layout: larger thumbnails */
#projectList.grid-layout .project-thumb {
  height: 120px;
  border-radius: 6px 6px 0 0;
  margin: -1rem -1.25rem 0.75rem;
  width: calc(100% + 2.5rem);
}

/* Light mode */
.light-mode .project-thumb {
  background: rgba(0, 0, 0, 0.04);
}

.project-card.has-approval {
  border-left: 3px solid #22c55e;
}

.project-card.is-draft {
  border-left: 3px solid #94a3b8;
}

.draft-badge {
  background: #94a3b8;
  color: #000;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Project type badges — colours match Canvas node types */
.project-type-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.type-soundtrack {
  background: color-mix(in srgb, var(--badge-soundtrack) 13%, transparent);
  color: var(--badge-soundtrack);
}

.type-cut-share {
  background: color-mix(in srgb, var(--badge-video-editor) 13%, transparent);
  color: var(--badge-video-editor);
}

.type-supervisor {
  background: color-mix(in srgb, var(--badge-supervisor) 13%, transparent);
  color: var(--badge-supervisor);
}

.type-file-share {
  background: color-mix(in srgb, var(--badge-file-share) 13%, transparent);
  color: var(--badge-file-share);
}

.type-presentation {
  background: color-mix(in srgb, var(--badge-presentation) 13%, transparent);
  color: var(--badge-presentation);
}

.type-folder {
  background: rgba(148, 163, 184, 0.13);
  color: #94a3b8;
}

.project-info {
  flex: 1;
  min-width: 0;
}

.project-name {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Project name as a clickable link */
.project-name-link {
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-name-link:hover { color: var(--primary); }

/* Inline-editable project name on dashboard */
.project-name-text {
  cursor: pointer;
  border-radius: 0.2rem;
  padding: 0 0.2rem;
  transition: background 0.2s;
}
.project-name-text.editing {
  cursor: text;
  outline: 1px solid var(--accent);
  background: rgba(255, 255, 255, 0.1);
  white-space: normal;
  min-width: 80px;
}

/* Pen icon for rename */
.rename-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.15rem;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  flex-shrink: 0;
}
.project-card:hover .rename-btn { opacity: 0.6; }
.rename-btn:hover { opacity: 1 !important; color: var(--text); }

.approval-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: #22c55e;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius:0;
  flex-shrink: 0;
}

.approved-text {
  color: #22c55e;
}

.project-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.project-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
}

.project-actions button {
  white-space: nowrap;
}

/* Sibling-consistent sizing: Open button (text) and ⋮ (icon) share
   the same height and border treatment so they read as a set. */
.project-actions > a button.secondary,
.project-actions > .overflow-menu .overflow-btn {
  height: 32px;
  padding: 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.project-actions > .overflow-menu .overflow-btn {
  width: 32px;
  padding: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.delete-btn {
  color: #ef4444 !important;
  border-color: #ef4444 !important;
}

.delete-btn:hover {
  background: #ef4444 !important;
  color: #fff !important;
}

/* ── Dashboard bulk-selection ─────────────────────────────────────────────── */

/* Checkbox always visible on each card */
.card-checkbox {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--accent);
  opacity: 0; /* hidden by default — reveals on hover / focus / checked */
  transition: opacity 0.15s;
}

.project-card:hover .card-checkbox,
.card-checkbox:hover,
.card-checkbox:focus-visible,
.card-checkbox:checked {
  opacity: 1;
}

/* Selected card highlight */
.project-card.selected {
  background: rgba(254, 172, 0, 0.06);
  outline: 1px solid rgba(254, 172, 0, 0.25);
}

/* Drag-to-folder states */
.project-card.dragging-to-folder {
  opacity: 0.5;
}
.project-card.folder-drop-target {
  outline: 2px dashed var(--accent, #6c63ff);
  outline-offset: -2px;
}
.project-card.folder-drop-hover {
  outline-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

/* Header right side — groups selection bar + new project button */
.dashboard-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Inline toolbar — appears when at least one card is checked */
#selectionBar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  /* Every child lines up on the same baseline — consistent height
     prevents Select-all / Delete / ✕ drifting onto different lines. */
  height: 32px;
}

#selectionBar > * {
  display: inline-flex;
  align-items: center;
  height: 100%;
  font-size: 0.8rem;
  box-sizing: border-box;
}

#selectionCount {
  color: var(--muted);
}

#selectAllLabel {
  gap: 0.35rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  /* Cancel the global label rule (display:block, margin-bottom:0.5rem,
     font-weight:500) — it was pushing the label off the selection-bar
     baseline and making "Select all" read heavier than the count text. */
  margin: 0;
  font-weight: inherit;
  line-height: 1;
}
/* Size the checkbox so it doesn't tower over the 0.8rem text */
#selectAllCb {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* Small delete button */
.danger-btn {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 3px;
  padding: 0 0.6rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.danger-btn:hover:not(:disabled) {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
}

.danger-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ✕ clear-selection button — matched to .danger-btn sizing so they
   read as siblings rather than two unrelated widgets. */
.clear-selection-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0 0.55rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s, border-color 0.15s, color 0.15s, background 0.15s;
}

.clear-selection-btn:hover {
  opacity: 1;
  color: var(--text);
  border-color: var(--muted);
}

/* ── Browser warning banner ──────────────────────────────────────────────── */
#browser-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 1rem;
  margin: 0 -1rem 0.5rem; /* bleed to body edges */
  background: rgba(148, 163, 184, 0.1);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  font-size: 0.82rem;
  color: #94a3b8;
}

#browser-warning button {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 0.25rem;
  opacity: 0.65;
  flex-shrink: 0;
}
#browser-warning button:hover { opacity: 1; }

/* ── Cookie consent banner ───────────────────────────────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: #161e2a;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.8rem;
  color: var(--muted);
  z-index: 999;
}
#cookie-banner a { color: var(--primary); }
.cookie-btns { display: flex; gap: 0.5rem; flex-shrink: 0; }
.cookie-btns button { font-size: 0.78rem; padding: 0.28rem 0.7rem; }

/* ── Mobile overlay ──────────────────────────────────────────────────────── */
#mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--background);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
@media (max-width: 767px) {
  #mobile-overlay { display: flex; }
}
#mobile-overlay-box { max-width: 300px; }
#mobile-overlay-box p { margin: 0 0 0.75rem; }
#mobile-continue { font-size: 0.85rem; padding: 0.5rem 1.25rem; margin-top: 0.75rem; }

/* ── Project Overview page ───────────────────────────────────────────────── */
#projectOverview {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}
#overviewBreadcrumb {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 1rem;
}
#overviewBreadcrumb a {
  color: var(--accent, #6c8aff);
  text-decoration: none;
}
#overviewBreadcrumb a:hover { text-decoration: underline; }
.breadcrumb-sep {
  margin: 0 0.35rem;
  color: #999;
}
#overviewHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
#overviewTitle {
  font-size: 1.3rem;
  font-weight: 600;
}
#versionGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.version-card {
  background: var(--surface, #1a1a2e);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  text-decoration: none;
  display: block;
  color: var(--text);
}
.version-card:hover {
  border-color: var(--accent, #6c8aff);
  transform: translateY(-2px);
}
.version-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}
.version-card-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.version-overflow-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}
.version-overflow-btn:hover { color: var(--text); }
.version-card-badges {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.version-status {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-weight: 500;
}
.status-draft { background: rgba(255,200,50,0.15); color: #e0b040; }
.status-published { background: rgba(80,200,120,0.15); color: #5cc87a; }
.status-password { background: rgba(200,150,255,0.15); color: #c8a0ff; }
.version-card-meta {
  font-size: 0.8rem;
  color: #aaa;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.version-overflow-menu {
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 8px;
  padding: 0.25rem 0;
  min-width: 160px;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.version-overflow-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.version-overflow-menu button:hover { background: rgba(255,255,255,0.05); }
.version-overflow-menu .danger-text { color: #e54; }
.version-overflow-menu hr {
  border: none;
  border-top: 1px solid var(--border, #2a2a4a);
  margin: 0.25rem 0;
}

/* "+" Add-to-project dropdown in waveform header */
.add-to-project-menu {
  position: relative;
}
.add-to-project-menu > button {
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
  background: var(--accent, #6c8aff);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.add-to-project-menu > button:hover { opacity: 0.85; }
.add-to-project-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface, #1a1a2e);
  border: 1px solid var(--border, #2a2a4a);
  border-radius: 8px;
  padding: 0.25rem 0;
  min-width: 180px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.add-to-project-dropdown button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.add-to-project-dropdown button:hover { background: rgba(255,255,255,0.05); }

/* Breadcrumb on Project Management page (app.html) */
#projectBreadcrumb {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 1rem;
}
#projectBreadcrumb a {
  color: var(--accent, #6c8aff);
  text-decoration: none;
}
#projectBreadcrumb a:hover { text-decoration: underline; }
#projectBreadcrumb .breadcrumb-sep {
  margin: 0 0.35rem;
  color: #999;
}
#projectBreadcrumb .breadcrumb-current {
  color: #bbb;
}

/* Light mode overrides for project overview */
.light-mode .version-card { border-color: rgba(0,0,0,0.08); }
.light-mode .version-card-meta { color: var(--muted); }
.light-mode .version-overflow-menu { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

/* ── Site footer ─────────────────────────────────────────────────────────── */
.site-footer {
  margin-top: 3rem;
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  max-width: var(--page-max-width);
  margin-left: auto;
  margin-right: auto;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  margin: 0 0.6rem;
}
.site-footer a:hover { color: var(--text); }
.site-footer span { margin: 0 0.6rem; }

/* ── Onboarding hint cards ────────────────────────────────────────────── */
.hint-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border-left: 3px solid var(--primary);
  border-radius: 0.35rem;
  padding: 0.6rem 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
  animation: hint-fade-in 0.3s ease;
}
@keyframes hint-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hint-card-body {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}
.hint-card-icon {
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1.4;
}
.hint-card-text {
  color: #bbb;
}
.light-mode .hint-card-text {
  color: #444;
}
.hint-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.hint-dismiss {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.15rem;
  line-height: 1;
}
.hint-dismiss:hover { color: var(--text); }
.hint-hide-all {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hint-hide-all:hover { color: var(--text); }
.hint-card-right {
  margin-left: auto;
  max-width: 520px;
}

/* ── Page-level max-width for unconstrained pages ────────────────────── */
#adminPanel,
#upload {
  max-width: var(--page-max-width);
  margin-left: auto;
  margin-right: auto;
}
#authSection {
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem 2rem 1.5rem;
}
#authSection h2 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}
#authSection p {
  line-height: 1.5;
}

/* Auth form inputs */
#authSection input[type="email"],
#authSection input[type="password"],
#authSection input[type="text"] {
  display: block;
  padding: 0.6rem 0.75rem;
  background: var(--background);
  border: 1px solid var(--muted);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
}
#authSection input[type="email"]:focus,
#authSection input[type="password"]:focus,
#authSection input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
}
#authSection input::placeholder {
  color: var(--muted);
}

/* Auth buttons */
#authSection button:not(.secondary):not(.modal-close-btn) {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  font-family: inherit;
}
#authSection button.secondary {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.6rem 1rem;
  font-family: inherit;
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--text);
}

/* Auth form layout */
#authSection input[type="email"],
#authSection input[type="password"] {
  width: 100%;
  margin-bottom: 0.6rem;
  box-sizing: border-box;
}
#authSection button:not(.secondary):not(.modal-close-btn):not(.account-menu-btn) {
  width: 100%;
}
#authSection button.secondary {
  width: 100%;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
}
.auth-links a {
  color: var(--primary);
  font-size: 0.85rem;
  text-decoration: none;
}
.auth-links a:hover { text-decoration: underline; }
.auth-hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.4rem;
}
.auth-switch {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}
.auth-switch a {
  color: var(--primary);
  text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }
.auth-remember {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  cursor: pointer;
}

/* OAuth button — provider icon + label side by side */
.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
}
.oauth-btn .oauth-icon {
  flex-shrink: 0;
  background: #fff;
  border-radius: 2px;
  padding: 2px;
  box-sizing: content-box;
}
#oauthFields { margin-bottom: 0.75rem; }

/* Auth divider — "or" line between password and magic link */
.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  gap: 0.75rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--muted);
  opacity: 0.4;
}
.auth-divider span {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.beta-badge {
  display: inline-block;
  background: color-mix(in srgb, var(--badge-beta) 15%, transparent);
  color: var(--badge-beta);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--badge-beta) 30%, transparent);
  border-radius: 0.25rem;
  margin: 0 0.6rem;
  vertical-align: middle;
}

#userInfo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Mobile adjustments for dashboard */
@media (max-width: 600px) {
  #headerBar {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .project-card {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .project-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .project-actions button {
    flex: 1;
    min-width: 80px;
  }
}

/* ---------------------------------------------------------------------------
   Approve Button & Modal
--------------------------------------------------------------------------- */
.approve-btn {
  background: transparent;
  color: #6ee7b7;
  border: 1px solid rgba(110, 231, 183, 0.35);
  padding: 0.5rem 1rem;
  border-radius: 0;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.approve-btn:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #a7f3d0;
  border-color: rgba(110, 231, 183, 0.6);
}

.approve-btn:disabled {
  background: transparent;
  color: #6b7280;
  border-color: rgba(107, 114, 128, 0.3);
  cursor: not-allowed;
}

/* Review Share button */
.review-share-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}

.review-share-btn:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.review-share-btn:disabled {
  background: #6b7280;
  cursor: not-allowed;
  transform: none;
}

/* Export button */
.export-btn {
  background: #94a3b8;
  color: #000;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}

.export-btn:hover {
  background: #78909c;
  transform: translateY(-1px);
}

.export-btn:disabled {
  background: #6b7280;
  color: #fff;
  cursor: wait;
  transform: none;
}
/* Prominent export button — pulled out of overflow menu for supervisor mode */
.export-btn-prominent {
  display: inline-flex !important;
}

/* Export status bar */
#exportStatus {
  background: var(--surface, #1e1e2e);
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
}

#exportStatus.hidden {
  display: none;
}

#exportStatusInner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

#exportStatusText {
  flex: 1;
  font-size: 0.9rem;
  color: var(--muted, #999);
}

#exportDownloadLink {
  background: #22c55e;
  color: #000;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

#exportDownloadLink:hover {
  background: #16a34a;
}

/* Forward Feedback button */
.forward-feedback-btn {
  background: #8b5cf6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
}

.forward-feedback-btn:hover {
  background: #7c3aed;
  transform: translateY(-1px);
}

.forward-feedback-btn:disabled {
  background: #6b7280;
  cursor: not-allowed;
  transform: none;
}

/* Privacy notice in review share modal */
.privacy-notice {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid var(--accent);
}

/* Forwarded comment styling */
.comment-item.forwarded {
  border-left: 3px solid #8b5cf6;
  padding-left: 0.75rem;
}

.comment-forwarded-badge {
  display: block;
  font-size: 0.75rem;
  color: #8b5cf6;
  font-style: italic;
  margin-bottom: 0.25rem;
}

.comment-forward-note {
  font-size: 0.8rem;
  color: #8b5cf6;
  font-style: italic;
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(139, 92, 246, 0.2);
}

/* Foreign comment styling (comment from a child review share, shown on the
   parent view with a "Share with owner" button). */
.comment-item.foreign {
  border-left: 3px solid #60a5fa;
  padding-left: 0.75rem;
  background: rgba(96, 165, 250, 0.05);
}

.comment-foreign-badge {
  display: block;
  font-size: 0.75rem;
  color: #60a5fa;
  font-style: italic;
  margin-bottom: 0.25rem;
}

.comment-forward-foreign {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #60a5fa;
  background: transparent;
  border: 1px solid #60a5fa;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.comment-forward-foreign:hover {
  background: rgba(96, 165, 250, 0.15);
}

/* Timeline marker for a foreign comment — blue instead of the default colour. */
.comment-marker.comment-marker-foreign {
  background: #60a5fa;
}

/* Review share track list in modal */
.review-share-group {
  margin-bottom: 0.5rem;
}

/* Forward item labels */
.forward-item {
  display: block;
  margin-bottom: 0.25rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--surface);
  padding: 1.5rem;
  border-radius:0;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  margin-top: 0;
  color: var(--primary);
}

.modal-content label {
  display: block;
  margin-bottom: 1rem;
}

.modal-content label.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.modal-content label.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border: 1px solid var(--muted);
  border-radius:0;
  background: var(--background);
  color: var(--text);
}

.modal-content textarea {
  min-height: 80px;
  resize: vertical;
}

.modal-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
}
.modal-close-btn:hover {
  color: var(--foreground);
  background: rgba(255,255,255,0.08);
}

.share-setting-suggestion {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.share-setting-suggestion-label {
  font-size: 0.8rem;
  color: var(--muted);
}
.share-setting-suggestion-value {
  font-family: monospace;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  background: rgba(96, 165, 250, 0.12);
  border-radius: 0.25rem;
  white-space: nowrap;
}
.share-setting-suggestion button.secondary {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
}

/* Share bar — compact toolbar inside the player section */
.share-bar {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 1rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.5rem;
}
.share-bar-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
#shareLinkStatus {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
}
.spinner-inline {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent, #6c8aff);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
.light-mode .spinner-inline {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: var(--accent, #6c8aff);
}
@keyframes spin { to { transform: rotate(360deg); } }
.share-bar-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}
.share-bar-link input[type="text"] {
  flex: 1;
  min-width: 120px;
  max-width: 480px;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
}
.share-bar-progress {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
}
.share-bar-progress:empty {
  display: none;
}
.empty-project-modal {
  background: var(--surface, #1a1a2e);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2rem;
  max-width: 480px;
  width: 90vw;
  position: relative;
}
.empty-project-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.empty-project-dropzone:hover,
.empty-project-dropzone.dragover {
  border-color: var(--accent, #6c8aff);
  background: rgba(108, 138, 255, 0.05);
}
.empty-project-dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.empty-project-dropzone-icon {
  font-size: 2.5rem;
  line-height: 1;
  color: var(--accent, #6c8aff);
  font-weight: 300;
}
.empty-project-dropzone-types {
  font-size: 0.8rem;
  color: #aaa;
}
.light-mode .empty-project-modal {
  background: var(--surface, #fff);
  border-color: rgba(0, 0, 0, 0.1);
}
.light-mode .empty-project-dropzone {
  border-color: rgba(0, 0, 0, 0.15);
}
.light-mode .empty-project-dropzone:hover,
.light-mode .empty-project-dropzone.dragover {
  background: rgba(108, 138, 255, 0.05);
}
.bg-upload-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(20, 20, 24, 0.92);
  backdrop-filter: blur(6px);
  z-index: 9999;
}
.bg-upload-bar.hidden { display: none; }
.bg-upload-bar-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}
.light-mode .bg-upload-bar { background: rgba(245, 245, 248, 0.92); }
.light-mode .bg-upload-bar-track { background: rgba(0, 0, 0, 0.08); }
.bg-upload-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent, #6c8aff);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.bg-upload-bar-label {
  font-size: 0.75rem;
  color: #aaa;
  white-space: nowrap;
  min-width: fit-content;
}
#confirmApproval {
  background: #10b981;
}

#confirmApproval:hover {
  background: #059669;
}

/* ---------------------------------------------------------------------------
   Music Supervisor Mode
--------------------------------------------------------------------------- */

/* Video audio waveform - subtle, secondary appearance */
#videoAudioWaveform .waveform-item.video-audio {
  height: 32px;
  background: linear-gradient(to bottom, #1e1e22 0%, #28282e 50%, #1e1e22 100%);
  margin-bottom: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#videoAudioWaveform .waveform-item.video-audio .waveform-label {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  padding: 2px 8px;
}

#videoAudioWaveform .waveform-item.video-audio .waveform-played {
  background: rgba(255, 255, 255, 0.06);
}

/* Download video button (supervisor mode — near the video) */
#supervisorVideoActions {
  text-align: center;
  margin: 0.5rem 0;
}

/* Composer submission section */
#composerSubmission {
  margin-top: 1.5rem;
}

.submission-box {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-left: 4px solid #8b5cf6;
  padding: 1.25rem;
  border-radius: 0;
}

.submission-box h4 {
  margin: 0 0 0.5rem 0;
  color: #a78bfa;
}

.submission-box p {
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.submission-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.submission-form input[type="text"],
.submission-form input[type="email"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--muted);
  background: var(--background);
  color: var(--text);
  border-radius: 0;
  width: 180px;
}

#submitTrackBtn {
  background: #8b5cf6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-weight: 600;
}

#submitTrackBtn:hover:not(:disabled) {
  background: #7c3aed;
}

#submitTrackBtn:disabled {
  background: #6b7280;
  cursor: not-allowed;
}

#submissionStatus {
  width: 100%;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

#downloadVideoBtn {
  background: var(--surface);
  border: 1px solid #8b5cf6;
  color: #a78bfa;
}

#downloadVideoBtn:hover {
  background: rgba(139, 92, 246, 0.2);
}

/* Video info bar — shown when proxy isn't available */
.video-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.8rem;
  color: #ffffff;
  margin-top: 0.25rem;
}

.video-info-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 0.25rem;
  opacity: 0.6;
}

.video-info-dismiss:hover {
  opacity: 1;
  color: #ffffff;
}

/* Download dropdown — choice between original and web version */
.download-dropdown {
  background: var(--surface);
  border: 1px solid var(--muted);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 100;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}

.download-dropdown-item {
  padding: 0.6rem 0.75rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.download-dropdown-item:hover {
  background: rgba(96, 165, 250, 0.15);
  color: var(--primary);
}

.download-dropdown-item + .download-dropdown-item {
  border-top: 1px solid rgba(107, 114, 128, 0.3);
}

/* Large file warning — shown when video exceeds 2GB */
.large-file-warning {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: rgba(234, 179, 8, 0.1);
  border: 1px solid rgba(234, 179, 8, 0.3);
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
  gap: 0.5rem;
}

/* Conversion warning with progress bar */
.conversion-warning-with-progress {
  align-items: flex-start;
}

.conversion-progress-content {
  flex: 1;
}

.conversion-progress-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.conversion-progress-fill {
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 5px;
  transition: width 0.5s ease;
  width: 0%;
}

.conversion-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: conversion-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

/* Submitted by label in supervisor mode */
.submitted-by {
  font-weight: 400;
  font-size: 0.75rem;
  opacity: 0.8;
  margin-left: 0.25rem;
}

/* Composer dropzone */
.composer-dropzone {
  border: 2px dashed rgba(139, 92, 246, 0.5);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 1rem 0;
  background: rgba(139, 92, 246, 0.05);
}

.composer-dropzone:hover,
.composer-dropzone.drag-over {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.15);
}

.composer-dropzone.drag-over {
  transform: scale(1.01);
}

.dropzone-content {
  pointer-events: none;
}

.dropzone-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.composer-dropzone p {
  margin: 0.25rem 0;
  color: #a78bfa;
}

.dropzone-hint {
  font-size: 0.8rem;
  opacity: 0.7;
}

.composer-dropzone input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  cursor: pointer;
}

.composer-dropzone {
  position: relative;
}

.composer-dropzone.hidden {
  display: none;
}

/* Multi-file list for composer uploads */
#composerFileList {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.composer-file-item {
  padding: 0.6rem 0.75rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 4px;
}

.composer-file-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.composer-file-name {
  flex: 1;
  color: #a78bfa;
  font-weight: 500;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer-file-remove {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  min-width: auto;
  flex-shrink: 0;
}

/* Composer pending tracks — rendered into the main waveform container so the
   composer experience matches the soundtrack primary user. A subtle purple
   border distinguishes them from already-submitted tracks. */
.waveform-item.composer-pending {
  border-left: 3px solid rgba(139, 92, 246, 0.7);
}
.waveform-item.composer-pending .waveform-label .submitted-by {
  color: #a78bfa;
  font-style: italic;
}

/* ---------------------------------------------------------------
   Supervisor mode: per-track download button on waveform items
--------------------------------------------------------------- */
.waveform-download-btn {
  position: absolute;
  top: 4px;
  right: 8px;
  width: 28px;
  height: 24px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #a78bfa;
  font-size: 0.8rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  padding: 0;
  border-radius: 2px;
}

.waveform-item:hover .waveform-download-btn {
  opacity: 1;
}

.waveform-download-btn:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}

.waveform-download-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Shift download button left when a delete button is also present */
.waveform-item:has(.waveform-delete) .waveform-download-btn {
  right: 40px;
}

/* ---------------------------------------------------------------
   Per-track share button — sits left of the download button on
   the play.html viewer; opens the Create Review Link modal.
--------------------------------------------------------------- */
.waveform-share-btn {
  position: absolute;
  top: 4px;
  right: 40px;
  width: 28px;
  height: 24px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(139, 92, 246, 0.5);
  color: #a78bfa;
  font-size: 0.85rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
  padding: 0;
  border-radius: 2px;
}

.waveform-item:hover .waveform-share-btn {
  opacity: 1;
}

.waveform-share-btn:hover {
  background: rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}

/* Push share further left when a delete button is present (download already
   shifted to right: 40px in that case). */
.waveform-item:has(.waveform-delete) .waveform-share-btn {
  right: 72px;
}

/* ---------------------------------------------------------------
   Supervisor mode: new track submission notification banner
--------------------------------------------------------------- */
#newTracksNotification {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.5);
  border-left: 4px solid #8b5cf6;
  margin-bottom: 1rem;
}

#newTracksNotification.hidden {
  display: none;
}

#newTracksMessage {
  flex: 1;
  color: #a78bfa;
  font-weight: 500;
  font-size: 0.9rem;
}

#reloadForNewTracks {
  background: #8b5cf6;
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  flex-shrink: 0;
}

#reloadForNewTracks:hover {
  background: #7c3aed;
}

#dismissNewTracks {
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  min-width: auto;
  flex-shrink: 0;
}

/* -----------------------------------------------------------------------
   Supervisor Review Mode: ratings, shortlist, notes (owner only)
   ----------------------------------------------------------------------- */

.supervisor-review-controls {
  position: absolute;
  bottom: 4px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 6;
  pointer-events: auto;
}

/* Hide on inactive tracks, show on hover */
.waveform-item.inactive .supervisor-review-controls {
  opacity: 0;
  transition: opacity 0.2s;
}
.waveform-item.inactive:hover .supervisor-review-controls {
  opacity: 1;
}

/* Star ratings — RTL trick for CSS-only hover preview */
.review-stars {
  display: flex;
  direction: rtl;
  gap: 2px;
}

.review-star {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
  user-select: none;
  line-height: 1;
}

.review-star.active {
  color: #f59e0b;
}

/* Hover preview: dim all, then light up hovered + siblings after it (visually = before, due to RTL) */
.review-stars:hover .review-star {
  color: rgba(255, 255, 255, 0.2);
}
.review-stars .review-star:hover,
.review-stars .review-star:hover ~ .review-star {
  color: #f59e0b !important;
}
.review-stars .review-star:hover {
  transform: scale(1.2);
}

/* Shortlist toggle */
.review-shortlist-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  transition: all 0.15s;
  line-height: 1;
  min-width: auto;
}
.review-shortlist-btn:hover {
  border-color: #f59e0b;
  color: #f59e0b;
}
.review-shortlist-btn.shortlisted {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
}

/* Notes button */
.review-notes-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 6px;
  transition: all 0.15s;
  line-height: 1;
  min-width: auto;
}
.review-notes-btn:hover {
  border-color: var(--accent, #60a5fa);
  background: rgba(96, 165, 250, 0.1);
}

/* Review filter bar */
#reviewFilterBar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 8px 14px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 6px;
  margin-top: 6px;
  font-size: 0.85rem;
}
#reviewFilterBar.hidden { display: none; }

.review-filter-count {
  color: #f59e0b;
  font-weight: 600;
  flex: 1;
}

/* -----------------------------------------------------------------------
   Mode Selection Popup
   ----------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

/* Mode-select overlay: blur the page underneath so the dropzone /
   project page reads as out-of-focus context. ~85% blur. */
#modeSelectOverlay {
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(20px);
          backdrop-filter: blur(20px);
}

.modal-overlay.hidden {
  display: none;
}

.mode-select-modal {
  position: relative;
  background: var(--background, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 2rem;
  max-width: 680px;
  width: 90%;
  text-align: center;
}

.mode-select-modal h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.mode-select-options {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.mode-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  color: var(--text, #e2e8f0);
}

.mode-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent, #94a3b8);
}

.mode-icon {
  font-size: 2rem;
}

.mode-title {
  font-weight: 600;
  font-size: 1rem;
}

.mode-desc {
  font-size: 0.8rem;
  color: var(--muted, #94a3b8);
  line-height: 1.4;
}

/* -----------------------------------------------------------------------
   Cut Bars (Cut Sharing)
   ----------------------------------------------------------------------- */

#cutContainer {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cut-item {
  width: 100%;
  background: linear-gradient(to bottom, var(--waveform-bg) 0%, var(--waveform-bg-mid) 50%, var(--waveform-bg) 100%);
  overflow: hidden;
  cursor: pointer;
  transition: height 0.3s ease, opacity 0.3s ease, background 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
}

/* Per-cut colour tint — matches the waveform per-track palette */
.cut-item[style*="--track-color"] {
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--track-color) 12%, var(--waveform-bg)) 0%,
    color-mix(in srgb, var(--track-color) 18%, var(--waveform-bg-mid)) 50%,
    color-mix(in srgb, var(--track-color) 12%, var(--waveform-bg)) 100%);
}

.cut-item.active {
  height: 80px;
  background: linear-gradient(to bottom, var(--waveform-active-bg) 0%, var(--waveform-active-bg-mid) 50%, var(--waveform-active-bg) 100%);
}

.cut-item.active[style*="--track-color"] {
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--track-color) 18%, var(--waveform-active-bg)) 0%,
    color-mix(in srgb, var(--track-color) 25%, var(--waveform-active-bg-mid)) 50%,
    color-mix(in srgb, var(--track-color) 18%, var(--waveform-active-bg)) 100%);
}

/* Read-only cut description (viewer-side): subtle muted quote */
.cut-description-readonly {
  cursor: default;
}
.cut-description-readonly:focus {
  border-bottom-color: transparent;
}

.cut-item.inactive {
  height: 40px;
  opacity: 0.7;
}

.cut-item.inactive:hover {
  opacity: 0.7;
}

.cut-thumbnail {
  flex-shrink: 0;
  width: 70px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.cut-item.active .cut-thumbnail {
  width: 100px;
  height: 56px;
}

.cut-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cut-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text, #e2e8f0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  outline: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.cut-label:focus {
  border-bottom-color: var(--accent, #94a3b8);
}

.cut-item.active .cut-label {
  color: var(--accent, #94a3b8);
}

.cut-description {
  flex: 1;
  font-size: 0.8rem;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.cut-description:empty::before {
  content: attr(data-placeholder);
  color: rgba(148, 163, 184, 0.4);
}

.cut-description:focus {
  border-bottom-color: var(--accent, #94a3b8);
  white-space: normal;
}

.cut-item.active .cut-description {
  white-space: normal;
}

.cut-size {
  font-size: 0.75rem;
  color: var(--muted, #94a3b8);
  white-space: nowrap;
  margin-left: auto;
}

.cut-drag-handle {
  cursor: grab;
  color: var(--muted, #94a3b8);
  font-size: 1rem;
  opacity: 0.4;
  flex-shrink: 0;
  user-select: none;
}

.cut-drag-handle:hover {
  opacity: 0.8;
}

.cut-item.dragging {
  opacity: 0.4;
}

.cut-item.drag-over {
  border-top: 2px solid var(--accent, #94a3b8);
}

/* Fold/unfold toggle on player page */
.cut-fold-btn {
  cursor: pointer;
  font-size: 0.6rem;
  color: var(--muted, #94a3b8);
  flex-shrink: 0;
  padding: 4px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.cut-fold-btn:hover {
  opacity: 1;
}

.cut-item.folded {
  height: 24px;
  opacity: 0.5;
  gap: 0.4rem;
  padding: 0 0.75rem;
}

.cut-item.folded .cut-thumbnail,
.cut-item.folded .cut-description,
.cut-item.folded .cut-size {
  display: none;
}

.cut-item.folded .cut-label {
  font-size: 0.75rem;
  font-weight: 400;
}

/* ---------------------------------------------------------------------------
   Presentation Mode — minimal viewer for video versions
   ---------------------------------------------------------------------------
   Horizontal thumbnail row sitting where the waveforms / cut bar usually go.
   Each tile is a small auto-framed video preview with the version's filename
   below. Click a tile to load it into the main viewer above.
---------------------------------------------------------------------------- */

.presentation-thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem;
  align-items: flex-start;
}

.presentation-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 160px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.4rem;
  border-radius: 8px;
  border: 2px solid transparent;
  background: color-mix(in srgb, var(--badge-presentation) 6%, transparent);
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.presentation-thumb:hover {
  background: color-mix(in srgb, var(--badge-presentation) 12%, transparent);
  transform: translateY(-1px);
}

.presentation-thumb.active {
  border-color: var(--badge-presentation);
  background: color-mix(in srgb, var(--badge-presentation) 18%, transparent);
}

.presentation-thumb-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
}

.presentation-thumb-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.presentation-thumb-label {
  font-size: 0.78rem;
  color: var(--text);
  text-align: center;
  letter-spacing: 0.01em;
  /* Allow long filenames to wrap onto multiple lines rather than
     ellipsis-truncating — reviewers need to be able to tell the
     versions apart. */
  word-break: break-word;
  line-height: 1.3;
}

.presentation-thumb.active .presentation-thumb-label {
  color: var(--badge-presentation);
  font-weight: 600;
}

/* Owner-only delete button — appears in the top-right of each tile on hover */
.presentation-thumb-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.presentation-thumb:hover .presentation-thumb-delete {
  opacity: 1;
}

.presentation-thumb-delete:hover {
  background: var(--danger);
}

/* + Add Video tile at the end of the row — owner-only */
.presentation-thumb-add {
  flex: 0 0 auto;
  width: 160px;
  aspect-ratio: 16 / 9;
  margin-top: 0.4rem;
  border: 2px dashed color-mix(in srgb, var(--text) 30%, transparent);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.presentation-thumb-add:hover {
  border-color: var(--badge-presentation);
  color: var(--badge-presentation);
  background: color-mix(in srgb, var(--badge-presentation) 6%, transparent);
}

.presentation-thumb-add span:first-child {
  font-size: 1.4rem;
  line-height: 1;
}

.presentation-thumb-add-label {
  font-size: 0.75rem;
}

/* Download button — bottom-right of the thumbnail frame, hover-revealed.
   Lets secondaries / tertiaries grab the file. Sits opposite the
   comment-count pill (bottom-left) for visual balance. */
.presentation-thumb-download {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.presentation-thumb:hover .presentation-thumb-download {
  opacity: 1;
}

.presentation-thumb-download:hover {
  background: var(--badge-presentation);
}

.presentation-thumb-download:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Per-video comment-count pill — sits in the bottom-left of the thumbnail
   frame. Mirrors the WhatsApp-style round-tab badge: only shown when the
   video has at least one note. */
.presentation-thumb-count {
  position: absolute;
  bottom: 4px;
  left: 4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--badge-presentation);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  letter-spacing: 0.02em;
}

/* Immersive playback — cinema-style auto-hide of every panel except
   the top header and the video viewer. JS adds .presentation-playback-active
   to <body> after 1s of stillness during playback; mouse movement removes
   it and re-arms the timer. Pausing clears it.
   #playerHeader covers both the project title AND the per-video size /
   fullscreen controls in one node. */
body.presentation-playback-active #playerHeader,
body.presentation-playback-active #presentationThumbRow,
body.presentation-playback-active #controls,
body.presentation-playback-active #transportRow,
body.presentation-playback-active #comments,
body.presentation-playback-active footer.site-footer {
  opacity: 0;
  pointer-events: none;
}

/* Smooth fade for the affected elements. Scoped to body.presentation-mode
   so other modes don't pick up the transition unnecessarily. */
body.presentation-mode #playerHeader,
body.presentation-mode #presentationThumbRow,
body.presentation-mode #controls,
body.presentation-mode #transportRow,
body.presentation-mode #comments,
body.presentation-mode footer.site-footer {
  transition: opacity 0.4s ease;
}

/* Hide the cursor over the page during immersive playback — returns
   immediately on mousemove because the JS handler removes the class. */
body.presentation-playback-active {
  cursor: none;
}

/* Match the progress bar + transport row width to the video viewer.
   The video sits inside #videoContainer at .video-size-{25,50,75,100};
   sibling selectors propagate that width to the controls below so the
   scrub bar lines up with the video edges instead of running full-width. */
body.presentation-mode #videoContainer.video-size-25 ~ #controls,
body.presentation-mode #videoContainer.video-size-25 ~ #transportRow {
  max-width: 25%;
  margin-left: auto;
  margin-right: auto;
}
body.presentation-mode #videoContainer.video-size-50 ~ #controls,
body.presentation-mode #videoContainer.video-size-50 ~ #transportRow {
  max-width: 50%;
  margin-left: auto;
  margin-right: auto;
}
body.presentation-mode #videoContainer.video-size-75 ~ #controls,
body.presentation-mode #videoContainer.video-size-75 ~ #transportRow {
  max-width: 75%;
  margin-left: auto;
  margin-right: auto;
}

/* ---------------------------------------------------------------------------
   Settings page
---------------------------------------------------------------------------- */
#settings {
  max-width: 600px;
  margin: 0 auto;
}

#settingsHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

#settingsHeader h2 {
  margin: 0;
}

.settings-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.light-mode .settings-group {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.settings-group h3 {
  color: var(--accent);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin: 0 0 0.75rem 0;
}

.settings-group label {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.settings-group input[type="text"],
.settings-group input[type="email"],
.settings-group select {
  display: block;
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.5rem 0.6rem;
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 0.25rem;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}

.settings-group input:focus,
.settings-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.toggle-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* ── Theme light/dark slider switch ──────────────────────────────────── */
.theme-switch {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.theme-switch-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.2s;
  user-select: none;
}
.theme-switch-label[data-mode="light"] { color: var(--text); }
.theme-switch-label[data-mode="dark"]  { color: var(--muted); }
html.light-mode .theme-switch-label[data-mode="light"] { color: var(--text); }
html.light-mode .theme-switch-label[data-mode="dark"]  { color: var(--muted); }
html:not(.light-mode) .theme-switch-label[data-mode="light"] { color: var(--muted); }
html:not(.light-mode) .theme-switch-label[data-mode="dark"]  { color: var(--text); }

.theme-slider {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}
.theme-slider input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.theme-slider-track {
  position: absolute;
  inset: 0;
  background: var(--primary);
  border-radius: 12px;
  transition: background 0.25s;
}
.theme-slider-track::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
}
.theme-slider input:checked + .theme-slider-track::before {
  transform: translateX(20px);
}

.email-change-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.3rem;
}

.email-change-row input {
  flex: 1;
  margin-top: 0 !important;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

#saveStatus {
  font-size: 0.85rem;
}

.settings-danger-zone {
  border-bottom: none;
  margin-top: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(239, 68, 68, 0.25);
}

.settings-danger-zone h3 {
  color: #ef4444 !important;
}

/* Light mode — fix hardcoded dark backgrounds */
.light-mode section {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.light-mode .waveform-label {
  background: rgba(255, 255, 255, 0.9);
  color: #1e293b;
  text-shadow: none;
}

.light-mode .waveform-item.active .waveform-label {
  background: var(--accent);
  color: #000;
}

.light-mode #headerBar {
  background: var(--surface);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.light-mode .account-menu-btn:hover {
  border-color: rgba(0,0,0,0.12);
  background: rgba(0,0,0,0.03);
}
.light-mode .account-menu-dropdown {
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.light-mode .account-menu-dropdown a:hover,
.light-mode .account-menu-dropdown button:hover {
  background: rgba(0,0,0,0.04);
}
.light-mode .account-menu-dropdown hr {
  border-top-color: rgba(0,0,0,0.08);
}

.light-mode button.secondary {
  border-color: var(--muted);
}

.light-mode .project-card {
  background: var(--surface);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .page-label {
  border-color: rgba(0, 0, 0, 0.12);
}
.light-mode .overflow-btn {
  border-color: rgba(0, 0, 0, 0.12);
}
.light-mode .overflow-dropdown {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.light-mode .overflow-dropdown button:hover {
  background: rgba(0, 0, 0, 0.04);
}

.light-mode .share-setting-suggestion-value {
  background: rgba(59, 130, 246, 0.1);
}
.light-mode .share-bar {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}
.light-mode .approve-btn {
  color: #059669;
  border-color: rgba(5, 150, 105, 0.3);
}
.light-mode .approve-btn:hover {
  background: rgba(5, 150, 105, 0.08);
  color: #047857;
  border-color: rgba(5, 150, 105, 0.5);
}

.light-mode .modal-content {
  background: var(--surface);
}

/* ═══════════════════════════════════════════════════════════════════════════
   NODAL CANVAS (nodal.html)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Canvas page body — no scroll, no padding */
body:has(#drawflowCanvas) {
  padding: 0;
  overflow: hidden;
}
body:has(#drawflowCanvas) #headerBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--background);
  padding: 0.25rem 1rem;
  margin-bottom: 0;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
}
body:has(#drawflowCanvas) .site-footer {
  display: none;
}

/* Canvas toolbar — sits between header and canvas; top set by JS after header measured */
#canvasToolbar {
  position: fixed;
  left: 0;
  right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  background: var(--surface, #111128);
  border-bottom: 1px solid #333;
  z-index: 19;
}

/* Canvas fills viewport below header + toolbar; top/height set by JS after header measured */
#drawflowCanvas {
  position: fixed;
  left: 0;
  width: 100%;
  background: var(--background, #0d0d1a);
  overflow: hidden;
  z-index: 1;
  touch-action: none;  /* Prevent browser gestures interfering with Drawflow pan */
  outline: none;
}

/* Drawflow precanvas — the inner element that gets transformed for zoom/pan */
#drawflowCanvas .drawflow {
  width: 100%;
  height: 100%;
  position: relative;    /* Anchor for absolutely-positioned child nodes */
  user-select: none;     /* Prevent text selection during drag */
  background-color: transparent;
  background-image: radial-gradient(circle, #2a2a4a 1px, transparent 1px);
  background-size: 30px 30px;
}

/* Node container — Drawflow's CSS is blocked by CSP (no unpkg.com in style-src),
   so we must provide ALL critical positioning styles ourselves. */
.drawflow .drawflow-node {
  position: absolute !important;  /* CRITICAL — without this, left/top have no effect */
  display: flex !important;
  align-items: center !important;
  z-index: 2 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  min-width: auto !important;
  padding: 0 !important;
  min-height: auto !important;
  width: auto !important;
  height: auto !important;
  cursor: move !important;
}

/* Drawflow delete button (hidden — we use our own context menu) */
.drawflow .drawflow-node .drawflow-delete { display: none !important; }

/* Drawflow content wrapper */
.drawflow .drawflow_content_node { width: 100%; }

/* Connection ports (input/output circles) */
.drawflow .drawflow-node .input,
.drawflow .drawflow-node .output {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent, #6c63ff);
  border: 2px solid var(--background, #0d0d1a);
  cursor: crosshair;
}
.drawflow .drawflow-node .output { right: -7px; }
.drawflow .drawflow-node .input { left: -7px; }

/* Connection wires — SVG lines between nodes */
.drawflow .connection .main-path {
  stroke: var(--accent, #6c63ff);
  stroke-width: 2.5;
  opacity: 0.5;
  fill: none;
}
.drawflow .connection .main-path:hover {
  stroke-width: 4;
  opacity: 0.9;
}

/* Ghost wire — dashed and faint until the + button is hovered/active */
.drawflow .connection.connection-ghost .main-path {
  stroke-dasharray: 8 6;
  opacity: 0.15;
  transition: opacity 0.25s, stroke-dasharray 0.25s;
}
.drawflow .connection.connection-ghost.connection-active .main-path {
  stroke-dasharray: none;
  opacity: 0.6;
}

/* Selected node highlight */
.drawflow .drawflow-node.selected .node-project,
.drawflow .drawflow-node.selected .node-collection {
  box-shadow: 0 0 0 2px var(--accent, #6c63ff);
}

/* Multi-selected node highlight (lasso) */
.drawflow-node.multi-selected .node-project,
.drawflow-node.multi-selected .node-collection,
.drawflow-node.multi-selected .node-variation,
.drawflow-node.multi-selected .node-group {
  box-shadow: 0 0 0 2px var(--accent, #6c63ff);
  outline: 2px dashed var(--accent, #6c63ff);
  outline-offset: 3px;
}

/* Lasso selection rectangle */
#lassoRect {
  position: fixed;
  border: 1.5px dashed var(--accent, #6c63ff);
  background: rgba(108, 99, 255, 0.08);
  z-index: 50;
  pointer-events: none;
}

/* Group context menu header */
.context-menu-header {
  padding: 6px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted, #bbb);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Media Tray ── */
.media-tray {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 260px;
  max-height: 300px;
  z-index: 35;
  background: rgba(17, 17, 40, 0.95);
  border: 1px solid #333;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(8px);
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.media-tray.collapsed {
  max-height: 38px;
}
.tray-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 8px 12px;
  border-bottom: 1px solid #333;
  cursor: pointer;
  flex-shrink: 0;
}
.tray-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #ccc;
  flex: 1;
}
.tray-count {
  font-size: 0.65rem;
  background: #333;
  color: #aaa;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 16px;
  text-align: center;
}
.tray-collapse {
  background: none;
  border: none;
  color: #aaa;
  font-size: 0.6rem;
  cursor: pointer;
  padding: 2px;
  transition: transform 0.25s;
}
.media-tray.collapsed .tray-collapse { transform: rotate(-90deg); }
.tray-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tray-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 6px 8px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}
.tray-filters {
  display: flex;
  gap: 2px;
  flex: 1;
}
.tray-filter {
  background: none;
  border: 1px solid #333;
  color: #bbb;
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
}
.tray-filter.active {
  background: var(--accent, #6c63ff);
  color: #fff;
  border-color: var(--accent, #6c63ff);
}
.tray-sort {
  background: #1a1a2e;
  border: 1px solid #333;
  color: #aaa;
  font-size: 0.6rem;
  padding: 2px 4px;
  border-radius: 3px;
}
.tray-file-list {
  overflow-y: auto;
  max-height: calc(100vh - 320px);
  padding: 4px 0;
}
.tray-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: grab;
  border-bottom: 1px solid #1a1a2e;
  transition: background 0.15s;
  position: relative;
}
.tray-file-item:hover { background: rgba(255,255,255,0.03); }
.tray-file-item.selected { background: rgba(var(--accent-rgb, 108,99,255), 0.15); outline: 1px solid var(--accent, #6c63ff); outline-offset: -1px; }
.tray-file-item.selected:hover { background: rgba(var(--accent-rgb, 108,99,255), 0.22); }
.tray-file-item.dragging { opacity: 0.4; }
.tray-file-item.uploading { opacity: 0.6; }
.tray-select-bar { display: flex; align-items: center; gap: 8px; padding: 4px 10px; font-size: 12px; color: var(--muted, #bbb); border-bottom: 1px solid #1a1a2e; }
.tray-select-bar button { background: none; border: none; color: var(--accent, #6c63ff); cursor: pointer; font-size: 12px; padding: 0; }
.tray-select-bar button:hover { text-decoration: underline; }
.tray-drag-ghost { position: fixed; top: -200px; left: -200px; background: var(--accent, #6c63ff); color: #fff; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; pointer-events: none; z-index: 9999; white-space: nowrap; }
.tray-file-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tray-file-icon svg { width: 16px; height: 16px; }
.tray-file-icon.audio svg { color: #4fc3f7; }
.tray-file-icon.video svg { color: #ab47bc; }
.tray-file-icon.attachment svg { color: #aaa; }
.tray-file-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.tray-file-name {
  font-size: 0.72rem;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tray-file-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}
.tray-quality-badge {
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0px 4px;
  border-radius: 2px;
}
.tray-quality-badge.master { background: #1b5e20; color: #a5d6a7; }
.tray-quality-badge.review { background: #4a3800; color: #ffd54f; }
.tray-file-size {
  font-size: 0.55rem;
  color: #aaa;
}
.tray-file-assignments {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
}
.tray-assign-check {
  width: 16px;
  height: 16px;
  color: var(--accent, #6c63ff);
  cursor: pointer;
}
.tray-assign-tooltip {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: #222;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 4px 0;
  z-index: 50;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.tray-file-assignments:hover .tray-assign-tooltip { display: block; }
.tray-assign-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  font-size: 0.65rem;
  color: #ccc;
}
.tray-assign-entry:hover { background: #2a2a4a; }
.tray-assign-remove {
  background: none;
  border: none;
  color: #f55;
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0 2px;
}
.tray-file-remove {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.tray-file-item:hover .tray-file-remove { opacity: 1; }
.tray-file-remove:hover { color: #f55; }
.tray-upload-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
}
.tray-progress-bar {
  height: 100%;
  background: var(--accent, #6c63ff);
  transition: width 0.2s;
  border-radius: 0 0 6px 6px;
}

/* ── Tray player (audio preview in media tray) ─────────────────────────── */
.tray-player {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 6px 10px 8px;
}
.tray-player.hidden { display: none; }
.tray-player-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tray-play-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: var(--accent, #6c63ff);
  color: #fff;
  font-size: 0.65rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}
.tray-play-btn:hover { filter: brightness(1.15); }
.tray-player-name {
  flex: 1;
  min-width: 0;
  font-size: 0.7rem;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tray-player-time {
  font-size: 0.65rem;
  color: #bbb;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tray-playback-track {
  margin-top: 5px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.tray-playback-track:hover { background: rgba(255,255,255,0.12); }
.tray-playback-fill {
  height: 100%;
  width: 0%;
  background: var(--accent, #6c63ff);
  border-radius: 2px;
  transition: width 0.15s linear;
  pointer-events: none;
}

/* Tray crossfader */
.tray-crossfader-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 6px;
  padding: 0 2px;
}
.tray-crossfader-row.hidden { display: none; }
.tray-crossfader-row .crossfader-label {
  font-size: 0.6rem;
}
#trayCrossfader {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--accent) 0%, var(--muted) 100%);
  border-radius: 2px;
  cursor: pointer;
}
#trayCrossfader::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: none;
  border: none;
  border-top: 2.5px solid var(--text);
  border-right: 2.5px solid var(--text);
  rotate: 45deg;
  cursor: pointer;
}
#trayCrossfader::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: none;
  border: none;
  border-top: 2.5px solid var(--text);
  border-right: 2.5px solid var(--text);
  rotate: 45deg;
  cursor: pointer;
  border-radius: 0;
}

/* Permanent subtle drag hint — bottom-centre, always visible inside a project */
.drag-hint-permanent {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  color: #444;
  font-size: 0.75rem;
  pointer-events: none;
  letter-spacing: 0.02em;
}

/* Full-canvas drop overlay — shown when dragging files */
.canvas-drop-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: rgba(13, 13, 26, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border: 3px dashed var(--accent, #6c63ff);
  border-radius: 0;
}
/* .hidden with !important handles this globally */
.canvas-drop-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #ccc;
  font-size: 1.2rem;
  font-weight: 500;
}
.canvas-drop-message svg { color: var(--accent, #6c63ff); }

/* Node drop label — floats above a node during drag-over */
.node-drop-label {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent, #6c63ff);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 60;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Light mode overrides */
.light-mode .media-tray { background: rgba(250, 250, 250, 0.95); border-color: #ddd; }
.light-mode .tray-header { border-bottom-color: #e0e0e0; }
.light-mode .tray-title { color: #333; }
.light-mode .tray-count { background: #e0e0e0; color: #666; }
.light-mode .tray-controls { border-bottom-color: #eee; }
.light-mode .tray-filter { border-color: #ccc; color: #666; }
.light-mode .tray-sort { background: #fff; border-color: #ccc; color: #333; }
.light-mode .tray-file-item { border-bottom-color: #f0f0f0; }
.light-mode .tray-file-item:hover { background: rgba(0,0,0,0.02); }
.light-mode .tray-file-item.selected { background: rgba(var(--accent-rgb, 108,99,255), 0.08); }
.light-mode .tray-file-item.selected:hover { background: rgba(var(--accent-rgb, 108,99,255), 0.14); }
.light-mode .tray-select-bar { border-bottom-color: #eee; }
.light-mode .tray-file-name { color: #333; }
.light-mode .tray-assign-tooltip { background: #fff; border-color: #ddd; }
.light-mode .tray-assign-entry { color: #333; }
.light-mode .drag-hint-permanent { color: #aaa; }
.light-mode .canvas-drop-overlay { background: rgba(255,255,255,0.75); border-color: var(--accent); }
.light-mode .canvas-drop-message { color: #333; }

/* (Canvas toolbar defined above with body:has rules) */
.toolbar-btn {
  background: #222;
  color: #ccc;
  border: 1px solid #333;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.toolbar-btn:hover { background: #2a2a4a; color: #fff; border-color: #999; }
.toolbar-btn.primary-btn { background: var(--accent, #6c63ff); color: #fff; border-color: var(--accent, #6c63ff); }
.toolbar-btn.primary-btn:hover { opacity: 0.85; }
.toolbar-separator { width: 1px; height: 24px; background: #333; margin: 0 0.25rem; }
.toolbar-search {
  background: #1a1a2e;
  border: 1px solid #333;
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.75rem;
  width: 180px;
  outline: none;
}
.toolbar-search:focus { border-color: var(--accent, #6c63ff); }
.toolbar-search::placeholder { color: #999; }
.toolbar-spacer { flex: 1; }

/* Empty state */
#emptyState {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  z-index: 5;
  pointer-events: none;
}

/* --- Node cards --- */
.node-project, .node-collection {
  border-radius: 10px;
  padding: 0.75rem 1rem;
  cursor: grab;
  transition: box-shadow 0.2s;
  font-family: inherit;
}
.node-project:active, .node-collection:active {
  cursor: grabbing;
}
.node-project {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  min-width: 240px;
  max-width: 280px;
  cursor: pointer;
}
.node-collection {
  background: #151528;
  border: 1px solid #252548;
  min-width: 180px;
  max-width: 220px;
}
.node-project:hover, .node-collection:hover {
  box-shadow: 0 0 0 1px var(--accent, #6c63ff);
}

/* Node header */
.node-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}
.node-mode {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #ccc;
}
.node-phase {
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badges */
.node-badge {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 3px;
}
.node-badge-draft { background: #f59e0b22; color: #f59e0b; }
.node-badge-password { font-size: 0.65rem; }

/* Name */
.node-name {
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  outline: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.node-name[contenteditable="true"] {
  border-bottom-color: var(--accent, #6c63ff);
}
.node-collection .node-name { font-size: 0.8rem; }

/* Stats + date */
.node-stats {
  color: #bbb;
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
}
.node-date {
  color: #999;
  font-size: 0.6rem;
  margin-bottom: 0.5rem;
}
.node-collection .node-stats { font-size: 0.65rem; }

/* Node action buttons */
.node-actions {
  display: flex;
  gap: 0.35rem;
}
.node-btn {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
}
.node-btn:hover { opacity: 0.8; }
.node-btn-open { background: rgba(255,255,255,0.15); color: #eee; border: 1px solid rgba(255,255,255,0.2); font-weight: 500; }
.node-btn-copy { background: rgba(255,255,255,0.15); color: #eee; border: 1px solid rgba(255,255,255,0.2); font-weight: 500; }

/* Context menu */
.context-menu {
  position: fixed;
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 4px;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  min-width: 140px;
}
.context-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: #ccc;
  padding: 6px 12px;
  text-align: left;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}
.context-menu button:hover { background: #2a2a4a; color: #fff; }

/* --- Light mode overrides --- */
.light-mode #drawflowCanvas { background: #f5f5f5; }
.light-mode #drawflowCanvas .drawflow {
  background-image: radial-gradient(circle, #ccc 1px, transparent 1px);
}
.light-mode #canvasToolbar { background: #fff; border-bottom-color: #ddd; }
.light-mode .toolbar-btn { background: #eee; color: #333; border-color: #ccc; }
.light-mode .toolbar-btn:hover { background: #ddd; }
.light-mode .toolbar-search { background: #fff; border-color: #ccc; color: #333; }
.light-mode .toolbar-search::placeholder { color: #999; }
.light-mode .node-project { background: #fff; border-color: #ddd; }
.light-mode .node-collection { background: #fafafa; border-color: #e0e0e0; }
.light-mode .node-name { color: #111; }
.light-mode .node-stats { color: #666; }
.light-mode .node-date { color: #999; }
.light-mode .node-btn-copy { background: #eee; color: #333; }
.light-mode .context-menu { background: #fff; border-color: #ddd; }
.light-mode .context-menu button { color: #333; }
.light-mode .context-menu button:hover { background: #f0f0f0; }
.light-mode .drawflow .drawflow-node .input,
.light-mode .drawflow .drawflow-node .output { border-color: #fff; }
.light-mode .drawflow .connection .main-path { stroke: var(--accent, #6c63ff); }

/* ═══════════════════════════════════════════════════════════════════════════
   DETAIL PANEL (slides in from right when project node is clicked)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Panel tab — small vertical strip visible when panel is closed */
.detail-panel-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 31;
  background: #111128;
  border: 1px solid #333;
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 6px;
  cursor: pointer;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  color: #bbb;
  font-size: 0.7rem;
  font-family: inherit;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}
.detail-panel-tab:hover {
  background: #1a1a3a;
  color: var(--accent, #6c63ff);
  padding-right: 10px;
}
.light-mode .detail-panel-tab { background: #fafafa; border-color: #ddd; color: #999; }
.light-mode .detail-panel-tab:hover { background: #f0f0f0; color: var(--accent, #6c63ff); }

.detail-panel {
  position: fixed;
  top: 92px;
  right: 0;
  width: 380px;
  bottom: 332px; /* leave space for media tray (300px + 16px margin + 16px gap) */
  background: #111128;
  border-left: 1px solid #333;
  z-index: 30;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow: hidden;
}
.detail-panel.open {
  transform: translateX(0);
}

/* When panel is open, canvas shrinks */
#drawflowCanvas.panel-open {
  width: calc(100% - 380px) !important;
}

.detail-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}
.detail-panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 0.5rem;
}
.detail-panel-close {
  background: none;
  border: none;
  color: #bbb;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.detail-panel-close:hover {
  background: #2a2a4a;
  color: #fff;
}

.detail-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Collapsible sections */
.detail-section {
  border-bottom: 1px solid #222;
}
.detail-section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: none;
  border: none;
  color: #ccc;
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.detail-section-header:hover {
  background: #1a1a3a;
}
.detail-section-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s;
  display: inline-block;
  width: 12px;
}
.detail-section.expanded .detail-section-chevron {
  transform: rotate(90deg);
}
.detail-section-count {
  margin-left: auto;
  background: #2a2a4a;
  color: #bbb;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}

.detail-section-body {
  display: none;
  padding: 0 1rem 0.75rem;
}
.detail-section.expanded .detail-section-body {
  display: block;
}
.detail-empty {
  color: #999;
  font-size: 0.75rem;
  font-style: italic;
  margin: 0;
  padding: 0.5rem 0;
}

/* Comment rows */
.detail-comment {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #1a1a2e;
}
.detail-comment:last-child { border-bottom: none; }

.detail-comment-frame {
  width: 80px;
  height: 45px;
  border-radius: 4px;
  background: #1a1a2e;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.detail-comment-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* Shimmer loading placeholder */
.detail-comment-frame.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #1a1a2e 0%, #252548 50%, #1a1a2e 100%);
  background-size: 200% 100%;
  animation: detailShimmer 1.5s infinite;
}
@keyframes detailShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.detail-comment-frame .audio-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.2rem;
  color: #999;
}

.detail-comment-body {
  flex: 1;
  min-width: 0;
}
.detail-comment-meta {
  font-size: 0.65rem;
  color: #bbb;
  margin-bottom: 2px;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.detail-comment-meta .timecode {
  color: var(--accent, #6c63ff);
  font-weight: 600;
  font-family: monospace;
}
.detail-comment-text {
  font-size: 0.75rem;
  color: #ddd;
  line-height: 1.35;
}

/* File rows */
.detail-file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.75rem;
  color: #ccc;
}
.detail-file-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}
.detail-file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-file-by {
  color: #aaa;
  font-size: 0.65rem;
  flex-shrink: 0;
}

/* Approval rows */
.detail-approval {
  padding: 0.4rem 0;
  border-bottom: 1px solid #1a1a2e;
}
.detail-approval:last-child { border-bottom: none; }
.detail-approval-track {
  font-size: 0.75rem;
  color: #ddd;
  font-weight: 500;
}
.detail-approval-info {
  font-size: 0.65rem;
  color: #bbb;
  margin-top: 2px;
}
.detail-approval-notes {
  font-size: 0.7rem;
  color: #aaa;
  margin-top: 3px;
  font-style: italic;
}

/* Share rows */
.detail-share {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #1a1a2e;
}
.detail-share:last-child { border-bottom: none; }
.detail-share-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.detail-share-badge {
  font-size: 0.55rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.detail-share-badge.review { background: #3b82f622; color: #60a5fa; }
.detail-share-badge.sent-mix { background: #f59e0b22; color: #fbbf24; }
.detail-share-info {
  flex: 1;
  min-width: 0;
}
.detail-share-name {
  font-size: 0.75rem;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail-share-meta {
  font-size: 0.6rem;
  color: #bbb;
}
.detail-share-open {
  background: #333;
  color: #ccc;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.6rem;
  cursor: pointer;
  flex-shrink: 0;
}
.detail-share-open:hover { background: #444; color: #fff; }
.detail-share-lock {
  background: none;
  border: none;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 2px 4px;
  opacity: 0.5;
  transition: opacity 0.2s;
  flex-shrink: 0;
}
.detail-share-lock:hover, .detail-share-lock.locked { opacity: 1; }
.detail-share-password {
  background: #0a0a1a;
  border-radius: 6px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.share-password-input {
  background: #111128;
  border: 1px solid #333;
  color: #ddd;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: monospace;
  width: 100%;
  box-sizing: border-box;
}
.share-password-suggestions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.share-pw-suggest {
  background: #1a1a3a;
  color: #bbb;
  font-size: 0.6rem;
  font-family: monospace;
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.15s;
}
.share-pw-suggest:hover { background: var(--accent, #6c63ff); color: #fff; }
.share-password-actions {
  display: flex;
  gap: 6px;
}
.share-pw-save, .share-pw-remove {
  flex: 1;
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  font-size: 0.65rem;
  cursor: pointer;
  font-family: inherit;
}
.share-pw-save { background: var(--accent, #6c63ff); color: #fff; }
.share-pw-save:hover { opacity: 0.85; }
.share-pw-remove { background: #333; color: #aaa; }
.share-pw-remove:hover { background: #444; color: #fff; }
.light-mode .detail-share-password { background: #f0f0f0; }
.light-mode .share-password-input { background: #fff; border-color: #ddd; color: #111; }
.light-mode .share-pw-suggest { background: #e8e8e8; color: #666; }
.light-mode .share-pw-remove { background: #ddd; color: #666; }

/* ═══════════════════════════════════════════════════════════════════════════
   PLAYER LINK NODE (intermediate node — the shareable play.html link)
   ═══════════════════════════════════════════════════════════════════════════ */

.node-player-link {
  background: #131330;
  border: 1px solid #2a2a5a;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  min-width: 200px;
  max-width: 240px;
  cursor: grab;
  transition: box-shadow 0.2s;
  font-family: inherit;
}
.node-player-link:active { cursor: grabbing; }
.node-player-link:hover { box-shadow: 0 0 0 1px var(--accent, #6c63ff); }

.node-link-type {
  font-size: 0.55rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #6c63ff22;
  color: #a78bfa;
}

.node-link-status {
  font-size: 0.5rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: 4px;
}
.node-link-status.published { background: #10b98122; color: #34d399; }
.node-link-status.draft { background: #f59e0b22; color: #fbbf24; }

/* ═══════════════════════════════════════════════════════════════════════════
   DERIVED SHARE NODES (temporary nodes on canvas)
   ═══════════════════════════════════════════════════════════════════════════ */

.node-derived-share {
  background: #151530;
  border: 1px solid #2a2a4a;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  min-width: 200px;
  max-width: 240px;
  cursor: grab;
  transition: box-shadow 0.2s;
  font-family: inherit;
}
.node-derived-share:active { cursor: grabbing; }
.node-derived-share:hover { box-shadow: 0 0 0 1px var(--accent, #6c63ff); }

.node-share-type {
  font-size: 0.55rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.node-share-type.review { background: #3b82f622; color: #60a5fa; }
.node-share-type.sent-mix { background: #f59e0b22; color: #fbbf24; }

.node-share-creator {
  font-size: 0.6rem;
  color: #aaa;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOCUS MODE — hide unrelated nodes when a project is expanded
   ═══════════════════════════════════════════════════════════════════════════ */

.drawflow-node.focus-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.connection.focus-hidden-wire {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Exit focus button */
.exit-focus-btn {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 35;
  background: #1a1a2e;
  color: #ccc;
  border: 1px solid #444;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.exit-focus-btn:hover {
  background: #2a2a4a;
  color: #fff;
  border-color: var(--accent, #6c63ff);
}
/* .hidden with !important handles this globally */

/* --- Light mode overrides for detail panel + derived shares --- */
.light-mode .detail-panel { background: #fafafa; border-left-color: #ddd; }
.light-mode .detail-panel-header { border-bottom-color: #e0e0e0; }
.light-mode .detail-panel-header h3 { color: #111; }
.light-mode .detail-panel-close { color: #999; }
.light-mode .detail-panel-close:hover { background: #eee; color: #333; }
.light-mode .detail-section { border-bottom-color: #e8e8e8; }
.light-mode .detail-section-header { color: #333; }
.light-mode .detail-section-header:hover { background: #f0f0f0; }
.light-mode .detail-section-count { background: #e8e8e8; color: #666; }
.light-mode .detail-comment { border-bottom-color: #eee; }
.light-mode .detail-comment-frame { background: #e8e8e8; }
.light-mode .detail-comment-frame.loading::after {
  background: linear-gradient(90deg, #e8e8e8 0%, #f5f5f5 50%, #e8e8e8 100%);
  background-size: 200% 100%;
}
.light-mode .detail-comment-meta { color: #666; }
.light-mode .detail-comment-text { color: #333; }
.light-mode .detail-empty { color: #999; }
.light-mode .detail-file { color: #333; }
.light-mode .detail-file-by { color: #888; }
.light-mode .detail-approval { border-bottom-color: #eee; }
.light-mode .detail-approval-track { color: #111; }
.light-mode .detail-approval-info { color: #666; }
.light-mode .detail-approval-notes { color: #555; }
.light-mode .detail-share { border-bottom-color: #eee; }
.light-mode .detail-share-name { color: #111; }
.light-mode .detail-share-meta { color: #888; }
.light-mode .detail-share-open { background: #eee; color: #333; }
.light-mode .detail-share-open:hover { background: #ddd; }
.light-mode .node-player-link { background: #fff; border-color: #ddd; }
.light-mode .node-player-link:hover { box-shadow: 0 0 0 1px var(--accent, #6c63ff); }
.light-mode .node-link-type { background: #6c63ff11; color: #6c63ff; }
.light-mode .node-link-status.published { background: #10b98111; color: #059669; }
.light-mode .node-link-status.draft { background: #f59e0b11; color: #d97706; }
.light-mode .node-derived-share { background: #fff; border-color: #ddd; }
.light-mode .node-derived-share:hover { box-shadow: 0 0 0 1px var(--accent, #6c63ff); }
.light-mode .exit-focus-btn { background: #f5f5f5; color: #333; border-color: #ccc; }
.light-mode .exit-focus-btn:hover { background: #e8e8e8; border-color: var(--accent, #6c63ff); }

/* ═══════════════════════════════════════════════════════════════════════════
   VARIATION NODES (sub-group project nodes on canvas)
   ═══════════════════════════════════════════════════════════════════════════ */
.node-variation {
  background: #1a1530;
  border: 1px solid #3a2a6a;
  border-left: 3px solid var(--accent, #6c63ff);
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  min-width: 220px;
  max-width: 260px;
  cursor: pointer;
  transition: box-shadow 0.2s;
  font-family: inherit;
}
.node-variation:active { cursor: grabbing; }
.node-variation:hover { box-shadow: 0 0 0 1px var(--accent, #6c63ff); }
.node-variation .node-header { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.25rem; }
.node-variation .node-name { font-size: 0.8rem; font-weight: 600; color: #fff; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.node-variation .node-stats { font-size: 0.65rem; color: #bbb; margin-bottom: 0.4rem; }
.node-variation .node-actions { display: flex; gap: 0.35rem; }
.node-variation-mode {
  font-size: 0.55rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #6c63ff22;
  color: #a78bfa;
}

/* Mode-specific variation colours — dark mode */
.node-variation.mode-soundtrack { border-left-color: #6366f1; }
.node-variation.mode-soundtrack:hover { box-shadow: 0 0 0 1px #6366f1; }
.mode-soundtrack .node-variation-mode { background: #6366f122; color: #818cf8; }

.node-variation.mode-cut-share { background: #1f1a10; border-color: #4a3a1a; border-left-color: #d97706; }
.node-variation.mode-cut-share:hover { box-shadow: 0 0 0 1px #d97706; }
.mode-cut-share .node-variation-mode { background: #d9770622; color: #fbbf24; }

.node-variation.mode-music-supervisor { background: #0f1f1a; border-color: #1a4a3a; border-left-color: #059669; }
.node-variation.mode-music-supervisor:hover { box-shadow: 0 0 0 1px #059669; }
.mode-music-supervisor .node-variation-mode { background: #05966922; color: #34d399; }

/* Mode-specific drop-active glow */
.node-variation.mode-soundtrack.node-drop-active { box-shadow: 0 0 0 2px #6366f1, 0 0 20px rgba(99,102,241,0.4) !important; border-color: #6366f1 !important; }
.node-variation.mode-cut-share.node-drop-active { box-shadow: 0 0 0 2px #d97706, 0 0 20px rgba(217,119,6,0.4) !important; border-color: #d97706 !important; }
.node-variation.mode-music-supervisor.node-drop-active { box-shadow: 0 0 0 2px #059669, 0 0 20px rgba(5,150,105,0.4) !important; border-color: #059669 !important; }

/* "+ Add Variation" button node */
/* Combined "+" action button node */
.node-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 48px;
  padding: 0.25rem;
}
.action-btn-trigger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px dashed #444;
  background: transparent;
  color: #bbb;
  font-size: 1.3rem;
  font-weight: 300;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  line-height: 1;
}
.action-btn-trigger:hover {
  border-color: var(--accent, #6c63ff);
  color: var(--accent, #6c63ff);
  background: rgba(108, 99, 255, 0.08);
  transform: scale(1.1);
}
.action-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  background: #1a1a3a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 4px;
  min-width: 160px;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.action-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: #ccc;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  transition: all 0.15s;
}
.action-menu-item:hover {
  background: var(--accent, #6c63ff);
  color: #fff;
}
.light-mode .action-menu { background: #fff; border-color: #ddd; box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.light-mode .action-menu-item { color: #333; }
.light-mode .action-btn-trigger { border-color: #ccc; color: #999; }
.light-mode .action-btn-trigger:hover { border-color: var(--accent, #6c63ff); color: var(--accent, #6c63ff); background: rgba(108, 99, 255, 0.06); }

/* Group container node */
.node-group {
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-left: 3px solid #888;
  border-radius: 10px;
  padding: 0.6rem 0.8rem;
  min-width: 200px;
  max-width: 240px;
  cursor: pointer;
  transition: box-shadow 0.2s;
  font-family: inherit;
}
.node-group:active { cursor: grabbing; }
.node-group:hover { box-shadow: 0 0 0 1px #888; }
.node-group .node-header { display: flex; align-items: center; gap: 0.35rem; margin-bottom: 0.25rem; }
.node-group .node-name { font-size: 0.8rem; font-weight: 600; color: #fff; margin-bottom: 0.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.node-group .node-stats { font-size: 0.65rem; color: #bbb; margin-bottom: 0.4rem; }
.node-group-label {
  font-size: 0.55rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #88888822;
  color: #aaa;
}

/* Light mode — group node */
.light-mode .node-group { background: #f5f5f5; border-color: #ddd; border-left-color: #888; }
.light-mode .node-group:hover { box-shadow: 0 0 0 1px #888; }
.light-mode .node-group .node-name { color: #111; }
.light-mode .node-group-label { background: #88888811; color: #666; }

/* New-project highlight pulse — fades after 3 s */
.node-new-highlight .node-project {
  animation: newNodePulse 0.8s ease-in-out 3;
}
@keyframes newNodePulse {
  0%, 100% { box-shadow: 0 0 0 2px transparent; }
  50%      { box-shadow: 0 0 0 3px var(--primary, #60a5fa), 0 0 18px rgba(96,165,250,0.45); }
}

/* Detail panel variation items */
.detail-variation-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #222;
  cursor: pointer;
}
.detail-variation-item:hover { background: #1a1a2e; border-radius: 4px; }
.detail-variation-label { flex: 1; color: #fff; font-size: 0.85rem; font-weight: 500; }
.detail-variation-mode { font-size: 0.6rem; text-transform: uppercase; color: #bbb; letter-spacing: 0.3px; }
.detail-variation-open {
  background: #333;
  color: #ccc;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  cursor: pointer;
}
.detail-variation-open:hover { opacity: 0.8; }

/* Light mode — variation nodes */
.light-mode .node-variation { background: #f8f5ff; border-color: #d0c8f0; border-left-color: var(--accent, #6c63ff); }
.light-mode .node-variation:hover { box-shadow: 0 0 0 1px var(--accent, #6c63ff); }
.light-mode .node-variation .node-name { color: #111; }
.light-mode .node-variation-mode { background: #6c63ff11; color: #6c63ff; }
.light-mode .node-btn-add-variation { border-color: #ccc; color: #999; }
.light-mode .node-btn-add-variation:hover { border-color: var(--accent, #6c63ff); color: var(--accent, #6c63ff); }

/* Light mode — mode-specific variation colours */
.light-mode .node-variation.mode-soundtrack { background: #f5f5ff; border-color: #d0d0f0; border-left-color: #6366f1; }
.light-mode .node-variation.mode-soundtrack:hover { box-shadow: 0 0 0 1px #6366f1; }
.light-mode .mode-soundtrack .node-variation-mode { background: #6366f111; color: #6366f1; }

.light-mode .node-variation.mode-cut-share { background: #fff8f0; border-color: #e8d5b0; border-left-color: #d97706; }
.light-mode .node-variation.mode-cut-share:hover { box-shadow: 0 0 0 1px #d97706; }
.light-mode .mode-cut-share .node-variation-mode { background: #d9770611; color: #d97706; }

.light-mode .node-variation.mode-music-supervisor { background: #f0fdf8; border-color: #b0e0d0; border-left-color: #059669; }
.light-mode .node-variation.mode-music-supervisor:hover { box-shadow: 0 0 0 1px #059669; }
.light-mode .mode-music-supervisor .node-variation-mode { background: #05966911; color: #059669; }
.light-mode .detail-variation-item { border-bottom-color: #eee; }
.light-mode .detail-variation-item:hover { background: #f0f0f0; }
.light-mode .detail-variation-label { color: #111; }
.light-mode .detail-variation-open { background: #e0e0e0; color: #333; }

/* ═══════════════════════════════════════════════════════════════════════════
   DRAG & DROP UPLOAD ON NODES
   ═══════════════════════════════════════════════════════════════════════════ */

/* Drag-over highlight glow */
.node-project.node-drop-active,
.node-variation.node-drop-active {
  box-shadow: 0 0 0 2px var(--accent, #6c63ff), 0 0 20px rgba(108, 99, 255, 0.4) !important;
  border-color: var(--accent, #6c63ff) !important;
}

/* Upload in-progress overlay */
.node-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: #fff;
  font-size: 0.7rem;
  gap: 0.4rem;
  pointer-events: none;
}
.node-upload-label { font-weight: 500; }
.node-upload-progress {
  width: 60%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}
.node-upload-progress-bar {
  height: 100%;
  background: var(--accent, #6c63ff);
  transition: width 0.2s;
  width: 0%;
}

/* Light mode */
.light-mode .node-upload-overlay { background: rgba(255, 255, 255, 0.85); color: #111; }
.light-mode .node-upload-progress { background: #ddd; }

/* ── Overlength Preview Modal ── */
.olp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}
.olp-modal {
  background: var(--surface, #1e293b);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 12px;
  padding: 1.5rem;
  width: 92%;
  max-width: 720px;
  color: var(--text, #e2e8f0);
  position: relative;
}
.olp-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.olp-close:hover { color: var(--text); }
.olp-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 500;
}
.olp-video-wrap {
  width: 260px;
  max-width: 40%;
  margin: 0 auto 1rem;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}
.olp-video-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
/* Full waveform canvas container */
.olp-waveform-wrap {
  position: relative;
  width: 100%;
  height: 100px;
  margin-bottom: 0.75rem;
  background: var(--background, #0f172a);
  border-radius: 6px;
  overflow: hidden;
  cursor: default;
}
.olp-waveform-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
/* Draggable highlighted region */
.olp-region {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(96, 165, 250, 0.18);
  border-left: 2px solid var(--primary, #60a5fa);
  border-right: 2px solid var(--primary, #60a5fa);
  cursor: grab;
  z-index: 2;
  transition: background 0.15s;
}
.olp-region:hover {
  background: rgba(96, 165, 250, 0.28);
}
.olp-region.dragging {
  cursor: grabbing;
  background: rgba(96, 165, 250, 0.32);
}
/* Dimmed areas outside the region */
.olp-dim-left, .olp-dim-right {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 1;
}
.olp-dim-left { left: 0; }
.olp-dim-right { right: 0; }
/* Playhead inside the modal waveform */
.olp-playhead {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: #fff;
  z-index: 3;
  pointer-events: none;
  transition: left 0.05s linear;
}
/* Transport controls */
.olp-transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.olp-transport button {
  background: var(--background, #0f172a);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  color: var(--text);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.olp-transport button:hover { background: rgba(255,255,255,0.08); }
.olp-transport button.olp-playing { background: var(--primary); color: #fff; }
.olp-timecode {
  font-size: 0.85rem;
  color: var(--muted);
  min-width: 200px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}
/* Crossfader inside the modal */
.olp-crossfader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.olp-crossfader-slider {
  width: 160px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right, var(--accent) 0%, var(--muted) 100%);
  border-radius: 3px;
  cursor: pointer;
}
.olp-crossfader-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: none;
  border: none;
  border-top: 2.5px solid var(--text);
  border-right: 2.5px solid var(--text);
  rotate: 45deg;
  cursor: pointer;
}
.olp-crossfader-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: none;
  border: none;
  border-top: 2.5px solid var(--text);
  border-right: 2.5px solid var(--text);
  rotate: 45deg;
  cursor: pointer;
  border-radius: 0;
}

.olp-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.olp-actions button {
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid var(--border);
}
.olp-apply-btn {
  background: var(--primary, #60a5fa);
  color: #fff;
  border-color: var(--primary, #60a5fa) !important;
  font-weight: 500;
}
.olp-apply-btn:hover { opacity: 0.9; }
.olp-cancel-btn {
  background: transparent;
  color: var(--text);
}
.olp-cancel-btn:hover { background: rgba(255,255,255,0.05); }

/* Light mode overrides */
.light-mode .olp-modal { background: var(--surface); border-color: var(--border); }
.light-mode .olp-waveform-wrap { background: var(--background); }
.light-mode .olp-dim-left, .light-mode .olp-dim-right { background: rgba(255,255,255,0.5); }
.light-mode .olp-region { background: rgba(59, 130, 246, 0.15); }
.light-mode .olp-region:hover { background: rgba(59, 130, 246, 0.25); }
.light-mode .olp-playhead { background: #1e293b; }
.light-mode .waveform-scissors-btn { background: rgba(255,255,255,0.85); }

/* ── File Share ── */
#fileSharePanel {
  max-width: 700px;
  margin: 2rem auto;
  padding: 0 1rem;
}

#fileSharePanel h2 {
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  margin-bottom: 0.25rem;
}

#fileSharePanel h2:hover {
  border-bottom-color: var(--muted);
}

/* Share result — clickable URL + editable password (used everywhere links are created) */
.share-result-url {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
  font-size: 0.85rem;
}
.share-result-url:hover {
  text-decoration: underline;
}
/* Uniform row used for link, password, copy-both — icons sit next to content;
   in modals flex:1 stretches text to fill available width */
.share-info-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.share-info-row .fileshare-copy-text,
.share-info-row .share-result-password-row {
  min-width: 0;
}
.share-info-row > .copy-icon-btn {
  flex-shrink: 0;
}
/* In the modal the rows can stretch full width */
.modal .share-info-row {
  width: 100%;
}
.modal .share-info-row .fileshare-copy-text,
.modal .share-info-row .share-result-password-row {
  flex: 1;
}
.modal .share-info-row > .copy-icon-btn {
  margin-left: auto;
}
.share-result-password-row {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}
.share-result-password-row strong {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
  margin-right: 0.25rem;
}
.share-result-password-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: monospace;
  padding: 0.15rem 0.25rem;
  width: auto;
  min-width: 100px;
  max-width: 230px;
}
.share-result-password-input:focus {
  border-color: var(--primary);
  outline: none;
}
.share-result-password-note {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0.35rem 0 0;
}

.checkbox-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 0.35rem 0 0;
}

.fileshare-pw-pencil {
  color: var(--muted);
  opacity: 0.6;
  flex-shrink: 0;
}

/* File Share title editing hint */
.fileshare-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.fileshare-title-row h2 {
  border-bottom: 1px dashed var(--muted);
  padding-bottom: 2px;
  outline: none;
  cursor: text;
}
.fileshare-title-row h2:focus {
  border-bottom-color: var(--primary);
  border-bottom-style: solid;
}
.fileshare-title-pencil {
  color: var(--muted);
  flex-shrink: 0;
  opacity: 0.6;
  margin-top: 2px;
}

/* File Share cards — distinct surfaces for each section */
.fileshare-card {
  background: var(--surface);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.fileshare-result-card {
  padding-right: 2.5rem;
}
.fileshare-card-heading {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

/* File Share progress bar */
.fileshare-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
/* Reserve a consistent height for the progress slot so the Files card
   doesn't shunt up/down when the bar appears/disappears. The bar itself
   fades in/out via opacity — space is always held. */
.fileshare-progress-slot {
  min-height: calc(6px + 0.75rem); /* bar height + its margin-bottom */
}
.fileshare-progress-slot > .fileshare-progress-bar {
  transition: opacity 0.2s;
}
.fileshare-progress-slot > .fileshare-progress-bar.hidden {
  display: block !important;
  opacity: 0;
  pointer-events: none;
}
/* Same idea for the status text — keep a constant line so subsequent
   elements don't jump when the text is empty. */
.fileshare-progress-text {
  min-height: 1.2em;
  margin: 0 0 0.25rem;
}
.fileshare-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--primary), var(--accent, var(--primary)));
  border-radius: 3px;
  transition: width 0.2s ease;
}

.fileshare-file-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.75rem;
}

.fileshare-file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.fileshare-file-item:last-of-type {
  border-bottom: none;
}

.fileshare-file-name {
  flex: 1;
  min-width: 0;
  /* Always show the full filename including the extension — on long names
     we wrap over multiple lines rather than truncate with an ellipsis,
     because the extension is the thing that gets cut off first and
     recipients need to know what file type they're getting. */
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.9rem;
}

.fileshare-file-size {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.fileshare-remove-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
}

.fileshare-remove-btn:hover {
  color: #ef4444;
}

.fileshare-total {
  padding: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.fileshare-dropzone {
  border: 2px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.fileshare-dropzone.dragover {
  border-color: var(--badge-file-share);
  background: color-mix(in srgb, var(--badge-file-share) 5%, transparent);
}

.light-mode .fileshare-card {
  background: #f1f5f9;
}

.light-mode .fileshare-file-item {
  border-bottom-color: rgba(0,0,0,0.08);
}

.light-mode .fileshare-dropzone {
  border-color: rgba(0,0,0,0.15);
}

.light-mode .fileshare-dropzone.dragover {
  border-color: var(--badge-file-share);
  background: color-mix(in srgb, var(--badge-file-share) 8%, transparent);
}

.fileshare-copy-text {
  font-size: 0.85rem;
  word-break: break-all;
  line-height: 1.6;
  margin: 0;
}

.fileshare-copy-text strong {
  color: var(--muted);
  font-weight: 500;
}

/* Uploading prompt (play.html) — shown when media isn't ready yet */
#uploadingPrompt {
  max-width: 480px;
  margin: 6rem auto;
  padding: 0 1rem;
  text-align: center;
}
.uploading-prompt-content {
  background: var(--surface);
  border-radius: 12px;
  padding: 2.5rem 2rem;
}
.uploading-prompt-content h2 {
  margin: 1.25rem 0 0.5rem;
  font-size: 1.25rem;
}
.uploading-prompt-content p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.uploading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--separator);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: uploadingSpin 0.8s linear infinite;
}
@keyframes uploadingSpin {
  to { transform: rotate(360deg); }
}

/* File Share download page (play.html) */
#fileShareDownload {
  max-width: 600px;
  margin: 3rem auto;
  padding: 0 1rem;
  /* Opt out of the global `section { background: var(--surface) ... }` rule
     so only the translucent `.fileshare-download-card` inside paints pixels —
     otherwise the section's own surface colour masks the wallpaper behind it. */
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.fileshare-download-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 2rem;
}
/* On the dedicated file-share download page, give the card a defined
   border + blur so it reads cleanly over the wallpaper (same treatment
   as #fileSharePanel on /fileshare). */
body.page-fileshare-download .fileshare-download-card {
  background: rgba(20, 22, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.light-mode body.page-fileshare-download .fileshare-download-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.fileshare-download-card h2 {
  margin-bottom: 0.25rem;
}

.fileshare-download-item {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.fileshare-download-item:last-of-type {
  border-bottom: none;
}

.light-mode .fileshare-download-item {
  border-bottom-color: rgba(0,0,0,0.06);
}

.fileshare-download-btn {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.fileshare-download-btn:hover {
  opacity: 0.85;
}
.fileshare-download-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.expiry-text {
  color: var(--muted);
}

/* Review page overrides are applied via inline styles in play.js */

/* ── Wallpaper ───────────────────────────────────────────────────────────── */
/* Wallpaper starts below the header (57px = 56px header + 1px border) and
   runs to the bottom of the viewport. Rendered at full brightness — no
   overlay — because the file-share panel has its own opaque card background
   for text readability. */
.wallpaper-layer {
  position: fixed;
  top: 57px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: none;
}
.wallpaper-layer.active {
  display: block;
}
/* Ensure page content paints above the wallpaper. Body keeps its opaque
   --background — the fixed-position wallpaper layer paints above that in
   its own region (below the header), so the header area shows body bg
   and the rest shows the wallpaper image. */
body:has(.wallpaper-layer.active) > :not(.wallpaper-layer) {
  position: relative;
  z-index: 1;
}

.wallpaper-btn {
  background: rgba(30, 30, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  color: var(--text);
  opacity: 0.85;
  transition: opacity 0.2s, background 0.2s, border-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  backdrop-filter: blur(6px);
}
.wallpaper-btn:hover {
  opacity: 1;
  background: rgba(40, 40, 48, 0.95);
  border-color: rgba(255, 255, 255, 0.28);
}
.light-mode .wallpaper-btn {
  background: rgba(245, 245, 248, 0.92);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text);
}
.light-mode .wallpaper-btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(0, 0, 0, 0.25);
}
.wallpaper-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.wallpaper-remove-btn {
  padding: 0.35rem;
  opacity: 0.4;
}
.wallpaper-remove-btn.hidden {
  display: none;
}
.wallpaper-remove-btn:hover {
  opacity: 1;
}

/* ── YouTube-style progress bar scrub preview ────────────────────────────── */
.scrub-preview {
  position: fixed;
  pointer-events: none;
  transform: translate(-50%, -100%);
  opacity: 0;
  transition: opacity 0.12s ease-out;
  z-index: 10000;
  text-align: center;
  will-change: left, top;
}
.scrub-preview.visible {
  opacity: 1;
}
.scrub-preview-video {
  display: block;
  width: 200px;
  height: 112px; /* 16:9 */
  background: #000;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  object-fit: cover;
}
.scrub-preview-time {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  border-radius: 4px;
  line-height: 1.4;
}
.light-mode .scrub-preview-time {
  background: rgba(30, 30, 34, 0.9);
}

/* ── File Share hero dropzone (dedicated /fileshare page) ─────────────────── */
.fileshare-dropzone-hero {
  padding: 2.25rem 1.25rem;
  border-width: 2px;
  border-style: dashed;
  border-color: rgba(255,255,255,0.14);
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.fileshare-dropzone-hero .fileshare-dropzone-icon {
  color: var(--muted);
  opacity: 0.85;
}
.light-mode .fileshare-dropzone-hero {
  border-color: rgba(0,0,0,0.18);
}
body.page-fileshare.is-drag-active .fileshare-dropzone-hero {
  border-color: var(--badge-file-share);
  background: color-mix(in srgb, var(--badge-file-share) 6%, transparent);
}

/* ── File Share in-line media viewer ──────────────────────────────────────── */
/* Match .fileshare-download-btn geometry exactly so the two buttons
   line up at identical heights; differentiate visually with an outline
   rather than a solid fill. */
.fileshare-view-btn {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  background: transparent;
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--muted) 55%, transparent);
  border-radius: 4px;
  cursor: pointer;
  margin-right: 0.4rem;
  white-space: nowrap;
  line-height: 1.2;
}
.fileshare-view-btn:hover {
  background: color-mix(in srgb, var(--muted) 16%, transparent);
}

.fileshare-viewer {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  /* Opt out of the global `section {...}` defaults — the viewer should be an
     invisible positioning wrapper, with only `.fileshare-viewer-panel`
     painting anything. */
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  margin: 0;
}
.fileshare-viewer.hidden { display: none; }

/* Transparent backdrop — still captures clicks-to-close, but lets the
   page's wallpaper / content show through so the viewer feels like it's
   floating over the page rather than masking it. */
.fileshare-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
}

.fileshare-viewer-panel {
  position: relative;
  z-index: 1;
  background: rgba(20, 22, 30, 0.85);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.6rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem 1rem 1.1rem;
  max-width: min(960px, 100%);
  width: 100%;
  max-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.light-mode .fileshare-viewer-panel {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.18);
}

.fileshare-viewer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.fileshare-viewer-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fileshare-viewer-close {
  font-size: 1.4rem;
  line-height: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 0.3rem;
  flex-shrink: 0;
}
.fileshare-viewer-close:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--muted) 18%, transparent);
}

.fileshare-viewer-media {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}
.fileshare-viewer-video {
  width: 100%;
  max-height: 70vh;
  background: #000;
  border-radius: 0.35rem;
  display: block;
}
.fileshare-viewer-audio {
  width: 100%;
  max-width: 520px;
}
