/* ---------- Chronologie ---------- */

.timeline {
  position: relative;
  flex: 1;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.006)), var(--card);
  overflow: hidden;
}

.tl-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--lane-gutter) minmax(0, 1fr);
  grid-template-rows: 26px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
}

.tl-corner {
  position: sticky;
  top: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 26px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #0a0f16;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.tl-ruler {
  position: sticky;
  top: 0;
  z-index: 6;
  height: 26px;
  border-bottom: 1px solid var(--line);
  background: #0a0f16;
  overflow: hidden;
}
.tl-ruler canvas { display: block; width: 100%; height: 26px; }

.track-head {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #0b1119;
  transition: background 0.15s ease;
}
.track-head:hover { background: #0d141d; }
.track-head.active { background: #0c1620; }
.track-head.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, #22d3ee, #8b5cf6);
}

.track-title { display: flex; align-items: center; gap: 7px; min-width: 0; }

.track-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.track-head.muted .track-dot { background: #62768d; box-shadow: none; }

.track-name {
  flex: 1;
  min-width: 0;
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
}
.track-name:hover { background: rgba(255, 255, 255, 0.045); }
.track-name:focus { outline: 2px solid rgba(34, 211, 238, 0.7); outline-offset: 0; background: rgba(255, 255, 255, 0.05); }

.track-badges { display: flex; align-items: center; gap: 5px; min-width: 0; }

.badge {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.14);
  color: #7ce6f7;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.badge.violet { background: rgba(139, 92, 246, 0.16); color: #c4b5fd; }
.badge.ok { background: rgba(52, 211, 153, 0.14); color: #8ee6c0; }

.track-controls { display: flex; align-items: center; gap: 4px; }

.mini-btn {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.mini-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.mini-btn.on {
  color: #c8f7ff;
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.16);
}
.mini-btn.solo.on {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.14);
}
.mini-btn.danger:hover { color: #fca5a5; background: rgba(248, 113, 113, 0.14); }
.mini-btn svg { width: 12px; height: 12px; }

.track-faders { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.fader { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fader label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6f839b;
}
.fader input[type="range"] {
  width: 100%;
  height: 3px;
  margin: 4px 0;
  accent-color: var(--ok);
  cursor: pointer;
}
.fader.pan input[type="range"] { accent-color: var(--accent); }

.lane-cell {
  position: relative;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.lane-cell canvas {
  display: block;
  border-radius: 10px;
  background: #06090e;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.tl-overlay {
  grid-column: 2;
  grid-row: 2 / -1;
  position: relative;
  z-index: 4;
  cursor: text;
  touch-action: none;
  min-height: 40px;
}

.tl-selection {
  position: absolute;
  top: 0;
  bottom: 0;
  display: none;
  background: rgba(34, 211, 238, 0.1);
  border-left: 1px solid rgba(34, 211, 238, 0.6);
  border-right: 1px solid rgba(34, 211, 238, 0.6);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.08);
  pointer-events: none;
}

.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(180deg, #67e8f9, #8b5cf6);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.7);
  pointer-events: none;
  will-change: transform;
}
.tl-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  width: 10px;
  height: 9px;
  border-radius: 2px 2px 4px 4px;
  background: linear-gradient(180deg, #c8f7ff, #22d3ee);
}

/* ---------- État vide ---------- */

.tl-empty {
  position: absolute;
  top: 26px;
  left: var(--lane-gutter);
  right: 0;
  bottom: 30px;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 3;
}
.tl-empty.hidden { display: none; }
.empty-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 380px;
  padding: 20px;
  pointer-events: auto;
}
.empty-icon {
  width: 86px;
  height: 86px;
  color: rgba(120, 186, 235, 0.5);
  filter: drop-shadow(0 12px 40px rgba(34, 211, 238, 0.18));
}
.empty-inner h2 { margin: 14px 0 0; font-size: 18px; font-weight: 600; color: #d7e3f3; }
.empty-inner p { margin: 8px 0 16px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.empty-inner .btn { width: auto; }

/* ---------- Pied de chronologie ---------- */

.tl-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 12px;
  min-height: 30px;
  border-top: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.5);
}
.tl-scroll {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #141c27;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}
.tl-thumb {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  min-width: 26px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f5a70, #2c7d97);
  transition: background 0.15s ease;
}
.tl-scroll:hover .tl-thumb { background: linear-gradient(90deg, #1e7288, #22a3bd); }
.tl-zoom { font-size: 10px; color: #62768d; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Repères et régions ---------- */

.tl-markers { position: absolute; inset: 0; pointer-events: none; z-index: 5; }

.tl-region {
  position: absolute;
  top: 0;
  bottom: 0;
  pointer-events: none;
  background: rgba(139, 92, 246, 0.09);
  border-left: 1px solid rgba(139, 92, 246, 0.4);
  border-right: 1px solid rgba(139, 92, 246, 0.4);
}

.tl-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: rgba(103, 232, 249, 0.55);
  pointer-events: auto;
  cursor: pointer;
}
.tl-marker::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  width: 9px;
  bottom: 0;
}
.tl-marker span {
  position: absolute;
  top: 3px;
  left: 5px;
  max-width: 168px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 1px 5px;
  border: 1px solid rgba(34, 211, 238, 0.32);
  border-radius: 5px;
  background: rgba(8, 12, 18, 0.86);
  color: #c8f7ff;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.marker-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 148px;
  overflow-y: auto;
}
.marker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 11px;
  cursor: pointer;
}
.marker-row:hover { background: rgba(34, 211, 238, 0.1); }
.marker-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cfe0f2; }
.marker-time { color: #8296ad; font-size: 9.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.marker-row .icon-mini { color: #fca5a5; }
.marker-empty { padding: 6px 2px; color: #62768d; font-size: 11px; }

.meter { position: relative; }
.meter-hold {
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: 0;
  width: 2px;
  border-radius: 1px;
  background: #f8fafc;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
  transition: left 0.08s linear;
}
