:root {
  --bg: #f6f7f8; --surface: #ffffff; --text: #1d2125; --muted: #646b73; --line: #e1e4e8;
  --accent: #0f766e; --accent-text: #ffffff; --accent-soft: #e6f4f2;
  --ok: #1a7f37; --warn: #b26b00; --bad: #c62828; --bar: #e9ecef;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.04);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111416; --surface: #1a1e21; --text: #e6e8ea; --muted: #9aa1a8; --line: #2b3136;
    --accent: #2bb3a5; --accent-text: #0b1312; --accent-soft: #18302d;
    --ok: #3fb950; --warn: #e3a33b; --bad: #f47067; --bar: #2b3136; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.muted { color: var(--muted); }
.error { color: var(--bad); }
a { color: var(--accent); }

.btn { font: inherit; font-size: 14px; border-radius: 8px; padding: 7px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: wait; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.logo { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: var(--accent-text);
  display: inline-grid; place-items: center; font-size: 15px; font-weight: 700; }
.pill { font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line);
  border-radius: 99px; padding: 1px 8px; }

/* Connexion */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login-card p { margin: 0; font-size: 14px; }
label { display: grid; gap: 5px; font-size: 14px; font-weight: 500; }
input, select, textarea { font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%; }
textarea { resize: vertical; }
textarea.code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; min-height: 320px; }

/* Barre du haut */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.content { max-width: 1180px; margin: 0 auto; padding: 24px 28px 40px; }
.banner { background: var(--surface); border: 1px solid var(--bad); border-radius: var(--radius); padding: 10px 14px; }

/* Tuiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 28px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tile-body { display: grid; gap: 8px; font-size: 14px; flex: 1; align-content: start; }
.big { font-size: 22px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.meter { display: grid; gap: 3px; }
.meter-bar { height: 6px; border-radius: 99px; background: var(--bar); overflow: hidden; }
.meter-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meter-bar > span.warn { background: var(--warn); } .meter-bar > span.bad { background: var(--bad); }
.sub-name { font-weight: 600; font-size: 14px; margin-top: 4px; }
.small { font-size: 12.5px; }

/* Profils */
.profiles-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.profiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  display: grid; gap: 12px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.card-title { font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge { font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft);
  border-radius: 99px; padding: 2px 8px; }
.card-id { font: 12px ui-monospace, Menlo, monospace; color: var(--muted); }
.desc { margin: 0; font-size: 14px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.card-actions .spacer { flex: 1; }
.foot { font-size: 12.5px; margin-top: 22px; }

/* Fenêtre */
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(640px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0; }
#modal-body { display: grid; gap: 14px; }
#modal-body p { margin: 0; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.choice { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.choice input { width: auto; margin-top: 4px; }
.note { font-size: 13px; background: var(--accent-soft); border-radius: 8px; padding: 9px 12px; }

@media (max-width: 600px) {
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .profiles { grid-template-columns: 1fr; }
}
