/* Trading Evolution — panneau d'administration (autonome : aucune ressource du site, accessible même depuis un pays bloqué) */
:root {
  color-scheme: dark;
  --bg: #070a12; --bg2: #0a0e18; --pop: #0e1322;
  --card: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.015));
  --line: rgba(255,255,255,.09); --line2: rgba(255,255,255,.06);
  --ink: #eef2fa; --ink2: #b9c3d9; --muted: #8a95ae;
  --blue: #3b82f6; --blue2: #8fb4ff; --blue-50: rgba(59,130,246,.12);
  --pos: #22c55e; --neg: #f87171; --amber: #f59e0b;
  --r: 18px; --r-sm: 10px;
  --f: system-ui, -apple-system, 'Segoe UI', Roboto, Tahoma, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { min-height: 100vh; background: radial-gradient(900px 420px at 85% -10%, rgba(59,130,246,.14), transparent 60%), var(--bg); color: var(--ink); font: 15px/1.55 var(--f); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.1rem; }
p { margin: 0; }
.muted { color: var(--muted); font-size: .9rem; }
.fine { color: var(--muted); font-size: .8rem; }
:focus-visible { outline: 3px solid rgba(96,165,250,.55); outline-offset: 2px; }

/* En-tête */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; background: rgba(7,10,18,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.brand img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.brand b { color: var(--blue2); }
.brand em { font-style: normal; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: #fff; background: var(--blue); padding: .2rem .5rem; border-radius: 6px; }
.top-right { margin-inline-start: auto; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.who { font-size: .82rem; color: var(--ink2); padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 99px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .5rem 1rem; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--ink); font: 700 .88rem var(--f); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover { background: rgba(255,255,255,.1); border-color: rgba(96,165,250,.5); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: linear-gradient(135deg, #2f6fe8, #3b82f6 55%, #5aa2ff); border-color: transparent; color: #fff; }
.btn.pri:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 32px; padding: .3rem .65rem; font-size: .78rem; }
.btn.danger { color: #fca5a5; }
.btn.danger:hover { border-color: rgba(248,113,113,.6); background: rgba(248,113,113,.1); }
.btn:disabled { opacity: .5; cursor: progress; }

/* Mise en page */
.wrap { max-width: 1080px; margin: 0 auto; padding: 1.5rem; display: grid; gap: 1.25rem; }
#appView { display: grid; gap: 1.25rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.4rem; box-shadow: 0 20px 50px rgba(0,0,0,.3); display: grid; gap: .8rem; align-content: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.center { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 1rem; text-align: center; }
.login { max-width: 420px; justify-items: center; text-align: center; padding: 2.2rem 1.8rem; }
.lock { width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center; background: var(--blue-50); border: 1px solid rgba(59,130,246,.3); }
.lock svg { width: 28px; height: 28px; fill: none; stroke: var(--blue2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.msg { min-height: 1.4em; font-size: .88rem; color: var(--neg); }
.or { display: flex; align-items: center; gap: .75rem; width: 100%; color: var(--muted); font-size: .8rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pw-login { width: 100%; text-align: start; }
.pw-login input { width: 100%; }
.setup { padding-top: .8rem; border-top: 1px solid var(--line); }
#setupCode { font-family: var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.link { background: none; border: 0; padding: .2rem; color: var(--blue2); font: 600 .82rem var(--f); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: #fff; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.12); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Carte principale */
.hero { background: radial-gradient(600px 240px at 100% 0%, rgba(59,130,246,.16), transparent 70%), var(--card); }
.hero-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.stats > div { background: rgba(255,255,255,.03); border: 1px solid var(--line2); border-radius: 12px; padding: .75rem .9rem; }
.stats small { display: block; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stats strong { font-size: 1.05rem; }
.ok { color: var(--pos); }

/* Interrupteurs */
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { position: relative; width: 44px; height: 24px; border-radius: 99px; background: rgba(255,255,255,.14); transition: background .2s; flex: none; }
.thumb { position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.switch input:checked + .track { background: var(--neg); }
.switch input:checked + .track .thumb { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid rgba(96,165,250,.55); outline-offset: 2px; }
.switch.big .track { width: 58px; height: 32px; }
.switch.big .thumb { width: 24px; height: 24px; top: 4px; inset-inline-start: 4px; }
.switch.big input:checked + .track .thumb { transform: translateX(26px); }
.switch-label { font-weight: 800; font-size: .9rem; min-width: 5.5rem; }
.switch-label.on { color: var(--neg); } .switch-label.off { color: var(--pos); }

/* Liste des pays */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.rows li { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border: 1px solid var(--line2); border-radius: 12px; background: rgba(255,255,255,.025); }
.code { font: 800 .75rem var(--mono); letter-spacing: .08em; padding: .3rem .45rem; border-radius: 6px; background: var(--blue-50); color: var(--blue2); min-width: 2.6rem; text-align: center; }
.rows .name { flex: 1; min-width: 0; font-weight: 600; }
.rows .state { font-size: .75rem; font-weight: 700; }
.rows .state.on { color: var(--neg); } .rows .state.off { color: var(--muted); }

/* Formulaires */
.inline { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline select { flex: 1; min-width: 180px; }
.stack { display: grid; gap: .7rem; }
.stack label { display: grid; gap: .3rem; font-size: .8rem; font-weight: 700; color: var(--ink2); }
input, select { font: inherit; color: var(--ink); background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .55rem .75rem; min-height: 40px; }
input:focus, select:focus { border-color: rgba(96,165,250,.6); outline: none; }
.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--ink2); cursor: pointer; }
.check input { min-height: 0; width: 16px; height: 16px; accent-color: var(--blue); }
.created { border: 1px solid rgba(34,197,94,.35); background: rgba(34,197,94,.08); border-radius: 12px; padding: .8rem; display: grid; gap: .5rem; font-size: .88rem; }
.copyrow { display: flex; gap: .5rem; }
.copyrow input { flex: 1; min-width: 0; font: .78rem var(--mono); }

/* Tableau des liens */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: start; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
td { padding: .65rem .6rem; border-bottom: 1px solid var(--line2); vertical-align: middle; }
th.r, td.r { text-align: end; white-space: nowrap; }
td.r .btn + .btn { margin-inline-start: .35rem; }
.pill { display: inline-block; font-size: .72rem; font-weight: 800; padding: .2rem .55rem; border-radius: 99px; }
.pill.active { color: var(--pos); background: rgba(34,197,94,.12); }
.pill.expired { color: var(--muted); background: rgba(255,255,255,.06); }
.pill.revoked { color: var(--neg); background: rgba(248,113,113,.12); }
.empty { color: var(--muted); font-size: .9rem; text-align: center; padding: 1rem 0; }
.foot-note { color: var(--muted); font-size: .78rem; text-align: center; }

/* Notification */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 50; padding: .7rem 1.1rem; border-radius: 12px; background: var(--pop); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.5); font-weight: 600; font-size: .9rem; max-width: calc(100% - 32px); }
.toast.err { border-color: rgba(248,113,113,.5); color: #fecaca; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .top { padding: .7rem 1rem; }
  .wrap { padding: 1rem; }
  .who { display: none; }
}
@media (max-width: 560px) {
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border: 1px solid var(--line2); border-radius: 12px; padding: .4rem; margin-bottom: .5rem; }
  td { border: 0; padding: .3rem .4rem; }
  td[data-k]::before { content: attr(data-k) " : "; color: var(--muted); font-size: .75rem; }
  td.r { text-align: start; }
}
