/* ── Chords panel body ── */
.chords-panel-body { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.chords-panel-body::-webkit-scrollbar { width: 4px; }
.chords-panel-body::-webkit-scrollbar-thumb { background: var(--border); }

/* ── Panel inner sections ── */
.cpanel-section {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.cpanel-section:last-child { border-bottom: none; }
.cpanel-section-title {
  font-size: 7px; letter-spacing: 2px; color: var(--label);
  text-transform: uppercase; margin-bottom: 8px;
}
.cpanel-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 0;
}
.cpanel-label {
  font-size: 7px; letter-spacing: 1px; color: var(--border2);
  min-width: 44px; flex-shrink: 0; text-transform: uppercase;
}
.cpanel-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 9px; padding: 3px 6px;
  border-radius: var(--r-sm); font-family: 'DM Mono', monospace;
  min-width: 0;
}
.cpanel-input:focus { outline: none; border-color: var(--accent); }
.cpanel-select {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 8px; padding: 3px 4px;
  border-radius: var(--r-sm); font-family: 'DM Mono', monospace;
}
.cpanel-section-item {
  padding: 6px 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 5px;
  background: var(--surface);
}
.cpanel-section-item.selected {
  border-color: var(--accent);
  background: rgba(255,77,166,.04);
}

/* ── Sections row in timeline ── */
/* ── Sections row — styled to match the visual tab's sections strip ── */
.sections-row {
  height: 36px !important;
  /* Sticky so it stays visible at the top of the effects / tracks scroll */
  position: sticky !important;
  top: 0;
  z-index: 6;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.sections-row .track-label {
  background: var(--bg);
  border-right: 1px solid var(--border);
  font-size: 7px;
  letter-spacing: 2px;
  color: var(--label);
}
.sections-canvas {
  position: relative;
  overflow: hidden;
  height: 36px !important;
}
.section-block {
  position: absolute;
  top: 0; bottom: 0;       /* full row height — no vertical gap */
  background: color-mix(in srgb, var(--sc, #666) 20%, transparent);
  border-left:  2px solid color-mix(in srgb, var(--sc, #666) 75%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--sc, #666) 20%, transparent);
  border-top: none; border-bottom: none;
  color: var(--sc, #aaa);
  font-size: 8.5px; letter-spacing: 1.5px; font-family: 'DM Mono', monospace;
  font-weight: 600;
  display: flex; align-items: center; padding: 0 6px;
  cursor: pointer; overflow: hidden; white-space: nowrap;
  transition: filter 0.12s;
  box-sizing: border-box;
  user-select: none;
}
.section-block:hover {
  filter: brightness(1.5);
  background: color-mix(in srgb, var(--sc, #666) 32%, transparent);
}
.section-block.selected {
  background: color-mix(in srgb, var(--sc, #666) 40%, transparent);
  border-left-color: var(--sc, #666);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sc, #666) 50%, transparent);
  filter: brightness(1.3);
}
.section-resize-handle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 6px;
  cursor: ew-resize; background: transparent;
}
.section-resize-handle:hover { background: rgba(255,255,255,0.15); }

/* ── Collapsed (merged) Structure strip ── */
/* A thin band tucked under the Timing track; entering edit mode expands it. */
.sections-row.collapsed,
.sections-row.collapsed .sections-canvas.collapsed { height: 18px !important; }
.sections-row.collapsed .track-label {
  font-size: 6.5px; letter-spacing: 1.5px;
}
.sections-row.collapsed .section-block {
  font-size: 6.5px; letter-spacing: 0.5px; font-weight: 500;
  padding: 0 4px;
}

/* ── Chord block palette coloring ── */
.chord-block { cursor: pointer; transition: filter 0.1s; }
.chord-block:hover { filter: brightness(1.4); }
.chord-block.selected { outline: 1px solid currentColor; filter: brightness(1.5); }

/* Collapsed chords row — a thin strip like the collapsed Structure track. */
.track-row.chords-row.collapsed,
.track-row.chords-row.collapsed .track-canvas { height: 18px !important; }
.track-row.chords-row.collapsed .chord-block { font-size: 6.5px; padding: 0 3px; letter-spacing: 0; }
.track-row.chords-row.collapsed .track-label .track-name { font-size: 7px; }

/* ── Chords mode button ── */
#chordsModeBtn.active { border-color: #ff4da6; color: #ff4da6; background: rgba(255,77,166,.05); }

/* ── Palette swatch ── */
.palette-swatch {
  display: inline-block; width: 16px; height: 16px;
  border-radius: 2px; border: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

/* ── Preset palette grid ── */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 4px;
}
.preset-tile {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: border-color var(--trans), transform .1s;
}
.preset-tile:hover { border-color: var(--border2); transform: scale(1.05); }
.preset-tile:active { transform: scale(0.97); }
.preset-half { height: 16px; }
.preset-label {
  font-size: 6px;
  letter-spacing: 1px;
  text-align: center;
  padding: 2px 0;
  color: var(--label);
  background: var(--surface);
  text-transform: uppercase;
}

/* ── Chord palette table ── */
.chord-palette-table { width: 100%; border-collapse: collapse; }
.chord-palette-table td { padding: 2px 4px; vertical-align: middle; }

/* ── Editing mode — track label highlight ── */
.track-label.editing {
  background: rgba(0, 229, 255, 0.06) !important;
  border-right-color: var(--accent) !important;
}
.track-label.editing .track-name {
  color: var(--accent);
}
.sections-row .track-label.editing {
  background: rgba(0, 229, 255, 0.08) !important;
}

/* "EDIT" badge shown on labels in editing mode */
.track-editing-badge {
  font-size: 6px;
  letter-spacing: 1.2px;
  color: var(--accent);
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.35);
  border-radius: 2px;
  padding: 1px 4px;
  flex-shrink: 0;
  animation: edit-badge-pulse 1.8s ease-in-out infinite;
}
@keyframes edit-badge-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* Section / chord blocks in drag-editable state */
.section-block.editable {
  cursor: grab !important;
}
.section-block.editable:active {
  cursor: grabbing !important;
}
.chord-block.editable {
  cursor: grab !important;
  user-select: none;
}
.chord-block.editable:active {
  cursor: grabbing !important;
}
