/* ─────────────────────────────────────────────────────────────────
 *  console.css — chrome propre à la console BAO.
 *  S'appuie sur jowwwan-tokens.css (tokens, .btn, .field, switcher) +
 *  origine.css. N'utilise que les variables de la charte.
 * ───────────────────────────────────────────────────────────────── */

body { background: var(--bg); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 22px;
}
.brand {
  font-family: var(--font-display);
  font-size: 20px; color: var(--text); white-space: nowrap;
}
.brand span { color: var(--accent2); }
.brand em {
  font-style: normal; font-size: 12px; color: var(--text3);
  font-family: var(--font-body); margin-left: 4px;
}
.nav { display: flex; gap: 4px; }
.nav-link {
  color: var(--text2); font-size: 13.5px; padding: 6px 12px;
  border-radius: var(--radius-sm); transition: background .12s, color .12s;
}
.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { color: var(--accent); background: var(--accent-soft); }
/* Téléphone : la navigation (jusqu'à cinq liens pour un admin) passe sur sa
   propre ligne, et défile de côté plutôt que de sortir de l'écran. */
@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
  .nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav-link { white-space: nowrap; }
}
/* jowwwan-tokens.css fait de .topbar un conteneur flex (padding, hauteur fixe) : .topbar-inner
   s'y rétrécissait à son contenu et se centrait, si bien que .topbar-right (Connexion,
   Déconnexion) n'arrivait jamais à droite. On repasse en bloc : .topbar-inner fait la mise en page. */
.topbar { display: block; height: auto; padding: 0; }
/* Le sélecteur de thème est fixé en haut à droite (36 px, à 16 px du bord) : quand la barre
   atteint ce bord, on lui garde sa place. */
@media (max-width: 1100px) { .topbar-inner { padding-right: 68px; } }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-right .who { font-size: 12.5px; color: var(--text3); white-space: nowrap; }
.logout-form { display: inline; }

/* ── Conteneur de page ───────────────────────────────────────── */
.wrap { max-width: 980px; margin: 0 auto; padding: 30px 20px 70px; }
.wrap-narrow { max-width: 440px; margin: 0 auto; padding: 8vh 20px 60px; }

.page-head { margin-bottom: 22px; }
.page-title {
  font-family: var(--font-display); font-size: 26px; color: var(--text);
  margin: 0 0 4px;
}
.page-sub { color: var(--text3); font-size: 14px; line-height: 1.55; }

.section-title {
  font-family: var(--font-display); font-size: 18px; color: var(--text);
  margin: 32px 0 12px;
}

/* ── Cartes ──────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
}
.card + .card { margin-top: 14px; }

.grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-items: stretch;
}
.grid .card { margin-top: 0; }

/* ── Stat / tableau de bord ──────────────────────────────────── */
.stats { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.stat {
  flex: 1; min-width: 150px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
}
.stat .n { font-family: var(--font-display); font-size: 30px; color: var(--text); }
.stat .l { font-size: 12.5px; color: var(--text3); margin-top: 2px; }

/* ── Liste des communes ──────────────────────────────────────── */
.commune {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.commune + .commune { margin-top: 10px; }
.commune-main { flex: 1; min-width: 0; }
.commune-name { font-size: 15px; color: var(--text); font-weight: 500; }
.commune-sub { font-size: 12.5px; color: var(--text3); margin-top: 2px; }
.commune-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ── Pastilles de statut ─────────────────────────────────────── */
.pill {
  display: inline-block; font-size: 11px; font-weight: 600;
  letter-spacing: .03em; padding: 3px 9px; border-radius: 999px;
}
.pill-installed { color: var(--color-success); background: color-mix(in srgb, var(--color-success) 16%, transparent); }
.pill-pending   { color: var(--color-warning); background: color-mix(in srgb, var(--color-warning) 16%, transparent); }
.pill-error     { color: var(--color-error);   background: color-mix(in srgb, var(--color-error) 16%, transparent); }
.pill-soon      { color: var(--text3);          background: color-mix(in srgb, var(--text3) 14%, transparent); }
.pill-active    { color: var(--accent);         background: var(--accent-soft); }

/* ── Alertes ─────────────────────────────────────────────────── */
.alert {
  border: 1px solid var(--border2); border-radius: var(--radius);
  padding: 12px 16px; font-size: 13.5px; line-height: 1.55; margin-bottom: 18px;
  color: var(--text2); background: var(--surface);
}
.alert strong { color: var(--text); }
.alert-info { border-color: color-mix(in srgb, var(--accent) 40%, var(--border2)); }
.alert-warn { border-color: color-mix(in srgb, var(--color-warning) 50%, var(--border2)); background: color-mix(in srgb, var(--color-warning) 8%, var(--surface)); }
.alert-ok   { border-color: color-mix(in srgb, var(--color-success) 50%, var(--border2)); }
.alert-err  { border-color: color-mix(in srgb, var(--color-error) 55%, var(--border2)); background: color-mix(in srgb, var(--color-error) 8%, var(--surface)); }

/* ── Carte d'authentification ────────────────────────────────── */
.auth-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 30px 28px;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.auth-logo {
  font-family: var(--font-display); font-size: 30px; color: var(--text);
  text-align: center; margin-bottom: 2px;
}
.auth-logo span { color: var(--accent2); }
.auth-tag { text-align: center; color: var(--text3); font-size: 13px; margin-bottom: 22px; }
.auth-card .field input { font-size: 15px; }
.btn-block { display: block; width: 100%; text-align: center; padding: 11px; font-size: 14px; }

/* ── Divers ──────────────────────────────────────────────────── */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.muted { color: var(--text3); }
.mono { font-family: var(--font-mono); }
.empty {
  text-align: center; color: var(--text3); padding: 40px 20px;
  border: 1px dashed var(--border2); border-radius: var(--radius);
}
.foot {
  max-width: 980px; margin: 0 auto; padding: 24px 20px;
  color: var(--text3); font-size: 12px; text-align: center;
}
.foot .dot { color: var(--accent); }
/* Deux champs côte à côte (prénom/nom, téléphone/email…) : un par ligne sur téléphone. */
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.tool-toggle { display: flex; align-items: center; gap: 10px; }
.tool-toggle .icon { font-size: 20px; }
.inline-form { display: inline; }

/* ── Aperçu support (lecture seule) ──────────────────────────── */
.support-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 72px 10px 20px;   /* à droite : place du sélecteur de thème fixe */
  font-size: 13px; line-height: 1.5; color: var(--text);
  background: color-mix(in srgb, var(--color-warning) 18%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--color-warning) 45%, var(--border2));
}
.support-bar .support-eye { font-size: 16px; }
.support-bar .support-text { flex: 1; min-width: 240px; }
.support-bar .btn { padding: 5px 12px; font-size: 12.5px; }

/* ── Accès aux outils (acces.php) ────────────────────────────── */
.acces-tableau {
  overflow-x: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.acces { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.acces th, .acces td { padding: 10px 14px; text-align: left; vertical-align: middle; border-top: 1px solid var(--border); }
.acces thead th { border-top: 0; vertical-align: bottom; font-weight: 400; white-space: nowrap; }
.acces tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.acces tr.off { opacity: .55; }
/* Sur téléphone, le tableau défile de côté : la colonne des noms reste en place. */
.acces-qui { min-width: 150px; position: sticky; left: 0; z-index: 1; background: var(--surface); }
.acces tbody .acces-qui { font-weight: 400; }
.acces-qui .n { color: var(--text); font-weight: 500; margin-right: 6px; }
.acces-qui .pill { margin-right: 4px; vertical-align: 1px; }
.acces-qui .e { display: block; font-size: 11.5px; color: var(--text3); margin-top: 2px; }
.acces-outil { display: block; color: var(--text); font-weight: 500; }
.acces-outil > span { margin-right: 5px; }
.acces-compte { display: block; font-size: 11.5px; color: var(--text3); margin-top: 2px; }
.acces-tous { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; font-size: 11.5px; color: var(--text2); cursor: pointer; }
.acces-tous[hidden] { display: none; }
.acces-case { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--text2); }
.acces input[type="checkbox"] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.acces select {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border2); border-radius: var(--radius-sm, 6px);
  padding: 5px 8px;
}
.acces-inclus { font-size: 12.5px; color: var(--text3); white-space: nowrap; }
.acces-lien { font-size: 13px; white-space: nowrap; }
.acces-pied {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 0; background: var(--bg);
  font-size: 12.5px;
}
.acces-note { font-size: 12.5px; line-height: 1.6; margin: 14px 0 0; max-width: 760px; }
