:root {
  --bg: #0a0a12;
  --bg-elevated: #11111a;
  --surface: #151521;
  --surface-hover: #1c1c2a;
  --surface-active: #232336;
  --card: #16161f;
  --card-hover: #1d1d2b;
  
  --accent: #e94560;
  --accent-hover: #ff5d70;
  --accent-muted: #e9456020;
  --accent-glow: rgba(233, 69, 96, 0.4);
  
  --text: #f0f0f5;
  --text-dim: #a0a0b0;
  --text-muted: #6a6a7a;
  
  --border: #2a2a3e;
  --border-light: #3a3a4e;
  --divider: #252538;
  
  --success: #00d47e;
  --warning: #ffb800;
  --danger: #ff4757;
  --info: #54a0ff;
  
  --font: 'Inter', 'SF Pro Display', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Typography scale (12 → 20px). All UI font sizes map to these tokens so
     every page/component stays uniform. */
  --font-xs: 12px;   /* smallest: badges, tiny aux labels */
  --font-sm: 13px;   /* help text, small labels */
  --font-md: 14px;   /* body / form inputs / most labels */
  --font-lg: 16px;   /* sub-headings, buttons, emphasised text */
  --font-xl: 20px;   /* section titles */
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 24px var(--accent-glow);
  
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  font-family: var(--font);
  font-size: 15px;
}

/* ===== Light theme =====
   Activated by <html data-theme="light"> (ThemeToggle sets it). Re-tints the
   same variable names so every component using var(--*) switches automatically. */
:root[data-theme='light'] {
  --bg: #f4f5f9;
  --bg-elevated: #eceef4;
  --surface: #ffffff;
  --surface-hover: #f7f8fc;
  --surface-active: #eef0f6;
  --card: #ffffff;
  --card-hover: #f6f7fb;

  --accent: #d63a52;
  --accent-hover: #c12f47;
  --accent-muted: #e9456018;
  --accent-glow: rgba(214, 58, 82, 0.25);

  --text: #1c1c26;
  --text-dim: #5c5c70;
  --text-muted: #8a8a9c;

  --border: #d8dbe6;
  --border-light: #c6cad8;
  --divider: #e3e6ef;

  --success: #00a96a;
  --warning: #d99100;
  --danger: #d6304a;
  --info: #2f80ed;

  --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.08);
  --shadow-md: 0 4px 12px rgba(20, 20, 40, 0.1);
  --shadow-lg: 0 8px 32px rgba(20, 20, 40, 0.14);
  --shadow-glow: 0 0 24px var(--accent-glow);
}

html {
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[data-theme='light'] {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(233,69,96,0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(84,160,255,0.06) 0%, transparent 60%),
    var(--bg);
}

#root {
  min-height: 100vh;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ::selection */
::selection {
  background: var(--accent);
  color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}
::-webkit-scrollbar-corner {
  background: transparent;
}

/* Focus visible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn var(--transition) ease-out; }
.animate-slide-in { animation: slideIn var(--transition-slow) ease-out; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* Layout */
.page {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  /* Dense inner tables (tracks, backline) scroll inside their own containers
     instead of forcing a horizontal page scroll on narrow/mobile screens. */
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .page { padding: 16px; }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header-actions {
  display: flex;
  gap: 12px;
}

/* Transport mode selector bar — sits under the page title, aligned left */
.config-transport-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -12px 0 24px;
  flex-wrap: wrap;
}

/* Inline per-field "Populate from" label layout */
.config-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 8px;
}
.collapsible-section .section-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text);
}
.collapsible-section .section-toggle h2 {
  margin: 0;
  font-size: 1.1rem;
}
.collapsible-section .chevron {
  display: inline-block;
  font-size: var(--font-xs);
  transition: transform 0.15s ease;
  color: var(--text-muted);
}
.collapsible-section .chevron.open {
  transform: rotate(90deg);
}
.section-body {
  padding-top: 4px;
}
.section-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 12px;
  padding-bottom: 4px;
}
.section-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 10px 20px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #d0344d 100%);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-light);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text);
}

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

.btn-danger:hover:not(:disabled) {
  background: #e83b48;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-large {
  padding: 14px 28px;
  font-size: 1rem;
}

.toggle-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}

.toggle-btn {
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-btn:hover { color: var(--text); }
.toggle-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="color"],
.form-field select,
.form-field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.875rem;
  color: var(--text);
  font-family: var(--font);
  transition: all var(--transition);
}

/* Auto-growing textarea — mirrors .form-field inputs but expands to fit content */
.auto-textarea {
  width: 100%;
  display: block;
  resize: none;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text);
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auto-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

/* WYSIWYG with the rider PDF (2026-08-09): the PDF body is A4 minus 40pt
   margins = 515pt usable, Roboto 10pt, line-height ~1.4. To keep the wrap
   identical while staying readable on screen, we scale font AND width by the
   same factor: 10px font @ 686px width ≈ 13.5px font @ 926px width — same
   width/font ratio, so one line typed in the config = one line in the rider.
   13.5px matches the sidebar nav links for a consistent UI. */
.config-page .auto-textarea {
  font-size: 13.5px;
  line-height: 1.4;
  padding: 8px 10px;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

/* Standalone form inputs (Show / Setlist pages) — match .form-field inputs */
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.875rem;
  color: var(--text);
  font-family: var(--font);
  transition: all var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.form-input::placeholder {
  color: var(--text-muted);
}
select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* Uniform height for every control — native date/time inputs render taller
   than selects/text inputs otherwise (DATE field looked bigger than STATUS).
   Neutralize the native picker chrome so the box is exactly 40px everywhere. */
.form-input {
  height: 40px;
  box-sizing: border-box;
}
textarea.form-input {
  height: auto;
}
input.form-input[type="date"],
input.form-input[type="time"] {
  height: 40px;
  padding: 0 12px;
  line-height: 1;
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}
input.form-input[type="date"]::-webkit-datetime-edit,
input.form-input[type="time"]::-webkit-datetime-edit {
  line-height: 38px;
  padding: 0;
}
input.form-input[type="date"]::-webkit-calendar-picker-indicator,
input.form-input[type="time"]::-webkit-calendar-picker-indicator {
  margin: 0;
}
/* Hide the native clock/calendar icon so time fields are a compact bare text
   input (still editable via typing / arrow keys / the picker on click). */
input.form-input.no-picker::-webkit-calendar-picker-indicator {
  display: none;
  -webkit-appearance: none;
}
input.form-input.no-picker {
  text-align: center;
  padding: 0 4px;
}

/* Compact color input — mirrors .form-field input[type="color"] */
input.form-input[type="color"] {
  width: 48px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

input.form-input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input.form-input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: var(--radius-sm);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--text-muted);
}

.form-field input[type="color"] {
  width: 48px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.form-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.form-field input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: var(--radius-sm);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 0.875rem;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.toggle-group {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}

.toggle-btn {
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-btn:hover { color: var(--text); }
.toggle-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

/* Grid */
.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}

/* ─── Setlists/Checklists: single-column layout (list above editor) ─── */
.setlists-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Band settings two-pane stays 2-up on desktop, stacks on mobile. The pages
   use an inline `gridTemplateColumns: '1fr 1fr'` (surcharges media queries), so
   the mobile rule needs `!important` to win. */
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 768px) {
  .settings-row { grid-template-columns: 1fr !important; }
}

/* ─── Backline (shared) — used by the config Audio-Backline read-only summary
       (backline-list + backline-row grid) AND the musician/crew editor. The
       editor table uses its OWN .bl-* classes so the summary layout is
       untouched. (2026-08-14 — the editor was refactored into a tracks-style
       table; the shared classes below keep the Audio-Backline summary correct.) */
.backline-list { display: flex; flex-direction: column; gap: 6px; }
.backline-row {
  display: grid;
  /* Default for rows that don't set their own gridTemplateColumns inline
     (e.g. the "Add Backline Item" row in ConfigAudioBacklinePage). The summary
     rows (IEM/Lights/Audio-Backline) override this inline. */
  grid-template-columns: 70px 60px 130px minmax(0,1fr) minmax(0,1fr) 130px 32px;
  gap: 6px;
  align-items: center;
  font-size: var(--font-xs);
}
.backline-type, .backline-label, .backline-qty, .backline-notes {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: var(--radius);
  font-size: var(--font-xs);
  min-width: 0;
}
.backline-qty { text-align: center; }
/* The NumberPicker wrapper must fill its grid cell (it renders inline-block,
   which shrinks to content and breaks the backline grid alignment). Used by
   the shared summary rows (ConfigLightsPage, ConfigAudioBacklinePage). */
.backline-row .number-picker { display: block; width: 100%; }
.backline-row .number-picker input { width: 100%; }

/* Mobile: the audio-backline "Add Backline Item" editor and its read-only
   summary reflow so the TYPE sits on its own line, with the rest below —
   instead of a wide 5-column row that overflows the viewport. (2026-08-14) */
@media (max-width: 767px) {
  .backline-edit-grid,
  .backline-summary-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .backline-edit-grid > :nth-child(3) { grid-column: 1 / -1; }
  .backline-edit-grid > :nth-child(4) { grid-column: 1 / -1; }
  .backline-edit-grid > :nth-child(5) { grid-column: 1 / -1; }
  .backline-edit-grid > :nth-child(6) { grid-column: 1 / -1; }
  .backline-edit-grid > :nth-child(7) { grid-column: 2; justify-self: end; }
  .backline-summary-grid > :nth-child(3) { grid-column: 1 / -1; }
  .backline-summary-grid > :nth-child(4) { grid-column: 1 / -1; }
  .backline-summary-grid > :nth-child(5) { grid-column: 1 / -1; }
}

/* ─── Backline EDITOR table (musician/crew edit) ───
   A TABLE with column headers, same pattern as the instrument tracks: one
   shared grid where every row is display:contents. On narrow screens the table
   scrolls horizontally in its .bl-section container (mirroring .tracks-section).
   Uses .bl-* (not .backline-*) so it never collides with the shared summary
   classes above. (2026-08-14) */
.bl-section {
  overflow-x: auto;
}
.bl-table {
  display: grid;
  grid-template-columns: 84px 56px 140px minmax(0,1fr) minmax(0,1fr) 120px 110px 34px;
  gap: 2px 6px;
  align-items: center;
  min-width: 760px;
}
.bl-row { display: contents; }
.bl-header {
  font-weight: 600;
  color: #aaa;
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bl-header > span {
  padding: 4px 2px 2px;
  display: block;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-bottom: 1px solid #333;
}
.bl-data { display: contents; }
.bl-data > div {
  padding: 3px 0;
  box-sizing: border-box;
}
.bl-handle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}
.bl-qty { text-align: center; }
.bl-qty .number-picker { display: block; width: 100%; }
.bl-qty .number-picker input { width: 100%; text-align: center; }
.bl-img { display: flex; align-items: center; }
.bl-dragging .bl-type,
.bl-dragging .bl-label,
.bl-dragging .bl-notes { opacity: 0.5; }

/* Mobile: reflow the backline editor into a 2-line layout — line 1 is the Type
   (full width), line 2 holds the rest (handle, qty, description, notes, image,
   delete). Hide the column header (it no longer matches a 2-line row). Drop
   display:contents so each row becomes its own grid; the shared-grid table
   look only applies ≥768px. (2026-08-14) */
@media (max-width: 767px) {
  .bl-header { display: none; }
  .bl-data {
    display: grid;
    grid-template-columns: 44px 48px 1fr 1fr 30px;
    gap: 6px;
    align-items: center;
    padding: 8px;
    border: 1px solid var(--border, #2a2a3e);
    border-radius: var(--radius, 8px);
    margin-bottom: 8px;
  }
  .bl-data .bl-type { grid-column: 1 / -1; }
  .bl-data .bl-label { grid-column: 1 / -1; }
  .bl-data .bl-notes { grid-column: 1 / -1; }
  .bl-data .bl-provider { grid-column: 1 / -1; }
  .bl-data .bl-img { grid-column: 1 / -1; }
  .bl-data .bl-handle { grid-column: 1 / 2; }
  .bl-data .bl-qty { grid-column: 2 / 3; }
  .bl-data .bl-actions { grid-column: 5 / 6; justify-self: end; }
  .bl-section { overflow-x: visible; }
  .bl-table { min-width: 0; display: block; }
}
/* Reuse the track table input style for a consistent "table" look */
.bl-data .td-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: var(--font-xs);
  width: 100%;
  box-sizing: border-box;
}
.bl-data .td-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.bl-data textarea.td-input {
  resize: none;
  overflow: hidden;
  line-height: 1.4;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface);
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-hover); }

/* Users & Access — elegant expandable list */
.u-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.95rem; color: #fff;
  background: var(--primary, #6366f1); flex-shrink: 0;
}
.u-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; line-height: 1.3;
}
.u-pill--super { background: rgba(79, 110, 247, 0.14); color: var(--accent, #4f6ef7); }
.u-pill--user { background: rgba(127, 127, 127, 0.12); color: var(--text-dim); }
.u-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.u-dot--on { background: #2ecc71; }
.u-dot--off { background: var(--text-muted); }
.u-chevr {
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 0.85rem; padding: 6px 8px; border-radius: 6px; line-height: 1;
}
.u-chevr:hover { background: var(--surface-hover); color: var(--text); }
.u-detail { background: var(--surface-hover); }
.u-detail td { padding: 18px 20px; }
.u-bandchip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 6px 4px 10px; font-size: 0.8rem;
}
.u-bandchip select {
  border: none; background: transparent; color: var(--text);
  font-size: 0.78rem; outline: none; cursor: pointer; padding: 0 2px;
}
.u-bandchip__x {
  border: none; background: transparent; color: var(--text-muted);
  cursor: pointer; font-size: 1rem; padding: 0 2px; line-height: 1;
}
.u-bandchip__x:hover { color: var(--danger); }
.u-rowactions { display: flex; gap: 6px; flex-wrap: wrap; }
.u-bandtag {
  font-size: 0.68rem; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  background: rgba(127, 127, 127, 0.12); color: var(--text-dim);
  white-space: nowrap; line-height: 1.4;
}
.u-sectionlabel {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 600; margin-bottom: 8px;
}

/* Forms */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-row {
  display: flex;
  gap: 12px;
}

.input-row > * { flex: 1; }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.tag-accent {
  background: var(--accent-muted);
  color: var(--accent);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.badge-warning { background: rgba(255, 184, 0, 0.15); color: var(--warning); }
.badge-danger { background: rgba(255, 71, 87, 0.15); color: var(--danger); }
.badge-success { background: rgba(0, 212, 126, 0.15); color: var(--success); }
.badge-info { background: rgba(84, 160, 255, 0.15); color: var(--info); }

/* Conflicts */
.conflict-banner {
  background: linear-gradient(135deg, rgba(255, 184, 0, 0.1) 0%, rgba(255, 184, 0, 0.05) 100%);
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  animation: slideIn var(--transition-slow) ease-out;
}

.conflict-banner strong { color: var(--warning); }
.conflict-banner ul { margin: 8px 0 0; padding-left: 20px; }
.conflict-banner li { color: var(--text-dim); font-size: 0.875rem; }

/* Conflict indicators on cards */
.conflict-ring {
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 1px var(--warning), 0 0 0 3px rgba(255, 184, 0, 0.1);
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  animation: fadeIn var(--transition) ease-out;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideIn var(--transition-slow) ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--divider);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--divider);
}

/* Tooltips */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  padding: 8px 12px;
  background: var(--surface-active);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  color: var(--text);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
  z-index: 100;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Drag and drop */
.dragging {
  opacity: 0.5;
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  z-index: 100;
}

.drag-over {
  border-color: var(--accent) !important;
  background: var(--accent-muted);
}

/* Conflict indicator pulse */
@keyframes conflictPulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--warning), 0 0 0 3px rgba(255,184,0,0.1); }
  50% { box-shadow: 0 0 0 2px var(--warning), 0 0 0 6px rgba(255,184,0,0.2); }
}

.conflict-ring {
  animation: conflictPulse 2s ease-in-out infinite;
}

/* Drag preview */
.drag-preview {
  transform: rotate(3deg);
  box-shadow: var(--shadow-lg);
  opacity: 0.9;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}

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

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.drag-handle:hover {
  color: var(--text);
  background: var(--surface);
}

.dragging .drag-handle {
  cursor: grabbing;
  color: var(--accent);
}

/* Print styles */
@media print {
  .page-header-actions,
  .btn,
  .modal-overlay,
  .page-header {
    display: none !important;
  }
  .page { padding: 0; }
  .card { border: 1px solid #ccc; }
  body { background: white; color: black; }
}
/* ─── Instrument Editor — compact track layout ─── */
.tracks-section {
  padding: 8px 12px;
  overflow-x: auto;
}
.tracks-list {
  /* ONE shared grid for the header row AND every track row — each .track-row
     is display: contents, so ALL rows share the exact same column tracks.
     (Previously each row was its own grid: fr columns were re-sized per row
     from that row's min-content — header "Name" 108px vs data 103px — which
     shifted every column from Rack onward.) (2026-08-09) */
  display: grid;
  grid-template-columns: 26px 0.9fr 92px 46px 46px 0.5fr 82px 88px 50px 82px 0.8fr 28px;
  gap: 2px 4px;
  align-items: center;
  /* Narrow enough to fit the page without horizontal scroll — the section
     that hosts the table is ~888px wide on the musician edit page. Selects
     still show their values fully (Rack "Stagerack", Mic From/From
     "The Band"). (2026-08-12: Connection + Transmitter columns removed —
     wireless now lives per instrument, not per track.) */
  min-width: 760px;
}
.track-row {
  display: contents;
}
.track-header {
  font-weight: 600;
  color: #aaa;
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0;
  border-bottom: none;
}
.track-header > span {
  padding: 4px 2px 2px;
  /* Each header cell fills its grid column (shared with data rows via
     display: contents on .track-row). Bottom border replaces the old
     .track-header border-bottom which is lost with display: contents. */
  display: block;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  border-bottom: 1px solid #333;
}
.track-data {
  display: contents;
}
.td-track-n {
  text-align: center;
  font-weight: 600;
  color: #ccc;
  font-size: var(--font-sm);
}
.td-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: var(--font-xs);
  width: 100%;
  /* Match the header cells (border-box) so fr columns size identically
     between header and data rows. (2026-08-09) */
  box-sizing: border-box;
}
.td-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.td-input-num {
  text-align: center;
}
.td-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 22px 4px 8px;
  border-radius: var(--radius);
  font-size: var(--font-xs);
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23999' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  cursor: pointer;
}
.td-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}
.td-boom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  color: var(--text-dim);
  font-size: var(--font-xs);
}
.td-boom input {
  accent-color: var(--accent);
  cursor: pointer;
}
.td-boom-label {
  white-space: nowrap;
}
/* Light tint on the microphone columns (MIC → MIC FROM) so the input-list
   table reads more easily as a group. */
.td-mic,
.td-mic-from {
  background: rgba(99, 102, 241, 0.07);
  border-radius: var(--radius);
}
.track-header > .th-mic,
.track-header > .th-mic-from {
  background: rgba(99, 102, 241, 0.12);
  border-radius: var(--radius);
  padding: 3px 6px;
}
.td-remove {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: var(--font-md);
  padding: 2px;
}
.td-remove:hover {
  color: #e94560;
}
.tracks-footer {
  padding-top: 6px;
}

/* ─── Instrument editor (musician edit page) ─── */
.instrument-editor {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.instrument-color-bar {
  width: 4px;
  flex: 0 0 auto;
  background: var(--accent);
}
.instrument-editor-header {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}
.instrument-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.instrument-editor-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.instrument-editor-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.instrument-name-input {
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.instrument-name-input:focus {
  outline: none;
  background: var(--bg);
}
.instrument-name-input::placeholder { color: var(--text-muted); }
.track-count-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex: 0 0 auto;
}
.conflict-warning { color: var(--warning); font-size: 0.85rem; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
}
.btn-icon:hover { color: var(--text); }
.chevron { width: 18px; height: 18px; transition: transform var(--transition); }
.chevron.open { transform: rotate(90deg); }
.has-conflict { border-color: var(--warning); }
.instrument-list { display: flex; flex-direction: column; gap: 8px; }
.tracks-section { padding: 0 12px 12px; border-top: 1px solid var(--divider); overflow-x: auto; }
.tracks-footer { margin-top: 8px; }

/* ─── Crew summary (rider page) ─── */
.crew-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.crew-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 6px;
  background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.2);
  font-size: var(--font-sm);
}
.crew-role { font-weight: 500; }
.crew-count { color: #818cf8; font-weight: bold; }

/* ─── Stage plot thumbnails ─── */
.stageplot-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.stageplot-thumb {
  position: relative;
  width: 200px;
  height: 200px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid #333;
  cursor: pointer;
}
.stageplot-thumb.selected {
  border-color: #4f46e5;
}
.stageplot-thumb img {
  width: 100%;
  height: 165px;
  object-fit: cover;
}
.stageplot-thumb-name {
  display: block;
  font-size: var(--font-xs);
  color: #aaa;
  text-align: center;
  padding: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stageplot-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: #e94560;
  cursor: pointer;
  font-size: var(--font-xs);
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}
.stageplot-thumb-remove:hover {
  background: rgba(233,69,96,0.8);
  color: white;
}
.stageplot-preview {
  margin-top: 12px;
}
.stageplot-preview img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  border: 1px solid #333;
}
.stageplot-clear-btn {
  margin-top: 4px;
}

/* ─── Instrument tags on musician cards ─── */
.instrument-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.instrument-tag {
  font-size: var(--font-xs);
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

/* ---- Save error banner (global persistence-failure warning) ---- */
.save-error-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 71, 87, 0.12);
  border: 1px solid var(--danger);
  border-radius: var(--radius, 8px);
  padding: 12px 14px;
  margin-bottom: 18px;
  color: var(--text);
}
.save-error-banner-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}
.save-error-banner-body strong { color: var(--danger); }
.save-error-banner-hint {
  color: var(--text-dim);
  font-size: 0.82rem;
}
.save-error-banner-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.save-error-banner-close:hover { color: var(--text); }

/* ---- Offline banner (top of main content, full width) ---- */
.offline-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--text, #f0f0f5);
}
.offline-banner-offline {
  background: rgba(255, 184, 0, 0.12);
  border-color: var(--warning, #ffb800);
}
.offline-banner-syncing {
  background: rgba(84, 160, 255, 0.1);
  border-color: var(--info, #54a0ff);
}
.offline-banner-success {
  background: rgba(0, 212, 126, 0.12);
  border-color: var(--success, #00d47e);
}
.offline-banner-icon { font-size: 1rem; line-height: 1; flex-shrink: 0; }
.offline-banner-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.offline-banner-body strong { font-size: 0.88rem; }
.offline-banner-sub { color: var(--text-dim, #a0a0b0); }
.offline-banner-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.offline-badge-sync {
  background: var(--warning, #ffb800);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}
.offline-badge-sync:hover { filter: brightness(1.1); }
.offline-badge-sync:disabled { opacity: 0.6; cursor: default; }
.offline-badge-clear {
  background: transparent;
  color: var(--text-dim, #a0a0b0);
  border: 1px solid var(--border, #2a2a3e);
}
/* ===== CSS Variables ===== */
:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --accent: #e94560;
  --accent-hover: #d63850;
  --text: #eaeaea;
  --text-muted: #8888aa;
  --border: #2a2a44;
  --border-light: #3a3a55;
  --danger: #e94560;
  --danger-hover: #d63850;
  --success: #00b894;
  --success-hover: #00a381;
  --warning: #fdcb6e;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --sidebar-width: 240px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 0.2s ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }

p { margin-bottom: 0.5rem; }

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

/* ===== App Layout ===== */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* New-version banner — appears when a deploy is detected and the auto-reload
   hasn't fired yet, so the user never has to hard-refresh every tab. */
.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 16px;
  background: #1d4e89;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform var(--transition);
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  font-size: 1.3rem;
  color: var(--accent);
  margin: 0;
}

.sidebar-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  /* No flex:1 — navs must only take their own content height so collapsed
     sections don't spread the remaining labels to the middle of the page.
     Content stays anchored at the top. */
}

.nav-section-label {
  padding: 0.75rem 1.25rem 0.25rem;
  font-size: 0.7rem;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-family: var(--font);
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background: rgba(233, 69, 96, 0.08);
  text-decoration: none;
  color: var(--text);
}

.nav-link.active {
  background: rgba(233, 69, 96, 0.12);
  color: var(--accent);
  border-left-color: var(--accent);
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  max-width: 1200px;
  width: calc(100% - var(--sidebar-width));
}

/* ===== Footer ===== */
.app-footer {
  margin-left: var(--sidebar-width);
  padding: 0 2rem 2rem;
  max-width: 1200px;
  width: calc(100% - var(--sidebar-width));
  box-sizing: border-box;
}
.app-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-xl, 12px) var(--radius-xl, 12px);
  background: linear-gradient(180deg, transparent, rgba(233, 69, 96, 0.05));
  color: var(--text-muted);
  font-size: 0.8rem;
}
.app-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.app-footer-logo {
  width: 22px;
  height: 22px;
  border-radius: 5px;
}
.app-footer-brand strong { color: var(--text); }
.app-footer-tagline { color: var(--text-muted); }
.app-footer-ver {
  font-family: var(--font-mono);
  color: var(--text-muted);
  opacity: 0.7;
}

/* ===== Page ===== */
.page {
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-header h1 {
  margin: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--border);
  border-color: var(--border-light);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

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

.btn-small {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 0.85rem;
}

.btn-icon:hover {
  background: var(--border);
  color: var(--text);
}

.btn-danger-icon {
  color: var(--danger);
}

.btn-danger-icon:hover {
  background: rgba(233, 69, 96, 0.15);
  color: var(--danger);
}

/* ===== Form Elements ===== */
.edit-form {
  max-width: 700px;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type='text'],
.form-group input[type='number'],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.15);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 150px;
}

/* Keep selects/inputs inside the flex row from overflowing on long options
   (e.g. "drum_hardware") — shrink below intrinsic content width. */
.form-row .form-group select,
.form-row .form-group input[type='number'],
.form-row .form-group input[type='text'] {
  width: 100%;
  min-width: 0;
}

.form-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.form-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.form-section-header h2 {
  margin: 0;
}

.form-actions {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

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

.checkbox-label input[type='checkbox'] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.checkbox-group-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Rider page: musicians/crew checkboxes flow inline, wrapping to the
   available width with a double-space gap between items. */
.musician-inline-list {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
}

.musician-inline-list .musician-checkbox {
  width: auto;
}

.input-with-save {
  display: flex;
  gap: 0.5rem;
}

.input-with-save input {
  flex: 1;
}

/* ===== Toggle Group ===== */
.toggle-group {
  display: flex;
  gap: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.toggle-btn {
  padding: 0.45rem 0.9rem;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
  border-right: 1px solid var(--border);
}

.toggle-btn:last-child {
  border-right: none;
}

.toggle-btn:hover {
  background: var(--border);
  color: var(--text);
}

.toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ===== Instrument Editor ===== */
.instrument-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.instrument-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.instrument-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.instrument-fields .form-group {
  margin-bottom: 0;
}

.instrument-fields .form-group:nth-child(5),
.instrument-fields .form-group:nth-child(6),
.instrument-fields .form-group:nth-child(7) {
  grid-column: 1 / -1;
}

/* ===== Musician List ===== */
.musician-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

/* Section label between base-role groups (main / session / guest) */
.musician-section-label {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.musician-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  cursor: grab;
}

.musician-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow);
}

.musician-card.dragging {
  opacity: 0.5;
  border-color: var(--accent);
}

.musician-color-bar {
  height: 4px;
  width: 100%;
}

.musician-card-body {
  padding: 1rem;
}

.musician-card-body h3 {
  margin-bottom: 0.15rem;
  font-size: 1.05rem;
}

.musician-role {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.musician-details {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.instrument-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.musician-card-actions {
  display: flex;
  gap: 0.5rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-hint {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
  padding: 0.5rem 0;
}

/* ===== Conflict Banner ===== */
.conflict-banner {
  background: rgba(233, 69, 96, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.conflict-banner strong {
  color: var(--danger);
  font-size: 0.9rem;
}

.conflict-banner ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.conflict-banner li {
  margin-bottom: 0.15rem;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  min-width: 320px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
}

.modal h2 {
  margin-bottom: 0.5rem;
}

.modal p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* ===== Rider Page ===== */
.rider-actions {
  display: flex;
  gap: 0.5rem;
}

.config-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

.config-section {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.config-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.config-section h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.musician-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0.3rem 0;
}

.musician-checkbox input[type='checkbox'] {
  accent-color: var(--accent);
}

.musician-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.musician-role-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--border);
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 0.35rem;
}

/* ===== Rider Card (new) ===== */
.rider-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.rider-card-section {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.rider-card-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.rider-card-section h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

/* ===== Rider Preview (real-time PDF) ===== */
.rider-preview-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.rider-preview-container h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

/* ===== Rider PDF Editor (admin WYSIWYG) ===== */
.rider-editor-scope {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.rider-editor-scope .toggle-group {
  display: flex;
  gap: 0.5rem;
}

.rider-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.rider-editor-panel {
  min-width: 0;
}

.rider-editor-panel .form-section {
  margin-bottom: 1.25rem;
}

.rider-editor-panel .form-section h2 {
  font-size: 1rem;
  margin-bottom: 0.6rem;
}

.section-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

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

.section-row-reorder {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.section-row-reorder .btn-small {
  padding: 0 0.4rem;
  line-height: 1;
}

.section-row-check {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  font-size: 0.8rem;
}

.section-row-title {
  flex: 1;
  min-width: 0;
}

/* Section card: control row + collapsible content details (mirrors the PDF). */
.section-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  background: var(--surface);
  overflow: hidden;
}

.section-card > .section-row {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 96%, var(--text) 4%);
}

.section-card-body {
  padding: 0.5rem 0.6rem 0.6rem 2.4rem;
  font-size: 0.85rem;
}

.section-detail-list {
  margin: 0 0 0.4rem;
  padding-left: 1.1rem;
  color: var(--text-dim);
  display: grid;
  gap: 2px;
}

.section-detail-list li {
  line-height: 1.4;
}

.section-text-inline {
  margin-top: 0.4rem;
  max-width: 560px;
}

.section-text-inline .form-field-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  display: block;
  margin-bottom: 2px;
}

/* The "Show tour name" checkbox lives in a .section-row-check (nowrap by
   default) — allow the long label to wrap instead of overflowing. */
.section-text-inline .section-row-check {
  white-space: normal;
  flex-wrap: wrap;
  cursor: pointer;
}

.section-card:has(> .section-row > .section-row-check input:not(:checked)) .section-detail-list {
  display: none;
}

/* Deep-link focus flash (2026-08-11): the Layout Editor links "edit" fields
   with ?focus=<fieldId>; the target element flashes to draw the eye. */
.field-focus-flash {
  outline: 2px solid var(--accent, #6366f1);
  outline-offset: 3px;
  border-radius: 8px;
  animation: field-focus-pulse 1.8s ease;
}

@keyframes field-focus-pulse {
  0% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35); }
  70% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0); }
}

/* Field-level rows inside a section card. */
.field-list {
  margin: 0.4rem 0 0.2rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.4rem;
}

.field-list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.field-list-head .field-spacer-add,
.field-list-add .field-spacer-add {
  opacity: 0.8;
}

.field-list-head .field-spacer-add:hover,
.field-list-add .field-spacer-add:hover {
  opacity: 1;
}

.field-list-add {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.field-text-editor {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.field-text-toolbar {
  display: flex;
  gap: 4px;
  align-items: center;
}

.field-text-toolbar .field-text-size {
  width: 52px;
  padding: 1px 4px;
  font-size: 0.78rem;
}

.field-text-toolbar select.form-input {
  width: auto;
  padding: 1px 4px;
  font-size: 0.78rem;
}

.field-row-text {
  background: rgba(127, 127, 127, 0.06);
  border-radius: 6px;
  padding: 2px 4px;
  align-items: flex-start;
}

.field-row-dragging {
  opacity: 0.45;
}

.field-row[draggable='true'] {
  cursor: grab;
}

.field-row[draggable='true']:active {
  cursor: grabbing;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.85rem;
}

.field-row .section-row-reorder {
  flex-direction: row;
}

.field-row .section-row-reorder .btn-small {
  padding: 0 0.35rem;
  font-size: 0.75rem;
}

/* Dedicated drag handle — only THIS grab-area starts a reorder drag, so the
   ↑/↓/✕ buttons inside the row keep receiving plain clicks. */
.field-drag-handle {
  cursor: grab;
  user-select: none;
  font-size: 0.8rem;
  letter-spacing: -2px;
  color: var(--text-dim, #888);
  padding: 0 4px;
  border-radius: 4px;
}

.field-drag-handle:hover {
  background: rgba(127, 127, 127, 0.18);
  color: var(--text);
}

.field-drag-handle:active {
  cursor: grabbing;
}

.section-card-dragging {
  opacity: 0.45;
  outline: 2px dashed var(--accent, #6366f1);
  outline-offset: 2px;
}
.backline-row-dragging {
  opacity: 0.45;
  outline: 2px dashed var(--accent, #6366f1);
  outline-offset: 2px;
}

.field-row-spacer {
  background: rgba(127, 127, 127, 0.06);
  border-radius: 6px;
  padding: 2px 4px;
}

/* A field that has no value set (would emit nothing in the PDF) — shown with
   an unchecked box and a small "empty" tag so gaps are visible at a glance. */
.field-row-empty .field-label {
  opacity: 0.55;
}

.field-empty-hint {
  margin-left: auto;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim, #888);
  background: rgba(127, 127, 127, 0.12);
  border-radius: 4px;
  padding: 1px 6px;
}

.field-row-spacer .field-spacer-size {
  width: 56px;
  padding: 1px 4px;
  font-size: 0.78rem;
}

.field-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-link {
  font-size: 0.78rem;
  color: var(--accent, #e11d48);
  text-decoration: none;
  white-space: nowrap;
}

.field-link:hover {
  text-decoration: underline;
}

.rider-editor-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
}

.rider-editor-preview h2 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.preview-scope-badge {
  margin-left: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim, #888);
  background: rgba(127, 127, 127, 0.14);
  border-radius: 6px;
  padding: 2px 8px;
  vertical-align: middle;
}

.save-status-ok {
  color: #16a34a;
  margin-left: 0.75rem;
  font-size: 0.9rem;
}

.save-status-err {
  color: var(--danger, #dc2626);
  margin-left: 0.75rem;
  font-size: 0.9rem;
}

@media (max-width: 1100px) {
  .rider-editor-grid {
    grid-template-columns: 1fr;
  }
  .rider-editor-preview {
    position: static;
  }
}

.rider-preview-iframe {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.rider-preview-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ===== Add Item Row ===== */
.add-item-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.add-item-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
}

.add-item-row input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== Item List ===== */
.item-list {
  list-style: none;
  padding: 0;
}

.item-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.item-list li:last-child {
  border-bottom: none;
}

.item-list li:hover {
  background: rgba(255, 255, 255, 0.02);
}

.item-list .empty-hint {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* ===== Config Page ===== */
/* Config pages match the shows page form width (ShowDetailPage uses
   max-width:1000) for uniform field widths across the site (2026-08-13). */
.config-page .edit-form {
  max-width: 1000px;
}

/* ===== Mobile Menu Button ===== */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 22px;
  height: 16px;
  justify-content: center;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

.sidebar-overlay {
  display: none;
}

/* ===== Responsive: 900px ===== */
@media (max-width: 900px) {
  .mobile-menu-btn {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 1.5rem;
    padding-top: 3.5rem;
  }

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

  .form-row {
    flex-direction: column;
  }

  .form-row .form-group {
    min-width: unset;
  }

  .instrument-fields {
    grid-template-columns: 1fr;
  }

  .rider-preview-iframe {
    height: 400px;
  }

  .app-footer {
    margin-left: 0;
    width: 100%;
    padding: 0 1.5rem 1.5rem;
    max-width: none;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .rider-actions {
    width: 100%;
  }

  .rider-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ===== Responsive: 480px ===== */
@media (max-width: 480px) {
  .main-content {
    padding: 1rem;
    padding-top: 3rem;
  }

  h1 {
    font-size: 1.35rem;
  }

  .musician-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    min-width: unset;
    width: calc(100% - 2rem);
    padding: 1.25rem;
  }

  .rider-preview-iframe {
    height: 350px;
    border-radius: var(--radius-sm);
  }

  .rider-preview-container {
    padding: 1rem;
  }

  .toggle-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
  }

  .add-item-row {
    flex-direction: column;
  }

  .input-with-save {
    flex-direction: column;
  }

  .form-actions .btn-large {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Utility ===== */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  opacity: 1;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ===== Profile Selector ===== */
.profile-selector {
  position: relative;
  width: 100%;
}

.profile-selector-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
}

.profile-selector-trigger:hover {
  border-color: var(--border-light);
  background: var(--border);
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-avatar.small {
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
  border-radius: 4px;
}

.profile-trigger-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.profile-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.profile-chevron.open {
  transform: rotate(180deg);
}

.profile-selector-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: fadeIn 0.15s ease;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.profile-dropdown-item:hover {
  background: var(--border);
}

.profile-dropdown-item.active {
  background: rgba(233, 69, 96, 0.08);
}

.profile-dropdown-item.manage {
  color: var(--accent);
  font-weight: 500;
  gap: 0.6rem;
}

.profile-dropdown-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile-dropdown-name {
  font-weight: 500;
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-dropdown-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.profile-check {
  flex-shrink: 0;
  color: var(--accent);
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ===== Profile Grid (List Page) ===== */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
}

.profile-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.profile-card-image {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
}

.profile-card-image img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}

.profile-card-image-placeholder {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
}

.profile-card-body {
  padding: 1rem;
}

.profile-card-name {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.profile-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.profile-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.profile-card-actions .btn {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
}

/* ===== Landing / Home page ===== */

.home-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.home-hero {
  text-align: center;
  padding: 3rem 1rem 2.5rem;
}

.home-logo {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: 0.75rem;
}

.home-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2, var(--accent)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
}

.home-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.home-band-card {
  text-align: left;
  cursor: pointer;
  padding: 0;
  font: inherit;
  color: inherit;
  width: 100%;
}

.home-band-card:hover {
  transform: translateY(-2px);
}

.home-open-btn {
  pointer-events: none;
  margin-top: 0.25rem;
}

.home-bands .profile-card-info {
  padding: 1rem;
}

/* ===== Transport-Dependent Config UI ===== */

.page-header-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-group-sm .toggle-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.config-preset-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-van {
  background: rgba(233, 69, 96, 0.15);
  color: #e94560;
  border: 1px solid rgba(233, 69, 96, 0.3);
}

.badge-plane {
  background: rgba(83, 144, 217, 0.15);
  color: #5390d9;
  border: 1px solid rgba(83, 144, 217, 0.3);
}

.badge-info {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 0.72rem;
}

.transport-icon {
  display: inline-flex;
  align-items: center;
  font-size: 0.9em;
  opacity: 0.8;
  margin-right: 0.2em;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* ===== Login Page ===== */
.login-page {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 340px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-card h1 {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  text-align: left;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.login-card input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
}

.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.15);
}

.login-btn {
  margin-top: 0.5rem;
  padding: 0.65rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.login-btn:hover {
  background: var(--accent-hover);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-error {
  background: rgba(233, 69, 96, 0.12);
  color: var(--danger);
  border: 1px solid rgba(233, 69, 96, 0.4);
  border-radius: var(--radius);
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  text-align: center;
}

/* ===== User panel (sidebar footer) ===== */
.user-panel {
  margin-top: 0;
  border-top: none;
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-weight: 700;
}

.role-admin { background: rgba(0, 184, 148, 0.18); color: var(--success); }
.role-manager { background: rgba(253, 203, 110, 0.18); color: var(--warning); }
.role-read-only { background: rgba(136, 136, 170, 0.18); color: var(--text-muted); }

.logout-btn {
  padding: 0.4rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}

.logout-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* ===== Users page ===== */
.page-pad {
  padding: 1rem;
}

.users-form {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 2rem;
}

.users-form input,
.users-form select {
  padding: 0.5rem 0.7rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
}

.users-list table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.users-list th,
.users-list td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.users-list select {
  padding: 0.3rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
}

.users-list button {
  padding: 0.3rem 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  cursor: pointer;
  font-size: 0.78rem;
}

.users-list button:hover:not(:disabled) {
  background: var(--border);
}

.users-list button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
/* ===== Stage Plot Editor ===== */

.stageplot-editor {
  display: flex;
  height: 100%;
  min-height: 500px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}

/* ── Toolbar / Palette (Left) ── */

.stageplot-toolbar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.stageplot-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stageplot-toolbar-actions .btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-size: 1rem;
}

.stageplot-toolbar-actions .btn-icon:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.stageplot-toolbar-actions .btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stageplot-toolbar-actions .btn-icon.active {
  color: var(--accent);
  background: var(--accent-muted);
}

.stageplot-toolbar-actions .btn-danger-icon {
  color: var(--danger);
}

.stageplot-toolbar-actions .btn-danger-icon:hover:not(:disabled) {
  background: rgba(255, 71, 87, 0.15);
}

.stageplot-toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.stageplot-toolbar-search {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stageplot-toolbar-search input {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
}

.stageplot-toolbar-search input:focus {
  outline: none;
  border-color: var(--accent);
}

.stageplot-toolbar-categories {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 120px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stageplot-category-tab {
  padding: 6px 12px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.8rem;
  text-align: left;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.stageplot-category-tab:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.stageplot-category-tab.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.stageplot-toolbar-items {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  align-content: start;
}

.stageplot-palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: grab;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  user-select: none;
}

.stageplot-palette-item:hover {
  background: var(--surface-hover);
}

.stageplot-palette-item:active {
  cursor: grabbing;
  background: var(--surface-active);
}

.stageplot-palette-icon {
  font-size: 1.3rem;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.stageplot-palette-label {
  font-size: 0.78rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stageplot-palette-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Canvas (Center) ── */

.stageplot-canvas-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, var(--surface) 0%, var(--bg) 100%);
}

.stageplot-canvas-container canvas {
  display: block;
}

/* ── Properties Sidebar (Right) ── */

.stageplot-properties {
  width: 260px;
  min-width: 260px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.stageplot-properties-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

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

.stageplot-properties-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px;
}

.stageplot-properties-empty p {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  line-height: 1.5;
}

.stageplot-property-section {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.stageplot-property-section h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stageplot-property-section .form-field {
  margin-bottom: 8px;
}

.stageplot-property-section .form-field:last-child {
  margin-bottom: 0;
}

.stageplot-property-section .form-field label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stageplot-property-section .form-field input[type="text"],
.stageplot-property-section .form-field input[type="number"],
.stageplot-property-section .form-field select {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.82rem;
  transition: border-color var(--transition);
}

.stageplot-property-section .form-field input:focus,
.stageplot-property-section .form-field select:focus {
  outline: none;
  border-color: var(--accent);
}

.stageplot-property-section .form-field input[type="checkbox"] {
  accent-color: var(--accent);
}

.stageplot-property-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.stageplot-property-row .form-field {
  flex: 1;
  margin-bottom: 0;
}

.stageplot-property-row .form-field input {
  width: 100%;
}

.stageplot-property-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stageplot-properties .checkbox-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Responsive ── */

@media (max-width: 900px) {
  .stageplot-editor {
    flex-direction: column;
  }

  .stageplot-toolbar {
    width: 100%;
    min-width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .stageplot-toolbar-categories {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    padding: 4px;
  }

  .stageplot-category-tab {
    white-space: nowrap;
    padding: 4px 10px;
    border-left: none;
    border-bottom: 2px solid transparent;
  }

  .stageplot-category-tab.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .stageplot-toolbar-items {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    max-height: 100px;
  }

  .stageplot-properties {
    width: 100%;
    min-width: 100%;
    max-height: 200px;
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

/* ── Toolbar: stage size + colour + zoom ── */

.stageplot-toolbar-size,
.stageplot-toolbar-color {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stageplot-toolbar-size label,
.stageplot-toolbar-color label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stage-size-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stage-size-row input {
  width: 100%;
  padding: 4px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
}

.stage-size-row span {
  color: var(--text-dim);
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform var(--transition);
}

.swatch:hover {
  transform: scale(1.12);
}

.swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 1px var(--surface);
}

.color-input {
  width: 100%;
  height: 28px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ── Canvas viewport / stage / elements ── */

.stageplot-canvas-viewport {
  flex: 1;
  min-width: 0;
}

.stageplot-canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.stageplot-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.stageplot-zoom .btn-icon {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
}

.stageplot-zoom .stageplot-dim-label {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.stageplot-element {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  user-select: none;
  touch-action: none;
}

/* Keep the editable instrument name outside the icon/image box. */
.stageplot-element-graphic {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.stageplot-element-label {
  font-size: 10px;
  line-height: 1.1;
  color: #444;
  text-align: center;
  pointer-events: none;
  margin-top: 2px;
  /* Let the label overflow the (narrow) icon width so the full name is
     readable under the image — a 10px label is wider than most icons. */
  max-width: 180px;
  overflow: visible;
  white-space: nowrap;
  /* ⚠️ flex-shrink:0 est CRITIQUE : le parent .stageplot-element a une
     hauteur fixe (el.height × STAGE_SCALE) et le graphic prend 100% de
     cette hauteur (flex:0 0 auto) → sans ça, le label est rétréci à 0px
     par le flex container et devient invisible dans le canvas. */
  flex-shrink: 0;
}

.stageplot-element-name-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 3px;
  padding: 2px 4px;
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  color: #222;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border, #ccc);
  border-radius: 4px;
  box-sizing: border-box;
  cursor: text;
  white-space: nowrap;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stageplot-element-name-input:focus {
  outline: 1.5px solid var(--accent, #E74C3C);
  outline-offset: 1px;
}

.stageplot-element.selected {
  outline: 1.5px dashed var(--accent);
  outline-offset: 2px;
}

.stageplot-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border: 1.5px solid #fff;
  border-radius: 50%;
  z-index: 5;
}

.stageplot-handle.resize {
  right: -6px;
  bottom: -6px;
  cursor: nwse-resize;
}

.stageplot-handle.rotate {
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  cursor: grab;
  background: var(--text-dim);
}

.stageplot-palette-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  flex-shrink: 0;
}

/* ── Properties sidebar swatch reuse ── */
.stageplot-properties .swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.stageplot-properties .swatch {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.stageplot-properties .swatch.active {
  border-color: var(--text);
}

.stageplot-properties .color-input {
  width: 100%;
  height: 28px;
  padding: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.stageplot-properties .stageplot-property-section h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* ── Drum Kit editor modal ── */
.stageplot-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.stageplot-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(720px, 92vw);
  max-height: 88vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.stageplot-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.stageplot-modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header-actions .btn-primary {
  height: 28px;
  padding: 0 14px;
  font-size: 0.85rem;
  line-height: 1;
}

.drumkit-body {
  display: flex;
  gap: 20px;
  padding: 16px;
  flex-wrap: wrap;
}

.drumkit-preview {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.drumkit-preview svg {
  max-width: 100%;
  height: auto;
}

.drumkit-summary {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  letter-spacing: 0.04em;
}

.drumkit-hand-note {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drumkit-controls {
  flex: 1 1 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drumkit-controls section h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.drumkit-hand-row,
.drumkit-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-toggle,
.btn-chip {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
}

.btn-toggle.active,
.btn-chip:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.drumkit-pieces {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}

.drumkit-piece {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.drumkit-piece label {
  font-size: 0.82rem;
  color: var(--text);
  flex: 1;
}

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

.stepper span {
  min-width: 18px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.stepper .btn-icon {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

/* ── Alignment guides (symmetry / edge snapping) ── */
.stageplot-guide {
  z-index: 5;
  pointer-events: none;
}

/* ── Riser editor (uses site design tokens) ── */
.dk-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  margin: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.dk-preview svg {
  max-width: 100%;
  height: auto;
}

.dk-summary {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  letter-spacing: 0.04em;
}

.dk-section {
  margin: 0 16px 18px;
}

.dk-section h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dk-section > .btn {
  margin-right: 8px;
}

.dk-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text);
  cursor: pointer;
}

.dk-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.dk-steppers {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dk-steppers span {
  min-width: 22px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
}

.dk-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.dk-riser-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dk-riser-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.dk-riser-idx {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 6px;
}

.layering-actions {
  display: flex;
  gap: 6px;
}

.layering-actions .btn-icon {
  flex: 1;
  font-size: 1rem;
}
/* Stage Plot Editor Page Styles */

/* ── List mode ────────────────────────────── */

.stageplot-list-page .page-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.stageplot-loading,
.stageplot-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 24px;
  color: var(--text-dim);
  font-size: 1rem;
}

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

.stageplot-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 24px;
  text-align: center;
}

.stageplot-empty-icon {
  font-size: 3.5rem;
  margin-bottom: 8px;
  opacity: 0.6;
  filter: grayscale(0.3);
}

.stageplot-empty h2 {
  font-size: 1.5rem;
  color: var(--text);
  margin: 0;
}

.stageplot-empty p {
  max-width: 420px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

/* ── Card grid ────────────────────────────── */

.stageplot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.stageplot-card.card {
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}

.stageplot-card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stageplot-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.stageplot-card .card-title {
  font-size: 1rem;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stageplot-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.stageplot-kind-badge {
  font-size: 0.7rem;
  background: var(--accent, #4f6ef7);
  color: #fff;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  white-space: nowrap;
}

.stageplot-card-info {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.stageplot-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ── Editor mode (full page) ──────────────── */

.stageplot-editor-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 32px); /* full viewport minus padding */
  overflow: hidden;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.editor-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.editor-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.editor-title-input {
  flex: 1;
  max-width: 400px;
  min-width: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color var(--transition);
}

.editor-title-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-muted);
}

.editor-title-input::placeholder {
  color: var(--text-muted);
}

.editor-save-status {
  font-size: 0.8125rem;
  font-weight: 500;
  min-width: 80px;
  text-align: right;
}

.editor-save-status.success {
  color: var(--success);
}

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

.editor-body {
  flex: 1;
  overflow: hidden;
}

/* ── Responsive ───────────────────────────── */

@media (max-width: 768px) {
  .editor-header {
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
  }

  .editor-header-left,
  .editor-header-right {
    width: 100%;
  }

  .editor-title-input {
    max-width: none;
  }

  .editor-save-status {
    min-width: 60px;
    font-size: 0.75rem;
  }

  .stageplot-grid {
    grid-template-columns: 1fr;
  }
}
