/* Console admin — même charte "Studio Nuit" */
:root {
  --bg: #0b0b12;
  --card: rgba(255,255,255,.045);
  --card-brd: rgba(255,255,255,.09);
  --txt: #f4efe9;
  --muted: #9b95a6;
  --amber: #ff9a3d;
  --magenta: #ff2d78;
  --grad: linear-gradient(135deg, var(--amber), var(--magenta));
  --danger: #ff4d4d;
  --ok: #3ddc84;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg); color: var(--txt);
  font-family: -apple-system, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  min-height: 100dvh;
}
.bg-glow { position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 40% at 50% -8%, rgba(255,154,61,.16), transparent 70%),
    radial-gradient(40% 30% at 85% 10%, rgba(255,45,120,.10), transparent 70%);
}
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(70% 50% at 50% 120%, rgba(126,63,255,.08), transparent 70%); }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; padding: 24px; }
.login-box {
  width: 100%; max-width: 340px; text-align: center;
  background: var(--card); border: 1px solid var(--card-brd);
  border-radius: 24px; padding: 38px 26px 30px;
}
.login-logo { font-size: 44px; }
.login-box h1 { font-size: 20px; font-weight: 850; margin-top: 8px; letter-spacing: .04em; }
.login-box .sub { color: var(--muted); font-size: 13px; margin: 4px 0 22px; }
#login-pass {
  width: 100%; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--card-brd); background: rgba(0,0,0,.3); color: var(--txt);
  font-size: 16px; text-align: center; outline: none;
}
#login-pass:focus { border-color: rgba(255,154,61,.5); }
.login-box button {
  width: 100%; margin-top: 12px; padding: 14px; border: none; border-radius: 14px;
  background: var(--grad); color: #1a0a08; font-weight: 800; font-size: 15px;
}
.err { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* ---------- barre haute ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(11,11,18,.85); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-brd);
}
.bar-title { display: flex; align-items: center; gap: 8px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; font-size: 14px; }
.bar-title em { font-style: normal; color: var(--muted); font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 12px; }
.bar-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 10px rgba(255,120,60,.7); }
.ghost-btn {
  background: none; border: 1px solid var(--card-brd); color: var(--muted);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.ghost-btn:active { border-color: var(--danger); color: var(--danger); }

/* ---------- layout ---------- */
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
.tab { display: flex; flex-direction: column; gap: 12px; }
.cards { display: grid; gap: 12px; }
.card {
  background: var(--card); border: 1px solid var(--card-brd);
  border-radius: 18px; padding: 16px;
}
.card.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.k { font-size: 10px; letter-spacing: .24em; color: var(--muted); font-weight: 800; margin-bottom: 6px; }
.v { font-size: 17px; font-weight: 800; }
.v.big { font-size: 30px; font-weight: 900;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.s { color: #d9b8ff; font-size: 14px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hint { color: var(--muted); font-size: 12px; text-align: center; padding: 4px 10px; }
.hint code { color: var(--amber); }

/* ---------- tabs bas ---------- */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(14,14,22,.92); backdrop-filter: blur(16px);
  border-top: 1px solid var(--card-brd);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn {
  background: none; border: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0 9px; font-size: 11px; font-weight: 700;
}
.tab-btn svg { width: 22px; height: 22px; }
.tab-btn.active { color: var(--amber); }

/* ---------- bibliothèque ---------- */
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--card); border: 1px solid var(--card-brd); color: var(--muted);
}
.cat-chip.active { background: var(--grad); color: #1a0a08; border-color: transparent; }
.cat-chip.mini { padding: 7px 12px; font-size: 12px; }
.genre-chips { padding-top: 2px; }
#up-genre {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--card-brd); background: rgba(0,0,0,.3); color: var(--txt);
  font-size: 14px; outline: none;
}
#up-genre:focus { border-color: rgba(255,154,61,.5); }
.rot-select {
  width: 200px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--card-brd); background: rgba(0,0,0,.3); color: var(--txt);
  font-size: 14px; font-weight: 700; outline: none; color-scheme: dark;
}
.rot-select:focus { border-color: rgba(255,154,61,.5); }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 26px 16px; border-radius: 18px; cursor: pointer; text-align: center;
  border: 2px dashed rgba(255,154,61,.35); background: rgba(255,154,61,.05);
  transition: background .2s, border-color .2s;
}
.dropzone.drag { background: rgba(255,154,61,.14); border-color: var(--amber); }
.dropzone input { display: none; }
.dz-ic { font-size: 26px; }
.dropzone b { font-size: 15px; }
.dropzone small { color: var(--muted); font-size: 12px; }
.progress { height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress div { height: 100%; width: 0%; background: var(--grad); transition: width .2s; }
.up-label { color: var(--muted); font-size: 12.5px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-list { display: flex; flex-direction: column; gap: 8px; }
.track {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--card-brd);
  padding: 10px 12px; border-radius: 14px;
}
.track.off { opacity: .45; }
.t-play {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: none;
  background: var(--grad); color: #1a0a08; display: grid; place-items: center;
}
.t-play svg { width: 17px; height: 17px; }
.t-info { flex: 1; min-width: 0; }
.t-title { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-sub { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-act { display: flex; gap: 4px; flex: none; }
.ic-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--card-brd);
  background: none; color: var(--muted); display: grid; place-items: center; font-size: 15px;
}
.ic-btn.del:active { color: var(--danger); border-color: var(--danger); }
.ic-btn.on { color: var(--ok); border-color: rgba(61,220,132,.4); }
.empty { text-align: center; color: var(--muted); padding: 26px 0; font-size: 14px; }

/* ---------- formulaire ---------- */
.form-card { display: flex; flex-direction: column; gap: 10px; }
.form-card input[type=text], .form-card input[type=time], .form-card input[type=date],
.form-card input[type=number], .form-card select {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--card-brd); background: rgba(0,0,0,.3); color: var(--txt);
  font-size: 15px; outline: none; color-scheme: dark;
}
.form-card input:focus, .form-card select:focus { border-color: rgba(255,154,61,.5); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.weekdays { display: flex; gap: 6px; }
.weekdays label { flex: 1; }
.weekdays input { display: none; }
.weekdays span {
  display: grid; place-items: center; height: 40px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--card-brd);
  color: var(--muted); font-weight: 800; font-size: 14px;
}
.weekdays input:checked + span { background: var(--grad); color: #1a0a08; border-color: transparent; }
.dur-lab { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.dur-lab input { width: 76px !important; text-align: center; }
.primary-btn {
  padding: 14px; border: none; border-radius: 12px;
  background: var(--grad); color: #1a0a08; font-weight: 800; font-size: 15px;
}
.switch-row { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }
.sw { -webkit-appearance: none; width: 52px; height: 30px; border-radius: 999px;
  background: rgba(255,255,255,.12); position: relative; transition: background .2s; outline: none; }
.sw:checked { background: var(--grad); }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: left .2s; }
.sw:checked::after { left: 25px; }

/* ---------- historique & grille ---------- */
.adm-hist { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.adm-hist li { font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.adm-hist .ago { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.adm-hist .cat { font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; background: rgba(126,63,255,.16); color: #b79bff; flex: none; }
.sched-list { display: flex; flex-direction: column; gap: 8px; }
.sched {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--card-brd);
  padding: 12px 14px; border-radius: 14px;
}
.sched.off { opacity: .45; }
.sched-info { flex: 1; min-width: 0; }
.sched-title { font-weight: 800; font-size: 15px; }
.sched-when { color: var(--amber); font-size: 12px; font-weight: 700; margin-top: 2px; }
.sched-file { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- sélection en lot ---------- */
.lib-head { display: flex; align-items: center; justify-content: space-between; }
.lib-count { color: var(--muted); font-size: 12px; }
.track .sel-box { flex: none; width: 22px; height: 22px; accent-color: var(--magenta); display: none; }
body.sel-mode .track .sel-box { display: block; }
body.sel-mode .track.sel { border-color: rgba(255,45,120,.55); background: rgba(255,45,120,.07); }
body.sel-mode .t-act { display: none; }
.bulk-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 8px;
  background: #1d1d28; border: 1px solid var(--card-brd);
  padding: 8px 12px; border-radius: 999px;
  box-shadow: 0 12px 34px rgba(0,0,0,.55);
}
#bulk-count { font-weight: 800; font-size: 13px; margin-right: 2px; }
.bulk-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--card-brd);
  background: var(--card); color: var(--txt); font-size: 16px;
}
.bulk-btn.del { color: var(--danger); border-color: rgba(255,77,77,.4); }
.bulk-btn.close { color: var(--muted); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(30px); opacity: 0; pointer-events: none;
  background: #1d1d28; padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600; border: 1px solid var(--card-brd);
  box-shadow: 0 12px 34px rgba(0,0,0,.5); transition: all .25s; z-index: 60;
  max-width: 88vw; text-align: center;
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.err { border-color: rgba(255,77,77,.5); }

/* ---------- enregistrement vocal ---------- */
.rec-hint { color: var(--muted); font-size: 12.5px; margin-bottom: 2px; }
.rec-row { display: flex; align-items: center; gap: 14px; }
.rec-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px; border: none; border-radius: 12px;
  background: var(--grad); color: #1a0a08; font-weight: 800; font-size: 15px;
}
.rec-btn .rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #1a0a08; }
.rec-btn.recording { background: var(--danger); color: #fff; animation: recpulse 1.2s infinite; }
.rec-btn.recording .rec-dot { background: #fff; border-radius: 2px; }
@keyframes recpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,77,77,.5); } 50% { box-shadow: 0 0 0 10px rgba(255,77,77,0); } }
.rec-timer { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 800; min-width: 58px; text-align: center; }
#rec-preview { display: flex; flex-direction: column; gap: 10px; }
#rec-preview audio { width: 100%; border-radius: 10px; }
.soft-btn {
  padding: 14px; border: 1px solid var(--card-brd); border-radius: 12px;
  background: var(--card); color: var(--txt); font-weight: 800; font-size: 14px;
}
.link-btn { background: none; border: none; color: var(--muted); font-size: 13px; text-decoration: underline; }
.track .asap-badge {
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: rgba(61,220,132,.15); color: var(--ok);
  margin-left: 6px;
}

.mini-play {
  flex: none; width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--grad); color: #1a0a08; display: grid; place-items: center;
}
.mini-play svg { width: 24px; height: 24px; }

/* bouton power ON/OFF */
.power-btn {
  flex: none; width: 62px; height: 62px; border-radius: 50%;
  border: 2px solid var(--card-brd); background: rgba(255,255,255,.04);
  color: var(--muted); display: grid; place-items: center;
  transition: all .2s;
}
.power-btn .pw-ic { font-size: 26px; line-height: 1; }
.power-btn.on {
  border-color: var(--ok); color: var(--ok);
  box-shadow: 0 0 18px rgba(61,220,132,.35), inset 0 0 12px rgba(61,220,132,.12);
}
.power-btn.off {
  border-color: var(--danger); color: var(--danger);
  box-shadow: 0 0 14px rgba(255,77,77,.25);
}
.power-btn:disabled { opacity: .5; }
.power-btn:active { transform: scale(.93); }
#d-power.on { color: var(--ok); }
#d-power.off { color: var(--danger); }
