:root {
  --bg: #0b0b10; --surface: #13131a; --surface-2: #1a1a23; --line: #262632; --line-2: #31313f;
  --text: #ededf3; --muted: #9696a8; --faint: #6b6b7d;
  --primary: #8b5cf6; --primary-hover: #7c4ded; --accent: #ffd400;
  --ok: #34d399; --warn: #fbbf24; --err: #f87171;
  --radius: 12px; --sidebar: 248px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- boutons & champs ---------- */
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid transparent; background: var(--primary); color: #fff; font: 600 13px/1 inherit;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
button:hover, .btn:hover { background: var(--primary-hover); }
button.secondary, .btn.secondary { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
button.secondary:hover, .btn.secondary:hover { border-color: #444457; background: #20202b; }
button.ghost { background: transparent; color: var(--muted); }
button.ghost:hover { background: var(--surface-2); color: var(--text); }
button.danger { background: transparent; border-color: #4a2329; color: var(--err); }
button.danger:hover { background: #2a1519; }
button.sm { height: 30px; padding: 0 10px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
input, select { width: 100%; min-height: 38px; background: var(--bg); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 9px; padding: 8px 12px; font: inherit; line-height: 20px; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.hint { color: var(--faint); font-size: 12px; font-weight: 400; }
.msg { min-height: 18px; font-size: 13px; }
.msg.err { color: var(--err); } .msg.ok { color: var(--ok); }

.brand { margin: 0; font: 800 18px/1 inherit; letter-spacing: .4px; }
.brand span { color: var(--accent); }

/* ---------- coquille ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; gap: 24px; }
.sidebar .brand { padding: 0 8px; }
.sidebar .brand small { display: block; margin-top: 6px; font: 500 12px/1.3 inherit; color: var(--faint); letter-spacing: 0; }
.nav { display: grid; gap: 2px; }
.nav .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: #8b5cf61f; color: #c4b5fd; }
.nav a .count { margin-left: auto; font-size: 11px; background: var(--primary); color: #fff; border-radius: 99px; padding: 1px 7px; }
.account { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; position: relative; }
.account > button { width: 100%; height: auto; justify-content: flex-start; padding: 8px; background: transparent; border-radius: 10px; text-align: left; font-weight: 500; color: var(--text); }
.account > button:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), #ec4899); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; }
.account .who { min-width: 0; display: grid; }
.account .who b, .account .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .who small { color: var(--faint); font-weight: 400; }
.menu { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 6px; display: grid; gap: 2px; box-shadow: 0 12px 32px #0008; }
.menu[hidden] { display: none; }
.menu button { justify-content: flex-start; background: transparent; color: var(--text); font-weight: 500; }
.menu button:hover { background: #2a2a37; }

.mobilebar { display: none; }
.main { min-width: 0; padding: 32px 40px 64px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .grow { flex: 1; min-width: 200px; }

/* ---------- blocs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; flex: 1; }
.card-body { padding: 20px; }
.empty { color: var(--muted); padding: 40px 20px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.pill:empty { display: none; }
.pill.ok { color: var(--ok); border-color: #1f4a3a; background: #10261e; }
.pill.warn { color: var(--warn); border-color: #4d3b12; background: #241c0a; }
.pill.err { color: var(--err); border-color: #4a2329; background: #241215; }
.pill.violet { color: #c4b5fd; border-color: #3b2d6b; background: #1c1630; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 10px; border: 1px solid #4d3b12; background: #1d170a; color: #fde68a; margin-bottom: 20px; }
.banner { flex-wrap: wrap; }
.banner a { color: var(--accent); font-weight: 600; white-space: nowrap; }

dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: 14px; padding: 24px; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: #000b; }
dialog form { display: grid; gap: 14px; }
dialog h3 { margin: 0; font-size: 17px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 14px; box-shadow: 0 12px 32px #0008; z-index: 50; }
.toast.err { border-color: #4a2329; color: var(--err); }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; left: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .2s; }
  .app.open .sidebar { transform: none; box-shadow: 0 0 0 100vmax #0009; }
  .mobilebar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 30; }
  .main { padding: 20px 16px 48px; }
}
