:root {
  --bg:      #0b0b10;
  --ink:     #eef0ff;
  --muted:   #b7bce6;
  --ok:      #38d996;
  --warn:    #ffd35c;
  --danger:  #ff4d6d;
  --accent:  #bd6baa;
  --accent2: #f4d6ff;
  --r:       18px;
  --shadow:  0 18px 42px rgba(0,0,0,.48);
}

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

html, body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow: hidden;
}

.root {
  height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hidden { display: none !important; }

/* ═══════════════════════════════════════
   TOPBAR
═══════════════════════════════════════ */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(18,18,27,.98), rgba(18,18,27,.88));
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

/* LED — uniquement connecté/déconnecté, indépendant du timer */
.pill {
  width: 14px; height: 14px; border-radius: 999px;
  background: rgba(255,255,255,.20);
  transition: background .2s, box-shadow .2s;
}
.pill.connected {
  background: var(--ok);
  box-shadow: 0 0 0 6px rgba(56,217,150,.12);
}
.pill.disconnected, .pill.error {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(255,77,109,.12);
}

.brandTitle { font-weight: 1000; letter-spacing: .4px; }
.brandSub   { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Timer centré */
.topCenter { flex: 1; display: flex; align-items: center; justify-content: center; }
.topTimer  { display: flex; align-items: center; gap: 16px; }

.topTimerLabel {
  font-size: 12px; font-weight: 1000;
  letter-spacing: .8px; text-transform: uppercase; color: var(--muted);
}
.topTimerDisplay {
  font-size: 32px; font-weight: 1000;
  letter-spacing: .02em; font-variant-numeric: tabular-nums;
  min-width: 110px; text-align: center; transition: color .2s;
}
.topTimerDisplay.running  { color: var(--ok); }
.topTimerDisplay.paused   { color: var(--warn); }
.topTimerDisplay.finished, .topTimerDisplay.overrun { color: var(--danger); }

.topTimerStatus {
  font-size: 11px; font-weight: 1000; letter-spacing: .8px; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10); background: rgba(255,255,255,.06); color: var(--muted);
  transition: all .2s;
}
.topTimerStatus.running  { border-color: rgba(56,217,150,.30);  background: rgba(56,217,150,.10);  color: var(--ok); }
.topTimerStatus.paused   { border-color: rgba(255,211,92,.30);  background: rgba(255,211,92,.10);  color: var(--warn); }
.topTimerStatus.finished,
.topTimerStatus.overrun  { border-color: rgba(255,77,109,.30);  background: rgba(255,77,109,.10);  color: var(--danger); }

/* Onglets mode appli */
.topModes { display: flex; gap: 4px; flex: 0 0 auto; }

.modeTab {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 12px; font-weight: 1000;
  cursor: pointer; transition: all .12s;
  letter-spacing: .3px;
}
.modeTab:hover { background: rgba(255,255,255,.12); color: var(--ink); }
.modeTab.active {
  background: rgba(189,107,170,.22);
  border-color: rgba(189,107,170,.42);
  color: var(--accent2);
}

.topActions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.layout {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 14px;
  align-items: stretch;
}

/* ═══════════════════════════════════════
   CARDS
═══════════════════════════════════════ */
.card {
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(24,24,39,.96), rgba(18,18,27,.92));
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column; min-height: 0;
}
.cardHead {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between;
}
.cardTitle { font-weight: 1000; font-size: 13px; letter-spacing: .6px; text-transform: uppercase; }

/* ═══════════════════════════════════════
   TRANSPORT
═══════════════════════════════════════ */
.transportBody {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px; padding: 18px 14px;
}

.bigDisplay {
  font-size: 68px; font-weight: 1000;
  letter-spacing: .02em; font-variant-numeric: tabular-nums;
  line-height: 1; text-align: center; width: 100%;
  transition: color .2s;
}
.bigDisplay.running  { color: var(--ok); }
.bigDisplay.paused   { color: var(--warn); }
.bigDisplay.finished, .bigDisplay.overrun { color: var(--danger); }

.bigLabel {
  font-size: 12px; font-weight: 1000; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
  text-align: center; margin-top: -10px;
}

/* Overrun */
.overrunBox {
  width: 100%;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,77,109,.10);
  border: 1px solid rgba(255,77,109,.28);
  text-align: center;
}
.overrunLabel {
  font-size: 11px; font-weight: 1000; text-transform: uppercase;
  letter-spacing: .6px; color: var(--danger); margin-bottom: 4px;
}
.overrunDisplay {
  font-size: 36px; font-weight: 1000;
  font-variant-numeric: tabular-nums;
  color: var(--danger); letter-spacing: .02em;
}

/* Boutons transport */
.transportButtons {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; width: 100%;
}
.transportBtn {
  border: none; border-radius: 14px;
  height: 52px; font-size: 14px; font-weight: 1000;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: 5px; white-space: nowrap; transition: filter .12s, transform .08s;
}
.transportBtn:active { transform: scale(.96); }
.transportBtn.start {
  background: rgba(56,217,150,.18); border: 1px solid rgba(56,217,150,.32); color: var(--ok);
}
.transportBtn.start:hover { background: rgba(56,217,150,.28); }
.transportBtn.pause {
  background: rgba(255,211,92,.14); border: 1px solid rgba(255,211,92,.28); color: var(--warn);
}
.transportBtn.pause:hover { background: rgba(255,211,92,.24); }
.transportBtn.reset {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); color: var(--muted);
}
.transportBtn.reset:hover { background: rgba(255,255,255,.12); }

/* Go Next */
.goNextBtn {
  width: 100%; height: 52px;
  border-radius: 14px; border: 2px solid rgba(244,214,255,.35);
  background: rgba(244,214,255,.12); color: var(--accent2);
  font-size: 15px; font-weight: 1000; letter-spacing: .5px;
  cursor: pointer; transition: background .12s, transform .08s;
}
.goNextBtn:hover { background: rgba(244,214,255,.22); }
.goNextBtn:active { transform: scale(.97); }

/* Indicateur playlist */
.playlistIndicator {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 1000; color: var(--muted);
}
.plSep { color: rgba(255,255,255,.25); }
.plDelay {
  margin-left: 6px;
  font-size: 11px; font-weight: 1000; letter-spacing: .4px;
  padding: 3px 8px; border-radius: 999px;
}
.plDelay.retard {
  background: rgba(255,77,109,.12); border: 1px solid rgba(255,77,109,.25); color: var(--danger);
}
.plDelay.avance {
  background: rgba(56,217,150,.12); border: 1px solid rgba(56,217,150,.25); color: var(--ok);
}

/* ═══════════════════════════════════════
   CONFIG — NORMAL / CONFÉRENCE
═══════════════════════════════════════ */
.configBody {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 0;
}

.fieldBlock { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.fieldLabel { font-size: 11px; font-weight: 1000; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.fieldRow   { display: flex; align-items: center; gap: 8px; }
.fieldSep   { font-weight: 1000; color: var(--muted); font-size: 18px; }
.fieldHint  { font-size: 11px; color: var(--muted); }

.quickLabels { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: rgba(189,107,170,.14); border: 1px solid rgba(189,107,170,.28);
  color: var(--accent2); border-radius: 999px;
  padding: 6px 12px; font-size: 11px; font-weight: 1000;
  letter-spacing: .4px; text-transform: uppercase; cursor: pointer; transition: background .12s;
}
.tag:hover { background: rgba(189,107,170,.28); }

.presetGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.presetBtn {
  background: rgba(244,214,255,.08); border: 1px solid rgba(244,214,255,.16);
  color: var(--accent2); border-radius: 14px;
  padding: 10px 8px; font-weight: 1000; font-size: 14px;
  cursor: pointer; text-align: center; transition: background .12s;
}
.presetBtn:hover { background: rgba(244,214,255,.18); }

/* ═══════════════════════════════════════
   CONFIG — PLAYLIST
═══════════════════════════════════════ */
#sectionPlaylist { display: flex; flex-direction: column; gap: 10px; height: 100%; }

.plToolbar { display: flex; gap: 8px; flex-wrap: wrap; }

.plImportLabel { cursor: pointer; }

.plList {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding-right: 2px;
}

.plItem {
  display: grid;
  grid-template-columns: 24px 1fr 80px 28px;
  align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  transition: background .15s, border-color .15s;
}

/* Item en cours — vert accentué */
.plItem.current {
  background: rgba(56,217,150,.12);
  border-color: rgba(56,217,150,.40);
  box-shadow: 0 0 0 2px rgba(56,217,150,.12);
}
.plItem.current .plItemIdx {
  color: var(--ok); font-weight: 1000;
}

.plItemIdx {
  font-size: 11px; font-weight: 1000; color: var(--muted); text-align: center;
}
.plItemLabel {
  background: transparent; border: none; border-bottom: 1px solid rgba(255,255,255,.12);
  color: var(--ink); font-size: 13px; font-weight: 900; padding: 2px 4px;
  outline: none; width: 100%;
}
.plItemDur {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.10);
  color: var(--ink); font-size: 12px; font-weight: 1000; font-variant-numeric: tabular-nums;
  padding: 4px 6px; border-radius: 8px; text-align: center;
  outline: none; width: 100%;
}
.plItemDel {
  background: transparent; border: none;
  color: var(--danger); font-size: 16px; cursor: pointer; line-height: 1;
  opacity: .6; transition: opacity .12s;
}
.plItemDel:hover { opacity: 1; }

.plTotalDelay {
  font-size: 12px; color: var(--muted); text-align: center; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.plTotalDelay span { color: var(--danger); font-weight: 1000; }

/* Transparence fond/bordure */
.transpLabel {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted); cursor: pointer; white-space: nowrap;
}

/* ═══════════════════════════════════════
   PANNEAU STYLE OVERLAY
═══════════════════════════════════════ */
.infoBody {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 14px; display: flex; flex-direction: column; gap: 0;
}

/* Prévisualisation */
.previewArea {
  width: 100%; min-height: 110px;
  border-radius: 14px;
  background: rgba(0,0,0,.30);
  border: 1px dashed rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center;
  padding: 12px; margin-bottom: 2px;
  position: relative; overflow: hidden;
}

.previewInner {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 12px 20px;
  border-radius: 18px;
  background: #f4d6ff;
  border: 3px solid #bd6baa;
  transition: all .15s;
}

.previewLabel {
  font-size: 13px; font-weight: 1000;
  letter-spacing: 1px; text-transform: uppercase;
  color: rgba(27,27,36,.65); line-height: 1;
}

.previewDisplay {
  font-size: 38px; font-weight: 1000;
  font-variant-numeric: tabular-nums;
  line-height: 1; color: rgba(27,27,36,.92);
  transition: all .15s;
}

/* Grille contrôles */
.styleGrid { display: flex; flex-direction: column; gap: 8px; }

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

.styleLabel {
  font-size: 11px; font-weight: 1000; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted);
  min-width: 90px; flex: 0 0 90px;
}

.styleSelect { flex: 1; min-width: 0; }

.styleUnit { font-size: 12px; color: var(--muted); white-space: nowrap; }

.colorPicker {
  width: 40px; height: 32px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12); cursor: pointer;
  padding: 2px; background: rgba(255,255,255,.05);
}

.styleCheck {
  width: 18px; height: 18px; cursor: pointer; accent-color: var(--accent);
}

.smallBtn { font-size: 11px; padding: 6px 10px; }

/* ═══════════════════════════════════════
   SHARED
═══════════════════════════════════════ */
.btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  color: var(--ink); border-radius: 12px; padding: 9px 13px;
  font-weight: 900; cursor: pointer; line-height: 1;
  white-space: nowrap; transition: background .12s; font-size: 13px;
}
.btn:hover { background: rgba(255,255,255,.14); }
.btn.ghost  { background: transparent; }

.btn.modeBtn { font-size: 12px; padding: 7px 11px; }
.btn.modeBtn.active {
  background: rgba(189,107,170,.22); border-color: rgba(189,107,170,.42); color: var(--accent2);
}

.input {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.10);
  color: var(--ink); border-radius: 12px; padding: 9px 11px; outline: none;
}
.input.wide   { flex: 1; min-width: 0; }
.input.narrow { width: 68px; }

.sep { height: 1px; background: rgba(255,255,255,.06); margin: 12px 0; }

/* ═══════════════════════════════════════
   FOOTER
═══════════════════════════════════════ */
.footerbar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 14px;
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(18,18,27,.98), rgba(18,18,27,.88));
  border: 1px solid rgba(255,255,255,.06); box-shadow: var(--shadow);
}
.footerLeft, .footerRight { display: flex; align-items: center; gap: 10px; }
.footerDot {
  width: 10px; height: 10px; border-radius: 999px;
  background: rgba(244,214,255,.85); box-shadow: 0 0 0 5px rgba(244,214,255,.10);
}
.footerText  { color: rgba(238,240,255,.85); font-size: 12px; font-weight: 900; letter-spacing: .3px; }
.footerSep   { color: rgba(238,240,255,.30); font-weight: 900; font-size: 12px; }
