/* Tableau de bord — charte AccèsPC (couleur principale remplacée par celle de
   la charte du serveur, BRAND_PRIMARY_COLOR). */
:root {
  --bg: #f5f7fb; --card: #fff; --tx: #12203a; --mut: #5b6b85; --pri: #0b5fff; --pri2: #0847c2;
  --bd: #dde3ee; --ok: #12a150; --warn: #c98200; --crit: #d0342c; --soft: #eef3ff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1424; --card: #151e33; --tx: #e8eefb; --mut: #9aa9c6; --pri: #4a86ff; --pri2: #6a9bff;
    --bd: #26324d; --ok: #3ecf7b; --warn: #f0b429; --crit: #ff6b61; --soft: #1b2744; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--tx); line-height: 1.5;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}
.w { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
a { color: var(--pri); }
.muted { color: var(--mut); }
.center { text-align: center; }
.pad { padding: 40px 0; }
.small { font-size: 14px; }
[hidden] { display: none !important; }

/* En-tête */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 0; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: .3px; color: var(--tx); text-decoration: none; }
.logo img { height: 36px; width: auto; }
.usernav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.who { color: var(--mut); font-size: 14px; margin-right: 4px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--pri); color: #fff; text-decoration: none; padding: 10px 18px; border-radius: 10px;
  font-weight: 600; border: 2px solid var(--pri); cursor: pointer; font-size: 15px; font-family: inherit; line-height: 1.2;
}
.btn:hover { background: var(--pri2); border-color: var(--pri2); }
.btn.o { background: transparent; color: var(--pri); }
.btn.o:hover { background: var(--soft); }
.btn.sm { padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.btn.danger { background: transparent; color: var(--crit); border-color: var(--crit); }
.btn.danger:hover { background: var(--crit); color: #fff; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* Onglets */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bd); margin-bottom: 20px; overflow-x: auto; }
.tabs button {
  background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600;
  color: var(--mut); cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--pri); border-bottom-color: var(--pri); }

/* Cartes */
h1 { font-size: clamp(22px, 4vw, 30px); margin: 4px 0 6px; line-height: 1.2; }
h2 { font-size: 20px; margin: 28px 0 12px; }
.lead { color: var(--mut); margin: 0 0 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--bd); border-radius: 14px; padding: 18px; box-shadow: 0 6px 20px rgba(0,0,0,.04); min-width: 0; }
.card h3 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.card .sub { color: var(--mut); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--card); border: 1px solid var(--bd); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 28px; line-height: 1.1; }
.stat span { color: var(--mut); font-size: 14px; }

/* Badges d'état */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: var(--soft); color: var(--mut); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); }
.badge.warn { color: var(--warn); }
.badge.crit { color: var(--crit); }

/* Détails d'un poste */
.facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 14px; margin: 14px 0 0; }
.facts dt { color: var(--mut); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.bar { height: 6px; border-radius: 3px; background: var(--bd); overflow: hidden; margin: 2px 0 6px; }
.bar i { display: block; height: 100%; background: var(--pri); }
.bar.warn i { background: var(--warn); }
.bar.crit i { background: var(--crit); }
.alert { border-left: 4px solid var(--warn); background: var(--soft); padding: 8px 10px; border-radius: 6px; font-size: 14px; margin-top: 10px; }
.alert.critical { border-color: var(--crit); }
.alert.info { border-color: var(--pri); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 14px; }
.chip button { background: none; border: 0; color: var(--mut); cursor: pointer; font-size: 16px; padding: 0 6px; }

/* Tableaux */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--bd); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bd); vertical-align: top; }
th { color: var(--mut); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }

/* Formulaires */
form.stack, .stack { display: grid; gap: 14px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 14px; }
label .hint { font-weight: 400; color: var(--mut); font-size: 13px; }
input, select, textarea {
  font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--bd); border-radius: 8px;
  background: var(--bg); color: var(--tx); width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri); outline-offset: 1px; }
fieldset { border: 1px solid var(--bd); border-radius: 12px; padding: 14px; margin: 0; display: grid; gap: 12px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.radio { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.radio input { width: auto; margin-top: 4px; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 4px; }
td .btn.sm { margin-top: 6px; }
.plan .price { font-size: 32px; font-weight: 800; }
.features { list-style: none; padding: 0; margin: 0; }
.features li { padding: 6px 0 6px 26px; position: relative; border-bottom: 1px solid var(--bd); }
.features li:last-child { border-bottom: 0; }
.features li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 18px; background: var(--soft); padding: 10px 12px; border-radius: 8px; user-select: all; overflow-wrap: anywhere; }

/* Boîte de dialogue et notifications */
dialog { border: 0; border-radius: 14px; padding: 0; max-width: min(560px, calc(100vw - 32px)); width: 100%; background: var(--card); color: var(--tx); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 18, 35, .55); }
.dlg { padding: 22px; display: grid; gap: 14px; max-height: 85vh; overflow: auto; }
.dlg h2 { margin: 0; }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0)); transform: translateX(-50%); background: var(--tx); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 15px; max-width: calc(100vw - 32px); z-index: 10; }
.toast.err { background: var(--crit); color: #fff; }
.foot { text-align: center; color: var(--mut); padding: 40px 0 28px; font-size: 14px; }
.empty { text-align: center; padding: 40px 16px; color: var(--mut); }

@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; }
  .btn { padding: 10px 14px; }
  .actions .btn { flex: 1 1 auto; }
}

/* Guide pas à pas (allumage à distance) */
.guide { background: var(--soft); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.guide summary { cursor: pointer; font-weight: 600; }
.guide ol { padding-left: 20px; margin: 8px 0; display: grid; gap: 6px; }

/* Barre d'outils, recherche, champs en ligne (administration) */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 10px 0 12px; }
.toolbar h2 { margin: 0; }
.toolbar .search { flex: 1 1 260px; max-width: 420px; }
.actions.tight { gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.inline-input { width: 140px; padding: 6px 10px; font-size: 14px; }
.actions.tight .btn.sm { white-space: nowrap; }
input:disabled { opacity: .65; cursor: not-allowed; }
