/* ================================================================
   Dashboard Mail — « Le Registre »
   Papeterie administrative de luxe : papier crème, encre bleu nuit,
   sceaux vermillon. Typographie éditoriale Fraunces + IBM Plex Sans.
   ================================================================ */

:root {
  --paper: #f6f4ee;        /* fond général, papier crème */
  --panel: #fffdf8;        /* surfaces : fiches, colonnes */
  --hairline: #e3ded2;     /* filets fins */
  --hairline-dark: #cfc8b8;
  --ink: #232936;          /* encre bleu-noir : texte */
  --ink-soft: #5c6270;     /* encre diluée : secondaire */
  --muted: #8b8fa0;
  --royal: #2b3a67;        /* encre royale : actif, liens */
  --royal-wash: #eef0f7;   /* lavis bleu très pâle */
  --seal: #c8401f;         /* vermillon du sceau : non-lu, alertes */
  --seal-wash: #faeee9;
  --ok: #4c7a4c;
  --shadow: 0 1px 2px rgba(35, 41, 54, 0.05), 0 8px 28px rgba(35, 41, 54, 0.09);
  --font-body: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font: 14px/1.5 var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(43, 58, 103, 0.05), transparent 60%),
    var(--paper);
}

#layout {
  display: grid;
  grid-template-columns: 272px 1fr;
  height: 100vh;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--hairline-dark); border-radius: 5px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- barre latérale ---------------- */

#sidebar {
  background: var(--panel);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
}

#sidebar header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#sidebar h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.2px;
  margin: 0 0 6px;
}
#sidebar h1 em {
  font-style: italic;
  font-weight: 480;
  color: var(--royal);
}

#groups { flex: 1; overflow-y: auto; padding: 6px 10px 14px; }

.group-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
  padding: 16px 6px 6px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  transition: background 0.12s ease, color 0.12s ease;
}
.account-row:hover { background: var(--royal-wash); color: var(--ink); }
.account-row.active {
  background: var(--royal);
  color: #fdfcf7;
}
.account-row.active .badge { background: #fdfcf7; color: var(--royal); }
.account-row.indent { margin-left: 12px; }

.filter-row .email { font-weight: 500; color: inherit; }

.account-row .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); flex-shrink: 0;
}
.account-row .dot.pending { background: var(--hairline-dark); }
.account-row .dot.reauth, .account-row .dot.error { background: #dd9a1c; }

.account-row .email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-row .edit-group {
  margin-left: auto;
  visibility: hidden;
  font-size: 12px;
  opacity: 0.7;
}
.account-row:hover .edit-group { visibility: visible; }

.account-row .badge {
  margin-left: auto;
  background: var(--seal);
  color: #fff;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}

#sidebar footer {
  border-top: 1px solid var(--hairline);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------------- zone principale ---------------- */

#main { display: flex; flex-direction: column; overflow: hidden; }

#toolbar {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  padding: 14px 20px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--hairline);
}

#folder-tabs { display: flex; gap: 2px; flex-wrap: wrap; }

.tab {
  border: none;
  background: none;
  padding: 8px 12px 10px;
  cursor: pointer;
  font: 13px var(--font-body);
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--royal);
  border-bottom-color: var(--seal);
  font-weight: 600;
}

#search {
  margin-left: auto;
  margin-bottom: 8px;
  width: 260px;
  padding: 7px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--paper);
  font: 13px var(--font-body);
  color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
#search:focus {
  outline: none;
  border-color: var(--royal);
  box-shadow: 0 0 0 3px var(--royal-wash);
}

/* ---------------- barre de sélection multiple ---------------- */

#bulkbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: var(--seal-wash);
  border-bottom: 1px solid var(--hairline);
  animation: slideDown 0.18s ease;
}
#bulkbar[hidden] { display: none; }
#bulk-count {
  font-weight: 600;
  font-size: 13px;
  color: var(--seal);
  min-width: 100px;
  font-variant-numeric: tabular-nums;
}
.bulk-sep { width: 1px; height: 18px; background: var(--hairline-dark); margin: 0 4px; }

@keyframes slideDown {
  from { transform: translateY(-6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------------- liste des messages ---------------- */

#list { flex: 1; overflow-y: auto; }

.msg-row {
  display: grid;
  grid-template-columns: 30px 220px 1fr 120px;
  gap: 10px;
  align-items: center;
  padding: 10px 20px 10px 12px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  background: var(--panel);
  position: relative;
  animation: rowIn 0.25s ease backwards;
  transition: background 0.1s ease;
}
.msg-row:nth-child(1) { animation-delay: 0.02s; }
.msg-row:nth-child(2) { animation-delay: 0.04s; }
.msg-row:nth-child(3) { animation-delay: 0.06s; }
.msg-row:nth-child(4) { animation-delay: 0.08s; }
.msg-row:nth-child(5) { animation-delay: 0.1s; }
.msg-row:nth-child(6) { animation-delay: 0.12s; }
.msg-row:nth-child(7) { animation-delay: 0.14s; }
.msg-row:nth-child(8) { animation-delay: 0.16s; }

@keyframes rowIn {
  from { transform: translateY(4px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.msg-row:hover { background: var(--royal-wash); }
.msg-row.selected { background: var(--seal-wash); }

/* pastille non-lu : trait vermillon sur la tranche */
.msg-row.unread::before {
  content: '';
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--seal);
}
.msg-row.unread .who, .msg-row.unread .what { font-weight: 600; }

.msg-row .sel { display: flex; align-items: center; justify-content: center; }
.msg-row .sel input {
  width: 15px; height: 15px;
  accent-color: var(--seal);
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.1s ease;
}
.msg-row:hover .sel input, .msg-row .sel input:checked { opacity: 1; }

.msg-row .who { overflow: hidden; }
.msg-row .who .acct {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--royal);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
}

.msg-row .what {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.msg-row .what .preview { color: var(--muted); font-weight: 400; }

.msg-row .when {
  text-align: right;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* actions rapides : remplacent la date au survol */
.msg-row .row-actions {
  grid-column: 4;
  grid-row: 1;
  display: none;
  justify-content: flex-end;
  gap: 6px;
}
.msg-row:hover .when { visibility: hidden; }
.msg-row:hover .row-actions { display: flex; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }

.ic {
  border: 1px solid var(--hairline-dark);
  background: var(--panel);
  border-radius: 7px;
  width: 30px; height: 28px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}
.ic:hover { border-color: var(--royal); color: var(--royal); background: #fff; }
.ic.danger:hover { border-color: var(--seal); color: var(--seal); background: var(--seal-wash); }

.empty {
  padding: 80px 40px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
}

/* ---------------- lecteur ---------------- */

#reader[hidden] { display: none; }
#reader {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(760px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: readerIn 0.22s cubic-bezier(0.2, 0.8, 0.25, 1);
  z-index: 20;
}

@keyframes readerIn {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

#reader-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
}
.reader-titles { min-width: 0; }
#reader-subject {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#reader-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.spacer { flex: 1; }

#reader-body { flex: 1; border: none; width: 100%; background: #fff; }

/* ---------------- composeur ---------------- */

#composer {
  border-top: 2px solid var(--royal);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  max-height: 55%;
}
#composer[hidden] { display: none; }

#composer-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}

.fmt {
  border: 1px solid transparent;
  background: none;
  border-radius: 6px;
  min-width: 30px;
  height: 28px;
  padding: 0 7px;
  cursor: pointer;
  font: 13px var(--font-body);
  color: var(--ink-soft);
  transition: all 0.1s ease;
}
.fmt:hover { background: var(--royal-wash); color: var(--royal); border-color: var(--hairline); }
.fmt-sep { width: 1px; height: 18px; background: var(--hairline); margin: 0 5px; }

#composer-body {
  min-height: 110px;
  max-height: 240px;
  overflow-y: auto;
  padding: 12px 16px;
  outline: none;
  font: 14px/1.55 var(--font-body);
}
#composer-body:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-style: italic;
}

#attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px;
}
#attachments:empty { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--royal-wash);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 6px;
}
.chip button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  padding: 0;
}
.chip button:hover { color: var(--seal); }

#composer-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 12px;
}
#composer-hint { font-size: 12px; color: var(--muted); font-style: italic; }

/* ---------------- boutons ---------------- */

.btn {
  border: 1px solid var(--hairline-dark);
  background: var(--panel);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  font: 13px var(--font-body);
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
  text-align: center;
  transition: all 0.12s ease;
}
.btn:hover { border-color: var(--royal); color: var(--royal); background: #fff; }
.btn.primary {
  background: var(--royal);
  border-color: var(--royal);
  color: #fdfcf7;
}
.btn.primary:hover { background: #22305a; color: #fff; }
.btn.danger { color: var(--seal); border-color: var(--seal); background: transparent; }
.btn.danger:hover { background: var(--seal); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); border-color: var(--hairline); }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* ---------------- nouveau message (fenêtre) ---------------- */

#compose-modal {
  position: fixed;
  inset: 0;
  background: rgba(35, 41, 54, 0.38);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
#compose-modal[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#compose-panel {
  width: min(680px, 94vw);
  max-height: 88vh;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: panelIn 0.2s cubic-bezier(0.2, 0.8, 0.25, 1);
}

@keyframes panelIn {
  from { transform: translateY(14px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

#compose-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}

.nm-field {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 18px;
  border-bottom: 1px solid var(--hairline);
}
.nm-field label {
  width: 46px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.nm-field input, .nm-field select {
  flex: 1;
  border: none;
  background: transparent;
  font: 13px var(--font-body);
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.nm-field input::placeholder { color: var(--muted); font-style: italic; }

.rich-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}

#nm-body {
  min-height: 150px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 18px;
  outline: none;
  font: 14px/1.55 var(--font-body);
}
#nm-body:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-style: italic;
}

.attach-zone {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 18px;
}
.attach-zone:empty { display: none; }

#nm-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--hairline);
}
#nm-hint { font-size: 12px; color: var(--muted); font-style: italic; }

/* ---------------- alertes de sécurité du message ---------------- */

#reader-signals {
  padding: 11px 20px 12px;
  border-bottom: 1px solid transparent;
  font-size: 12.5px;
}
#reader-signals[hidden] { display: none; }
#reader-signals.danger { background: #fdecea; border-bottom-color: #f3c9c4; color: #8f2b2b; }
#reader-signals.warn { background: #fdf4e3; border-bottom-color: #f0e0bd; color: #8a6212; }
.sig-head {
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 6px;
}
.sig {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 0 4px 12px;
  border-left: 2px solid currentColor;
  margin-top: 5px;
}
.sig span { opacity: 0.85; font-size: 12px; }

/* ---------------- contenu distant bloqué ---------------- */

#remote-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: #eef3fa;
  border-bottom: 1px solid #d9e2f0;
  font-size: 12.5px;
  color: #33507f;
}
#remote-bar[hidden] { display: none; }
#remote-bar span { flex: 1; }
#remote-bar .btn.small { padding: 3px 10px; font-size: 12px; }

#btn-empty-deleted {
  margin-left: auto;
  margin-bottom: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
/* Quand le bouton est là, c'est lui qui pousse à droite, pas la recherche. */
#btn-empty-deleted:not([hidden]) ~ #search { margin-left: 10px; }
#btn-empty-deleted[hidden] { display: none; }

/* ---------------- pièces jointes reçues ---------------- */

#reader-attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid var(--hairline);
  background: var(--wash, #faf9f6);
}
#reader-attachments[hidden] { display: none; }
.att-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.chip.download {
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.chip.download:hover { border-color: var(--accent); color: var(--accent); }
.chip.download.danger {
  border-color: #d98b84;
  background: #fdecea;
  color: #8f2b2b;
  font-weight: 600;
}
.chip.download.danger:hover { border-color: #8f2b2b; color: #8f2b2b; }
.att-size { color: var(--muted); font-size: 11px; margin-left: 4px; }
.msg-row .clip { font-size: 11px; opacity: 0.75; }

/* ---------------- bandeau de santé des comptes ---------------- */

#health {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  font-size: 12.5px;
  border-bottom: 1px solid transparent;
}
#health[hidden] { display: none; }
#health.alert { background: #fdecea; color: #8f2b2b; border-bottom-color: #f3c9c4; }
#health.warn { background: #fdf4e3; color: #8a6212; border-bottom-color: #f0e0bd; }
#health span { flex: 1; }
#health .btn.small { padding: 3px 10px; font-size: 12px; }

/* ---------------- erreur / perte de connexion ---------------- */

#offline-bar {
  padding: 8px 20px;
  background: #fdecea;
  color: #8f2b2b;
  font-size: 12.5px;
  border-bottom: 1px solid #f3c9c4;
}
#offline-bar[hidden] { display: none; }

.sync-note {
  padding: 2px 8px 6px;
  font-size: 11px;
  font-style: italic;
  color: var(--muted);
}

/* ---------------- toast ---------------- */

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fdfcf7;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: toastIn 0.2s ease;
}
#toast.err { background: var(--seal); }
#toast[hidden] { display: none; }

@keyframes toastIn {
  from { transform: translate(-50%, 8px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}


/* ---------------- test de bon fonctionnement ---------------- */

#test-modal {
  position: fixed;
  inset: 0;
  background: rgba(35, 41, 54, 0.38);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
#test-modal[hidden] { display: none; }

#test-panel {
  width: min(680px, 94vw);
  max-height: 88vh;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#test-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}
#test-intro {
  padding: 12px 18px;
  font-size: 13px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--hairline);
}
#test-intro select {
  margin-top: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  font: 13px var(--font-body);
}
#test-results {
  flex: 1;
  overflow-y: auto;
  padding: 6px 18px 12px;
  min-height: 80px;
}
.test-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
}
.test-line:last-child { border-bottom: none; }
.test-mark { flex-shrink: 0; width: 18px; font-weight: 700; }
.test-line.ok .test-mark { color: var(--ok); }
.test-line.ko .test-mark { color: var(--seal); }
.test-line.run .test-mark { color: var(--muted); }
.test-body { flex: 1; }
.test-name { font-weight: 600; }
.test-detail { color: var(--muted); font-size: 12px; }
.test-info { font-size: 12px; margin-top: 2px; font-family: ui-monospace, monospace; }
.test-line.ko .test-info { color: var(--seal); }
#test-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--hairline);
}
#test-hint { font-size: 12px; color: var(--muted); font-style: italic; }
.test-verdict {
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  margin: 10px 0 4px;
}
.test-verdict.ok { background: #edf5ed; color: #2f5c2f; }
.test-verdict.ko { background: var(--seal-wash); color: #8f2b2b; }

/* ---------------- page de connexion ---------------- */

body.page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  width: min(380px, 92vw);
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px 30px 28px;
}
.login-card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  margin: 0;
}
.login-card h1 em { font-style: italic; font-weight: 480; color: var(--royal); }
.login-sub {
  margin: 4px 0 22px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--muted);
}
.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--paper);
  font: 14px var(--font-body);
  color: var(--ink);
  margin-bottom: 14px;
}
.login-card input:focus {
  outline: none;
  border-color: var(--royal);
  box-shadow: 0 0 0 3px var(--royal-wash);
}
.login-card button { width: 100%; }
#login-error {
  margin: 14px 0 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--seal-wash);
  color: #8f2b2b;
  font-size: 12.5px;
}
#login-error[hidden] { display: none; }

/* ---------------- panneau d'organisation des groupes ---------------- */

#groupes-modal {
  position: fixed;
  inset: 0;
  background: rgba(35, 41, 54, 0.38);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
#groupes-modal[hidden] { display: none; }

#groupes-panel {
  width: min(720px, 94vw);
  height: min(660px, 88vh);
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#groupes-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}

#grp-barre {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px solid var(--hairline);
  flex-wrap: wrap;
}
#grp-filtre { flex: 1; min-width: 160px; }
#grp-barre input, #grp-barre select {
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: var(--paper);
  font: 13px var(--font-body);
  color: var(--ink);
}

#grp-liste { flex: 1; overflow-y: auto; padding: 4px 0; }

.grp-ligne {
  display: grid;
  grid-template-columns: 26px 1fr 180px;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  font-size: 13px;
}
.grp-ligne:hover { background: var(--royal-wash); }
.grp-ligne.selectionne { background: var(--seal-wash); }
.grp-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grp-groupe {
  font-size: 11.5px;
  color: var(--muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grp-vide { padding: 30px; text-align: center; color: var(--muted); font-style: italic; }

#grp-action {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--hairline);
  flex-wrap: wrap;
}
#grp-compte {
  font-weight: 600;
  font-size: 13px;
  color: var(--seal);
  min-width: 110px;
  font-variant-numeric: tabular-nums;
}
#grp-action select, #grp-action input {
  padding: 7px 10px;
  border: 1px solid var(--hairline);
  border-radius: 7px;
  background: var(--paper);
  font: 13px var(--font-body);
  color: var(--ink);
}
#grp-action input { flex: 1; min-width: 150px; }
#grp-deplacer:disabled { opacity: 0.45; cursor: not-allowed; }
