/* nallium-idm-frontend — design system
 *
 * Design tokens (:root) et classes de "chrome" (orbes, panel, boutons,
 * formulaires, badges) repris tels quels du système de design partagé des
 * apps Nallium (cf. erp_nallium) pour rester visuellement cohérent avec le
 * reste de l'écosystème. Les classes spécifiques à un module (CRM,
 * comptabilité, devis...) n'ont PAS été reprises : ce front n'affiche que
 * login / register / confirmation parentale, pas de dashboard ni de sidebar
 * de navigation par tenant (il s'exécute AVANT toute authentification).
 */

: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: 26px;
}

* {
  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.18), transparent 28%),
    radial-gradient(circle at 90% 12%, rgba(236, 72, 153, 0.14), transparent 24%),
    radial-gradient(circle at 72% 88%, rgba(34, 197, 94, 0.15), transparent 26%),
    radial-gradient(circle at 16% 86%, rgba(245, 158, 11, 0.13), transparent 22%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.22;
  z-index: -1;
}

.orb-a {
  width: 360px;
  height: 360px;
  background: var(--blue);
  top: -100px;
  left: 14%;
}

.orb-b {
  width: 300px;
  height: 300px;
  background: var(--pink);
  right: 8%;
  top: 22%;
}

.orb-c {
  width: 240px;
  height: 240px;
  background: var(--green);
  bottom: 4%;
  left: 40%;
}

/* Shell centré — pas de sidebar/dashboard ici, une seule carte au centre.
 * flexbox plutôt que grid : avec `display:grid` + `place-items:center`,
 * l'unique piste implicite occupait toute la largeur du conteneur (rien ne
 * la bornait à la taille de son contenu) — le logo, centré dans cette piste
 * pleine largeur, se retrouvait visuellement détaché de la carte (elle,
 * alignée à gauche dans cette même piste). */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Le conteneur logo+carte (`<div class="auth-shell"><div>...`, cf. js/app.js)
 * doit avoir une largeur explicite : un enfant `width:auto` d'un flex item
 * suit l'algorithme normal des boîtes de bloc (il remplit l'espace
 * disponible) même avec `align-items:center` sur le parent — center ne
 * rétrécit un enfant à son contenu que s'il a déjà une largeur définie.
 * On aligne donc cette largeur sur celle de `.auth-card` pour que le logo
 * (`.brand`, centré par son propre `justify-content`) et la carte partagent
 * la même colonne et restent visuellement un seul bloc centré. */
.auth-shell > div {
  width: min(440px, 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  margin-bottom: 22px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  padding: 2px;
  background: conic-gradient(from 180deg, var(--blue), var(--green), var(--amber), var(--pink), var(--violet), var(--blue));
  box-shadow: 0 16px 42px rgba(59, 130, 246, 0.22);
}

.brand-logo span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  background: #ffffff;
  font-weight: 950;
  font-size: 22px;
  color: #111827;
}

.brand-title {
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.03em;
  color: #0f172a;
  line-height: 1.1;
}

.brand-subtitle,
.mini-text {
  color: var(--muted);
  font-size: 12px;
}

.auth-card {
  width: min(440px, 100%);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  border-radius: var(--radius);
  padding: 30px;
}

.auth-card h1 {
  font-size: 26px;
  font-weight: 950;
  letter-spacing: -0.04em;
  margin: 0 0 4px;
  color: #0f172a;
}

.auth-card .subtitle {
  color: var(--muted);
  margin: 0 0 22px;
}

.rainbow-strip {
  height: 6px;
  border-radius: 99px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(30, 41, 59, 0.12);
  margin-bottom: 22px;
}

.rainbow-strip div:nth-child(1) {
  background: var(--blue);
}
.rainbow-strip div:nth-child(2) {
  background: var(--green);
}
.rainbow-strip div:nth-child(3) {
  background: var(--amber);
}
.rainbow-strip div:nth-child(4) {
  background: var(--pink);
}
.rainbow-strip div:nth-child(5) {
  background: var(--violet);
}

.form-label {
  font-size: 12px;
  color: #334155;
  font-weight: 850;
}

.form-control,
.form-select {
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(30, 41, 59, 0.16) !important;
  color: #0f172a !important;
  border-radius: 14px;
}

.form-control::placeholder {
  color: #94a3b8;
}

.btn {
  border-radius: 14px;
  font-weight: 850;
}

.btn-primary-gradient {
  border: 0;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet) 50%, var(--pink));
  box-shadow: 0 16px 40px rgba(139, 92, 246, 0.2);
}

.btn-primary-gradient:hover,
.btn-primary-gradient:focus {
  color: white;
}

.btn-primary-gradient:disabled {
  opacity: 0.65;
}

.btn-soft {
  border: 1px solid var(--border);
  color: #334155;
  background: rgba(255, 255, 255, 0.82);
}

.btn-soft:hover {
  background: #fff;
  color: #0f172a;
  box-shadow: var(--shadow-soft);
}

.badge-soft {
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(59, 130, 246, 0.11);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  display: inline-block;
}

.badge-soft.green {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.24);
  color: #047857;
}
.badge-soft.red {
  background: rgba(239, 68, 68, 0.11);
  border-color: rgba(239, 68, 68, 0.22);
  color: #b91c1c;
}
.badge-soft.amber {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.24);
  color: #92400e;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 850;
}

/* Bandeaux de message (erreur / succès / info) affichés en haut des pages */
.alert-banner {
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.alert-banner.error {
  background: rgba(239, 68, 68, 0.09);
  border-color: rgba(239, 68, 68, 0.22);
  color: #b91c1c;
}

.alert-banner.success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.24);
  color: #047857;
}

.alert-banner.info {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.22);
  color: #1d4ed8;
}

.auth-footer-links {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-footer-links a {
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
}

.auth-footer-links a:hover {
  text-decoration: underline;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.spinner-border-sm-inline {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
  margin-right: 6px;
}

/* Une seule section de page visible à la fois, cf. js/app.js::render() */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* Splashscreen affiché entre une connexion réussie et le chargement de la
 * config du tenant (cf. js/app.js::renderStandaloneLoginSuccess/
 * renderSplashScreen, appelé pendant GET /tenant). Classes préfixées
 * `splash-` (y compris les orbes, `.splash-orb-*`) pour ne pas entrer en
 * collision avec `.orb-a/b/c` déjà utilisés sur la page de login — mêmes
 * design tokens (:root ci-dessus), pas de :root dupliqué. */
.splash-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.splash-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.22;
  z-index: 0;
  animation: splash-drift 14s ease-in-out infinite alternate;
}

.splash-orb-a {
  width: 360px;
  height: 360px;
  background: var(--blue);
  top: -100px;
  left: 8%;
  animation-delay: 0s;
}
.splash-orb-b {
  width: 300px;
  height: 300px;
  background: var(--pink);
  right: 6%;
  top: 14%;
  animation-delay: -4s;
}
.splash-orb-c {
  width: 260px;
  height: 260px;
  background: var(--green);
  bottom: 0%;
  left: 36%;
  animation-delay: -8s;
}
.splash-orb-d {
  width: 220px;
  height: 220px;
  background: var(--amber);
  bottom: 8%;
  right: 18%;
  animation-delay: -2s;
}

@keyframes splash-drift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(24px, -18px) scale(1.08);
  }
}

.splash-stage {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 22px;
  text-align: center;
}

/* Le logo (anneau conique qui tourne + carré blanc intérieur) réutilise la
 * même construction que .brand-logo : un anneau surdimensionné animé en
 * transform plutôt qu'un dégradé animé directement (les navigateurs
 * n'animent pas fluidement l'angle d'un conic-gradient). */
.splash-logo {
  width: 132px;
  height: 132px;
  border-radius: 40px;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  animation: splash-logo-build 1.15s ease-in-out infinite alternate;
}

.splash-logo-ring {
  position: absolute;
  inset: -35%;
  background: conic-gradient(from 180deg, var(--blue), var(--green), var(--amber), var(--pink), var(--violet), var(--blue));
  animation: splash-ring-spin 5s linear infinite;
}

.splash-logo-inner {
  position: absolute;
  inset: 5px;
  border-radius: 34px;
  background: #ffffff;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.splash-logo-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 20%, rgba(59, 130, 246, 0.18), transparent 34%),
    radial-gradient(circle at 80% 75%, rgba(236, 72, 153, 0.15), transparent 32%);
  pointer-events: none;
}

.splash-logo span {
  position: relative;
  z-index: 1;
  font-weight: 950;
  font-size: 66px;
  letter-spacing: -0.08em;
  color: var(--text);
  line-height: 1;
  transform: translateY(-2px);
  font-family: inherit;
}

@keyframes splash-logo-build {
  0% {
    transform: scale(0.82) rotate(-8deg);
    filter: saturate(0.85);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  }
  60% {
    transform: scale(1.04) rotate(2deg);
    filter: saturate(1.3);
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.18);
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: saturate(1.45);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
  }
}

@keyframes splash-ring-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.splash-word {
  display: grid;
  justify-items: center;
  gap: 6px;
  opacity: 0;
  animation: splash-word-in 0.7s ease 0.35s forwards;
}

.splash-word strong {
  font-size: 26px;
  font-weight: 950;
  letter-spacing: -0.04em;
  color: var(--text);
}

.splash-word span {
  font-size: 13px;
  font-weight: 750;
  color: var(--muted);
  letter-spacing: 0.01em;
}

@keyframes splash-word-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.splash-loader {
  width: 156px;
  height: 6px;
  border-radius: 99px;
  background: rgba(30, 41, 59, 0.08);
  overflow: hidden;
  opacity: 0;
  animation: splash-word-in 0.7s ease 0.55s forwards;
}

.splash-loader-fill {
  height: 100%;
  width: 40%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--amber), var(--pink), var(--violet));
  background-size: 300% 100%;
  animation:
    splash-loader-sweep 1.6s ease-in-out infinite,
    splash-loader-hue 3s linear infinite;
}

@keyframes splash-loader-sweep {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(60%);
  }
  100% {
    transform: translateX(220%);
  }
}

@keyframes splash-loader-hue {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

.splash-footer {
  position: fixed;
  bottom: 22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  animation: splash-word-in 0.7s ease 0.8s forwards;
}

@media (max-width: 520px) {
  .auth-card {
    padding: 22px;
  }
}

/* ------------------------------------------------------------------
 * Console d'admin (js/admin.js) — sidebar + pages (dashboard, risk
 * management, compliance auditing, password management, users, roles,
 * applications, devices, billing, tenant). Affichée après connexion
 * réussie, remplace entièrement #view (voir renderAdminShell).
 * ------------------------------------------------------------------ */

.admin-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.admin-sidebar {
  width: 264px;
  flex: 0 0 264px;
  background: var(--panel-solid);
  border-right: 1px solid var(--border);
  padding: 22px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar .brand {
  padding: 4px 10px 18px;
}

.admin-nav-group-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 16px 10px 6px;
}

.admin-nav-group-label:first-of-type {
  margin-top: 4px;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 13.5px;
  transition: background 0.15s ease;
}

.admin-nav-link:hover {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
}

.admin-nav-link.active {
  background: linear-gradient(135deg, var(--blue), var(--violet) 50%, var(--pink));
  color: #fff;
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.22);
}

.admin-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentcolor;
  opacity: 0.55;
  flex-shrink: 0;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.admin-main {
  flex: 1;
  min-width: 0;
  padding: 30px 36px 64px;
}

.admin-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.admin-topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.admin-topbar .subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-user-chip {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}

.admin-user-chip strong {
  color: var(--text);
  display: block;
  font-size: 13.5px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
}

.kpi-card .kpi-label {
  font-size: 11.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.admin-panel {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px 24px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 22px;
}

.admin-panel h2 {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 4px;
}

.admin-panel .panel-desc {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}

.admin-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.risk-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
}

.risk-item:last-child {
  margin-bottom: 0;
}

.risk-item-label {
  font-weight: 700;
  font-size: 13.5px;
}

.risk-item-detail {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 2px;
}

.risk-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.risk-badge.high {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.risk-badge.medium {
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
}

.risk-badge.low {
  background: rgba(34, 197, 94, 0.12);
  color: #047857;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.plan-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  background: var(--panel-solid);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-card.current {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.plan-card .plan-name {
  font-weight: 800;
  font-size: 16px;
}

.plan-card .plan-price {
  font-size: 24px;
  font-weight: 800;
}

.plan-card .plan-price span {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.plan-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Sous-navigation locale d'une page détail (ex: client OIDC — voir
   js/admin.js::renderIntegrationDetailBody) — distincte de la sidebar
   principale (.admin-nav-link), mais réutilise son style pour rester
   cohérent visuellement. */
.admin-subnav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
}

.admin-panel h3 {
  font-size: 14px;
  font-weight: 750;
  margin: 0 0 10px;
}

.secret-reveal {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 14px;
  word-break: break-all;
  margin-bottom: 8px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 130px;
}

.chart-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--blue), var(--violet));
  border-radius: 5px 5px 0 0;
  min-height: 2px;
}

.admin-empty-state {
  color: var(--muted);
  font-size: 13.5px;
  padding: 18px 4px;
  text-align: center;
}

.admin-table thead th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 750;
  border-bottom-width: 2px;
}

.admin-table td {
  vertical-align: middle;
  font-size: 13.5px;
}

@media (max-width: 900px) {
  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    flex-basis: auto;
    height: auto;
    position: relative;
    flex-flow: row wrap;
    overflow-x: auto;
  }

  .admin-sidebar .brand {
    padding: 4px 6px 10px;
    width: 100%;
  }

  .admin-sidebar-footer {
    margin-top: 8px;
    border-top: none;
    padding-top: 0;
  }

  .admin-main {
    padding: 22px 18px 48px;
  }
}
