/* ZAuth Console — minimal noir */
:root {
  --bg: #000;
  --surface: #0a0a0b;
  --surface-2: #111113;
  --surface-3: #18181b;
  --border: #1f1f23;
  --border-strong: #34343a;
  --text: #ededed;
  --muted: #7d7d86;
  --accent: #fff;
  --accent-text: #000;
  --glow: rgba(255, 255, 255, .06);
  --danger: #ff5c5c;
  --ok: #3ddc97;
  --warn: #f5b84a;
  --radius: 12px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}
/* halo discret en haut de page */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 420px; pointer-events: none; z-index: 0;
  background: radial-gradient(60% 100% at 50% 0%, rgba(255, 255, 255, .07), transparent 70%);
  animation: halo 1.6s var(--ease) both;
}
.topbar, main, .toast { position: relative; z-index: 1; }
::selection { background: #fff; color: #000; }

a { color: var(--text); text-decoration: none; transition: color .2s; }
a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.03em; margin: 0 0 6px; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 14px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.container { max-width: 1040px; margin: 0 auto; padding: 40px 20px 96px; animation: rise .6s var(--ease) both; }
.narrow { max-width: 380px; margin: 12vh auto 0; }

/* ─── topbar ─── */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 24px; border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, .72); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  position: sticky; top: 0; z-index: 5;
  animation: fade .6s var(--ease) both;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); font-size: 14px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand::before {
  content: ""; width: 9px; height: 9px; background: #fff; border-radius: 2px; transform: rotate(45deg);
  box-shadow: 0 0 14px rgba(255, 255, 255, .55); transition: transform .5s var(--ease);
}
.brand:hover::before { transform: rotate(225deg); }
.brand span { color: var(--muted); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-right .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }

/* ─── cards ─── */
.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; position: relative;
  transition: border-color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
  animation: rise .55s var(--ease) both;
}
.card + .card { margin-top: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.grid > .card { margin-top: 0; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .cols-2 { grid-template-columns: 1fr; } }

/* apparition en cascade */
.grid > :nth-child(1), .container > :nth-child(1) { animation-delay: .03s; }
.grid > :nth-child(2), .container > :nth-child(2) { animation-delay: .08s; }
.grid > :nth-child(3), .container > :nth-child(3) { animation-delay: .13s; }
.grid > :nth-child(4), .container > :nth-child(4) { animation-delay: .18s; }
.grid > :nth-child(5), .container > :nth-child(5) { animation-delay: .23s; }
.grid > :nth-child(n+6), .container > :nth-child(n+6) { animation-delay: .28s; }

/* ─── boutons ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  border-radius: 9px; padding: 8px 15px; font: inherit; font-weight: 500; cursor: pointer;
  transition: background .2s, border-color .2s, color .2s, transform .15s var(--ease), box-shadow .25s;
}
.btn:hover { background: var(--surface-3); border-color: #55555d; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn-primary { background: #fff; border-color: #fff; color: #000; font-weight: 600; }
.btn-primary:hover { background: #fff; border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .12), 0 0 28px rgba(255, 255, 255, .25); }
.btn-danger { color: var(--danger); border-color: rgba(255, 92, 92, .3); }
.btn-danger:hover { background: rgba(255, 92, 92, .08); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }

/* ─── formulaires ─── */
label { display: block; font-weight: 500; font-size: 12.5px; color: #b4b4bb; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: #050506; color: var(--text); font: inherit;
  transition: border-color .2s, box-shadow .25s, background .2s;
}
input:hover, textarea:hover { border-color: var(--border-strong); }
input::placeholder, textarea::placeholder { color: #4a4a52; }
textarea { min-height: 72px; font-family: var(--mono); font-size: 12.5px; }
input:focus, textarea:focus { outline: none; border-color: #fff; box-shadow: 0 0 0 4px rgba(255, 255, 255, .08); background: #000; }
.btn:focus-visible, .tab:focus-visible, .app-card:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; color: var(--text); font-size: 13.5px; margin-bottom: 8px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: #fff; }

/* ─── badges ─── */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-ok, .badge-warn, .badge-danger { background: transparent; }
.badge-ok::before, .badge-warn::before, .badge-danger::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.badge-ok { color: var(--ok); border-color: rgba(61, 220, 151, .25); }
.badge-ok::before { box-shadow: 0 0 8px currentColor; animation: pulse 2.4s ease-in-out infinite; }
.badge-warn { color: var(--warn); border-color: rgba(245, 184, 74, .25); }
.badge-danger { color: var(--danger); border-color: rgba(255, 92, 92, .25); }

/* ─── cartes d'apps ─── */
.app-card { cursor: pointer; display: block; color: inherit; overflow: hidden; }
.app-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(240px circle at 50% 0%, rgba(255, 255, 255, .08), transparent 70%);
}
.app-card:hover { border-color: var(--border-strong); transform: translateY(-3px); text-decoration: none; color: inherit; box-shadow: 0 18px 40px -18px rgba(255, 255, 255, .12); }
.app-card:hover::after { opacity: 1; }
.app-card h2, .app-card h3 { transition: transform .3s var(--ease); }
.app-card:hover h2, .app-card:hover h3 { transform: translateX(3px); }
.stats { display: flex; gap: 28px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.stat { color: var(--muted); font-size: 12px; }
.stat b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.03em; color: var(--text); font-variant-numeric: tabular-nums; }

/* ─── onglets ─── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 24px 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; border: 0; background: none; color: var(--muted); padding: 10px 14px; font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: color .2s;
}
.tab::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: #fff; border-radius: 2px;
  transform: scaleX(0); transition: transform .35s var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected=true] { color: #fff; }
.tab[aria-selected=true]::after { transform: scaleX(1); }

/* ─── clé / valeur ─── */
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; align-items: center; }
.kv > div:nth-child(odd) { color: var(--muted); font-size: 13px; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv > div:nth-child(odd) { margin-top: 8px; } }
.copy { display: flex; gap: 6px; align-items: center; min-width: 0; }
.copy code { overflow-x: auto; white-space: nowrap; background: #050506; border: 1px solid var(--border); padding: 5px 9px; border-radius: 7px; min-width: 0; scrollbar-width: none; }

pre {
  background: #050506; border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; margin: 0;
}

/* ─── tableaux ─── */
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }
tbody tr:last-child td { border-bottom: 0; }
td .row { gap: 6px; }

/* ─── alertes ─── */
.alert {
  padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 16px;
  animation: rise .4s var(--ease) both;
}
.alert-danger { border-color: rgba(255, 92, 92, .4); color: var(--danger); background: rgba(255, 92, 92, .06); animation: rise .4s var(--ease) both, shake .4s .05s; }
.alert-warn { border-color: rgba(245, 184, 74, .4); background: rgba(245, 184, 74, .05); }

.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: var(--mono); }
.qr { display: block; width: 200px; height: 200px; background: #fff; padding: 10px; border-radius: 12px; }

/* ─── toast ─── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px) scale(.96);
  background: #fff; color: #000; padding: 10px 18px; border-radius: 999px; font-weight: 500; font-size: 13px;
  box-shadow: 0 10px 40px rgba(255, 255, 255, .15);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .4s var(--ease); max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ─── scrollbars ─── */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ─── keyframes ─── */
@keyframes rise  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes halo  { from { opacity: 0; transform: translateY(-40px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
