/* lighting.ai — Dark Theme
   Shared stylesheet for all pages.
   Fonts: Sora (UI) + DM Mono (data/monospace) */

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

/* ── Design Tokens ─────────────────────────────────── */
:root {
  --bg:      #08090d;
  --bg2:     #0e1017;
  --bg3:     #151820;
  --bg4:     #1c1f2b;
  --border:  #1e2230;
  --border2: #2a2e40;
  --t1:      #eef0f6;
  --t2:      #a0a4b8;
  --t3:      #5c6080;
  --t4:      #363a52;
  --green:   #00dc82;
  --amber:   #f0a030;
  --cyan:    #38bdf8;
  --red:     #ff3b5c;

  --font-ui:   'Sora', sans-serif;
  --font-mono: 'DM Mono', monospace;

  --radius:  6px;
  --radius2: 10px;
  --gap:     12px;
  --header-h: 52px;
}

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

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--t1);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  /* iOS safe areas for notch/rounded corners */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Typography ────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 600; }
h1 { font-size: 1.25rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }

.mono { font-family: var(--font-mono); }

/* ── Layout: App Shell ─────────────────────────────── */
#app {
  display: grid;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-columns: 280px 1fr;
  grid-template-areas:
    "header  header"
    "sidebar content";
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ── Header ────────────────────────────────────────── */
#header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 0 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  position: sticky;
  top: 0;
  min-height: var(--header-h);
  flex-shrink: 0;
}

#header .logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--green);
  letter-spacing: -0.02em;
  white-space: nowrap;
  user-select: none;
}

#header .logo span {
  color: var(--t3);
  font-weight: 400;
}

/* ── Tabs ──────────────────────────────────────────── */
.tab-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 24px;
}

.app-version {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--t3);
  margin-left: 10px;
  user-select: none;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--t3);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 16px;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s, background 0.15s;
  min-height: 36px;
  user-select: none;
}

.tab-btn:hover {
  color: var(--t2);
  background: var(--bg3);
}

.tab-btn.active {
  color: var(--green);
  background: var(--bg);
  border-bottom: 2px solid var(--green);
}

/* ── Header right section ──────────────────────────── */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--gap);
}

/* ── Sync Status Badge ─────────────────────────────── */
.sync-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 99px;
  user-select: none;
}

.sync-status[data-status="saved"] {
  color: var(--green);
  background: rgba(0, 220, 130, 0.1);
  border: 1px solid rgba(0, 220, 130, 0.25);
}

.sync-status[data-status="unsaved"] {
  color: var(--amber);
  background: rgba(240, 160, 48, 0.1);
  border: 1px solid rgba(240, 160, 48, 0.25);
}

.sync-status[data-status="saving"] {
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.sync-status[data-status="error"] {
  color: var(--red);
  background: rgba(255, 59, 92, 0.1);
  border: 1px solid rgba(255, 59, 92, 0.25);
}

.sync-status[data-status="loading"] {
  color: var(--t3);
  background: rgba(92, 96, 128, 0.1);
  border: 1px solid rgba(92, 96, 128, 0.25);
}

.sync-status[data-status="readonly"] {
  color: var(--amber);
  background: rgba(240, 160, 48, 0.1);
  border: 1px solid rgba(240, 160, 48, 0.25);
  cursor: pointer;
}

.sync-status[data-status="error"] ,
.sync-status[data-status="readonly"] {
  cursor: pointer;
}

/* ── Icon Buttons ──────────────────────────────────── */
.icon-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--t2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  font-size: 1.1rem;
}

.icon-btn:hover {
  color: var(--t1);
  background: var(--bg3);
  border-color: var(--border2);
}

/* ── Sidebar ───────────────────────────────────────── */
#sidebar {
  grid-area: sidebar;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
}

.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-header .search-box { flex: 1; min-width: 0; }

.sidebar-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--t3);
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sidebar-toggle:hover {
  color: var(--t1);
  border-color: var(--border2);
  background: var(--bg3);
}

/* ── Sidebar collapsed state ── */
#app.sidebar-collapsed {
  grid-template-columns: 40px 1fr;
}

#app.sidebar-collapsed #sidebar {
  overflow: visible;
}

#app.sidebar-collapsed #sidebar .search-box,
#app.sidebar-collapsed #sidebar .song-count,
#app.sidebar-collapsed #sidebar .song-list {
  display: none;
}

#app.sidebar-collapsed .sidebar-header {
  padding: 6px;
  border-bottom: none;
  justify-content: center;
}

#app.sidebar-collapsed .sidebar-toggle {
  width: 28px;
  height: 28px;
}

.search-box {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--t1);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
}

.search-box::placeholder { color: var(--t4); }
.search-box:focus { border-color: var(--green); }

.song-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--t3);
  padding: 6px 12px 2px;
  letter-spacing: 0.05em;
}

/* ── Song List ─────────────────────────────────────── */
.song-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.song-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-color 0.1s;
  min-height: 44px;
}

.song-item:hover {
  background: var(--bg3);
}

.song-item.active {
  background: var(--bg3);
  border-left-color: var(--green);
}

.song-item .song-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--t1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.song-item .song-artist {
  font-size: 0.75rem;
  color: var(--t3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-item .song-bpm {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--t3);
  min-width: 36px;
  text-align: right;
}

/* ── Content Area ──────────────────────────────────── */
#content {
  grid-area: content;
  overflow: hidden;
  background: var(--bg);
}

/* ── Welcome / Empty State ─────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--t3);
  gap: 12px;
  text-align: center;
}

.empty-state .icon { font-size: 3rem; opacity: 0.3; }
.empty-state p { max-width: 320px; font-size: 0.9rem; }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--t1);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 36px;
  user-select: none;
}

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

.btn-primary {
  background: var(--green);
  color: var(--bg);
  border-color: var(--green);
  font-weight: 600;
}

.btn-primary:hover {
  background: #00c474;
  border-color: #00c474;
}

.btn-danger {
  color: var(--red);
  border-color: rgba(255, 59, 92, 0.3);
}

.btn-danger:hover {
  background: rgba(255, 59, 92, 0.1);
}

.btn-success {
  color: var(--green);
  border-color: rgba(0, 220, 130, 0.3);
}

.btn-success:hover {
  background: rgba(0, 220, 130, 0.1);
}

.btn-sm {
  font-size: 0.75rem;
  padding: 4px 10px;
  min-height: 28px;
}

/* ── Forms / Inputs ────────────────────────────────── */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="url"],
select,
textarea {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--t1);
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.15s;
  min-height: 36px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
}

input::placeholder, textarea::placeholder { color: var(--t4); }

label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--t2);
  display: block;
  margin-bottom: 4px;
}

/* ── Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 24px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-bottom: 16px;
  color: var(--t1);
}

.modal .form-group {
  margin-bottom: 14px;
}

.modal .form-group input,
.modal .form-group select {
  width: 100%;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Confirm Modal */
.confirm-modal p {
  color: var(--t2);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 0;
}

/* ── Part Waveform Editor Modal ────────────────────── */
.part-wave-modal {
  max-width: 700px;
  width: 95%;
  padding: 20px;
}
.pw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.pw-header h2 { margin: 0; font-size: 1.1rem; }
.pw-header #pw-close {
  font-size: 1.3rem;
  line-height: 1;
  padding: 4px 10px;
  color: var(--t3);
}
.pw-waveform-wrap {
  position: relative;
  height: 140px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}
#pw-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
/* Dimmed areas outside trim range */
.pw-dim {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.pw-dim-left { left: 0; }
.pw-dim-right { right: 0; }
/* Trim handles */
.pw-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  z-index: 2;
  touch-action: none;
}
.pw-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 36px;
  border-radius: 1px;
}
.pw-handle-start { border-left: 3px solid var(--green); }
.pw-handle-start::after { background: var(--green); }
.pw-handle-end { border-right: 3px solid var(--red); }
.pw-handle-end::after { background: var(--red); }
/* Expand touch target on mobile */
@media (pointer: coarse) {
  .pw-handle { width: 20px; }
}
/* Playhead */
.pw-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--t1);
  pointer-events: none;
  z-index: 3;
  display: none;
}
/* Time display */
.pw-times {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}
.pw-time-label {
  color: var(--t3);
  font-size: 0.8rem;
}
.pw-time-label .mono {
  color: var(--t1);
  margin-left: 4px;
}
/* Controls */
.pw-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
}
.pw-nudge-group {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pw-sep {
  width: 12px;
}
.pw-play-group { display: flex; gap: 6px; }

/* ── Toast / Notifications ─────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--t1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.25s ease;
}

.toast.success { border-color: rgba(0, 220, 130, 0.4); }
.toast.error   { border-color: rgba(255, 59, 92, 0.4); color: var(--red); }
.toast.info    { border-color: rgba(56, 189, 248, 0.4); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* ── Utility ───────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.gap { gap: var(--gap); }
.flex-1 { flex: 1; }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-cyan  { color: var(--cyan); }
.text-red   { color: var(--red); }
.text-t1    { color: var(--t1); }
.text-t2    { color: var(--t2); }
.text-t3    { color: var(--t3); }
.text-t4    { color: var(--t4); }

/* ══════════════════════════════════════════════════════
   DB EDITOR — Meilenstein 2
   ══════════════════════════════════════════════════════ */

/* ── Editor Panel Layout ──────────────────────────── */
.editor-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.editor-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Song Fields Grid ─────────────────────────────── */
.song-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
  max-width: 960px;
}

.song-fields .sf-wide {
  grid-column: span 2;
}

.song-fields .sf-full {
  grid-column: 1 / -1;
}

.song-fields .sf-delete {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.song-fields input,
.song-fields textarea,
.song-fields select {
  width: 100%;
}

.song-fields textarea {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--t1);
  padding: 8px 12px;
  outline: none;
  resize: vertical;
  min-height: 36px;
  transition: border-color 0.15s;
}

.song-fields textarea:focus {
  border-color: var(--green);
}

/* ── Parts Header + Toolbar ───────────────────────── */
.parts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  max-width: 960px;
}

.parts-toolbar {
  display: flex;
  gap: 4px;
}

.parts-toolbar .btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Parts Table ──────────────────────────────────── */
.parts-table {
  width: 100%;
  max-width: 960px;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.parts-table thead tr {
  text-align: left;
  color: var(--t3);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.parts-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.parts-table .part-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.parts-table .part-row:hover {
  background: var(--bg3);
}

.parts-table .part-row.active {
  background: rgba(0, 220, 130, 0.06);
  border-left: 3px solid var(--green);
}

.parts-table td {
  padding: 4px 8px;
  vertical-align: middle;
}

.parts-table .pt-pos { width: 36px; text-align: center; font-size: 0.8rem; }
.parts-table .pt-play { width: 36px; text-align: center; padding: 0; }
.parts-table .pt-name { min-width: 120px; font-size: 0.85rem; }
.parts-table .pt-start { width: 90px; font-size: 0.8rem; }
.parts-table .pt-bars { width: 48px; text-align: center; }
.parts-table .pt-dur  { width: 56px; font-size: 0.8rem; text-align: center; }
.parts-table .pt-tmpl { min-width: 120px; font-size: 0.8rem; }
.parts-table .pt-grip { width: 28px; text-align: center; font-size: 1.1rem; cursor: grab; }

/* Play button in parts table */
.btn-part-play {
  background: none;
  border: 1px solid var(--border2);
  color: var(--green);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  line-height: 1;
}
.btn-part-play:hover {
  background: var(--bg4);
  border-color: var(--green);
}
.btn-part-play.playing {
  color: var(--red);
  border-color: var(--red);
}
.btn-part-play.playing:hover {
  background: rgba(255, 59, 92, 0.1);
}

/* Bar play button (Takte tab) */
.btn-bar-play {
  background: none;
  border: 1px solid var(--border2);
  color: var(--green);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  padding: 0;
  line-height: 1;
}
.btn-bar-play:hover {
  background: var(--bg4);
  border-color: var(--green);
}
.btn-bar-play.playing {
  color: var(--red);
  border-color: var(--red);
}
.btn-bar-play.playing:hover {
  background: rgba(255, 59, 92, 0.1);
}

.ttt-play { width: 36px; text-align: center; padding: 0; }

/* "Alle Songs" item in song list */
.song-item-all {
  border-bottom: 1px solid var(--border);
}

/* Parts table inline inputs */
.part-input {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--t1);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 4px 8px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  min-height: 32px;
}

.part-input:hover {
  border-color: var(--border);
  background: var(--bg3);
}

.part-input:focus {
  border-color: var(--green);
  background: var(--bg3);
}

.part-input-num {
  width: 60px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--t1);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 4px 8px;
  outline: none;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  min-height: 32px;
  -moz-appearance: textfield;
}

.part-input-num::-webkit-inner-spin-button,
.part-input-num::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.part-input-num:hover {
  border-color: var(--border);
  background: var(--bg3);
}

.part-input-num:focus {
  border-color: var(--green);
  background: var(--bg3);
}

.part-select {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 32px;
}

.part-select:hover {
  border-color: var(--border);
  background: var(--bg3);
}

.part-select:focus {
  border-color: var(--green);
  background: var(--bg3);
}

.part-select option {
  background: var(--bg2);
  color: var(--t1);
}

/* ── Bar Section ──────────────────────────────────── */
.bar-section {
  max-width: 960px;
  padding-bottom: 20px;
}

.bar-section h3 {
  margin-bottom: 12px;
}

.bar-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.bar-block {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--t2);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
}

.bar-block:hover {
  background: var(--bg4);
  border-color: var(--border2);
  color: var(--t1);
}

.bar-block.active {
  background: rgba(0, 220, 130, 0.15);
  border-color: var(--green);
  color: var(--green);
  font-weight: 600;
}

.bar-block.has-accents {
  border-bottom: 2px solid var(--amber);
}

.bar-block.has-lyrics {
  color: var(--t1);
}

.bar-block.has-accents.active {
  border-bottom-color: var(--amber);
}

/* ── Bar Editor ───────────────────────────────────── */
.bar-editor {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 16px;
  margin-top: 8px;
}

.bar-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bar-lyrics-input {
  width: 100%;
}

/* ── Accent Legend ─────────────────────────────────── */
.accent-legend {
  display: flex;
  gap: 6px;
}

.legend-item {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.legend-item.bl { background: rgba(240, 160, 48, 0.2); color: var(--amber); }
.legend-item.bo { background: rgba(255, 59, 92, 0.2); color: var(--red); }
.legend-item.hl { background: rgba(0, 220, 130, 0.2); color: var(--green); }
.legend-item.st { background: rgba(56, 189, 248, 0.2); color: var(--cyan); }
.legend-item.fg { background: rgba(92, 96, 128, 0.2); color: var(--t3); }

/* ── Accent Grid (16th notes) ─────────────────────── */
.accent-grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  gap: 3px;
}

.accent-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s;
  user-select: none;
  position: relative;
}

.accent-cell:hover {
  background: var(--bg4);
  border-color: var(--border2);
}

.accent-cell.beat {
  border-bottom: 2px solid var(--border2);
}

.accent-num {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--t4);
  line-height: 1;
}

.accent-cell.beat .accent-num {
  color: var(--t3);
  font-weight: 500;
}

.accent-tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1;
  margin-top: 4px;
}

/* Accent type colors */
.accent-cell.bl {
  background: rgba(240, 160, 48, 0.2);
  border-color: var(--amber);
}
.accent-cell.bl .accent-tag { color: var(--amber); }

.accent-cell.bo {
  background: rgba(255, 59, 92, 0.2);
  border-color: var(--red);
}
.accent-cell.bo .accent-tag { color: var(--red); }

.accent-cell.hl {
  background: rgba(0, 220, 130, 0.2);
  border-color: var(--green);
}
.accent-cell.hl .accent-tag { color: var(--green); }

.accent-cell.st {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--cyan);
}
.accent-cell.st .accent-tag { color: var(--cyan); }

.accent-cell.fg {
  background: rgba(92, 96, 128, 0.2);
  border-color: var(--t3);
}
.accent-cell.fg .accent-tag { color: var(--t3); }

/* ── Summary Bar ──────────────────────────────────── */
.summary-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 20px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-item .mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--t1);
}

/* ══════════════════════════════════════════════════════
   AUDIO SPLIT — Meilenstein 3
   ══════════════════════════════════════════════════════ */

/* ── Audio Panel Layout ──────────────────────────── */
.audio-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.audio-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Song Header (Audio Tab) ─────────────────────── */
.audio-song-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.audio-song-header .ash-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--t1);
}

.audio-song-header .ash-artist {
  font-size: 0.85rem;
  color: var(--t3);
}

.audio-song-header .ash-bpm {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--green);
  background: rgba(0, 220, 130, 0.1);
  padding: 4px 12px;
  border-radius: 99px;
  border: 1px solid rgba(0, 220, 130, 0.2);
}

/* ── Drop Zone ───────────────────────────────────── */
.audio-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 28px 20px;
  border: 2px dashed var(--border2);
  border-radius: var(--radius2);
  background: var(--bg2);
  color: var(--t3);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 20px;
  min-height: 80px;
  user-select: none;
}

.audio-dropzone:hover,
.audio-dropzone.dragover {
  border-color: var(--green);
  background: rgba(0, 220, 130, 0.04);
  color: var(--t2);
}

.audio-dropzone .dz-icon {
  font-size: 2rem;
  opacity: 0.4;
}

.audio-dropzone .dz-text {
  font-size: 0.85rem;
}

.audio-dropzone .dz-formats {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--t4);
}

.audio-dropzone.has-file {
  border-style: solid;
  border-color: var(--border);
  padding: 14px 20px;
  flex-direction: row;
  justify-content: space-between;
  min-height: auto;
}

.audio-dropzone.has-file .dz-info {
  display: flex;
  gap: 16px;
  align-items: center;
}

.audio-dropzone.has-file .dz-info span {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--t2);
}

.audio-dropzone.has-file .dz-filename {
  color: var(--t1);
  font-weight: 500;
}

.audio-dropzone.has-file .dz-filename {
  color: var(--t1);
  font-weight: 500;
}

.audio-dropzone.has-file .dz-change {
  font-size: 0.75rem;
  color: var(--t3);
}

/* ── Waveform Canvas ─────────────────────────────── */
.waveform-wrap {
  position: relative;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--bg2);
  border: 1px solid var(--border);
  cursor: crosshair;
  height: 120px;
}

.waveform-scroll {
  min-width: 100%;
  height: 100%;
}
.waveform-wrap.dragging,
.waveform-wrap.dragging * {
  cursor: grabbing !important;
}

/* ── Mini Waveforms (Parts + Takte table) ────────── */
.mini-waveform {
  width: 120px;
  height: 28px;
  border-radius: 3px;
  background: var(--bg);
  display: block;
  cursor: pointer;
}
.mini-waveform-sm {
  width: 80px;
  height: 22px;
}
.ptt-wave { width: 160px; }
.ptt-wave .mini-waveform { width: 150px; height: 32px; }
.ttt-wave { width: 90px; }

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

/* ── Transport Controls ──────────────────────────── */
.transport-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.transport-bar .t-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--t2);
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.15s;
  user-select: none;
}

.transport-bar .t-btn:hover {
  background: var(--bg4);
  color: var(--t1);
  border-color: var(--border2);
}

.transport-bar .t-btn.playing {
  background: rgba(0, 220, 130, 0.15);
  border-color: var(--green);
  color: var(--green);
}

.transport-bar .t-time {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--t2);
  min-width: 120px;
  text-align: center;
}

.transport-bar .t-progress-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.transport-bar .t-progress {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  width: 0%;
  transition: width 0.05s linear;
}

/* ── Speed / Zoom Controls ──────────────────────── */
.t-speed, .t-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 4px;
}

.t-speed-btn, .t-zoom-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--t2);
  cursor: pointer;
  font-size: 0.9rem;
  border-radius: 4px;
  transition: all 0.15s;
}

.t-speed-btn:hover, .t-zoom-btn:hover {
  background: var(--bg4);
  color: var(--t1);
}

.t-speed-label, .t-zoom-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t2);
  min-width: 36px;
  text-align: center;
  user-select: none;
}

/* ── Tap Buttons ─────────────────────────────────── */
.tap-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tap-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 12px;
  border-radius: var(--radius);
  border: 2px solid;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 0.15s;
  user-select: none;
  min-height: 64px;
}

.tap-btn .tap-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tap-btn .tap-label kbd {
  font-size: 0.6rem;
  opacity: 0.5;
  margin-left: 4px;
  padding: 1px 4px;
  border: 1px solid currentColor;
  border-radius: 3px;
  vertical-align: middle;
}

.tap-btn .tap-info {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.7;
}

.tap-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

.tap-btn.tap-part {
  background: rgba(240, 160, 48, 0.08);
  border-color: rgba(240, 160, 48, 0.3);
  color: var(--amber);
}

.tap-btn.tap-part:not([disabled]):hover,
.tap-btn.tap-part:not([disabled]):active {
  background: rgba(240, 160, 48, 0.2);
  border-color: var(--amber);
}

.tap-btn.tap-bar {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.3);
  color: var(--cyan);
}

.tap-btn.tap-bar:not([disabled]):hover,
.tap-btn.tap-bar:not([disabled]):active {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--cyan);
}

.tap-btn.tap-undo {
  flex: 0 0 80px;
  background: rgba(255, 59, 92, 0.08);
  border-color: rgba(255, 59, 92, 0.3);
  color: var(--red);
}

.tap-btn.tap-undo:not([disabled]):hover,
.tap-btn.tap-undo:not([disabled]):active {
  background: rgba(255, 59, 92, 0.2);
  border-color: var(--red);
}

.tap-btn.tap-btn-del {
  border-color: rgba(255, 59, 92, 0.3);
  background: rgba(255, 59, 92, 0.05);
  color: var(--red);
}

.tap-btn.tap-btn-del:not([disabled]):hover {
  background: rgba(255, 59, 92, 0.15);
  border-color: var(--red);
}

.tap-btn.tap-btn-snap {
  border-color: rgba(0, 220, 130, 0.3);
  background: rgba(0, 220, 130, 0.05);
  color: var(--green);
}

.tap-btn.tap-btn-snap:not([disabled]):hover {
  background: rgba(0, 220, 130, 0.15);
  border-color: var(--green);
}

/* ── Split Result List ───────────────────────────── */
.split-result {
  margin-bottom: 16px;
}

.split-result h3 {
  margin-bottom: 8px;
}

.split-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.split-table thead tr {
  text-align: left;
  color: var(--t3);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.split-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.split-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.split-table .st-nr { width: 40px; text-align: center; }
.split-table .st-name { min-width: 120px; }
.split-table .st-bars { width: 64px; text-align: center; }
.split-table .st-start { width: 80px; text-align: center; }
.split-table .st-dur { width: 80px; text-align: center; }
.split-table .st-check { width: 36px; text-align: center; }
.split-table .st-actions { width: 32px; text-align: center; }

.marker-delete {
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(255, 59, 92, 0.1);
  color: var(--red);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.marker-delete:hover {
  background: rgba(255, 59, 92, 0.3);
}

.split-table tbody tr {
  transition: background 0.1s;
}

.split-table tbody tr.done:hover {
  background: rgba(0, 220, 130, 0.05);
}

.split-table tbody tr.current {
  background: rgba(240, 160, 48, 0.08);
  border-left: 3px solid var(--amber);
}

.split-table tbody tr.done {
  color: var(--t3);
}

.split-table tbody tr.done .st-check {
  color: var(--green);
}

/* ── Export Section ───────────────────────────────── */
.export-section {
  margin-top: 16px;
  padding: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
}

.export-section .export-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.export-section .export-header h3 {
  margin: 0;
}

.export-progress {
  margin-top: 12px;
}

.export-progress-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.export-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transition: width 0.2s;
}

.export-progress-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t3);
}

/* ── BPM Update Banner ───────────────────────────── */
.bpm-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(240, 160, 48, 0.1);
  border: 1px solid rgba(240, 160, 48, 0.3);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.bpm-banner .bpm-banner-text {
  flex: 1;
  font-size: 0.85rem;
  color: var(--amber);
}

.bpm-banner .btn {
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════
   HELP MODAL
   ══════════════════════════════════════════════════════ */

.help-modal {
  max-width: 600px;
  width: 95%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.help-header h2 {
  margin: 0;
}

/* ── Help Tabs ────────────────────────────────────── */
.help-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.help-tab {
  background: none;
  border: none;
  color: var(--t3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s;
  user-select: none;
}

.help-tab:hover {
  color: var(--t2);
}

.help-tab.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

/* ── Help Pages ───────────────────────────────────── */
.help-page {
  display: none;
  overflow-y: auto;
  flex: 1;
  padding-right: 4px;
}

.help-page.active {
  display: block;
}

.help-page h3 {
  font-size: 0.9rem;
  color: var(--t1);
  margin: 16px 0 8px;
}

.help-page h3:first-child {
  margin-top: 0;
}

.help-page p {
  font-size: 0.85rem;
  color: var(--t2);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ── Help Steps ───────────────────────────────────── */
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.help-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.help-step-nr {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 220, 130, 0.15);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
}

.help-step div {
  font-size: 0.85rem;
  color: var(--t2);
  line-height: 1.5;
}

/* ── Help Table (key-value rows) ──────────────────── */
.help-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.help-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-size: 0.85rem;
}

.help-key {
  flex-shrink: 0;
  min-width: 100px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--t1);
}

.help-row span:last-child {
  color: var(--t2);
}

.help-row kbd,
.help-page kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  color: var(--t1);
  line-height: 1.4;
}

/* ══════════════════════════════════════════════════════
   PARTS TAB
   ══════════════════════════════════════════════════════ */

.parts-tab-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.parts-tab-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Parts Tab Header (Filter + Toolbar) ──────────── */
.parts-tab-header {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.parts-tab-filter {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.parts-tab-filter label {
  margin-bottom: 4px;
}

.parts-tab-filter-select {
  width: 100%;
}

/* ── Parts Tab Table ──────────────────────────────── */
.parts-tab-table {
  width: 100%;
  max-width: 1100px;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.parts-tab-table thead tr {
  text-align: left;
  color: var(--t3);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.parts-tab-table th {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

.parts-tab-table .ptt-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.parts-tab-table .ptt-row:hover {
  background: var(--bg3);
}

.parts-tab-table .ptt-row.active {
  background: rgba(0, 220, 130, 0.06);
  border-left: 3px solid var(--green);
}

.parts-tab-table td {
  padding: 4px 8px;
  vertical-align: middle;
}

.parts-tab-table .ptt-pos { width: 36px; text-align: center; font-size: 0.8rem; }
.parts-tab-table .ptt-song { min-width: 140px; max-width: 200px; }
.parts-tab-table .ptt-name { min-width: 120px; }
.parts-tab-table .ptt-start { width: 110px; }
.parts-tab-table .ptt-bars { width: 72px; }
.parts-tab-table .ptt-dur { width: 72px; }
.parts-tab-table .ptt-tmpl { min-width: 160px; }
.parts-tab-table .ptt-instr { width: 36px; text-align: center; }
.parts-tab-table .ptt-instr .instr-check { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; }
.parts-tab-table .ptt-notes { min-width: 120px; }

.ptt-song-name {
  font-size: 0.8rem;
  color: var(--cyan);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.ptt-song-name:hover {
  text-decoration: underline;
}

.ptt-notes-input {
  font-size: 0.8rem;
  color: var(--t3);
}

.parts-tab-table .ptt-play { width: 36px; text-align: center; padding: 0; }

/* Start cell: bar input + time label */
.start-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}
.start-cell .part-input-num { width: 52px; flex-shrink: 0; }
.start-cell .start-time { font-size: 0.75rem; white-space: nowrap; }

/* ── Takte Tab ─────────────────────────────────────── */

.takte-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 12px 4px;
}
.takte-toolbar .btn-small {
  font-size: 0.75rem;
  padding: 4px 12px;
}

.takte-tab-table .ttt-nr { width: 36px; text-align: center; font-size: 0.8rem; }
.takte-tab-table .ttt-song { min-width: 120px; max-width: 180px; }
.takte-tab-table .ttt-part { width: 110px; font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.takte-tab-table .ttt-bar { width: 48px; text-align: center; }
.takte-tab-table .ttt-time { width: 56px; text-align: center; font-size: 0.8rem; }
.takte-tab-table .ttt-lyrics { min-width: 160px; }
.takte-tab-table .ttt-acc { width: 48px; text-align: center; font-size: 0.8rem; }
.takte-tab-table .ttt-audio { width: 48px; text-align: center; }

.ttt-song-name {
  font-size: 0.8rem;
  color: var(--cyan);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.ttt-song-name:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════
   SETLIST — Meilenstein 4
   ══════════════════════════════════════════════════════ */

/* ── Setlist Panel Layout ──────────────────────────── */
.setlist-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.setlist-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Setlist Header (Name + Actions) ───────────────── */
.setlist-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.setlist-name-input {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 600;
  max-width: 400px;
}

.setlist-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* ── Setlist Items ─────────────────────────────────── */
.setlist-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 960px;
  min-height: 100px;
}

.setlist-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.1s, border-color 0.15s, opacity 0.15s, transform 0.15s;
  user-select: none;
  position: relative;
}

.setlist-card:hover {
  background: var(--bg3);
  border-color: var(--border2);
}

.setlist-card.dragging {
  opacity: 0.4;
  border-color: var(--green);
}

.setlist-card .sl-pos {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--t3);
  min-width: 28px;
  text-align: center;
}

.setlist-card .sl-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--t1);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setlist-card .sl-artist {
  font-size: 0.8rem;
  color: var(--t3);
  min-width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setlist-card .sl-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-shrink: 0;
}

.setlist-card .sl-meta span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t3);
  white-space: nowrap;
}

.setlist-card .sl-btns {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.setlist-card .sl-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--t3);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.setlist-card .sl-btn:hover {
  background: var(--bg4);
  border-color: var(--border2);
  color: var(--t1);
}

.setlist-card .sl-btn.sl-remove:hover {
  color: var(--red);
  background: rgba(255, 59, 92, 0.1);
}

.setlist-card .sl-grip {
  cursor: grab;
  color: var(--t4);
  font-size: 1rem;
  padding: 0 4px;
  touch-action: none;
}

.setlist-card .sl-grip:active {
  cursor: grabbing;
}

/* ── Pause Item ────────────────────────────────────── */
.setlist-card.pause {
  background: transparent;
  border-style: dashed;
  border-color: var(--border);
  justify-content: center;
  padding: 6px 12px;
  min-height: 36px;
}

.setlist-card.pause .sl-pause-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--t4);
  flex: 1;
  text-align: center;
}

/* ── Drag Indicator Line ───────────────────────────── */
.setlist-drop-indicator {
  height: 2px;
  background: var(--green);
  border-radius: 1px;
  margin: -1px 0;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(0, 220, 130, 0.4);
}

/* ── Song Search Overlay ───────────────────────────── */
.song-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.song-search-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.song-search-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  width: 90%;
  max-width: 500px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.song-search-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.song-search-header input {
  flex: 1;
}

.song-search-header .icon-btn {
  flex-shrink: 0;
}

.song-search-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.song-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  min-height: 44px;
}

.song-search-item:hover {
  background: var(--bg3);
}

.song-search-item.in-setlist {
  opacity: 0.35;
}

.song-search-item .ssi-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--t1);
}

.song-search-item .ssi-artist {
  font-size: 0.8rem;
  color: var(--t3);
}

.song-search-item .ssi-bpm {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--t3);
}

/* ══════════════════════════════════════════════════════
   LYRICS TAB
   ══════════════════════════════════════════════════════ */

/* ── Lyrics Tab ─────────────────────────────────── */
.lyrics-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lyrics-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* ── Raw Text Import Section ─────────────────────── */
.lyrics-raw-section {
  margin: 12px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  padding: 12px;
}

.lyrics-raw-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.lyrics-raw-header h3 {
  margin: 0;
  font-size: 0.9rem;
  color: var(--t1);
}

.lyrics-source-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lyrics-genius-link {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--amber);
  text-decoration: none;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s;
}

.lyrics-genius-link:hover {
  background: var(--bg4);
  border-color: var(--amber);
}

#lyrics-lrclib-btn {
  color: var(--cyan);
  border-color: var(--border2);
}
#lyrics-lrclib-btn:hover {
  border-color: var(--cyan);
}

.lyrics-paste {
  width: 100%;
  min-height: 100px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--t1);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 12px;
  resize: vertical;
}

.lyrics-paste:focus {
  outline: none;
  border-color: var(--green);
}

.lyrics-import-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Parts Toolbar ──────────────────────────────── */
.lyrics-parts-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 4px;
}

/* ── Parts List with Lyrics ──────────────────────── */
.lyrics-parts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 12px;
}

.lyrics-part-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  padding: 10px 12px;
}

.lyrics-part-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.lyrics-part-card.collapsed .lyrics-part-header {
  margin-bottom: 0;
}

.lyrics-collapse-btn {
  background: none;
  border: none;
  color: var(--t3);
  cursor: pointer;
  font-size: 0.65rem;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}
.lyrics-collapse-btn:hover {
  color: var(--t1);
}

.lyrics-preview {
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
  font-style: italic;
}

.lyrics-part-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.lyrics-part-info {
  font-size: 0.72rem;
}

.btn-part-play {
  width: 30px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--t2);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-part-play:hover {
  background: var(--bg4);
  color: var(--green);
}

.btn-part-play.playing {
  color: var(--amber);
  border-color: var(--amber);
}

.btn-part-play.paused {
  color: var(--green);
  border-color: var(--green);
  animation: lyrics-paused-pulse 1.5s ease-in-out infinite;
}

@keyframes lyrics-paused-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ── Copy Lyrics Button ─────────────────────────── */
.btn-lyrics-copy {
  font-size: 0.7rem;
  color: var(--cyan);
  border: 1px solid var(--border2);
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 2px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn-lyrics-copy:hover {
  background: var(--bg4);
  border-color: var(--cyan);
}

/* ── Lyrics Part Scroll Container ────────────────── */
.lyrics-part-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.lyrics-part-scroll-inner {
  width: 100%;
}

/* ── Lyrics Part Waveform ────────────────────────── */
.lyrics-wave-wrap {
  width: 100%;
  height: 48px;
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 6px;
  cursor: ew-resize;
}

.lyrics-wave-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ── Lyrics Bar Input Row ────────────────────────── */
.lyrics-bars-row {
  display: flex;
  gap: 0;
}

.lyrics-bar-cell {
  flex: 1 1 0;
  min-width: 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  overflow: hidden;
  padding: 0 1px;
  box-sizing: border-box;
}

.lyrics-bar-num {
  font-size: 0.6rem;
  text-align: center;
  line-height: 1;
}

.lyrics-bar-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--t1);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 4px 2px;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.lyrics-bar-input:focus {
  border-color: var(--green);
}

.lyrics-bar-input::placeholder {
  color: var(--t4);
}

.lyrics-part-bar-hint {
  font-size: 0.65rem;
  margin-top: 4px;
}

/* ── iPad Keyboard Mode ── */
/* Lock the panel to the visual viewport so nothing renders behind the keyboard.
   Safari doesn't repaint the area behind the sliding keyboard → black band.
   Fix: make panel position:fixed, height = visualViewport.height (--vv-h),
   and let it scroll internally. No content exists behind the keyboard anymore. */
.lyrics-kbd-mode {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  height: var(--vv-h, 100vh);
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  z-index: 10;
  background: var(--bg);
}

.lyrics-kbd-mode .lyrics-raw-section,
.lyrics-kbd-mode .lyrics-wave-wrap,
.lyrics-kbd-mode .audio-song-header {
  display: none !important;
}

.lyrics-kbd-mode .lyrics-part-header {
  padding: 4px 8px;
}

.lyrics-kbd-mode .lyrics-part-card {
  margin-bottom: 4px;
}

/* ── Instrumental Checkbox ────────────────────────── */
.lyrics-instr-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--t3);
  cursor: pointer;
  margin-left: 8px;
  user-select: none;
}

.lyrics-instr-label:hover {
  color: var(--t2);
}

.lyrics-instr-check {
  accent-color: var(--amber);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.lyrics-part-card.instrumental {
  opacity: 0.65;
}

.lyrics-part-card.instrumental .lyrics-part-name::after {
  content: ' (instrumental)';
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--t3);
}

/* ── Apply Button ────────────────────────────────── */
.lyrics-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 16px 0;
}

/* ══════════════════════════════════════════════════════
   Song Progress Panel
   ══════════════════════════════════════════════════════ */

.progress-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  margin-bottom: 16px;
  overflow: hidden;
}

.progress-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: default;
}

.progress-ring-wrap {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.progress-ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--t2);
}

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

.progress-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-next {
  font-size: 0.78rem;
  color: var(--t2);
  margin-top: 2px;
}

.progress-cats-mini {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.progress-cat-pip {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--t3);
}

.progress-cat-pip.done {
  border-color: rgba(0, 220, 130, 0.3);
  color: var(--green);
}

.progress-checklist {
  border-top: 1px solid var(--border);
  padding: 8px 16px 12px;
}

.progress-category {
  margin-bottom: 10px;
}

.progress-category:last-child {
  margin-bottom: 0;
}

.progress-cat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--t2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.progress-cat-icon {
  font-size: 0.85rem;
}

.progress-cat-title { flex: 1; }

.progress-cat-count {
  font-size: 0.7rem;
  font-weight: 500;
}

.progress-cat-check {
  font-size: 0.85rem;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 5px 28px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s;
}

.progress-step:hover { background: var(--bg4); }

.progress-step.done .progress-check { color: var(--green); }
.progress-step.done .progress-label { color: var(--t3); text-decoration: line-through; }

.progress-check {
  width: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--t4);
}

.progress-label { flex: 1; }

.progress-goto {
  font-size: 0.65rem;
  font-family: var(--font-mono);
}

/* Song list progress mini ring */
.song-progress-mini {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.song-pct {
  font-size: 0.65rem;
  color: var(--t3);
  min-width: 22px;
  text-align: right;
}

/* ══════════════════════════════════════════════════════
   Confetti Toast
   ══════════════════════════════════════════════════════ */

.toast-confetti {
  position: relative;
  overflow: hidden;
  border-color: rgba(0, 220, 130, 0.6) !important;
  padding: 0 !important;
}

.toast-confetti-content {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-weight: 500;
  z-index: 1;
  position: relative;
}

.toast-confetti-icon {
  font-size: 1.3rem;
}

.toast-pct {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--green);
  font-weight: 600;
}

.toast-confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════
   Accents Tab
   ══════════════════════════════════════════════════════ */

.accents-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.accents-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.accents-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--bg2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.accents-part-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  margin-bottom: 8px;
  overflow: hidden;
}

.accents-part-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.accents-part-header:hover { background: var(--bg4); }

.accents-part-arrow {
  font-size: 0.7rem;
  color: var(--t3);
  width: 14px;
}

.accents-part-name { font-weight: 500; }
.accents-part-info { font-size: 0.78rem; }
.accents-part-count { font-size: 0.78rem; }

.accents-bars-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 14px 10px;
}

.accents-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  min-height: 36px;
}

.accents-bar-row:hover { background: var(--bg4); }
.accents-bar-row.active { border-color: var(--cyan); background: var(--bg4); }
.accents-bar-row.has-accents { border-color: var(--amber); }

.accents-bar-row .accents-bar-num { font-size: 0.75rem; min-width: 24px; text-align: right; color: var(--t3); }
.accents-bar-row .accents-bar-lyrics { font-size: 0.8rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.accents-bar-row .accents-bar-dots { font-size: 0.7rem; min-width: 20px; text-align: center; }
.accents-bar-row .btn-bar-play { flex-shrink: 0; }

.accents-bar-editor {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
}

.accents-bar-editor-header {
  margin-bottom: 10px;
}

.accents-bar-editor-header h4 {
  font-size: 0.85rem;
  font-weight: 500;
}

.accents-bar-editor-lyrics {
  font-size: 0.85rem;
  margin-top: 4px;
  font-style: italic;
}

