:root {
  --brand-600: #143C72;
  --brand-500: #1B4F93;
  --brand-50: #EEF3FA;
  --gold: #F59E0B;
  --surface: #ffffff;
  --page: #F6F8FB;
  --ink: #10233d;
  --muted: #5b6b80;
  --line: #dfe5ee;
  --ok: #1f8a4c;
  --warn: #b45309;
  --bad: #b4262a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 35, 61, .06), 0 8px 24px rgba(16, 35, 61, .05);
}

:root[data-theme="sombre"] {
  --surface: #121b28;
  --page: #0b1220;
  --ink: #e7edf6;
  --muted: #9db0c8;
  --line: #24344c;
  --brand-50: #17253a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

[hidden] { display: none !important; }

h1, h2, h3 { margin: 0; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- marque ---------- */
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--brand-600); color: var(--gold);
  display: grid; place-items: center;
  font-weight: 800; letter-spacing: -.5px; font-size: 15px;
  flex: 0 0 auto;
}
.brand strong { display: block; font-size: 15px; line-height: 1.15; }
.brand small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- connexion ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; box-shadow: var(--shadow);
}
.login-card form { margin-top: 20px; display: grid; gap: 8px; }
.hint { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }

label { font-size: 13px; color: var(--muted); margin-top: 6px; }

input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; width: 100%;
}
input:focus { outline: 2px solid var(--brand-500); outline-offset: 1px; border-color: var(--brand-500); }

button {
  font: inherit; font-weight: 600; cursor: pointer;
  background: var(--brand-600); color: #fff;
  border: 1px solid var(--brand-600); border-radius: 10px;
  padding: 11px 16px; margin-top: 10px;
}
button:hover { background: var(--brand-500); }
button.ghost {
  background: transparent; color: var(--ink);
  border-color: var(--line); padding: 8px 12px; margin: 0;
}
button.ghost:hover { background: var(--brand-50); }

.error { color: var(--bad); font-size: 13px; margin: 4px 0 0; }
.ok { color: var(--ok); font-size: 13px; margin: 4px 0 0; }

/* ---------- coquille ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px calc(12px) 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.who { font-size: 13px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.wrap { padding: 16px; max-width: 980px; margin: 0 auto; }
.foot { padding: 4px 2px 22px; }

/* ---------- chiffres ---------- */
.kpis { display: grid; gap: 13px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 14px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name value" "detail detail";
  gap: 2px 10px;
}
.kpi-name { grid-area: name; font-size: 13px; color: var(--muted); }
.kpi-value { grid-area: value; font-size: 22px; font-weight: 700; text-align: right; }
.kpi-value b { font-weight: 700; }
.kpi-value i { font-style: normal; font-size: 13px; color: var(--muted); margin-left: 1px; }
.kpi-detail { grid-area: detail; font-size: 12px; color: var(--muted); }

/* ---------- cartes ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-top: 14px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-head h2 { font-size: 15px; }

.rows { list-style: none; margin: 10px 0 0; padding: 0; }
.rows li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.rows li:first-child { border-top: 0; }
.svc-name { font-weight: 600; font-size: 14px; }
.svc-sub { display: block; font-size: 12px; color: var(--muted); }
.pill {
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid currentColor; white-space: nowrap;
}
.pill.ok { color: var(--ok); }
.pill.mid { color: var(--warn); }
.pill.bad { color: var(--bad); }

.pw { display: grid; gap: 8px; margin-top: 10px; }
.pw button { justify-self: start; }

@media (max-width: 420px) {
  .who { display: none; }
  .kpi-value { font-size: 20px; }
}

@media (min-width: 720px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wrap { padding: 22px; }
}

/* ---------- ecran VPN ---------- */
a.lien {
  display: inline-block; text-decoration: none; font-weight: 600; font-size: 14px;
  color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px;
}
a.lien:hover { background: var(--brand-50); }

select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; width: 100%;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5;
}
textarea.mono {
  width: 100%; resize: vertical; white-space: pre;
  background: var(--page); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
.res-grid { display: grid; gap: 12px; margin-top: 10px; grid-template-columns: minmax(0, 1fr); }
.qr-box {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #ffffff; border: 1px solid var(--line); border-radius: 12px; padding: 10px;
}
.qr-box img { display: block; width: 168px; height: 168px; image-rendering: pixelated; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.btn-row button { margin-top: 0; }
.row-actions { display: flex; gap: 6px; flex: 0 0 auto; }
button.mini { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: rgba(180, 38, 42, .08); }

@media (min-width: 700px) {
  .res-grid { grid-template-columns: minmax(0, 1fr) 190px; align-items: start; }
}

