/* nallium-email-adminportal — design system
 *
 * Tokens (:root) et classes de "chrome" (topbar, boutons, panels, alertes)
 * copiés à l'identique de nallium-vistera-frontend/css/style.css (qui les
 * tient lui-même de nallium-drive-frontend) pour rester visuellement
 * cohérent avec le reste de l'écosystème Nallium — étendus avec les
 * éléments propres à ce portail : formulaires de gouvernance, tableau de
 * boîtes mail, barre de quota, interrupteurs (toggles).
 */

:root {
  --text: #172033;
  --muted: #64748b;
  --blue: #3b82f6;
  --green: #22c55e;
  --amber: #f59e0b;
  --pink: #ec4899;
  --violet: #8b5cf6;
  --red: #ef4444;
  --cyan: #06b6d4;
  --bg: #f7f9ff;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-solid: #ffffff;
  --border: rgba(30, 41, 59, 0.12);
  --shadow: 0 24px 80px rgba(30, 41, 59, 0.12);
  --shadow-soft: 0 14px 38px rgba(30, 41, 59, 0.09);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 4%, rgba(59, 130, 246, 0.16), transparent 28%),
    radial-gradient(circle at 90% 12%, rgba(236, 72, 153, 0.12), transparent 24%),
    radial-gradient(circle at 72% 88%, rgba(34, 197, 94, 0.13), transparent 26%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--blue);
  text-decoration: none;
}

button {
  font: inherit;
}

.btn {
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  padding: 8px 14px;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
}

.btn-outline {
  background: var(--panel-solid);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: #eef2ff;
}

.btn-outline.active {
  background: #dbeafe;
  border-color: var(--blue);
  color: #1d4ed8;
}

.btn-danger {
  background: #fff1f2;
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.btn-danger:hover {
  background: #ffe4e6;
}

/* ---------------------------------------------------------------------
 * Barre de navigation
 * ------------------------------------------------------------------- */
.ea-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.ea-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: #0f172a;
  cursor: pointer;
}

.ea-brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.ea-topbar-spacer {
  flex: 1;
}

.ea-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ea-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--violet), var(--pink));
}

/* ---------------------------------------------------------------------
 * Contenu
 * ------------------------------------------------------------------- */
.ea-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.ea-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 28px 32px;
}

.ea-panel h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.ea-sub {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 14.5px;
  line-height: 1.5;
}

.ea-loading,
.ea-muted {
  color: var(--muted);
  font-size: 14px;
}

.ea-empty {
  text-align: center;
  padding: 32px 12px;
  color: var(--muted);
}

.empty-icon {
  font-size: 34px;
  margin-bottom: 8px;
}

/* ---------------------------------------------------------------------
 * Alertes
 * ------------------------------------------------------------------- */
.alert-banner {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-banner.danger {
  background: #fff1f2;
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert-banner.success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

/* ---------------------------------------------------------------------
 * Login / gate
 * ------------------------------------------------------------------- */
.login-gate {
  text-align: center;
  padding: 48px 12px;
  color: var(--muted);
}

.login-gate p {
  max-width: 420px;
  margin: 0 auto 18px;
  line-height: 1.5;
}

/* ---------------------------------------------------------------------
 * Boîtes mail
 * ------------------------------------------------------------------- */
.ea-inline-form {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.ea-inline-form input {
  flex: 1;
}

.ea-table {
  margin: 0;
}

.ea-table th {
  color: var(--muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  border-bottom-width: 1px !important;
}

.ea-table td {
  vertical-align: middle;
}

.ea-quota {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}

.ea-quota-track {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.08);
  overflow: hidden;
}

.ea-quota-fill {
  height: 100%;
  border-radius: 999px;
}

.ea-quota-fill.ok {
  background: var(--green);
}

.ea-quota-fill.warn {
  background: var(--amber);
}

.ea-quota-fill.danger {
  background: var(--red);
}

.ea-quota-label {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
 * Gouvernance
 * ------------------------------------------------------------------- */
.ea-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.ea-toggle-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.ea-toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.ea-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ea-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(30, 41, 59, 0.18);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ea-toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.ea-toggle input:checked + .ea-toggle-slider {
  background: var(--blue);
}

.ea-toggle input:checked + .ea-toggle-slider::before {
  transform: translateX(18px);
}

.ea-field {
  margin: 18px 0;
}

.ea-field-label {
  display: block;
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 6px;
}

.ea-list-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.ea-field-row {
  display: flex;
  gap: 16px;
}

.ea-field-row .ea-field {
  flex: 1;
}

@media (max-width: 640px) {
  .ea-inline-form {
    flex-direction: column;
  }

  .ea-field-row {
    flex-direction: column;
    gap: 0;
  }

  .ea-quota {
    min-width: 140px;
  }
}
