/* Mission Control — charte LeadForge : noir, bleu électrique, verre, DM Sans / Inter */
:root {
  --bg: #000; --panel: rgba(8, 18, 40, .72); --panel2: rgba(255, 255, 255, .04); --line: rgba(120, 170, 255, .14);
  --text: #fff; --muted: #A9B8CC; --blue: #006cff; --cyan: #18caff; --ice: #8FE3FF;
  --ok: #7CF0C4; --warn: #FFD27A; --bad: #FF7A8A; --radius: 20px;
  --display: 'DM Sans', system-ui, sans-serif; --ease: cubic-bezier(.2, .7, .2, 1);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); line-height: 1.5; min-height: 100vh;
  background: radial-gradient(ellipse 70% 45% at 50% -5%, rgba(0, 108, 255, .4), transparent 70%), var(--bg) fixed; }
a { color: var(--ice); text-decoration: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; letter-spacing: -.02em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 999px; padding: 12px 22px; min-height: 44px;
  font: inherit; font-family: var(--display); font-weight: 500; cursor: pointer; background: #fff; color: #000;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s, background .3s; }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 34px rgba(24, 202, 255, .35); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.ghost { background: rgba(0, 0, 0, .4); color: var(--text); border: 1px solid rgba(255, 255, 255, .16); }
.btn.ghost:hover:not(:disabled) { border-color: rgba(143, 227, 255, .6); box-shadow: 0 0 24px rgba(0, 108, 255, .4); }
.btn.small { padding: 7px 14px; min-height: 36px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: progress; }
.btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

input, select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(0, 0, 0, .45); color: var(--text); font: inherit;
  transition: border-color .3s, box-shadow .3s; }
input:focus, select:focus { border-color: rgba(24, 202, 255, .7); box-shadow: 0 0 0 4px rgba(24, 202, 255, .12); outline: none; }
label { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Connexion */
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.auth h2 { margin: 0 0 6px; font-size: 28px; }
.err { color: var(--bad); min-height: 1.4em; font-size: 14px; margin-top: 10px; }

/* Layout dashboard */
.dash { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px; border-right: 1px solid var(--line); background: rgba(4, 10, 24, .6); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 30; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: .04em; padding: 4px 8px 18px; }
.logo i { width: 12px; height: 12px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--cyan)); box-shadow: 0 0 14px var(--cyan); }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 12px 14px; border-radius: 13px; color: var(--muted); font-family: var(--display); font-size: 15px; font-weight: 500;
  transition: background .25s, color .25s; }
.side-nav button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-nav button:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.side-nav button.on { color: #fff; background: linear-gradient(135deg, rgba(0, 108, 255, .4), rgba(24, 202, 255, .14)); box-shadow: inset 0 0 0 1px rgba(143, 227, 255, .35), 0 8px 24px rgba(0, 108, 255, .3); }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.main { padding: 22px clamp(16px, 3vw, 34px) 60px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: clamp(22px, 3vw, 30px); margin: 0; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.burger { display: none; }

/* Cartes & stats */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: rise .6s var(--ease) both; margin-bottom: 18px; }
.card h3 { margin: 0 0 14px; font-size: 20px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 18px; }
.statcard { position: relative; overflow: hidden; border-radius: 18px; padding: 20px 22px; border: 1px solid var(--line);
  background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: flex; flex-direction: column; gap: 4px; animation: rise .6s var(--ease) both; }
.statcard > span { font-size: 14px; color: var(--muted); }
.statcard b { font-family: var(--display); font-size: 40px; font-weight: 500; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.statcard small { color: var(--muted); font-size: 12px; }

.segmented { display: inline-flex; gap: 2px; background: rgba(255, 255, 255, .05); border-radius: 999px; padding: 3px; }
.segmented button { all: unset; cursor: pointer; padding: 7px 16px; border-radius: 999px; font-family: var(--display); font-size: 14px; color: var(--muted); }
.segmented button.on { background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #001018; }

/* Mini graphes (barres SVG) */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 70px; margin-top: 10px; }
.spark > div { flex: 1; min-width: 2px; background: linear-gradient(180deg, var(--cyan), var(--blue)); border-radius: 3px 3px 0 0; opacity: .85; transition: height .5s var(--ease); }
.spark > div:hover { opacity: 1; box-shadow: 0 0 10px var(--cyan); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
tbody tr { animation: fade .4s var(--ease) both; transition: background .3s; }
tbody tr:hover { background: rgba(24, 202, 255, .05); }
.scroll { overflow: auto; max-height: 560px; border-radius: 12px; }
.tag { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 500; background: rgba(24, 202, 255, .12); color: var(--ice); }
.tag.ok { background: rgba(124, 240, 196, .14); color: var(--ok); }
.tag.bad { background: rgba(255, 122, 138, .14); color: var(--bad); }
.search { max-width: 340px; border-radius: 999px; }
.empty { text-align: center; color: var(--muted); padding: 34px !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1 1 240px; }

/* Funnel */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel .step { display: flex; align-items: center; gap: 14px; }
.funnel .step .lbl { width: 130px; color: var(--muted); font-size: 14px; }
.funnel .bar { flex: 1; height: 34px; background: rgba(255, 255, 255, .05); border-radius: 10px; overflow: hidden; }
.funnel .bar > div { height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 14px var(--cyan); display: flex; align-items: center; padding: 0 12px; font-family: var(--display); font-variant-numeric: tabular-nums; transition: width .6s var(--ease); min-width: fit-content; }

/* .env snippet */
.env { background: rgba(0, 0, 0, .5); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 10px; position: relative; }
.env pre { margin: 0; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--ice); }
.copy { position: absolute; top: 10px; right: 10px; }

/* Modale */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .66); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .25s; }
.modal { width: 100%; max-width: 440px; background: #07101F; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; animation: rise .35s var(--ease) both; }
.modal h3 { margin: 0 0 4px; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; z-index: 60;
  padding: 12px 20px; border-radius: 999px; background: rgba(8, 18, 40, .92); border: 1px solid rgba(143, 227, 255, .4); color: #fff;
  box-shadow: 0 10px 40px rgba(0, 108, 255, .4); transition: opacity .35s, transform .35s var(--ease); font-family: var(--display); max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { border-color: var(--bad); }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Responsive : la barre latérale devient un tiroir */
@media (max-width: 860px) {
  .dash { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .3s var(--ease); }
  .side.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .7); }
  .burger { display: inline-flex; }
  .scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 29; }
}
@media (max-width: 520px) {
  th:nth-child(n+4), td:nth-child(n+4) { display: none; } /* tables : masque les colonnes secondaires sur petit écran */
  .statcard b { font-size: 34px; }
}
