@import url('https://fonts.googleapis.com/css2?family=Cabin:wght@400;500;600;700&display=swap');

:root{
  --primary:#60a5fa;
  --accent:#94a3b8;
  --background:#111827;
  --surface:#1f2937;
  --text:#e5e7eb;
  --muted:#6b7280;
  --wave-colour:#8ed1ff;
  --progress-colour:#1f9cef;
  --marker-colour:#94a3b8;
}

/* Light mode overrides — applied via .light-mode on <html> */
.light-mode {
  --primary: #2563eb;
  --accent: #475569;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --wave-colour: #3b82f6;
  --progress-colour: #2563eb;
  --marker-colour: #475569;
}

*{box-sizing:border-box;}
body{
  font-family:'Cabin',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  margin:0;
  padding:0 1rem 3rem;
  background:var(--background);
  color:var(--text);
  font-weight:500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Page-specific tonal backgrounds (dark mode) ──────────────────────── */
body.page-dashboard  { --background: #111827; } /* neutral base — home         */
body.page-uploader   { --background: #131720; } /* warm — creative workspace   */
body.page-project    { --background: #151515; --surface: #1e1e1e; } /* near-greyscale — workspace  */
body.page-player     { --background: #0e1622; } /* deep blue — cinema/viewing  */
body.page-canvas     { --background: #121428; } /* purple — architecture       */
body.page-admin      { --background: #161118; } /* warm red — control room     */
body.page-help       { --background: #0f181e; } /* teal — supportive           */
body.page-settings   { --background: #141620; } /* warm neutral                */
body.page-login      { --background: #111827; } /* neutral base                */

/* Light mode: subtler tonal shifts */
.light-mode body.page-dashboard,
.light-mode .page-dashboard  { --background: #f8fafc; }
.light-mode body.page-uploader,
.light-mode .page-uploader   { --background: #faf9f7; }
.light-mode body.page-project,
.light-mode .page-project    { --background: #f6f9fc; }
.light-mode body.page-player,
.light-mode .page-player     { --background: #f4f7fb; }
.light-mode body.page-canvas,
.light-mode .page-canvas     { --background: #f6f5fa; }
.light-mode body.page-admin,
.light-mode .page-admin      { --background: #faf6f6; }
.light-mode body.page-help,
.light-mode .page-help       { --background: #f5faf8; }
.light-mode body.page-settings,
.light-mode .page-settings   { --background: #f8f8f6; }
.light-mode body.page-login,
.light-mode .page-login      { --background: #f8fafc; }
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);}
/* ── 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 */
  margin-left: -1rem; /* bleed to edge — cancel body padding */
  margin-right: -1rem;
}
#playerMain {
  position: relative;
  flex: 1;
  min-width: 0; /* prevent flex overflow */
  overflow: hidden;
  padding: 0 1rem; /* restore body padding inside main */
}

/* ── Comments panel — collapsible, left side by default ──────────────── */
.comments-panel {
  flex-shrink: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 60px);
  position: sticky;
  top: 52px;
  order: -1; /* left side */
  margin-top: 2rem; /* match the global section margin-top so panel aligns with player card */
  padding: 0; /* override section default */
  box-shadow: none; /* override section default */
  z-index: 5;
  transition: width 0.25s ease;
  overflow: hidden;
  min-height: 300px;
}
.comments-panel.hidden { display: none; }

/* Expanded state */
.comments-panel.panel-open {
  width: 30vw;
  min-width: 280px;
  max-width: 400px;
  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;
  min-height: 200px;
  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,
#groupSelectionBar,
#reviewFilterBar,
#composerSubmission,
#transcriptSection,
#exportStatus,
#cutContainer {
  opacity: 0.55;
  transition: opacity 0.3s ease;
}
#playerHeader:hover,
#waveformHeader:hover,
#waveformContainer:hover,
#videoAudioWaveform:hover,
#videoAudioWaveformUpload:hover,
#comments:hover,
.share-bar:hover,
#groupSelectionBar:hover,
#reviewFilterBar:hover,
#composerSubmission:hover,
#transcriptSection:hover,
#exportStatus:hover,
#cutContainer:hover,
/* Also lift when interacting with child elements */
#playerHeader:focus-within,
#waveformContainer:focus-within,
#comments:focus-within,
.share-bar:focus-within,
#composerSubmission:focus-within {
  opacity: 1;
}
/* Transport row: slightly subdued but less than other areas (it's close to the video) */
#transportRow {
  opacity: 0.65;
  transition: opacity 0.3s ease;
}
#transportRow:hover,
#transportRow:focus-within {
  opacity: 1;
}
/* 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;
  position: relative;
  transition: outline 0.2s, background 0.2s;
}

#videoContainer video {
  max-width: 100%;
  height: 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%; }

/* 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;
  left: calc(50% - 24px - 8px - 80px - 8px);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

#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: 110px;
  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: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--text);
  background: transparent;
  cursor: pointer;
}

#crossfader::-moz-range-thumb {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--text);
  background: transparent;
  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: none;
  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;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* 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; }
#playerUserEmail { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 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:0;
  padding:2rem;
  text-align:center;
  transition:border-color .2s;
  margin-bottom:1rem;
  color:var(--muted);
}
#dropzone.dragover{border-color:var(--primary);background:#1e293b;}

/* 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);
}
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;
}
#commentButtons{
  display:flex;
  gap:0.5rem;
  flex-wrap:wrap;
  margin-bottom:1rem;
}

/* 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 - smooth animation */
#progressPlayhead {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--accent);
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 5;
}

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

/* Rounds tab bar */
.rounds-tab-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border, #334155);
}
.rounds-tabs {
  display: flex;
  gap: 0;
  flex: 1;
  overflow-x: auto;
}
.rounds-tab-btn {
  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;
  white-space: nowrap;
}
.rounds-tab-btn:hover { color: var(--text, #e2e8f0); }
.rounds-tab-btn.active {
  color: var(--primary, #6b8afd);
  border-bottom-color: var(--primary, #6b8afd);
}
.rounds-tab-btn .rounds-tab-text {
  outline: none;
}
.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:hover { 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, #1e293b 0%, #334155 50%, #1e293b 100%);
  border-radius:0;
  overflow: visible;
  cursor: pointer;
  transition: height 0.3s ease, opacity 0.3s ease, background 0.3s ease;
  position: relative;
}

.waveform-item.active {
  height: 120px;
  background: linear-gradient(to bottom, #1e3a5f 0%, #2d4a6f 50%, #1e3a5f 100%);
}

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

.waveform-item.inactive:hover {
  opacity: 0.9;
  background: linear-gradient(to bottom, #253449 0%, #3a4a5f 50%, #253449 100%);
}

/* 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.35);
}

.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;
}

/* 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;
  background: none;
  border: none;
  padding: 0.35rem;
  cursor: pointer;
  color: var(--muted);
  border-radius: 4px;
  transition: color 0.15s;
}
.copy-icon-btn:hover {
  color: var(--text);
}

/* Audio Switch Row */
#audioSwitchRow {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

#soundtrackLabel {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

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

#addAudioLabel {
  margin-left: auto;
}

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

/* Trim toggle */
.trim-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  border-radius:0;
  transition: all 0.2s;
  margin-left: 0.5rem;
}

.trim-toggle:hover {
  color: var(--text);
  background: var(--surface);
}

.trim-toggle input[type="checkbox"] {
  display: none;
}

.trim-toggle input[type="checkbox"]:checked + span {
  color: var(--accent);
}

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

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

.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;
}

.overlength-toast {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.78rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 4px;
  padding: 0.4rem 0.75rem;
  z-index: 30;
  opacity: 0;
  animation: toast-fade 5s ease-in-out forwards;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes toast-fade {
  0%   { opacity: 0; }
  8%   { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; }
}

.light-mode .overlength-toast {
  background: rgba(0, 0, 0, 0.75);
}

#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;
}

/* Track name in button */
.track-name {
  flex: 1;
}

/* Delete track button */
.delete-track {
  font-size: 1.1rem;
  color: var(--muted);
  padding: 0 0.25rem;
  margin-left: 0.25rem;
  line-height: 1;
  border-radius:0;
  transition: color 0.2s, background 0.2s;
}

.delete-track:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

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

.audio-btn-ghost {
  opacity:0.5;
  background:var(--muted) !important;
}

.audio-btn-chosen {
  transform:scale(1.05);
  box-shadow:0 4px 12px rgba(96,165,250,0.3);
  z-index:1000;
}

.audio-btn-drag {
  transform:rotate(5deg);
  box-shadow:0 8px 16px rgba(0,0,0,0.4);
}

/* 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:0;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.25rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--surface);
}

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

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

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

.logo {
  height: 100px;
  width: auto;
}

.tagline {
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0;
  padding-left: 0.5rem;
}

#headerBar h1 {
  margin: 0;
}

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

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

/* ── 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.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.2rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.25rem;
  white-space: nowrap;
}

/* Page label type colours — match Canvas node colours */
.page-label.type-soundtrack { color: #818cf8; border-color: #6366f144; }
.page-label.type-cut-share { color: #fbbf24; border-color: #d9770644; }
.page-label.type-supervisor { color: #34d399; border-color: #05966944; }
.light-mode .page-label.type-soundtrack { color: #6366f1; border-color: #6366f133; }
.light-mode .page-label.type-cut-share { color: #d97706; border-color: #d9770633; }
.light-mode .page-label.type-supervisor { color: #059669; border-color: #05966933; }

/* Overflow menu (⋯ button + dropdown) — progressive disclosure */
.overflow-menu {
  position: relative;
  display: inline-block;
}
.overflow-btn {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  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;
}
.overflow-btn:hover {
  color: var(--text);
  border-color: var(--muted);
  background: var(--surface);
}

#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 {
  background: rgba(255, 255, 255, 0.06);
  transform: none;
}

#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: 900px;
  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: #22c55e22; color: #4ade80; }
.badge-password { background: #f59e0b22; color: #fbbf24; }

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

.project-card {
  background: var(--surface);
  border-radius:0;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.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: #6366f122;
  color: #818cf8;
}

.type-cut-share {
  background: #d9770622;
  color: #fbbf24;
}

.type-supervisor {
  background: #05966922;
  color: #34d399;
}

.light-mode .type-soundtrack {
  background: #6366f111;
  color: #6366f1;
}

.light-mode .type-cut-share {
  background: #d9770611;
  color: #d97706;
}

.light-mode .type-supervisor {
  background: #05966911;
  color: #059669;
}

.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;
}

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

.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;
}

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

.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.45;
  transition: opacity 0.15s;
}

.card-checkbox:hover,
.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);
}

/* Subtle right-justified toolbar — appears when at least one card is checked */
#selectionBar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.3rem 0;
  margin-bottom: 0.5rem;
}

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

#selectAllLabel {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

/* Small delete button */
.danger-btn {
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 3px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  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 */
.clear-selection-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.clear-selection-btn:hover {
  opacity: 1;
}

/* ── 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: #666; }
.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);
}
.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; }
.beta-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 0.25rem;
  margin: 0 0.6rem;
  vertical-align: middle;
}
.light-mode .beta-badge { background: rgba(99, 102, 241, 0.08); color: #6366f1; border-color: rgba(99, 102, 241, 0.2); }

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

#userEmail {
  color: var(--muted);
  font-size: 0.9rem;
}

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

/* 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 Settings Modal */
.share-settings-modal {
  max-width: 420px;
  position: relative;
}
.share-setting-group {
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
}
.share-setting-row {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}
.share-setting-row input[type="checkbox"] {
  margin-top: 0.25rem;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}
.share-setting-row span {
  font-size: 0.95rem;
}
.share-setting-hint {
  margin: 0.15rem 0 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}
.share-setting-detail {
  margin-top: 0.6rem;
  padding-left: 1.65rem;
}
.share-setting-detail input[type="text"] {
  width: 100%;
  margin-bottom: 0.5rem;
}
.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;
}
.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;
}
.share-settings-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition: color 0.2s, border-color 0.2s;
}
.share-settings-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

#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-actions {
  margin-bottom: 1rem;
}

.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;
}

.upload-track-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--muted);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}

.upload-track-btn:hover {
  background: var(--background);
}

#selectedFileName {
  font-size: 0.85rem;
  color: var(--accent);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#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;
}

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

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

.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, #1e293b 0%, #334155 50%, #1e293b 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;
}

.cut-item.active {
  height: 80px;
  background: linear-gradient(to bottom, #1e3a5f 0%, #2d4a6f 50%, #1e3a5f 100%);
}

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

.cut-item.inactive:hover {
  opacity: 0.9;
  background: linear-gradient(to bottom, #253449 0%, #3a4a5f 50%, #253449 100%);
}

.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;
}

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

.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-group {
  background: rgba(0, 0, 0, 0.03);
}
.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 .share-settings-btn {
  border-color: rgba(0, 0, 0, 0.12);
}
.light-mode .share-settings-btn:hover {
  border-color: rgba(0, 0, 0, 0.2);
}

.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;
}

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