:root {
  --bg: #0b0f14;
  --bg-2: #11171f;
  --card: #151c26;
  --card-2: #1a2330;
  --line: #243041;
  --text: #e6edf5;
  --muted: #8b9bb0;
  --accent: #3ddc97;
  --accent-ink: #062418;
  --warn: #f5b942;
  --bad: #ff6b6b;
  --info: #5aa9ff;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #12251d 0%, transparent 60%), var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .2px; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #1fa7ff); color: var(--accent-ink); font-weight: 900;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card h3 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* Auth */
.auth { max-width: 440px; margin: 6vh auto 0; }
.auth h1 { font-size: 26px; margin: 0 0 6px; }
.tabs { display: flex; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 10px; margin: 18px 0; }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 9px; border-radius: 8px; font: inherit; cursor: pointer; }
.tabs button.on { background: var(--card-2); color: var(--text); }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 12px; border-radius: 10px; font: inherit; outline: none;
}
input:focus { border-color: var(--accent); }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .08s ease, background .15s ease, opacity .15s;
}
.btn:hover { background: #223044; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { background: #5be6aa; }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; margin-top: 18px; }
.err { color: var(--bad); font-size: 14px; margin-top: 12px; min-height: 1em; }
.ok-msg { color: var(--accent); font-size: 14px; margin-top: 12px; }

/* Dashboard */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { position: relative; }
.step .num {
  position: absolute; top: 16px; right: 16px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--bg-2); color: var(--muted);
}
.step.done .num { background: var(--accent); color: var(--accent-ink); }
.step p { margin: 6px 0 16px; color: var(--muted); font-size: 14px; min-height: 42px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--bg-2); color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--accent); }
.pill.warn { color: var(--warn); }
.pill.bad { color: var(--bad); }
.pill.info { color: var(--info); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track { width: 52px; height: 30px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); position: relative; transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .2s ease, background .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(22px); background: var(--accent-ink); }

.bar { height: 6px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 14px 0; }
.stat .v { font-size: 26px; font-weight: 700; }
.stat .k { color: var(--muted); font-size: 13px; }

.cols { display: grid; grid-template-columns: 1fr 1.3fr; gap: 14px; }
.feed { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.feed li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; gap: 10px; }
.feed li:last-child { border: 0; }
.feed time { color: var(--muted); font-family: var(--mono); font-size: 12px; min-width: 64px; padding-top: 2px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 0 8px 8px; }
td { padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }
.res-ok { color: var(--accent); font-weight: 600; }
.res-ko { color: var(--bad); }
.empty { color: var(--muted); padding: 18px 0; text-align: center; font-size: 14px; }

/* Auto-tickets Paperclip */
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.pc-rules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pc-rules span { background: var(--bg-2); border-radius: 999px; padding: 4px 10px; }
.pc-rules b { color: var(--text); }
.pc-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) repeat(3, 1fr); gap: 14px; align-items: end; margin-top: 6px; }
.pc-kpi { background: var(--bg-2); border-radius: 10px; padding: 10px 12px; }
.pc-kpi .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pc-kpi .k { color: var(--muted); font-size: 12px; }
.pc-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-top: 10px; }
.pc-games div { background: var(--bg-2); border-radius: 8px; padding: 7px 10px; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.pc-games em { color: var(--muted); font-style: normal; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pc-notice { border-radius: 10px; padding: 10px 14px; background: var(--bg-2); }
.pc-notice.warn { border-left: 3px solid var(--warn); }
.pc-notice.bad { border-left: 3px solid var(--bad); }
.pc-notice.ok { border-left: 3px solid var(--accent); }

/* Warmup modal */
.modal { position: fixed; inset: 0; background: rgba(4, 7, 10, .82); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal .box { width: min(1140px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.modal .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.screen { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 1100 / 720; }
.screen canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.screen .overlay { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { background: var(--bg-2); border-radius: 10px; padding: 10px 14px; margin-top: 12px; font-size: 14px; }

@media (max-width: 860px) {
  .steps, .cols { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .pc-row { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Valeur minimum d'un code */
.minval { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.minval label { margin: 0 0 6px; }
.minval-row { display: flex; gap: 6px; align-items: center; }
.minval-row .cur { color: var(--muted, #8a94a6); font-weight: 600; }
.minval-row input { width: 90px; margin: 0; }
.minval-row .btn { padding: 8px 12px; }
