:root {
  --bg: #0f0f14;
  --panel: #17171f;
  --panel-2: #1f1f29;
  --line: #2c2c38;
  --text: #f1f1f5;
  --muted: #9d9daf;
  --accent: #f97316;
  --accent-soft: rgba(249, 115, 22, .15);
  --ok: #2fb67c;
  --ok-soft: rgba(47, 182, 124, .15);
  --warn: #e0a72e;
  --warn-soft: rgba(224, 167, 46, .15);
  --bad: #e5484d;
  --bad-soft: rgba(229, 72, 77, .15);
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }

/* Mise en page */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { font-weight: 800; font-size: 18px; padding: 4px 10px 14px; letter-spacing: .2px; }
.brand span { color: var(--accent); }
.space { margin: 0 4px 12px; }
.space select { width: 100%; }
.space .role { font-size: 12px; color: var(--muted); padding: 4px 6px 0; }
.nav a { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.nav a:hover { background: var(--panel-2); }
.nav a.on { background: var(--accent-soft); color: #fff; }
.nav a .ic { width: 18px; text-align: center; opacity: .85; }
.count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; }
.me { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.me b { color: var(--text); display: block; font-size: 13px; }
.me a { color: var(--muted); }
main { padding: 26px 32px 70px; max-width: 1180px; width: 100%; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
.sub { color: var(--muted); margin-bottom: 20px; }

/* Éléments */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 26px; font-weight: 750; }
.stat .l { color: var(--muted); font-size: 12px; }
.stat .d { font-size: 12px; margin-top: 2px; }
.up { color: var(--ok); } .down { color: var(--bad); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre { white-space: pre-wrap; word-break: break-word; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a, .tabs button { text-decoration: none; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; }
.tabs .on { background: var(--text); color: var(--bg); border-color: var(--text); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
tr.link { cursor: pointer; }
tr.link:hover td { background: var(--panel-2); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.btn { border: 1px solid var(--line); background: var(--panel-2); padding: 8px 14px; border-radius: 9px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.bad { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%;
}
textarea { min-height: 90px; resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--accent); }
label.f { display: block; margin: 12px 0 5px; color: var(--muted); font-size: 12px; }
.check { display: inline-flex; gap: 7px; align-items: center; margin-right: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.side-by-side { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--panel-2); display: block; }
.cover { width: 100%; aspect-ratio: 1; border-radius: 12px; object-fit: cover; background: var(--panel-2); border: 1px dashed var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.notice { background: var(--accent-soft); border: 1px solid rgba(249,115,22,.35); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.progress { height: 5px; background: var(--panel-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.track-row { display: grid; grid-template-columns: 28px 1fr 200px 110px auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.track-row:last-child { border-bottom: 0; }
.track-row .num { color: var(--muted); text-align: center; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.products { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.product img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--panel-2); }
.bars .bar { display: grid; grid-template-columns: 140px 1fr 70px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13px; }
.bars .bar .t { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bars .bar .t div { height: 100%; background: var(--accent); }
svg.line { width: 100%; height: 200px; display: block; }
audio { width: 100%; height: 36px; }

/* Fenêtres */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 20; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 12px; font-size: 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.picker { max-height: 280px; overflow-y: auto; margin-top: 8px; }
.picker .item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; cursor: pointer; }
.picker .item:hover, .picker .item.on { background: var(--panel-2); }

/* Connexion */
.login { max-width: 400px; margin: 10vh auto; padding: 0 16px; }
.login .card { padding: 26px; }
.login .brand { font-size: 24px; text-align: center; padding-bottom: 6px; }
.err { color: var(--bad); margin-top: 10px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 30; }
.toast.bad { background: var(--bad); color: #fff; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  main { padding: 20px 16px 60px; }
  .two, .three, .side-by-side { grid-template-columns: 1fr; }
  .track-row { grid-template-columns: 24px 1fr; }
}
