:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6eb;
  --text: #1b1f27;
  --muted: #667085;
  --accent: #2563eb;
  --accent-soft: #e8efff;
  --ok: #12805c;
  --ok-soft: #e3f6ee;
  --err: #c0362c;
  --err-soft: #fdecea;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --border: #262b35;
    --text: #e6e8ee;
    --muted: #8b93a4;
    --accent: #6c9bff;
    --accent-soft: #1b2640;
    --ok: #3ecf8e;
    --ok-soft: #13291f;
    --err: #ff7a6e;
    --err-soft: #2e1714;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.hidden { display: none !important; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 24px;
}
header.top h1 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 10px; }
.logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 16px; }

.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 550;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.err { background: var(--err-soft); color: var(--err); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ports { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

.field { margin-bottom: 12px; }
.field .label { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.copy {
  display: flex; gap: 8px; align-items: stretch;
}
.copy code {
  flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 10px; font-size: 13px;
}

button, .btn {
  font: inherit; font-size: 14px; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 7px 14px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.small { padding: 4px 10px; font-size: 13px; }

input, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input { max-width: 280px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 550; font-size: 13px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
td .sub { color: var(--muted); font-size: 12px; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button { margin-left: 6px; }
.empty { text-align: center; color: var(--muted); padding: 32px 8px; }
.muted { color: var(--muted); }

/* Connexion */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
}
.login .card { width: 100%; max-width: 360px; }
.login h1 { font-size: 18px; margin: 0 0 16px; display: flex; gap: 10px; align-items: center; }
.error { color: var(--err); font-size: 13px; min-height: 20px; margin: 6px 0; }

/* Modale */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  width: min(460px, calc(100vw - 32px)); padding: 20px;
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h2 { margin: 0 0 14px; font-size: 16px; }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 8px; font-size: 14px;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* Page d'aide */
.help { max-width: 760px; }
.help h1 { font-size: 26px; margin: 8px 0 4px; }
.help .lead { color: var(--muted); margin: 0 0 24px; font-size: 16px; }
.steps { counter-reset: step; display: grid; gap: 16px; }
.step { position: relative; padding-left: 58px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 18px; top: 18px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 14px;
}
.step h2 { font-size: 16px; }
.step p { margin: 6px 0; }
.dl { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.note { font-size: 13px; color: var(--muted); }
.reassure { background: var(--ok-soft); border-color: transparent; }
.reassure h2 { color: var(--ok); }

@media (max-width: 640px) {
  .hide-sm { display: none; }
  td.actions button { margin: 2px 0 2px 4px; }
}

.full { width: 100%; justify-content: center; }
.mb { margin-bottom: 16px; }
.flush { margin: 0 !important; }
.grid > *, .steps > * { min-width: 0; }
.reassure { margin-top: 16px; }
header.top { flex-wrap: wrap; }
