/* ==========================================================================
   Konurya Systems — Système de design
   Palette claire professionnelle (charte officielle 2026-08-24), typo Inter,
   mobile-first, composants tactiles, animations sobres.
   ========================================================================== */

:root {
  /* Couleurs — theme clair (le sombre ne doit plus dominer, cf. retour du 2026-08-24) */
  --bg: #f1f5f9;
  --bg-elevated: #f8fafc;
  --surface: #ffffff;
  --surface-2: #e2e8f0;
  --border: #cbd5e1;
  --border-soft: #e2e8f0;

  --text-primary: #0d1b2a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Identite Konurya Systems (revision 2026-09-01) — l'accent est
     derive du navy de la marque (--accent-navy, deja utilise par le
     logo) plutot que d'un bleu generique importe d'un framework : le
     bleu Tailwind par defaut (#2563eb) precedent etait litteralement
     la couleur de milliers d'autres produits, sans lien avec
     l'identite Konurya. Une seule famille de teinte (navy), pas une
     deuxieme couleur de marque ajoutee par-dessus. */
  --accent-navy: #0d1b2a;
  --accent: #14355c;
  --accent-strong: #0c2340;
  --accent-grad: linear-gradient(135deg, #14355c 0%, #0c2340 100%);

  --success: #16a34a;
  --success-bg: rgba(34, 197, 94, 0.14);
  --warning: #d97706;
  --warning-bg: rgba(245, 166, 35, 0.16);
  --danger: #dc2626;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #14355c;
  --info-bg: rgba(20, 53, 92, 0.12);

  /* Typo — Inter uniquement (titres et texte), conforme a la charte */
  --font-display: "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;

  /* Échelle */
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.25rem;
  --fs-3xl: 3rem;
  --fs-4xl: 3.75rem;

  /* Espacement */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 96px;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* Teintees avec le navy de marque (13, 27, 42 = #0d1b2a) plutot
     qu'un gris neutre generique — coherent avec le reste de
     l'identite plutot que "n'importe quelle ombre CSS". */
  --shadow-sm: 0 2px 8px rgba(13, 27, 42, 0.06);
  --shadow: 0 8px 24px rgba(13, 27, 42, 0.09);
  --shadow-lg: 0 20px 60px rgba(13, 27, 42, 0.16);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
  --dur: 280ms;

  --header-h: 64px;
  --container-max: 1160px;
  --tap-min: 44px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------------------- */
/* Base                                                                  */
/* -------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 0%, rgba(20, 53, 92, 0.06), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(91, 127, 166, 0.05), transparent 40%);
  pointer-events: none;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 var(--sp-3);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); }

p {
  margin: 0 0 var(--sp-4);
  color: var(--text-secondary);
  max-width: 65ch;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { color: var(--accent-strong); }

img, svg { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

@media (min-width: 768px) {
  .container { padding: 0 var(--sp-6); }
  h1 { font-size: var(--fs-4xl); }
}

.section {
  padding: var(--sp-8) 0;
}

.overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* -------------------------------------------------------------------- */
/* Nav                                                                   */
/* -------------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  transition: border-color var(--dur) var(--ease);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--text-primary);
  white-space: nowrap;
}

/* Sous ~400px, le nom complet + le CTA + le bouton menu ne tiennent plus
   sur une ligne sans se compresser inconfortablement — on garde alors
   uniquement le symbole, deja reconnaissable seul. */
@media (max-width: 400px) {
  .brand-text { display: none; }
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.nav-links {
  display: none;
  align-items: center;
  gap: var(--sp-5);
}

.nav-links a {
  position: relative;
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease);
}

.nav-links a:hover { color: var(--text-primary); }

.nav-links a.active {
  color: var(--accent);
  font-weight: 600;
}

.nav-links a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -22px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.nav-toggle {
  display: grid;
  place-items: center;
  width: var(--tap-min);
  height: var(--tap-min);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
}

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }
}

.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 99;
  background: var(--bg-elevated);
  padding: var(--sp-6) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.mobile-menu.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.mobile-menu a {
  padding: var(--sp-4);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-soft);
  border-left: 3px solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.mobile-menu a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(20, 53, 92, 0.06);
}

@media (min-width: 900px) {
  .mobile-menu { display: none; }
}

/* -------------------------------------------------------------------- */
/* Boutons                                                               */
/* -------------------------------------------------------------------- */

.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap-min);
  padding: 0 var(--sp-5);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  white-space: nowrap;
}

/* Anneau de focus clavier coherent — sans ca, un bouton/lien tabule
   n'affiche que le contour par defaut du navigateur (variable d'un
   navigateur a l'autre, parfois quasi invisible). Un seul style, la
   meme couleur de marque, partout ou l'utilisateur navigue au clavier. */
.btn:focus-visible,
a:focus-visible,
.nav-toggle:focus-visible,
.admin-nav-link:focus-visible,
.disclosure summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(20, 53, 92, 0.22);
}

.btn-primary:hover { background: var(--accent-strong); box-shadow: 0 6px 22px rgba(20, 53, 92, 0.3); color: #fff; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover { border-color: var(--accent); color: var(--text-primary); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-soft);
}

.btn-ghost:hover { color: var(--text-primary); background: var(--surface); border-color: var(--accent); }

/* Acces a la fiche monitoring/facturation d'un site (dashboard client) —
   couleur "info" distincte du reste des boutons de la carte, pour que
   ce lien vers des donnees en direct se remarque immediatement. */
.btn-site-details {
  background: var(--info-bg);
  color: var(--accent-strong);
  border-color: transparent;
  white-space: normal;
  font-size: var(--fs-sm);
}

.btn-site-details:hover {
  background: var(--accent-strong);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-site-details svg { flex-shrink: 0; }

/* Danger = action destructive reelle (suspendre, supprimer, regenerer
   un secret) — fond plein, jamais confondu avec une action secondaire
   normale. */
.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 var(--sp-4); font-size: var(--fs-xs); }

.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: ripple 600ms var(--ease);
  pointer-events: none;
}

@keyframes ripple {
  to { transform: scale(3); opacity: 0; }
}

/* -------------------------------------------------------------------- */
/* Cartes                                                                */
/* -------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

/* Une carte peut elle-meme etre un lien (ex: fiche produit cliquable) —
   ses titres restent des titres, pas des liens bleus. */
.card h1, .card h2, .card h3, .card h4, .card h5 {
  color: var(--text-primary);
}

.card-hover:hover {
  transform: translateY(-3px);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

.card-glow {
  border-color: rgba(20, 53, 92, 0.3);
  border-width: 1.5px;
}

.card-grid {
  display: grid;
  gap: var(--sp-4);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .card-grid-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .card-grid-3 { grid-template-columns: repeat(3, 1fr); }
  .card-grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Stat / KPI — leger zoom d'entree, tabular-nums pour qu'un compteur
   ne "saute" pas visuellement au fil des chiffres. */
.stat-value {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  animation: enter-scale 420ms var(--ease) both;
}

@keyframes enter-scale {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .stat-value { animation: none; }
}

.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* -------------------------------------------------------------------- */
/* Badges / pills                                                       */
/* -------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--text-secondary); }

/* -------------------------------------------------------------------- */
/* Formulaires                                                          */
/* -------------------------------------------------------------------- */

.field { margin-bottom: var(--sp-4); }

.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

.field-hint {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

input, select, textarea {
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px; /* évite le zoom auto iOS */
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

textarea { min-height: 120px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 53, 92, 0.2);
}

input[type="file"] {
  padding: var(--sp-2);
  font-size: var(--fs-sm);
}

.form-card {
  max-width: 460px;
  margin: 0 auto;
}

/* -------------------------------------------------------------------- */
/* Tableaux → cartes en mobile                                          */
/* -------------------------------------------------------------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

table.responsive-table {
  width: 100%;
  border-collapse: collapse;
}

.responsive-table th {
  text-align: left;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
}

.responsive-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

.responsive-table tr:last-child td { border-bottom: none; }

/* En dessous de 720px : chaque ligne devient une carte, les <th>
   deviennent des étiquettes via data-label (plus lisible qu'un
   tableau compressé sur petit écran). */
@media (max-width: 720px) {
  .responsive-table thead { display: none; }

  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    padding: var(--sp-4);
    border-bottom: 8px solid var(--bg);
  }

  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    border-bottom: none;
    padding: var(--sp-2) 0;
    text-align: right;
  }

  .responsive-table td::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
    text-align: left;
  }
}

/* -------------------------------------------------------------------- */
/* Toasts                                                                */
/* -------------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + var(--sp-3));
  right: var(--sp-4);
  left: var(--sp-4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

@media (min-width: 640px) {
  .toast-stack { left: auto; width: 380px; }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  color: var(--text-primary);
  transform: translateX(20px);
  opacity: 0;
  animation: toast-in var(--dur) var(--ease) forwards;
}

.toast.is-leaving {
  animation: toast-out var(--dur-fast) var(--ease) forwards;
}

.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }

@keyframes toast-in {
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateX(20px); opacity: 0; }
}

/* -------------------------------------------------------------------- */
/* Scroll-reveal                                                        */
/* -------------------------------------------------------------------- */

/* Entree au CHARGEMENT, jamais au scroll (retour du 2026-08-31 :
   l'ancienne version — opacity:0 jusqu'a intersection scroll — laissait
   des blocs invisibles tant qu'on n'y avait pas fait defiler). Une
   animation CSS pure demarre des la peinture de la page : le pire cas
   sur un appareil lent est un cadre en retard, jamais un element bloque
   a opacite 0 indefiniment — la difference technique qui rend "beaucoup
   d'animation" sans danger. */
@keyframes enter-up {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  animation: enter-up 520ms var(--ease) both;
}

.reveal-delay-1 { animation-delay: 70ms; }
.reveal-delay-2 { animation-delay: 140ms; }
.reveal-delay-3 { animation-delay: 210ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
}

/* Grille de cartes : chaque carte entre individuellement en cascade au
   lieu du bloc entier d'un seul mouvement — cree la sensation de detail
   soigne sans jamais dependre du scroll (voir .reveal ci-dessus). */
.card-grid.reveal {
  animation: none;
}

.card-grid.reveal > * {
  animation: enter-up 480ms var(--ease) both;
}

.card-grid.reveal > *:nth-child(1) { animation-delay: 30ms; }
.card-grid.reveal > *:nth-child(2) { animation-delay: 80ms; }
.card-grid.reveal > *:nth-child(3) { animation-delay: 130ms; }
.card-grid.reveal > *:nth-child(4) { animation-delay: 180ms; }
.card-grid.reveal > *:nth-child(n+5) { animation-delay: 220ms; }

@media (prefers-reduced-motion: reduce) {
  .card-grid.reveal > * { animation: none; }
}

/* -------------------------------------------------------------------- */
/* Micro-interactions — coherentes, rapides, jamais decoratives seules. */
/* -------------------------------------------------------------------- */

/* Liens texte : trait qui se deploie au survol plutot qu'un simple
   changement de couleur — un seul langage pour tous les liens du site. */
a:not(.btn):not(.nav-links a):not(.admin-nav-link) {
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size var(--dur) var(--ease), color var(--dur-fast) var(--ease);
  padding-bottom: 1px;
}

a:not(.btn):not(.nav-links a):not(.admin-nav-link):hover {
  background-size: 100% 1px;
}

/* Lien de nav actif : le trait glisse depuis le centre plutot que
   d'apparaitre instantanement. */
.nav-links a.active::after {
  animation: underline-in 320ms var(--ease) both;
}

@keyframes underline-in {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Lignes de tableau : reperage clair de la ligne survolee. */
.responsive-table tbody tr {
  transition: background var(--dur-fast) var(--ease);
}

@media (min-width: 721px) {
  .responsive-table tbody tr:hover { background: var(--bg-elevated); }
}

/* Pastille "en ligne" (monitoring reel, .badge-live) UNIQUEMENT — pas
   sur badge-success en general, qui sert aussi a des etats statiques
   (paiement, disponibilite produit...) ou le pouls n'aurait aucun sens
   et deviendrait distrayant sur une page avec plusieurs badges verts. */
.badge-live::before {
  animation: pulse-dot 2.4s var(--ease) infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.35); }
  50% { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .badge-live::before { animation: none; }
}

/* Widget "monitoring en direct" (site_detail.html, uniquement quand
   etat_sante == 'healthy' — jamais affiche pour un statut statique,
   sinon l'animation perd tout son sens). Elements : pouls radar
   (3 anneaux), ligne ECG defilante, icone de synchro qui tourne,
   compteur "il y a Xs" mis a jour en JS (live-counter-value), fond en
   respiration douce sur toute la carte. Intensifie le 2026-09-03 (3
   anneaux au lieu de 2, coeur plus gros, glow de fond) — retour
   explicite de l'utilisateur : la 1ere version manquait de presence. */
.monitor-live {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-4);
  margin: var(--sp-2) calc(var(--sp-4) * -1) 0;
  border-radius: var(--radius);
  animation: monitor-breathe 3s var(--ease) infinite;
}

@keyframes monitor-breathe {
  0%, 100% { background: rgba(22, 163, 74, 0.04); }
  50% { background: rgba(22, 163, 74, 0.10); }
}

.pulse-radar {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-radar .core {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18), 0 0 14px 3px rgba(22, 163, 74, 0.7);
  z-index: 2;
  animation: core-glow 1.6s var(--ease) infinite;
}

@keyframes core-glow {
  0%, 100% { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.18), 0 0 14px 3px rgba(22, 163, 74, 0.7); }
  50% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.28), 0 0 20px 6px rgba(22, 163, 74, 0.95); }
}

.pulse-radar .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--success);
  opacity: 0;
  animation: radar-ping 1.8s var(--ease) infinite;
}

.pulse-radar .ring.ring-2 { animation-delay: 0.6s; }
.pulse-radar .ring.ring-3 { animation-delay: 1.2s; }

@keyframes radar-ping {
  0% { transform: scale(0.3); opacity: 0.85; }
  100% { transform: scale(1.9); opacity: 0; }
}

.sync-spin {
  flex-shrink: 0;
  display: inline-flex;
  color: var(--success);
  animation: sync-rotate 1.8s linear infinite;
}

@keyframes sync-rotate {
  to { transform: rotate(360deg); }
}

.heartbeat-line {
  flex: 1;
  min-width: 0;
  height: 34px;
  overflow: hidden;
}

.heartbeat-line svg {
  height: 100%;
  width: 200%;
  animation: heartbeat-scroll 2.2s linear infinite;
}

.heartbeat-line path {
  fill: none;
  stroke: var(--success);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes heartbeat-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.live-counter-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text-primary);
}

/* Barre de performance (temps de reponse du dernier heartbeat) — le
   curseur glisse jusqu'a sa position au chargement (transition CSS),
   plutot qu'un pouls/rotation deja utilises ailleurs sur cette carte. */
.perf-bar {
  position: relative;
  height: 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--success) 0%, var(--warning) 55%, var(--danger) 100%);
}

.perf-bar-marker {
  position: absolute;
  top: 50%;
  left: var(--pos, 0%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--text-primary);
  box-shadow: var(--shadow-sm);
  transform: translate(-50%, -50%);
  animation: perf-marker-in 1.2s var(--ease) both;
}

@keyframes perf-marker-in {
  from { left: 0%; opacity: 0; }
  to { left: var(--pos, 0%); opacity: 1; }
}

/* Compteurs de trafic (requetes recues / appels de controle envoyes) —
   reutilise [data-counter] (voir konurya.js), meme mecanisme que les
   statistiques de la page d'accueil. */
.traffic-counters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-soft);
}

@media (prefers-reduced-motion: reduce) {
  .perf-bar-marker { animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pulse-radar .ring { animation: none; opacity: 0.35; transform: scale(1); }
  .heartbeat-line svg { animation: none; width: 100%; }
  .pulse-radar .core { animation: none; }
  .sync-spin { animation: none; }
  .monitor-live { animation: none; background: rgba(22, 163, 74, 0.06); }
}


/* Transition douce entre pages (View Transitions API) — degrade sans
   aucun impact sur les navigateurs qui ne la supportent pas encore. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: fade-out 180ms var(--ease) both;
}

::view-transition-new(root) {
  animation: fade-in 220ms var(--ease) both;
}

@keyframes fade-out {
  to { opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* -------------------------------------------------------------------- */
/* Hero                                                                  */
/* -------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: var(--sp-8) 0 var(--sp-7);
  overflow: hidden;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-full);
  background: rgba(20, 53, 92, 0.08);
  border: 1px solid rgba(20, 53, 92, 0.2);
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: var(--sp-4);
}

.hero h1 {
  max-width: 16ch;
}

.hero .lead {
  font-size: var(--fs-md);
  max-width: 52ch;
  margin-bottom: var(--sp-6);
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-bottom: var(--sp-7);
}

.text-gradient {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* -------------------------------------------------------------------- */
/* Utilitaires                                                          */
/* -------------------------------------------------------------------- */

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mono { font-variant-numeric: tabular-nums; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-0 { margin-bottom: 0; }

.footer {
  border-top: 1px solid var(--border-soft);
  padding: var(--sp-6) 0;
  margin-top: var(--sp-8);
}

.footer p { font-size: var(--fs-xs); color: var(--text-muted); }

.footer-whatsapp { display: inline-flex; align-items: center; gap: 5px; vertical-align: -1px; }

.alert {
  padding: var(--sp-4);
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: var(--fs-sm);
  margin-bottom: var(--sp-4);
}

.alert-error { background: var(--danger-bg); border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }

.empty-state {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-muted);
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

@media (min-width: 640px) {
  .page-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* -------------------------------------------------------------------- */
/* Cases a cocher / radios — remplace le rendu natif du navigateur      */
/* (incoherent d'un OS a l'autre) par un style Konurya uniforme.        */
/* -------------------------------------------------------------------- */

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  cursor: pointer;
  font-weight: 400;
}

.checkbox-field input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-height: 0;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}

.checkbox-field input[type="checkbox"]::before {
  content: "";
  width: 11px;
  height: 11px;
  transform: scale(0);
  transition: transform var(--dur-fast) var(--ease);
  box-shadow: inset 1em 1em #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.checkbox-field input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checkbox-field input[type="checkbox"]:checked::before { transform: scale(1); }

.checkbox-field input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(20, 53, 92, 0.25);
}

/* -------------------------------------------------------------------- */
/* Divulgation progressive — regroupe les reglages secondaires d'une    */
/* fiche (permissions, infrastructure, zone dangereuse...) derriere un  */
/* clic plutot que tout empiler visible en permanence.                  */
/* -------------------------------------------------------------------- */

.disclosure {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.disclosure + .disclosure { margin-top: var(--sp-3); }

.disclosure summary {
  list-style: none;
  cursor: pointer;
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--text-primary);
  min-height: var(--tap-min);
  transition: background var(--dur-fast) var(--ease);
}

.disclosure summary::-webkit-details-marker { display: none; }

.disclosure summary:hover { background: var(--bg-elevated); }

.disclosure summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform var(--dur-fast) var(--ease);
  flex-shrink: 0;
}

.disclosure[open] summary::after { transform: rotate(45deg); }

.disclosure-body {
  padding: 0 var(--sp-5) var(--sp-5);
  border-top: 1px solid var(--border-soft);
  padding-top: var(--sp-4);
  animation: enter-up 260ms var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .disclosure-body { animation: none; }
}

.disclosure-body.disclosure-danger {
  background: var(--danger-bg);
}

/* -------------------------------------------------------------------- */
/* Coquille admin — barre laterale persistante remplacant les liens     */
/* en vrac qui debordaient de chaque en-tete de page.                   */
/* -------------------------------------------------------------------- */

.admin-shell {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  align-items: flex-start;
}

.admin-sidebar {
  flex-shrink: 0;
  width: 240px;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  border-right: 1px solid var(--border-soft);
  background: var(--bg-elevated);
  padding: var(--sp-5) var(--sp-3);
  display: none;
}

@media (min-width: 900px) {
  .admin-sidebar { display: block; }
}

.admin-nav-group {
  margin-bottom: var(--sp-5);
}

.admin-nav-group-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
}

.admin-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-secondary);
  min-height: 40px;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.admin-nav-link:hover { background: var(--surface-2); color: var(--text-primary); }

.admin-nav-link.active {
  background: rgba(20, 53, 92, 0.1);
  color: var(--accent);
  font-weight: 600;
}

.admin-nav-link .badge { flex-shrink: 0; }

.admin-main {
  flex: 1;
  min-width: 0;
  padding: var(--sp-6) var(--sp-4);
}

@media (min-width: 900px) {
  .admin-main { padding: var(--sp-7) var(--sp-6); }
}

.admin-mobile-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  padding: var(--sp-2) 0 var(--sp-5);
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: var(--sp-5);
}

@media (min-width: 900px) {
  .admin-mobile-nav { display: none; }
}

.admin-mobile-nav .admin-nav-link {
  background: var(--surface);
  border: 1px solid var(--border-soft);
}

.admin-mobile-nav .admin-nav-link.active {
  border-color: var(--accent);
}

/* -------------------------------------------------------------------- */
/* Impression — utilise par documentation_api.html (bouton "Imprimer"). */
/* -------------------------------------------------------------------- */

@media print {
  .nav, .mobile-menu, .footer, .toast-stack, .no-print {
    display: none !important;
  }

  body::before { display: none; }

  body {
    background: #fff;
    color: #111;
  }

  .card {
    border-color: #ddd;
    box-shadow: none;
  }

  .text-secondary, .text-muted, p { color: #333; }
}
