/* LPA Pass Cloud — console client et admin. Même identité que la page produit (site/index.html). */
:root {
  --bg: #07090f;
  --bg-2: #0c1020;
  --panel: #10162a;
  --panel-2: #141b33;
  --line: #1f2945;
  --line-2: #2a365a;
  --text: #eef2ff;
  --muted: #94a3c4;
  --faint: #7684a6;           /* plus clair que sur le site : sert à du texte, doit tenir 4.5:1 */
  --violet: #7c5cff;
  --violet-text: #b3a2ff;
  --cyan: #22d3ee;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --grad: linear-gradient(100deg, var(--violet), var(--cyan) 55%, var(--green));
  --radius: 14px;
  --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", var(--sans);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, .85);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
[hidden] { display: none !important; }
a { color: var(--violet-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); }
code { font-size: .88em; background: rgba(255, 255, 255, .05); padding: 1px 5px; border-radius: 5px; }
h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: -0.02em; line-height: 1.15; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--text); color: #0b0f1a; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* --- Marque --- */
.brand { display: inline-flex; align-items: center; gap: 9px; font: 800 17px/1 var(--display); letter-spacing: -0.02em; color: var(--text); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand em { font-style: normal; color: var(--muted); font-weight: 600; }
.brand-lg { font-size: 20px; }
.brand-lg svg { width: 32px; height: 32px; }

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  font: 600 14px/1 var(--sans); padding: 11px 16px; border-radius: 10px; white-space: nowrap; color: var(--text);
  transition: background-color .15s, color .15s, transform .15s var(--ease); text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-primary { background: var(--text); color: #0b0f1a; }
.btn-primary:hover { background: #fff; }
.btn-ghost { background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, .09); }
.btn-danger { background: rgba(251, 113, 133, .12); color: #fecdd3; box-shadow: inset 0 0 0 1px rgba(251, 113, 133, .4); }
.btn-danger:hover { background: rgba(251, 113, 133, .22); }
.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; }
.btn-discord svg { width: 20px; height: 20px; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.btn-xs { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* --- Formulaires --- */
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { margin: 0; }
input, select {
  width: 100%; min-width: 0; font: 15px/1.3 var(--sans); color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 12px; transition: border-color .15s;
}
input:hover, select:hover { border-color: #3a4875; }
input:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 0; border-color: transparent; border-radius: 9px; }
input[aria-invalid="true"] { border-color: var(--red); }
select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2394a3c4' stroke-width='2'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
.label-row .btn-xs { padding: 3px 8px; font-size: 11.5px; }
.form-grid .full { grid-column: 1 / -1; }

.alert { padding: 10px 12px; border-radius: 9px; font-size: 14px; background: rgba(34, 211, 238, .08); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, .3); color: #cffafe; }
.alert-error { background: rgba(251, 113, 133, .1); box-shadow: inset 0 0 0 1px rgba(251, 113, 133, .4); color: #fecdd3; }
.alert-ok { background: rgba(52, 211, 153, .08); box-shadow: inset 0 0 0 1px rgba(52, 211, 153, .35); color: #d1fae5; }
.alert-warn { background: rgba(251, 191, 36, .08); box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .35); color: #fef3c7; }

/* --- Connexion --- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.login-card { width: min(400px, 100%); background: var(--panel); border-radius: 18px; padding: 32px; box-shadow: inset 0 0 0 1px var(--line), var(--shadow); position: relative; overflow: hidden; }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--grad); }
.login-card h1 { font-size: 24px; margin: 26px 0 4px; }
.login-card > .muted { margin: 0 0 22px; }
.login-card .alert { margin-bottom: 16px; }
.login-card .btn-primary { margin-top: 4px; padding: 12px 16px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-card .fine { margin-top: 20px; text-align: center; }

/* --- Barre du haut --- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(7, 9, 15, .92); border-bottom: 1px solid var(--line); }
@supports (backdrop-filter: blur(1px)) { .topbar { background: rgba(7, 9, 15, .72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); } }
.topbar-inner { width: min(1240px, 100% - 32px); margin-inline: auto; display: flex; align-items: center; gap: 24px; height: 56px; }
.tabs { display: flex; align-items: stretch; gap: 2px; height: 100%; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; display: flex; align-items: center; padding: 0 12px; color: var(--muted); font-weight: 500; font-size: 14px;
  white-space: nowrap; text-decoration: none; transition: color .15s;
}
.tabs a:hover { color: var(--text); }
.tabs a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--grad); transform: scaleX(0); transition: transform .2s var(--ease); }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"]::after { transform: scaleX(1); }
.tabs a:focus-visible { outline-offset: -4px; }
.tabs-sep { width: 1px; background: var(--line-2); margin: 16px 6px; flex: none; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover; background: var(--line, #1f2945); vertical-align: middle; }
.avatar-fallback { font: 600 12px/1 var(--sans, inherit); color: var(--text, #eef2ff); background: #232c4d; }
#who-avatar { display: inline-flex; }
.user-cell { display: flex; align-items: center; gap: 10px; }
#acc-discord { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag { display: inline-block; font: 500 11px/1 var(--mono); padding: 4px 7px; border-radius: 6px; background: rgba(255, 255, 255, .06); color: var(--muted); letter-spacing: .03em; }
.tag-admin { background: rgba(124, 92, 255, .16); color: var(--violet-text); }

/* --- Page --- */
.page { width: min(1240px, 100% - 32px); margin-inline: auto; padding: 28px 0 64px; outline: none; }
.page > .alert { margin-bottom: 18px; }
.view { animation: view-in .22s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head h1 { font-size: 26px; font-weight: 800; }
.h-sub { font: 400 14px var(--sans); letter-spacing: 0; margin-left: 6px; }

.panel { background: var(--panel); border-radius: var(--radius); box-shadow: inset 0 0 0 1px var(--line); padding: 18px 20px; min-width: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-title { font: 600 13px/1.3 var(--sans); color: var(--muted); letter-spacing: .02em; margin-bottom: 12px; }
.panel-title .muted { font-weight: 400; }
.panel-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid-ov { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.span-2 { grid-column: 1 / -1; }

/* Jauge */
.meter-num { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.big { font: 800 34px/1 var(--display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.meter { position: relative; height: 10px; margin-top: 14px; border-radius: 6px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meter i { position: absolute; inset: 0; background: var(--grad); transform-origin: left; transform: scaleX(0); transition: transform .6s var(--ease); }
.meter.warn i { background: var(--amber); }
.meter.over i { background: var(--red); }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; }
.kpis-4 { grid-template-columns: repeat(4, 1fr); }
.kpis div { min-width: 0; }
.kpis dt { font-size: 12px; color: var(--muted); }
.kpis dd { margin: 4px 0 0; font: 700 22px/1.1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* Graphique */
.chart { position: relative; margin-top: 6px; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .axis { fill: var(--faint); font: 11px var(--mono); }
.chart .gridline { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.chart .ok { fill: var(--cyan); }
.chart .err { fill: var(--red); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover, .chart .hit:focus { fill: rgba(255, 255, 255, .05); outline: none; }
.chart-tip {
  position: absolute; top: 0; left: 0; pointer-events: none; z-index: 2; background: var(--panel-2); color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow); border-radius: 8px; padding: 7px 10px; font-size: 12px;
  white-space: nowrap; opacity: 0; transition: opacity .12s;
}
.chart-tip.on { opacity: 1; }
.chart-tip b { display: block; font-family: var(--mono); font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-ok { background: var(--cyan); }
.sw-err { background: var(--red); }

/* Barres horizontales (résolutions) */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 96px 1fr 56px; align-items: center; gap: 10px; font-size: 13px; }
.bars .name { color: var(--text); text-transform: capitalize; overflow: hidden; text-overflow: ellipsis; }
.bars .track { height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.bars .track, .bars .fill { display: block; }
.bars .fill { width: 100%; height: 100%; background: var(--violet); border-radius: 4px; transform-origin: left; }
.bars .val { text-align: right; font-family: var(--mono); color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; }

/* Code */
.code { position: relative; margin-top: 10px; }
.code pre {
  margin: 0; padding: 14px 16px; padding-right: 70px; border-radius: 10px; background: #080b16; box-shadow: inset 0 0 0 1px var(--line);
  font: 12.5px/1.65 var(--mono); color: #c7d2fe; overflow-x: auto; white-space: pre;
}
.code .copy { position: absolute; top: 8px; right: 8px; }
.tips { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; display: grid; gap: 6px; }

/* Tableaux */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }  /* contient les .sr-only absolus */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table thead th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--bg-2); position: sticky; top: 0; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .018); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.empty-row { text-align: center; color: var(--muted); padding: 28px 14px; white-space: normal; }
.table .url { max-width: min(420px, 34vw); overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.table .when { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table tr.is-off td { color: var(--faint); }
/* Actions toujours accessibles quand le tableau défile horizontalement */
.table-users th:last-child, .table-users td:last-child { position: sticky; right: 0; background: var(--panel); box-shadow: -1px 0 0 var(--line); }
.table-users thead th:last-child { background: var(--bg-2); }
.table-users tbody tr:hover td:last-child { background: #121931; }
.table-users .mono { font-size: 12.5px; }
.table .sub { display: block; font-size: 12px; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1 var(--mono); padding: 4px 8px; border-radius: 6px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: rgba(52, 211, 153, .12); color: var(--green); }
.pill-err { background: rgba(251, 113, 133, .12); color: var(--red); }
.pill-warn { background: rgba(251, 191, 36, .12); color: var(--amber); }
.pill-off { background: rgba(255, 255, 255, .06); color: var(--muted); }
.chips { display: inline-flex; gap: 4px; flex-wrap: nowrap; }
.chip { font: 500 11.5px/1 var(--mono); padding: 4px 7px; border-radius: 6px; background: rgba(124, 92, 255, .14); color: var(--violet-text); }

.usage-cell { display: grid; gap: 5px; min-width: 130px; }
.usage-cell .meter { height: 5px; margin: 0; }
.usage-cell .meter i { transition: none; }

/* Propriétés */
.props { margin: 0; display: grid; gap: 0; }
.props div { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.props div:last-child { border-bottom: 0; }
.props dt { color: var(--muted); font-size: 13px; }
.props dd { margin: 0; min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Modale */
.modal { border: 0; padding: 0; background: transparent; color: var(--text); max-width: none; width: min(480px, 100vw - 32px); }
.modal.modal-wide { width: min(560px, 100vw - 32px); }
.modal::backdrop { background: rgba(3, 5, 10, .7); }
.modal[open] { animation: modal-in .2s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-inner { background: var(--panel); border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow); padding: 20px; display: grid; gap: 16px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 19px; }
.modal-body { display: grid; gap: 14px; }
.modal-body p { margin: 0; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.secret { display: flex; gap: 8px; align-items: stretch; }
.secret code { flex: 1; min-width: 0; display: block; padding: 11px 12px; border-radius: 9px; background: #080b16; box-shadow: inset 0 0 0 1px var(--line-2); font-size: 13px; overflow-wrap: anywhere; color: var(--green); user-select: all; }

/* --- Responsive --- */
@media (max-width: 860px) {
  .topbar-inner { gap: 12px; }
  .who #who-name { display: none; }
  .grid-ov, .grid-2 { grid-template-columns: 1fr; }
  .kpis-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .topbar-inner { width: calc(100% - 24px); height: auto; flex-wrap: wrap; gap: 0 12px; padding-top: 10px; }
  .topbar .brand { flex: 1; }
  .tabs { order: 3; flex-basis: 100%; height: 44px; margin: 0 -12px; padding: 0 6px; }
  .page { width: calc(100% - 24px); padding-top: 20px; }
  .view-head h1 { font-size: 22px; }
  .h-sub { display: block; margin: 4px 0 0; }
  .panel { padding: 16px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis dd { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .props div { grid-template-columns: 1fr; gap: 2px; }
  .login-card { padding: 24px 20px; }
  .bars li { grid-template-columns: 80px 1fr 44px; }
  .chart svg { height: 180px; }
  .table-users th:last-child, .table-users td:last-child { position: static; box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
