:root {
  --bg: #080a10;
  --panel: rgba(18, 21, 32, 0.74);
  --panel-solid: #141722;
  --panel2: rgba(27, 32, 48, 0.72);
  --panel2-solid: #1b2030;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef0f6;
  --muted: #9aa0b4;
  --accent: #aa5cc3;
  --accent2: #00a4dc;
  --ok: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  --grad: linear-gradient(135deg, var(--accent), var(--accent2));
  --mono: Consolas, "Cascadia Mono", Menlo, "DejaVu Sans Mono", monospace;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --radius: 18px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Fond d'écran Jellyfin immersif avec voile sombre pour une lisibilité parfaite */
.bg-scene {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--bg);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  transform: scale(1.02);
}

.bg-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(900px 520px at 15% -5%, rgba(170, 92, 195, 0.22) 0%, transparent 65%),
    radial-gradient(800px 500px at 90% 10%, rgba(0, 164, 220, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, rgba(8, 10, 16, 0.52) 0%, rgba(8, 10, 16, 0.72) 55%, rgba(8, 10, 16, 0.88) 100%);
}

main {
  margin: 0 auto;
  padding: 20px 18px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main.narrow { max-width: 480px; }
main.narrow.auth-center { justify-content: center; padding-top: 28px; padding-bottom: 36px; }
main.wide { max-width: 1260px; }

a { color: #d1a7e3; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color .18s ease; }
a:hover { color: #67d4fa; }

.muted { color: var(--muted); }
.small, .hint { font-size: 12.5px; }
.hint { color: var(--muted); margin: -3px 0 2px; line-height: 1.4; }

h1 { font-size: 25px; font-weight: 750; letter-spacing: -0.02em; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 10px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
h3 { font-size: 15.5px; font-weight: 650; margin: 20px 0 8px; }

/* En-tête & navigation */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 4px 0 24px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(16, 19, 29, 0.65);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

main.narrow.auth-center .top {
  justify-content: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 750;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.brand:hover { color: #fff; }

.brand .badge-app {
  color: #d7e8f5;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line);
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(170, 92, 195, 0.42), 0 2px 10px rgba(0, 164, 220, 0.32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.logo img, .logo svg { width: 36px; height: 36px; display: block; }

nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 550;
  transition: background .18s ease, border-color .18s ease, transform .15s ease;
}

nav a svg { width: 15px; height: 15px; opacity: .82; flex-shrink: 0; }

nav a:hover {
  background: rgba(170, 92, 195, 0.14);
  border-color: rgba(170, 92, 195, 0.45);
  color: #fff;
  transform: translateY(-1px);
}

/* Cartes glassmorphism */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.card.center { text-align: center; }

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.head h2 { margin: 0; }

/* Formulaires & champs */
form { display: grid; gap: 13px; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
}

input, select {
  width: 100%;
  background: rgba(12, 15, 23, 0.72);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 13px;
  color: var(--text);
  font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

input::placeholder { color: #676e85; }

input:hover, select:hover { border-color: var(--line-strong); }

input:focus, select:focus {
  outline: none;
  background: rgba(15, 19, 30, 0.92);
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(0, 164, 220, 0.22);
}

button, .btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s ease, filter .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

button:hover, .btn:hover {
  border-color: var(--accent);
  background: rgba(170, 92, 195, 0.14);
  color: #fff;
  transform: translateY(-1px);
}

button:active, .btn:active { transform: translateY(0); }

button:disabled { opacity: .42; cursor: not-allowed; transform: none; }

.primary {
  background: var(--grad);
  border: 0;
  color: #fff;
  padding: 11px 18px;
  box-shadow: 0 8px 24px rgba(170, 92, 195, 0.32), 0 4px 12px rgba(0, 164, 220, 0.2);
}

.primary:hover {
  background: var(--grad);
  filter: brightness(1.09);
  box-shadow: 0 10px 28px rgba(170, 92, 195, 0.45), 0 4px 14px rgba(0, 164, 220, 0.3);
}

.danger {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.32);
}

.danger:hover {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.6);
  color: #fff;
}

.links {
  text-align: center;
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}

/* Messages flash */
.flash {
  padding: 11px 15px;
  border-radius: 12px;
  margin: 12px 0;
  border: 1px solid;
  font-size: 14px;
  line-height: 1.45;
}

.flash.ok { background: rgba(52, 211, 153, 0.12); border-color: rgba(52, 211, 153, 0.38); color: #a7f3d0; }
.flash.bad { background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.38); color: #fecaca; }
.flash.warn { background: rgba(251, 191, 36, 0.12); border-color: rgba(251, 191, 36, 0.38); color: #fde68a; }

/* Infos compte */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

.facts .fact-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
}

.facts dt { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.facts dd { margin: 0; font-size: 14.5px; }

/* Tags & compteurs */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.tag.ok { color: var(--ok); background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.35); }
.tag.bad { color: var(--bad); background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.35); }
.tag.warn { color: var(--warn); background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.35); }
.bad-text { color: var(--bad); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; align-items: end; }

/* Invitations & QR */
.invites { display: grid; gap: 12px; margin-top: 18px; }
.invite {
  display: grid;
  grid-template-columns: 98px 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.invite.dead { opacity: .55; grid-template-columns: 1fr auto; }
.invite.dead .qr { display: none; }

.qr svg {
  width: 96px;
  height: 96px;
  display: block;
  background: #fff;
  border-radius: 10px;
  padding: 5px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.copy { display: flex; gap: 8px; margin-top: 8px; }
.copy input { font: 12.5px var(--mono); padding: 7px 10px; }
.inv-actions { display: grid; gap: 8px; }
form.inline { display: flex; gap: 6px; }
form.inline input { width: 185px; padding: 7px 10px; }

/* Tableaux admin */
.table { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: rgba(11, 13, 20, 0.45); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  color: var(--muted);
  font-weight: 650;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
}
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
tr.off td { opacity: .58; }

.head input[type=search] { max-width: 280px; padding: 8px 12px; }

details summary {
  cursor: pointer;
  color: #d1a7e3;
  font-weight: 600;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(170, 92, 195, 0.12);
  border: 1px solid rgba(170, 92, 195, 0.28);
}
details summary:hover { background: rgba(170, 92, 195, 0.22); }
details[open] summary { margin-bottom: 10px; }

.manage { display: grid; gap: 10px; min-width: 520px; padding: 4px 0 6px; }
.manage .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  padding: 11px;
  background: rgba(20, 24, 36, 0.88);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.manage .row label { flex: 1 1 130px; }
.manage .row input, .manage .row select { padding: 7px 10px; }

label.check { display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
label.check input { width: auto; accent-color: var(--accent); }

/* Sous-navigation admin */
.subnav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: -6px 0 18px;
  position: sticky;
  top: 10px;
  z-index: 10;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(14, 17, 26, 0.78);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.subnav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 550;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}

.subnav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); border-color: var(--line); }
.subnav a.active { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 4px 14px rgba(170, 92, 195, 0.35); }

/* Statistiques */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 18px;
  display: grid;
  gap: 2px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
  position: relative;
  overflow: hidden;
}

.stats div::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--grad);
  opacity: .7;
}

.stats b {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stats span { color: var(--muted); font-size: 13px; font-weight: 500; }

/* Cartes de formules */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 14px; }

.plan {
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  display: grid;
  gap: 8px;
  align-content: start;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.plan:hover {
  border-color: rgba(170, 92, 195, 0.65);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.plan-name { font-weight: 700; font-size: 16px; display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.plan-price { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }

.plan.pick { cursor: pointer; position: relative; color: var(--text); font-size: 15px; padding-right: 40px; }
.plan.pick input { position: absolute; opacity: 0; }
.plan.pick::after {
  content: "";
  position: absolute;
  top: 18px;
  right: 16px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.25);
  transition: all .18s ease;
}
.plan.pick:has(input:checked) {
  border-color: var(--accent2);
  background: rgba(0, 164, 220, 0.1);
  box-shadow: 0 0 0 3px rgba(0, 164, 220, 0.22), 0 14px 32px rgba(0, 0, 0, 0.4);
}
.plan.pick:has(input:checked)::after {
  border-color: var(--accent2);
  background: var(--grad);
  box-shadow: inset 0 0 0 4px #141722;
}

.plan.current {
  border-color: rgba(0, 164, 220, 0.5);
  background: linear-gradient(135deg, rgba(170, 92, 195, 0.12), rgba(0, 164, 220, 0.1));
  margin: 12px 0;
}

form .plans { margin-bottom: 6px; }
form.confirm { margin-top: 10px; display: flex; }

/* Parrainage */
.ref { display: flex; gap: 18px; align-items: center; }
.ref > div:last-child { flex: 1; min-width: 0; }
.plans-table input { padding: 7px 10px; }
.plans-table input[type=checkbox] { width: auto; accent-color: var(--accent); }

section[id] { scroll-margin-top: 72px; }
.log { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; font-size: 14px; }
.log li { padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }

/* Demandes */
.requests { display: grid; gap: 12px; margin-top: 14px; }
.request {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.request.dead { opacity: .6; }
.request .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.request .row label { width: 135px; }

.count {
  background: var(--warn);
  color: #111;
  border-radius: 999px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 800;
  margin-left: 3px;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }

/* Guide */
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--grad);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(170, 92, 195, 0.35);
}

.stores { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 12px; margin: 14px 0; }
.store {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  transition: border-color .18s ease, transform .18s ease;
}
.store:hover { border-color: var(--accent2); transform: translateY(-2px); color: #fff; }
.store .qr svg { width: 150px; height: 150px; }

code {
  font-family: var(--mono);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  padding: 2px 7px;
  border-radius: 7px;
  font-size: 13.5px;
}

section h2 { margin-top: 6px; }
section ol, section ul { line-height: 1.65; padding-left: 22px; }

.page-title { margin: 0 0 18px; }
.guide-grid, .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 18px; align-items: start; }
.guide-grid .span-all { grid-column: 1 / -1; }
.guide-grid .card, .grid2 .card { margin-bottom: 0; }
.grid2 { margin-top: 18px; }

.with-shot { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.shots { display: grid; grid-template-columns: 240px 1fr; gap: 18px; margin-top: 14px; align-items: start; }
.shots-wide { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }

.shot { margin: 0; text-align: center; }
.shot img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  display: block;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  transition: transform .2s ease;
}
.shot img:hover { transform: scale(1.015); }
.shot.phone img { max-width: 220px; margin: 0 auto; }
.shot figcaption { color: var(--muted); font-size: 12.5px; margin-top: 7px; }
.center { text-align: center; margin-top: 20px; }

/* Pied de page discret */
.foot {
  margin-top: auto;
  padding-top: 22px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(154, 160, 180, 0.72);
}

@media (max-width: 720px) {
  main { padding: 14px 12px 36px; }
  .card { padding: 18px; border-radius: 15px; }
  .top { padding: 10px 12px; }
  nav { width: 100%; }
  nav a { flex: 1 1 auto; justify-content: center; padding: 8px 10px; font-size: 13px; }
  .invite { grid-template-columns: 1fr; }
  .qr { display: none; }
  form.inline input { width: 100%; }
  #utilisateurs th:nth-child(4), #utilisateurs td:nth-child(4),
  #utilisateurs th:nth-child(5), #utilisateurs td:nth-child(5) { display: none; }
  .manage { min-width: 240px; }
  .ref { flex-direction: column; align-items: flex-start; }
  .request { grid-template-columns: 1fr; }
  .shots { grid-template-columns: 1fr; }
  .with-shot { grid-template-columns: 1fr; }
  .subnav { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
